This patch should be applied to an un-modified XFree86 version 4.4.0
source tree. It is patch 2 of 4 patches that will will convert the
source tree to XFree86 version 4.5.0.
To apply this patch, run the following from the directory containing your
'xc' directory:
patch -p0 -E < XFree86-4.4.0-4.5.0.diff1
patch -p0 -E < XFree86-4.4.0-4.5.0.diff2
patch -p0 -E < XFree86-4.4.0-4.5.0.diff3
patch -p0 -E < XFree86-4.4.0-4.5.0.diff4
sh XFree86-4.4.0-4.5.0-cleanup.sh
gzip -d < XFree86-4.4.0-4.5.0-diff0.tgz | tar vxf -
-------------------------------------------------------------------------------
Index: xc/extras/Mesa/src/mesa/glapi/Makefile
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/Makefile:1.1.1.1
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/Makefile Fri Dec 10 10:05:28 2004
@@ -0,0 +1,38 @@
+# This file isn't used during a normal compilation since we don't want to
+# require Python in order to compile Mesa.
+# Instead, when the Mesa developers update/change the API interface it's
+# up to him/her to re-run this makefile and check in the newly generated files.
+
+
+OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h glapi_x86.S
+
+COMMON = gl_XML.pyc license.pyc gl_API.xml
+
+all: $(OUTPUTS)
+
+gl_XML.pyc: gl_XML.py
+ rm -f gl_XML.pyc > /dev/null
+ python2 -t -O gl_XML.py
+
+license.pyc: license.py
+ rm -f license.pyc > /dev/null
+ python2 -t -O license.py
+
+glprocs.h: $(COMMON) gl_procs.py
+ python2 -t gl_procs.py > glprocs.h
+
+glapitemp.h: $(COMMON) gl_apitemp.py
+ python2 -t gl_apitemp.py > glapitemp.h
+
+glapioffsets.h: $(COMMON) gl_offsets.py
+ python2 -t gl_offsets.py > glapioffsets.h
+
+glapitable.h: $(COMMON) gl_table.py
+ python2 -t gl_table.py > glapitable.h
+
+glapi_x86.S: $(COMMON) gl_x86_asm.py
+ python2 -t gl_x86_asm.py > glapi_x86.S
+
+clean:
+ rm -f *~ *.pyc
+ rm -f $(OUTPUTS)
Index: xc/extras/Mesa/src/mesa/glapi/apiparser.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/apiparser.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/apiparser.py Thu Apr 8 05:17:32 2004
@@ -0,0 +1,147 @@
+#!/usr/bin/env python
+
+# $Id: apiparser.py,v 1.2 2003/08/19 01:06:24 brianp Exp $
+
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# These helper functions are used by the other Mesa Python scripts.
+# The main function is ProcessSpecFile(spedFile, function) which parses
+# the named spec file and calls function() for each entry in the spec file.
+
+
+import string
+
+
+# Given parallel arrays of types and names, make a C-style parameter string
+def MakeArgList(typeList, nameList):
+ result = ''
+ i = 1
+ n = len(typeList)
+ for typ in typeList:
+ result = result + typ + ' ' + nameList[i - 1]
+ if i < n:
+ result = result + ', '
+ i = i + 1
+ #endfor
+ if result == '':
+ result = 'void'
+ #endif
+ return result
+#enddef
+
+
+prevCatagory = ''
+
+#
+# Example callback function for ProcessSpecFile()
+#
+def PrintRecord(name, returnType, argTypeList, argNameList, alias, offset):
+ argList = MakeArgList(argTypeList, argNameList)
+ if category != prevCategory or prevCategory == '':
+ print '\n/* %s */' % category
+ prevCategory = category
+ #endif
+ print '%s gl%s(%s); /* %d */' % (returnType, name, argList, offset)
+#endfor
+
+
+#
+# Process the api spec file
+#
+def ProcessSpecFile(specFile, userFunc):
+
+ NO_OFFSET = -2
+
+ # init some vars
+ prevCategory = ''
+ funcName = ''
+ returnType = ''
+ argTypeList = [ ]
+ argNameList = [ ]
+ maxOffset = 0
+ table = { }
+ offset = -1
+ alias = ''
+
+ f = open(specFile)
+ for line in f.readlines():
+
+ # split line into tokens
+ tokens = string.split(line)
+
+ if len(tokens) > 0 and line[0] != '#':
+
+ if tokens[0] == 'name':
+ if funcName != '':
+ # Verify entry has offset or alias
+ pnts = 0
+ if offset == NO_OFFSET:
+ pnts = pnts + 1
+ if offset >= 0:
+ pnts = pnts + 1
+ if alias != '':
+ pnts = pnts + 1
+ if pnts != 1:
+ print 'XXXXXXXXXX bad entry for %s' % funcName
+
+ # process the function now
+ userFunc (funcName, returnType, argTypeList, argNameList, alias, offset)
+ # reset the lists
+ argTypeList = [ ]
+ argNameList = [ ]
+ returnType = ''
+ offset = -1
+ alias = ''
+
+ funcName = tokens[1]
+
+ elif tokens[0] == 'return':
+ returnType = string.join(tokens[1:], ' ')
+
+ elif tokens[0] == 'param':
+ argNameList.append(tokens[1])
+ argTypeList.append(string.join(tokens[2:], ' '))
+
+ elif tokens[0] == 'category':
+ category = tokens[1]
+
+ elif tokens[0] == 'offset':
+ if tokens[1] == '?':
+ offset = NO_OFFSET
+ else:
+ offset = int(tokens[1])
+ if offset > maxOffset:
+ maxOffset = offset
+# else:
+# print 'Unassigned offset for %s' % funcName
+
+ elif tokens[0] == 'alias':
+ alias = tokens[1]
+
+ else:
+ print 'Invalid token %s after function %s' % (tokens[0], funcName)
+ #endif
+ #endif
+ #endfor
+#enddef
Index: xc/extras/Mesa/src/mesa/glapi/gl_API.xml
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_API.xml:1.1.1.1
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_API.xml Fri Dec 10 10:05:33 2004
@@ -0,0 +1,8772 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: xc/extras/Mesa/src/mesa/glapi/gl_SPARC_asm.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_SPARC_asm.py:1.1.1.2
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_SPARC_asm.py Fri Dec 10 10:32:32 2004
@@ -0,0 +1,134 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+from xml.sax import saxutils
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+import gl_XML
+import license
+import sys, getopt
+
+class PrintGenericStubs(gl_XML.FilterGLAPISpecBase):
+ name = "gl_SPARC_asm.py (from Mesa)"
+
+ def __init__(self):
+ gl_XML.FilterGLAPISpecBase.__init__(self)
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+
+ def printRealHeader(self):
+ print '#include "glapioffsets.h"'
+ print ''
+ print '#define GLOBL_FN(x) .globl x ; .type x,#function'
+ print ''
+ print '#if (defined(__sparc_v9__) && (!defined(__linux__) || defined(__linux_sparc_64__)))'
+ print '# define GL_STUB(fn,off)\t\t\t\t\\'
+ print 'GLOBL_FN(fn) ; fn:\t\t\t\t\t\\'
+ print '\tsethi\t%hi(0x00000000), %g4 ;\t\t\t\\'
+ print '\tsethi\t%hi(0x00000000), %g1 ;\t\t\t\\'
+ print '\tor\t%g4, %lo(0x00000000), %g4 ;\t\t\\'
+ print '\tor\t%g1, %lo(0x00000000), %g1 ;\t\t\\'
+ print '\tsllx\t%g4, 32, %g4 ;\t\t\t\t\\'
+ print '\tldx\t[%g1 + %g4], %g1 ;\t\t\t\\'
+ print '\tsethi\t%hi(8 * off), %g4 ;\t\t\t\\'
+ print '\tor\t%g4, %lo(8 * off), %g4 ;\t\t\\'
+ print '\tldx\t[%g1 + %g4], %g5 ;\t\t\t\\'
+ print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
+ print '\tnop'
+ print '#else'
+ print '# define GL_STUB(fn,off)\t\t\t\t\\'
+ print 'GLOBL_FN(fn) ; fn:\t\t\t\t\t\\'
+ print '\tsethi\t%hi(0x00000000), %g1 ;\t\t\t\\'
+ print '\tld\t[%g1 + %lo(0x00000000)], %g1 ;\t\t\\'
+ print '\tld\t[%g1 + (4 * off)], %g5 ;\t\t\\'
+ print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
+ print '\tnop'
+ print '#endif'
+ print ''
+ print '.text'
+ print '.align 32'
+ print 'GLOBL_FN(__glapi_sparc_icache_flush)'
+ print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
+ print '\tflush\t%o0'
+ print '\tretl'
+ print '\tnop'
+ print ''
+ print '.data'
+ print '.align 64'
+ print ''
+ print 'GLOBL_FN(_mesa_sparc_glapi_begin)'
+ print '_mesa_sparc_glapi_begin:'
+ print ''
+ return
+
+ def printRealFooter(self):
+ print ''
+ print 'GLOBL_FN(_mesa_sparc_glapi_end)'
+ print '_mesa_sparc_glapi_end:'
+ return
+
+ def printFunction(self, f):
+ print '\tGL_STUB(gl%s, _gloffset_%s)' % (f.name, f.real_name)
+ return
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+ mode = "generic"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == '-m':
+ mode = val
+ elif arg == "-f":
+ file_name = val
+
+ if mode == "generic":
+ dh = PrintGenericStubs()
+ else:
+ print "ERROR: Invalid mode \"%s\" specified." % mode
+ show_usage()
+
+ parser = make_parser()
+ parser.setFeature(feature_namespaces, 0)
+ parser.setContentHandler(dh)
+
+ f = open(file_name)
+
+ dh.printHeader()
+ parser.parse(f)
+ dh.printFooter()
Index: xc/extras/Mesa/src/mesa/glapi/gl_XML.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_XML.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_XML.py Fri Dec 10 10:05:28 2004
@@ -0,0 +1,493 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+from xml.sax import saxutils
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+import sys, re
+
+class glItem:
+ """Generic class on which all other API entity types are based."""
+
+ def __init__(self, tag_name, name, context):
+ self.name = name
+ self.category = context.get_category_define()
+ self.context = context
+ self.tag_name = tag_name
+
+ context.append(tag_name, self)
+ return
+
+ def startElement(self, name, attrs):
+ """Generic startElement handler.
+
+ The startElement handler is called for all elements except
+ the one that starts the object. For a foo element, the
+ XML "" would cause the startElement handler
+ to be called once, but the endElement handler would be called
+ twice."""
+ return
+
+ def endElement(self, name):
+ """Generic endElement handler.
+
+ Generic endElement handler. Returns 1 if the tag containing
+ the object is complete. Otherwise 0 is returned. All
+ derived class endElement handlers should call this method. If
+ the name of the ending tag is the same as the tag that
+ started this object, the object is assumed to be complete.
+
+ This fails if a tag can contain another tag with the same
+ name. The XML "" would fail. The
+ object would end before the bar tag was processed.
+
+ The endElement handler is called for every end element
+ associated with an object, even the element that started the
+ object. See the description of startElement an example."""
+
+ if name == self.tag_name:
+ return 1
+ else:
+ return 0
+ return
+
+ def get_category_define(self):
+ return self.category
+
+
+class glEnum( glItem ):
+ """Subclass of glItem for representing GL enumerants.
+
+ This class is not complete, and is not really used yet."""
+
+ def __init__(self, context, name, attrs):
+ self.value = int(attrs.get('value', "0x0000"), 0)
+ self.functions = {}
+
+ enum_name = "GL_" + attrs.get('name', None)
+ glItem.__init__(self, name, enum_name, context)
+
+ def startElement(self, name, attrs):
+ if name == "size":
+ name = attrs.get('name', None)
+ count = int(attrs.get('count', "0"), 0)
+ self.functions[name] = count
+
+ return
+
+
+class glType( glItem ):
+ """Subclass of glItem for representing GL types."""
+
+ def __init__(self, context, name, attrs):
+ self.size = int(attrs.get('size', "0"))
+
+ type_name = "GL" + attrs.get('name', None)
+ glItem.__init__(self, name, type_name, context)
+
+
+class glParameter( glItem ):
+ """Parameter of a glFunction."""
+ p_type = None
+ p_type_string = ""
+ p_count = 0
+ p_count_parameters = None
+ counter = None
+ is_output = 0
+ is_counter = 0
+ is_pointer = 0
+
+ def __init__(self, context, name, attrs):
+ p_name = attrs.get('name', None)
+ self.p_type_string = attrs.get('type', None)
+ self.p_count_parameters = attrs.get('variable_param', None)
+
+ self.p_type = context.context.find_type(self.p_type_string)
+ if self.p_type == None:
+ raise RuntimeError("Unknown type '%s' in function '%s'." % (self.p_type_string, context.name))
+
+
+ # The count tag can be either a numeric string or the name of
+ # a variable. If it is the name of a variable, the int(c)
+ # statement will throw an exception, and the except block will
+ # take over.
+
+ c = attrs.get('count', "0")
+ try:
+ self.p_count = int(c)
+ self.counter = None
+ except Exception,e:
+ self.p_count = 0
+ self.counter = c
+
+ if attrs.get('counter', "false") == "true":
+ self.is_counter = 1
+ else:
+ self.is_counter = 0
+
+ if attrs.get('output', "false") == "true":
+ self.is_output = 1
+ else:
+ self.is_output = 0
+
+ if self.p_count > 0 or self.counter != None or self.p_count_parameters != None :
+ has_count = 1
+ else:
+ has_count = 0
+
+
+ # If there is a * anywhere in the parameter's type, then it
+ # is a pointer.
+
+ if re.compile("[*]").search(self.p_type_string):
+ # We could do some other validation here. For
+ # example, an output parameter should not be const,
+ # but every non-output parameter should.
+
+ self.is_pointer = 1;
+ else:
+ # If a parameter is not a pointer, then there cannot
+ # be an associated count (either fixed size or
+ # variable) and the parameter cannot be an output.
+
+ if has_count or self.is_output:
+ raise RuntimeError("Non-pointer type has count or is output.")
+ self.is_pointer = 0;
+
+ glItem.__init__(self, name, p_name, context)
+ return
+
+
+ def is_variable_length_array(self):
+ """Determine if a parameter is a variable length array.
+
+ A parameter is considered to be a variable length array if
+ its size depends on the value of another parameter that is
+ an enumerant. The params parameter to glTexEnviv is an
+ example of a variable length array parameter. Arrays whose
+ size depends on a count variable, such as the lists parameter
+ to glCallLists, are not variable length arrays in this
+ sense."""
+
+ return self.p_count_parameters != None
+
+
+ def is_array(self):
+ return self.is_pointer
+
+
+ def count_string(self):
+ """Return a string representing the number of items
+
+ Returns a string representing the number of items in a
+ parameter. For scalar types this will always be "1". For
+ vector types, it will depend on whether or not it is a
+ fixed length vector (like the parameter of glVertex3fv),
+ a counted length (like the vector parameter of
+ glDeleteTextures), or a general variable length vector."""
+
+ if self.is_array():
+ if self.is_variable_length_array():
+ return "compsize"
+ elif self.counter != None:
+ return self.counter
+ else:
+ return str(self.p_count)
+ else:
+ return "1"
+
+
+ def size(self):
+ if self.is_variable_length_array():
+ return 0
+ elif self.p_count == 0:
+ return self.p_type.size
+ else:
+ return self.p_type.size * self.p_count
+
+
+class glParameterIterator:
+ """Class to iterate over a list of glParameters.
+
+ Objects of this class are returned by the __iter__ method of the
+ glFunction class. They are used to iterate over the list of
+ parameters to the function."""
+
+ def __init__(self, data):
+ self.data = data
+ self.index = 0
+
+ def next(self):
+ if self.index == len( self.data ):
+ raise StopIteration
+ i = self.index
+ self.index += 1
+ return self.data[i]
+
+
+class glFunction( glItem ):
+ real_name = ""
+ fn_alias = None
+ fn_offset = -1
+ fn_return_type = "void"
+ fn_parameters = []
+
+ def __init__(self, context, name, attrs):
+ self.fn_alias = attrs.get('alias', None)
+ self.fn_parameters = []
+
+ temp = attrs.get('offset', None)
+ if temp == None or temp == "?":
+ self.fn_offset = -1
+ else:
+ self.fn_offset = int(temp)
+
+ fn_name = attrs.get('name', None)
+ if self.fn_alias != None:
+ self.real_name = self.fn_alias
+ else:
+ self.real_name = fn_name
+
+ glItem.__init__(self, name, fn_name, context)
+ return
+
+
+ def __iter__(self):
+ return glParameterIterator(self.fn_parameters)
+
+
+ def startElement(self, name, attrs):
+ if name == "param":
+ try:
+ glParameter(self, name, attrs)
+ except RuntimeError:
+ print "Error with parameter '%s' in function '%s'." \
+ % (attrs.get('name','(unknown)'), self.name)
+ raise
+ elif name == "return":
+ self.set_return_type(attrs.get('type', None))
+
+
+ def append(self, tag_name, p):
+ if tag_name != "param":
+ raise RuntimeError("Trying to append '%s' to parameter list of function '%s'." % (tag_name, self.name))
+
+ self.fn_parameters.append(p)
+
+
+ def set_return_type(self, t):
+ self.fn_return_type = t
+
+
+ def get_parameter_string(self):
+ arg_string = ""
+ comma = ""
+ for p in self:
+ arg_string = arg_string + comma + p.p_type_string + " " + p.name
+ comma = ", "
+
+ if arg_string == "":
+ arg_string = "void"
+
+ return arg_string
+
+
+class glItemFactory:
+ """Factory to create objects derived from glItem."""
+
+ def create(self, context, name, attrs):
+ if name == "function":
+ return glFunction(context, name, attrs)
+ elif name == "type":
+ return glType(context, name, attrs)
+ elif name == "enum":
+ return glEnum(context, name, attrs)
+ else:
+ return None
+
+
+class FilterGLAPISpecBase(saxutils.XMLFilterBase):
+ name = "a"
+ license = "The license for this file is unspecified."
+ functions = {}
+ next_alias = -2
+ types = {}
+ xref = {}
+ current_object = None
+ factory = None
+ current_category = ""
+
+ def __init__(self):
+ saxutils.XMLFilterBase.__init__(self)
+ self.functions = {}
+ self.types = {}
+ self.xref = {}
+ self.factory = glItemFactory()
+
+
+ def find_type(self,type_name):
+ for t in self.types:
+ if re.compile(t).search(type_name):
+ return self.types[t]
+ print "Unable to find base type matching \"%s\"." % (type_name)
+ return None
+
+
+ def find_function(self,function_name):
+ index = self.xref[function_name]
+ return self.functions[index]
+
+
+ def printFunctions(self):
+ keys = self.functions.keys()
+ keys.sort()
+ prevk = -1
+ for k in keys:
+ if k < 0: continue
+
+ if self.functions[k].fn_alias == None:
+ if k != prevk + 1:
+ #print 'Missing offset %d' % (prevk)
+ pass
+ prevk = int(k)
+ self.printFunction(self.functions[k])
+
+ keys.reverse()
+ for k in keys:
+ if self.functions[k].fn_alias != None:
+ self.printFunction(self.functions[k])
+
+ return
+
+
+ def printHeader(self):
+ """Print the header associated with all files and call the printRealHeader method."""
+
+ print '/* DO NOT EDIT - This file generated automatically by %s script */' \
+ % (self.name)
+ print ''
+ print '/*'
+ print ' * ' + self.license.replace('\n', '\n * ')
+ print ' */'
+ print ''
+ self.printRealHeader();
+ return
+
+
+ def printFooter(self):
+ """Print the header associated with all files and call the printRealFooter method."""
+
+ self.printFunctions()
+ self.printRealFooter()
+
+
+ def get_category_define(self):
+ """Convert the category name to the #define that would be found in glext.h"""
+
+ if re.compile("[1-9][0-9]*[.][0-9]+").match(self.current_category):
+ s = self.current_category
+ return "GL_VERSION_" + s.replace(".", "_")
+ else:
+ return self.current_category
+
+
+ def append(self, object_type, obj):
+ if object_type == "function":
+ # If the function is not an alias and has a negative
+ # offset, then we do not need to track it. These are
+ # functions that don't have an assigned offset
+
+ if obj.fn_offset >= 0 or obj.fn_alias != None:
+ if obj.fn_offset >= 0:
+ index = obj.fn_offset
+ else:
+ index = self.next_alias
+ self.next_alias -= 1
+
+ self.functions[index] = obj
+ self.xref[obj.name] = index
+ elif object_type == "type":
+ self.types[obj.name] = obj
+
+ return
+
+
+ def startElement(self, name, attrs):
+ """Start a new element in the XML stream.
+
+ Starts a new element. There are three types of elements that
+ are specially handled by this function. When a "category"
+ element is encountered, the name of the category is saved.
+ If an element is encountered and no API object is
+ in-progress, a new object is created using the API factory.
+ Any future elements, until that API object is closed, are
+ passed to the current objects startElement method.
+
+ This paradigm was chosen becuase it allows subclasses of the
+ basic API types (i.e., glFunction, glEnum, etc.) to handle
+ additional XML data, GLX protocol information, that the base
+ classes do not know about."""
+
+ if self.current_object != None:
+ self.current_object.startElement(name, attrs)
+ elif name == "category":
+ self.current_category = attrs.get('name', "")
+ else:
+ self.current_object = self.factory.create(self, name, attrs)
+ return
+
+
+ def endElement(self, name):
+ if self.current_object != None:
+ if self.current_object.endElement(name):
+ self.current_object = None
+ return
+
+
+ def printFunction(self,offset):
+ """Print a single function.
+
+ In the base class, this function is empty. All derived
+ classes should over-ride this function."""
+ return
+
+
+ def printRealHeader(self):
+ """Print the "real" header for the created file.
+
+ In the base class, this function is empty. All derived
+ classes should over-ride this function."""
+ return
+
+
+ def printRealFooter(self):
+ """Print the "real" footer for the created file.
+
+ In the base class, this function is empty. All derived
+ classes should over-ride this function."""
+ return
Index: xc/extras/Mesa/src/mesa/glapi/gl_apitemp.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_apitemp.py:1.1.1.2
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_apitemp.py Fri Dec 10 10:32:36 2004
@@ -0,0 +1,236 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+from xml.sax import saxutils
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+import gl_XML
+import license
+import sys, getopt
+
+class PrintGlOffsets(gl_XML.FilterGLAPISpecBase):
+ name = "gl_apitemp.py (from Mesa)"
+
+ def __init__(self):
+ gl_XML.FilterGLAPISpecBase.__init__(self)
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+ def printFunction(self, f):
+ p_string = ""
+ o_string = ""
+ t_string = ""
+ comma = ""
+
+ for p in f:
+ cast = ""
+
+ if p.is_pointer:
+ t = "%p"
+ cast = "(const void *) "
+ elif p.p_type_string == 'GLenum':
+ t = "0x%x"
+ elif p.p_type_string in ['GLfloat', 'GLdouble', 'GLclampf', 'GLclampd']:
+ t = "%f"
+ else:
+ t = "%d"
+
+ t_string = t_string + comma + t
+ p_string = p_string + comma + p.name
+ o_string = o_string + comma + cast + p.name
+ comma = ", "
+
+
+ if f.fn_return_type != 'void':
+ dispatch = "RETURN_DISPATCH"
+ else:
+ dispatch = "DISPATCH"
+
+ print 'KEYWORD1 %s KEYWORD2 NAME(%s)(%s)' \
+ % (f.fn_return_type, f.name, f.get_parameter_string())
+ print '{'
+ if p_string == "":
+ print ' %s(%s, (), (F, "gl%s();\\n"));' \
+ % (dispatch, f.real_name, f.name)
+ else:
+ print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \
+ % (dispatch, f.real_name, p_string, f.name, t_string, o_string)
+ print '}'
+ print ''
+ return
+
+ def printRealHeader(self):
+ print """
+/*
+ * This file is a template which generates the OpenGL API entry point
+ * functions. It should be included by a .c file which first defines
+ * the following macros:
+ * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32
+ * KEYWORD2 - usually nothing, but might be __stdcall on Win32
+ * NAME(n) - builds the final function name (usually add "gl" prefix)
+ * DISPATCH(func, args, msg) - code to do dispatch of named function.
+ * msg is a printf-style debug message.
+ * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value
+ *
+ * Here is an example which generates the usual OpenGL functions:
+ * #define KEYWORD1
+ * #define KEYWORD2
+ * #define NAME(func) gl##func
+ * #define DISPATCH(func, args, msg) \\
+ * struct _glapi_table *dispatch = CurrentDispatch; \\
+ * (*dispatch->func) args
+ * #define RETURN DISPATCH(func, args, msg) \\
+ * struct _glapi_table *dispatch = CurrentDispatch; \\
+ * return (*dispatch->func) args
+ *
+ */
+
+
+#if defined( NAME )
+#ifndef KEYWORD1
+#define KEYWORD1
+#endif
+
+#ifndef KEYWORD2
+#define KEYWORD2
+#endif
+
+#ifndef DISPATCH
+#error DISPATCH must be defined
+#endif
+
+#ifndef RETURN_DISPATCH
+#error RETURN_DISPATCH must be defined
+#endif
+
+GLAPI void GLAPIENTRY gl__unused413(void); /* silence warning */
+"""
+ return
+
+
+
+ def printInitDispatch(self):
+ print """
+#endif /* defined( NAME ) */
+
+/*
+ * This is how a dispatch table can be initialized with all the functions
+ * we generated above.
+ */
+#ifdef DISPATCH_TABLE_NAME
+
+#ifndef TABLE_ENTRY
+#error TABLE_ENTRY must be defined
+#endif
+
+static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
+ keys = self.functions.keys()
+ keys.sort()
+ for k in keys:
+ if k < 0: continue
+
+ print ' TABLE_ENTRY(%s),' % (self.functions[k].name)
+
+ print ' /* A whole bunch of no-op functions. These might be called'
+ print ' * when someone tries to call a dynamically-registered'
+ print ' * extension function without a current rendering context.'
+ print ' */'
+ for i in range(1, 100):
+ print ' TABLE_ENTRY(Unused),'
+
+ print '};'
+ print '#endif /* DISPATCH_TABLE_NAME */'
+ print ''
+ return
+
+ def printAliasedTable(self):
+ print """
+/*
+ * This is just used to silence compiler warnings.
+ * We list the functions which are not otherwise used.
+ */
+#ifdef UNUSED_TABLE_NAME
+static _glapi_proc UNUSED_TABLE_NAME[] = {"""
+
+ keys = self.functions.keys()
+ keys.sort()
+ keys.reverse();
+ for k in keys:
+ f = self.functions[k]
+ if f.fn_offset < 0:
+ print ' TABLE_ENTRY(%s),' % (f.name)
+
+ print '};'
+ print '#endif /*UNUSED_TABLE_NAME*/'
+ print ''
+ return
+
+ def printRealFooter(self):
+ self.printInitDispatch()
+ self.printAliasedTable()
+ print"""
+#undef KEYWORD1
+#undef KEYWORD2
+#undef NAME
+#undef DISPATCH
+#undef RETURN_DISPATCH
+#undef DISPATCH_TABLE_NAME
+#undef UNUSED_TABLE_NAME
+#undef TABLE_ENTRY
+"""
+ return
+
+def show_usage():
+ print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+
+ dh = PrintGlOffsets()
+
+ parser = make_parser()
+ parser.setFeature(feature_namespaces, 0)
+ parser.setContentHandler(dh)
+
+ f = open(file_name)
+
+ dh.printHeader()
+ parser.parse(f)
+ dh.printFooter()
+
Index: xc/extras/Mesa/src/mesa/glapi/gl_offsets.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_offsets.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_offsets.py Fri Dec 10 10:05:29 2004
@@ -0,0 +1,86 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+from xml.sax import saxutils
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+import gl_XML
+import license
+import sys, getopt
+
+class PrintGlOffsets(gl_XML.FilterGLAPISpecBase):
+ name = "gl_offsets.py (from Mesa)"
+
+ def __init__(self):
+ gl_XML.FilterGLAPISpecBase.__init__(self)
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+ def printFunction(self, f):
+ if f.fn_offset < 0: return
+ print '#define _gloffset_%s %d' % (f.name, f.fn_offset)
+
+ def printRealHeader(self):
+ print '#ifndef _GLAPI_OFFSETS_H_'
+ print '#define _GLAPI_OFFSETS_H_'
+ print ''
+ return
+
+ def printRealFooter(self):
+ print ''
+ print '#endif'
+ return
+
+def show_usage():
+ print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+
+ dh = PrintGlOffsets()
+
+ parser = make_parser()
+ parser.setFeature(feature_namespaces, 0)
+ parser.setContentHandler(dh)
+
+ f = open(file_name)
+
+ dh.printHeader()
+ parser.parse(f)
+ dh.printFooter()
Index: xc/extras/Mesa/src/mesa/glapi/gl_procs.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_procs.py:1.1.1.2
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_procs.py Fri Dec 10 10:32:35 2004
@@ -0,0 +1,179 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+from xml.sax import saxutils
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+import license
+import gl_XML
+import sys, getopt
+
+class PrintGlProcs(gl_XML.FilterGLAPISpecBase):
+ name = "gl_procs.py (from Mesa)"
+
+ def __init__(self, long_strings):
+ self.long_strings = long_strings
+ gl_XML.FilterGLAPISpecBase.__init__(self)
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+
+ def printRealHeader(self):
+ print '/* This file is only included by glapi.c and is used for'
+ print ' * the GetProcAddress() function'
+ print ' */'
+ print ''
+ print 'typedef struct {'
+ print ' GLint Name_offset;'
+ print '#ifdef NEED_FUNCTION_POINTER'
+ print ' _glapi_proc Address;'
+ print '#endif'
+ print ' GLuint Offset;'
+ print '} glprocs_table_t;'
+ print ''
+ print '#ifdef NEED_FUNCTION_POINTER'
+ print '# define NAME_FUNC_OFFSET(n,f,o) { n , (_glapi_proc) f , o }'
+ print '#else'
+ print '# define NAME_FUNC_OFFSET(n,f,o) { n , o }'
+ print '#endif'
+ print ''
+ return
+
+ def printRealFooter(self):
+ print ''
+ print '#undef NAME_FUNC_OFFSET'
+ return
+
+ def printFunctionString(self, f):
+ if self.long_strings:
+ print ' "gl%s\\0"' % (f.name)
+ else:
+ print " 'g','l',",
+ for c in f.name:
+ print "'%s'," % (c),
+
+ print "'\\0',"
+
+ def printFunctionOffset(self, f, offset_of_name):
+ print ' NAME_FUNC_OFFSET( % 5u, gl%s, _gloffset_%s ),' % (offset_of_name, f.name, f.real_name)
+
+
+ def printFunctions(self):
+ print ''
+ if self.long_strings:
+ print 'static const char gl_string_table[] ='
+ else:
+ print 'static const char gl_string_table[] = {'
+
+ keys = self.functions.keys()
+ keys.sort()
+ for k in keys:
+ if k < 0: continue
+ self.printFunctionString(self.functions[k])
+
+ keys.reverse()
+ for k in keys:
+ if k >= -1: continue
+ self.printFunctionString(self.functions[k])
+
+ if self.long_strings:
+ print ' ;'
+ else:
+ print '};'
+
+ print ''
+ print 'static const glprocs_table_t static_functions[] = {'
+
+ keys = self.functions.keys()
+ keys.sort()
+ base_offset = 0
+ for k in keys:
+ if k < 0: continue
+ self.printFunctionOffset(self.functions[k], base_offset)
+
+ # The length of the function's name, plus 2 for "gl",
+ # plus 1 for the NUL.
+
+ base_offset += len(self.functions[k].name) + 3
+
+ keys.reverse()
+ for k in keys:
+ if k >= -1: continue
+ self.printFunctionOffset(self.functions[k], base_offset)
+
+ # The length of the function's name, plus 2 for "gl",
+ # plus 1 for the NUL.
+
+ base_offset += len(self.functions[k].name) + 3
+
+ print ' NAME_FUNC_OFFSET( -1, NULL, 0 )'
+ print '};'
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m mode]" % sys.argv[0]
+ print "mode can be one of:"
+ print " long - Create code for compilers that can handle very "
+ print " long string constants. (default)"
+ print " short - Create code for compilers that can only handle "
+ print " ANSI C89 string constants."
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
+ except Exception,e:
+ show_usage()
+
+ long_string = 1
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ if val == "short":
+ long_string = 0
+ elif val == "long":
+ long_string = 1
+ else:
+ show_usage()
+
+ dh = PrintGlProcs( long_string )
+
+ parser = make_parser()
+ parser.setFeature(feature_namespaces, 0)
+ parser.setContentHandler(dh)
+
+ f = open(file_name)
+
+ dh.printHeader()
+ parser.parse(f)
+ dh.printFooter()
Index: xc/extras/Mesa/src/mesa/glapi/gl_table.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_table.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_table.py Fri Dec 10 10:05:28 2004
@@ -0,0 +1,98 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+from xml.sax import saxutils
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+import gl_XML
+import license
+import sys, getopt
+
+class PrintGlTable(gl_XML.FilterGLAPISpecBase):
+ file_name = "gl_gen_table.xml (from Mesa)"
+
+ def __init__(self):
+ gl_XML.FilterGLAPISpecBase.__init__(self)
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+
+ def printFunction(self, f):
+ if f.fn_offset < 0: return
+
+ arg_string = f.get_parameter_string()
+ print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % \
+ (f.fn_return_type, f.name, arg_string, f.fn_offset)
+
+ def printRealHeader(self):
+ print '#ifndef _GLAPI_TABLE_H_'
+ print '#define _GLAPI_TABLE_H_'
+ print ''
+ print '#ifndef GLAPIENTRYP'
+ print '#define GLAPIENTRYP'
+ print '#endif'
+ print ''
+ print 'struct _glapi_table'
+ print '{'
+ return
+
+ def printRealFooter(self):
+ print '};'
+ print ''
+ print '#endif'
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+
+ dh = PrintGlTable()
+
+ parser = make_parser()
+ parser.setFeature(feature_namespaces, 0)
+ parser.setContentHandler(dh)
+
+ f = open(file_name)
+
+ dh.printHeader()
+ parser.parse(f)
+ dh.printFooter()
Index: xc/extras/Mesa/src/mesa/glapi/gl_x86_asm.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gl_x86_asm.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/gl_x86_asm.py Fri Dec 10 10:05:29 2004
@@ -0,0 +1,189 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+from xml.sax import saxutils
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+import gl_XML
+import license
+import sys, getopt
+
+class PrintGenericStubs(gl_XML.FilterGLAPISpecBase):
+ name = "gl_x86_asm.py (from Mesa)"
+
+ def __init__(self):
+ gl_XML.FilterGLAPISpecBase.__init__(self)
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+
+ def get_stack_size(self, f):
+ size = 0
+ for p in f:
+ t = p.p_type
+
+ if p.is_array() or t.size != 8:
+ size += 4
+ else:
+ size += 8
+
+ return size
+
+ def printRealHeader(self):
+ print '#include "assyntax.h"'
+ print '#include "glapioffsets.h"'
+ print ''
+ print '#ifndef __WIN32__'
+ print ''
+ print '#if defined(STDCALL_API)'
+ print '# if defined(USE_MGL_NAMESPACE)'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n2))'
+ print '# else'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2))'
+ print '# endif'
+ print '#else'
+ print '# if defined(USE_MGL_NAMESPACE)'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n))'
+ print '# else'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n))'
+ print '# endif'
+ print '#endif'
+ print ''
+ print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))'
+ print ''
+ print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)'
+ print '#define GLOBL_FN(x) GLOBL x ; .type x, function'
+ print '#else'
+ print '#define GLOBL_FN(x) GLOBL x'
+ print '#endif'
+ print ''
+ print '#if defined(PTHREADS) || defined(XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+ print '# define THREADS'
+ print '#endif'
+ print ''
+ print '#if defined(PTHREADS)'
+ print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
+ print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
+ print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
+ print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
+ print '\tMOV_L(CONTENT(GLNAME(_glapi_DispatchTSD)), EAX) ;\t\\'
+ print '\tTEST_L(EAX, EAX) ;\t\t\t\t\\'
+ print '\tJE(1f) ;\t\t\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
+ print '1:\tCALL(_x86_get_dispatch) ;\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off))'
+ print '#elif defined(THREADS)'
+ print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
+ print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
+ print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
+ print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
+ print '\tMOV_L(CONTENT(GLNAME(_glapi_DispatchTSD)), EAX) ;\t\\'
+ print '\tTEST_L(EAX, EAX) ;\t\t\t\t\\'
+ print '\tJE(1f) ;\t\t\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
+ print '1:\tCALL(_glapi_get_dispatch) ;\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off))'
+ print '#else /* Non-threaded version. */'
+ print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
+ print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
+ print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
+ print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
+ print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
+ print '\tJMP(GL_OFFSET(off))'
+ print '#endif'
+ print ''
+ print 'SEG_TEXT'
+ print ''
+ print '#ifdef PTHREADS'
+ print 'EXTERN GLNAME(_glapi_Dispatch)'
+ print 'EXTERN GLNAME(_gl_DispatchTSD)'
+ print 'EXTERN GLNAME(pthread_getspecific)'
+ print ''
+ print 'ALIGNTEXT16'
+ print 'GLNAME(_x86_get_dispatch):'
+ print '\tSUB_L(CONST(24), ESP)'
+ print '\tPUSH_L(GLNAME(_gl_DispatchTSD))'
+ print '\tCALL(GLNAME(pthread_getspecific))'
+ print '\tADD_L(CONST(28), ESP)'
+ print '\tRET'
+ print '#elif defined(THREADS)'
+ print 'EXTERN GLNAME(_glapi_get_dispatch)'
+ print '#endif'
+ print ''
+ print '\t\tALIGNTEXT16 ; GLOBL GLNAME(gl_dispatch_functions_start)'
+ print 'GLNAME(gl_dispatch_functions_start):'
+ print ''
+ return
+
+ def printRealFooter(self):
+ print ''
+ print '#endif /* __WIN32__ */'
+ return
+
+ def printFunction(self, f):
+ stack = self.get_stack_size(f)
+
+ alt = "%s@%u" % (f.name, stack)
+ print '\tGL_STUB(%s, _gloffset_%s, %s)' % (f.name, f.real_name, alt)
+ return
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+ mode = "generic"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == '-m':
+ mode = val
+ elif arg == "-f":
+ file_name = val
+
+ if mode == "generic":
+ dh = PrintGenericStubs()
+ else:
+ print "ERROR: Invalid mode \"%s\" specified." % mode
+ show_usage()
+
+ parser = make_parser()
+ parser.setFeature(feature_namespaces, 0)
+ parser.setContentHandler(dh)
+
+ f = open(file_name)
+
+ dh.printHeader()
+ parser.parse(f)
+ dh.printFooter()
Index: xc/extras/Mesa/src/mesa/glapi/glapi.c
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glapi.c:1.2
--- /dev/null Wed Mar 16 21:01:22 2005
+++ xc/extras/Mesa/src/mesa/glapi/glapi.c Fri Dec 17 11:38:02 2004
@@ -0,0 +1,1031 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/glapi/glapi.c,v 1.2 2004/12/17 16:38:02 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * This file manages the OpenGL API dispatch layer.
+ * The dispatch table (struct _glapi_table) is basically just a list
+ * of function pointers.
+ * There are functions to set/get the current dispatch table for the
+ * current thread and to manage registration/dispatch of dynamically
+ * added extension functions.
+ *
+ * It's intended that this file and the other glapi*.[ch] files are
+ * flexible enough to be reused in several places: XFree86, DRI-
+ * based libGL.so, and perhaps the SGI SI.
+ *
+ * NOTE: There are no dependencies on Mesa in this code.
+ *
+ * Versions (API changes):
+ * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0
+ * 2001/01/16 - added dispatch override feature for Mesa 3.5
+ * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1.
+ * 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints
+ * itself (using offset ~0). _glapi_add_entrypoint() can be
+ * called afterward and it'll fill in the correct dispatch
+ * offset. This allows DRI libGL to avoid probing for DRI
+ * drivers! No changes to the public glapi interface.
+ */
+
+
+
+#include "glheader.h"
+#include "glapi.h"
+#include "glapioffsets.h"
+#include "glapitable.h"
+#include "glthread.h"
+
+/***** BEGIN NO-OP DISPATCH *****/
+
+static GLboolean WarnFlag = GL_FALSE;
+static _glapi_warning_func warning_func;
+
+
+/*
+ * Enable/disable printing of warning messages.
+ */
+void
+_glapi_noop_enable_warnings(GLboolean enable)
+{
+ WarnFlag = enable;
+}
+
+/*
+ * Register a callback function for reporting errors.
+ */
+void
+_glapi_set_warning_func( _glapi_warning_func func )
+{
+ warning_func = func;
+}
+
+static GLboolean
+warn(void)
+{
+ if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
+ && warning_func) {
+ return GL_TRUE;
+ }
+ else {
+ return GL_FALSE;
+ }
+}
+
+
+#define KEYWORD1 static
+#define KEYWORD2 GLAPIENTRY
+#define NAME(func) NoOp##func
+
+#define F NULL
+
+#define DISPATCH(func, args, msg) \
+ if (warn()) { \
+ warning_func(NULL, "GL User Error: called without context: %s", #func); \
+ }
+
+#define RETURN_DISPATCH(func, args, msg) \
+ if (warn()) { \
+ warning_func(NULL, "GL User Error: called without context: %s", #func); \
+ } \
+ return 0
+
+#define DISPATCH_TABLE_NAME __glapi_noop_table
+#define UNUSED_TABLE_NAME __unused_noop_functions
+
+#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
+
+static GLint NoOpUnused(void)
+{
+ if (warn()) {
+ warning_func(NULL, "GL User Error: calling extension function without a current context\n");
+ }
+ return 0;
+}
+
+#include "glapitemp.h"
+
+/***** END NO-OP DISPATCH *****/
+
+
+
+/***** BEGIN THREAD-SAFE DISPATCH *****/
+
+#if defined(THREADS)
+
+/**
+ * \name Multi-threaded control support variables
+ *
+ * If thread-safety is supported, there are two potential mechanisms that can
+ * be used. The old-style mechanism would set \c _glapi_Dispatch to a special
+ * thread-safe dispatch table. These dispatch routines would call
+ * \c _glapi_get_dispatch to get the actual dispatch pointer. In this
+ * setup \c _glapi_Dispatch could never be \c NULL. This dual layered
+ * dispatch setup performed great for single-threaded apps, but didn't
+ * perform well for multithreaded apps.
+ *
+ * In the new mechansim, there are two variables. The first is
+ * \c _glapi_DispatchTSD. In the single-threaded case, this variable points
+ * to the dispatch table. In the multi-threaded case, this variable is
+ * \c NULL, and thread-specific variable \c _gl_DispatchTSD points to the
+ * actual dispatch table. \c _glapi_DispatchTSD is used to signal to the
+ * static dispatch functions to call \c _glapi_get_dispatch to get the real
+ * dispatch table.
+ *
+ * There is a race condition in setting \c _glapi_DispatchTSD to \c NULL.
+ * It is possible for the original thread to be setting it at the same instant
+ * a new thread, perhaps running on a different processor, is clearing it.
+ * Because of that, \c ThreadSafe, which can only ever be changed to
+ * \c GL_TRUE, is used to determine whether or not the application is
+ * multithreaded.
+ */
+/*@{*/
+static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */
+_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
+static _glthread_TSD RealDispatchTSD; /**< only when using override */
+static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
+/*@}*/
+
+
+#define DISPATCH_TABLE_NAME __glapi_threadsafe_table
+#define UNUSED_TABLE_NAME __unused_threadsafe_functions
+
+#define TABLE_ENTRY(name) (_glapi_proc) gl##name
+
+static GLint glUnused(void)
+{
+ return 0;
+}
+
+#include "glapitemp.h"
+
+#endif
+
+/***** END THREAD-SAFE DISPATCH *****/
+
+
+
+struct _glapi_table *_glapi_Dispatch = (struct _glapi_table *) __glapi_noop_table;
+#if defined( THREADS )
+struct _glapi_table *_glapi_DispatchTSD = (struct _glapi_table *) __glapi_noop_table;
+#endif
+struct _glapi_table *_glapi_RealDispatch = (struct _glapi_table *) __glapi_noop_table;
+
+
+/* Used when thread safety disabled */
+void *_glapi_Context = NULL;
+
+
+static GLboolean DispatchOverride = GL_FALSE;
+
+
+
+/**
+ * strdup() is actually not a standard ANSI C or POSIX routine.
+ * Irix will not define it if ANSI mode is in effect.
+ */
+static char *
+str_dup(const char *str)
+{
+ char *copy;
+ copy = (char*) malloc(strlen(str) + 1);
+ if (!copy)
+ return NULL;
+ strcpy(copy, str);
+ return copy;
+}
+
+
+
+/**
+ * We should call this periodically from a function such as glXMakeCurrent
+ * in order to test if multiple threads are being used.
+ */
+void
+_glapi_check_multithread(void)
+{
+#if defined(THREADS)
+ if (!ThreadSafe) {
+ static unsigned long knownID;
+ static GLboolean firstCall = GL_TRUE;
+ if (firstCall) {
+ knownID = _glthread_GetID();
+ firstCall = GL_FALSE;
+ }
+ else if (knownID != _glthread_GetID()) {
+ ThreadSafe = GL_TRUE;
+ _glapi_set_dispatch(NULL);
+ }
+ }
+ else if (!_glapi_get_dispatch()) {
+ /* make sure that this thread's dispatch pointer isn't null */
+ _glapi_set_dispatch(NULL);
+ }
+#endif
+}
+
+
+
+/**
+ * Set the current context pointer for this thread.
+ * The context pointer is an opaque type which should be cast to
+ * void from the real context pointer type.
+ */
+void
+_glapi_set_context(void *context)
+{
+ (void) __unused_noop_functions; /* silence a warning */
+#if defined(THREADS)
+ (void) __unused_threadsafe_functions; /* silence a warning */
+ _glthread_SetTSD(&ContextTSD, context);
+ _glapi_Context = (ThreadSafe) ? NULL : context;
+#else
+ _glapi_Context = context;
+#endif
+}
+
+
+
+/**
+ * Get the current context pointer for this thread.
+ * The context pointer is an opaque type which should be cast from
+ * void to the real context pointer type.
+ */
+void *
+_glapi_get_context(void)
+{
+#if defined(THREADS)
+ if (ThreadSafe) {
+ return _glthread_GetTSD(&ContextTSD);
+ }
+ else {
+ return _glapi_Context;
+ }
+#else
+ return _glapi_Context;
+#endif
+}
+
+
+
+/**
+ * Set the global or per-thread dispatch table pointer.
+ */
+void
+_glapi_set_dispatch(struct _glapi_table *dispatch)
+{
+ if (!dispatch) {
+ /* use the no-op functions */
+ dispatch = (struct _glapi_table *) __glapi_noop_table;
+ }
+#ifdef DEBUG
+ else {
+ _glapi_check_table(dispatch);
+ }
+#endif
+
+#if defined(THREADS)
+ if (DispatchOverride) {
+ _glthread_SetTSD(&RealDispatchTSD, (void *) dispatch);
+ if (ThreadSafe)
+ _glapi_RealDispatch = (struct _glapi_table*) __glapi_threadsafe_table;
+ else
+ _glapi_RealDispatch = dispatch;
+ }
+ else {
+ /* normal operation */
+ _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
+ if (ThreadSafe) {
+ _glapi_Dispatch = (struct _glapi_table *) __glapi_threadsafe_table;
+ _glapi_DispatchTSD = NULL;
+ }
+ else {
+ _glapi_Dispatch = dispatch;
+ _glapi_DispatchTSD = dispatch;
+ }
+ }
+#else /*THREADS*/
+ if (DispatchOverride) {
+ _glapi_RealDispatch = dispatch;
+ }
+ else {
+ _glapi_Dispatch = dispatch;
+ }
+#endif /*THREADS*/
+}
+
+
+
+/**
+ * Return pointer to current dispatch table for calling thread.
+ */
+struct _glapi_table *
+_glapi_get_dispatch(void)
+{
+#if defined(THREADS)
+ if (ThreadSafe) {
+ if (DispatchOverride) {
+ return (struct _glapi_table *) _glthread_GetTSD(&RealDispatchTSD);
+ }
+ else {
+ return (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD);
+ }
+ }
+ else {
+ if (DispatchOverride) {
+ assert(_glapi_RealDispatch);
+ return _glapi_RealDispatch;
+ }
+ else {
+ assert(_glapi_DispatchTSD);
+ return _glapi_DispatchTSD;
+ }
+ }
+#else
+ return _glapi_Dispatch;
+#endif
+}
+
+
+/*
+ * Notes on dispatch overrride:
+ *
+ * Dispatch override allows an external agent to hook into the GL dispatch
+ * mechanism before execution goes into the core rendering library. For
+ * example, a trace mechanism would insert itself as an overrider, print
+ * logging info for each GL function, then dispatch to the real GL function.
+ *
+ * libGLS (GL Stream library) is another agent that might use override.
+ *
+ * We don't allow more than one layer of overriding at this time.
+ * In the future we may allow nested/layered override. In that case
+ * _glapi_begin_dispatch_override() will return an override layer,
+ * _glapi_end_dispatch_override(layer) will remove an override layer
+ * and _glapi_get_override_dispatch(layer) will return the dispatch
+ * table for a given override layer. layer = 0 will be the "real"
+ * dispatch table.
+ */
+
+/*
+ * Return: dispatch override layer number.
+ */
+int
+_glapi_begin_dispatch_override(struct _glapi_table *override)
+{
+ struct _glapi_table *real = _glapi_get_dispatch();
+
+ assert(!DispatchOverride); /* can't nest at this time */
+ DispatchOverride = GL_TRUE;
+
+ _glapi_set_dispatch(real);
+
+#if defined(THREADS)
+ _glthread_SetTSD(&_gl_DispatchTSD, (void *) override);
+ if ( ThreadSafe ) {
+ _glapi_Dispatch = (struct _glapi_table *) __glapi_threadsafe_table;
+ _glapi_DispatchTSD = NULL;
+ }
+ else {
+ _glapi_Dispatch = override;
+ _glapi_DispatchTSD = override;
+ }
+#else
+ _glapi_Dispatch = override;
+#endif
+ return 1;
+}
+
+
+void
+_glapi_end_dispatch_override(int layer)
+{
+ struct _glapi_table *real = _glapi_get_dispatch();
+ (void) layer;
+ DispatchOverride = GL_FALSE;
+ _glapi_set_dispatch(real);
+ /* the rest of this isn't needed, just play it safe */
+#if defined(THREADS)
+ _glthread_SetTSD(&RealDispatchTSD, NULL);
+#endif
+ _glapi_RealDispatch = NULL;
+}
+
+
+struct _glapi_table *
+_glapi_get_override_dispatch(int layer)
+{
+ if (layer == 0) {
+ return _glapi_get_dispatch();
+ }
+ else {
+ if (DispatchOverride) {
+#if defined(THREADS)
+ return (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD);
+#else
+ return _glapi_Dispatch;
+#endif
+ }
+ else {
+ return NULL;
+ }
+ }
+}
+
+
+#if !defined( USE_X86_ASM )
+#define NEED_FUNCTION_POINTER
+#endif
+
+/* The code in this file is auto-generated with Python */
+#include "glprocs.h"
+
+
+/**
+ * Search the table of static entrypoint functions for the named function
+ * and return the corresponding glprocs_table_t entry.
+ */
+static const glprocs_table_t *
+find_entry( const char * n )
+{
+ GLuint i;
+
+ for (i = 0; static_functions[i].Name_offset >= 0; i++) {
+ const char * test_name;
+
+ test_name = gl_string_table + static_functions[i].Name_offset;
+ if (strcmp(test_name, n) == 0) {
+ return & static_functions[i];
+ }
+ }
+ return NULL;
+}
+
+
+/**
+ * Return dispatch table offset of the named static (built-in) function.
+ * Return -1 if function not found.
+ */
+static GLint
+get_static_proc_offset(const char *funcName)
+{
+ const glprocs_table_t * const f = find_entry( funcName );
+
+ if ( f != NULL ) {
+ return f->Offset;
+ }
+ return -1;
+}
+
+
+#ifdef USE_X86_ASM
+extern const GLubyte gl_dispatch_functions_start[];
+
+# if defined(THREADS)
+# define X86_DISPATCH_FUNCTION_SIZE 32
+# else
+# define X86_DISPATCH_FUNCTION_SIZE 16
+# endif
+
+
+/**
+ * Return dispatch function address the named static (built-in) function.
+ * Return NULL if function not found.
+ */
+static const _glapi_proc
+get_static_proc_address(const char *funcName)
+{
+ const glprocs_table_t * const f = find_entry( funcName );
+
+ if ( f != NULL ) {
+ return (_glapi_proc) (gl_dispatch_functions_start
+ + (X86_DISPATCH_FUNCTION_SIZE * f->Offset));
+ }
+ else {
+ return NULL;
+ }
+}
+
+#else
+
+
+/**
+ * Return pointer to the named static (built-in) function.
+ * \return NULL if function not found.
+ */
+static _glapi_proc
+get_static_proc_address(const char *funcName)
+{
+ const glprocs_table_t * const f = find_entry( funcName );
+ return ( f != NULL ) ? f->Address : NULL;
+}
+
+#endif /* USE_X86_ASM */
+
+
+/**
+ * Return the name of the function at the given offset in the dispatch
+ * table. For debugging only.
+ */
+static const char *
+get_static_proc_name( GLuint offset )
+{
+ GLuint i;
+
+ for (i = 0; static_functions[i].Name_offset >= 0; i++) {
+ if (static_functions[i].Offset == offset) {
+ return gl_string_table + static_functions[i].Name_offset;
+ }
+ }
+ return NULL;
+}
+
+
+
+/**********************************************************************
+ * Extension function management.
+ */
+
+/*
+ * Number of extension functions which we can dynamically add at runtime.
+ */
+#define MAX_EXTENSION_FUNCS 300
+
+
+/*
+ * The dispatch table size (number of entries) is the size of the
+ * _glapi_table struct plus the number of dynamic entries we can add.
+ * The extra slots can be filled in by DRI drivers that register new extension
+ * functions.
+ */
+#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
+
+
+struct name_address_offset {
+ const char *Name;
+ _glapi_proc Address;
+ GLuint Offset;
+};
+
+
+static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS];
+static GLuint NumExtEntryPoints = 0;
+
+#ifdef USE_SPARC_ASM
+extern void __glapi_sparc_icache_flush(unsigned int *);
+#endif
+
+/**
+ * Generate a dispatch function (entrypoint) which jumps through
+ * the given slot number (offset) in the current dispatch table.
+ * We need assembly language in order to accomplish this.
+ */
+static _glapi_proc
+generate_entrypoint(GLuint functionOffset)
+{
+#if defined(USE_X86_ASM)
+ /*
+ * This x86 code contributed by Josh Vanderhoof.
+ *
+ * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax
+ * 00 01 02 03 04
+ * 5: 85 c0 testl %eax,%eax
+ * 05 06
+ * 7: 74 06 je f
+ * 07 08
+ * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax)
+ * 09 0a 0b 0c 0d 0e
+ * f: e8 fc ff ff ff call __glapi_get_dispatch
+ * 0f 10 11 12 13
+ * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax)
+ * 14 15 16 17 18 19
+ */
+ static const unsigned char insn_template[] = {
+ 0xa1, 0x00, 0x00, 0x00, 0x00,
+ 0x85, 0xc0,
+ 0x74, 0x06,
+ 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00,
+ 0xe8, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00
+ };
+ unsigned char *code = (unsigned char *) malloc(sizeof(insn_template));
+ unsigned int next_insn;
+ if (code) {
+ memcpy(code, insn_template, sizeof(insn_template));
+
+#if defined( THREADS )
+ *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_DispatchTSD;
+#else
+ *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch;
+#endif
+ *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4;
+ next_insn = (unsigned int)(code + 0x14);
+ *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn;
+ *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4;
+ }
+ return (_glapi_proc) code;
+#elif defined(USE_SPARC_ASM)
+
+#if (defined(__sparc_v9__) && (!defined(__linux__) || defined(__linux_sparc_64__)))
+ static const unsigned int insn_template[] = {
+ 0x05000000, /* sethi %uhi(_glapi_Dispatch), %g2 */
+ 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */
+ 0x8410a000, /* or %g2, %ulo(_glapi_Dispatch), %g2 */
+ 0x82106000, /* or %g1, %lo(_glapi_Dispatch), %g1 */
+ 0x8528b020, /* sllx %g2, 32, %g2 */
+ 0xc2584002, /* ldx [%g1 + %g2], %g1 */
+ 0x05000000, /* sethi %hi(8 * glapioffset), %g2 */
+ 0x8410a000, /* or %g2, %lo(8 * glapioffset), %g2 */
+ 0xc6584002, /* ldx [%g1 + %g2], %g3 */
+ 0x81c0c000, /* jmpl %g3, %g0 */
+ 0x01000000 /* nop */
+ };
+#else
+ static const unsigned int insn_template[] = {
+ 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */
+ 0xc2006000, /* ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
+ 0xc6006000, /* ld [%g1 + %lo(4*glapioffset)], %g3 */
+ 0x81c0c000, /* jmpl %g3, %g0 */
+ 0x01000000 /* nop */
+ };
+#endif
+ unsigned int *code = (unsigned int *) malloc(sizeof(insn_template));
+ unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch;
+ if (code) {
+ memcpy(code, insn_template, sizeof(insn_template));
+
+#if (defined(__sparc_v9__) && (!defined(__linux__) || defined(__linux_sparc_64__)))
+ code[0] |= (glapi_addr >> (32 + 10));
+ code[1] |= ((glapi_addr & 0xffffffff) >> 10);
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1));
+ code[3] |= (glapi_addr & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&code[2]);
+ code[6] |= ((functionOffset * 8) >> 10);
+ code[7] |= ((functionOffset * 8) & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&code[6]);
+#else
+ code[0] |= (glapi_addr >> 10);
+ code[1] |= (glapi_addr & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] |= (functionOffset * 4);
+ __glapi_sparc_icache_flush(&code[2]);
+#endif
+ }
+ return (_glapi_proc) code;
+#else
+ (void) functionOffset;
+ return NULL;
+#endif /* USE_*_ASM */
+}
+
+
+/**
+ * This function inserts a new dispatch offset into the assembly language
+ * stub that was generated with the preceeding function.
+ */
+static void
+fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
+{
+#if defined(USE_X86_ASM)
+
+ unsigned char *code = (unsigned char *) entrypoint;
+ *(unsigned int *)(code + 0x0b) = offset * 4;
+ *(unsigned int *)(code + 0x16) = offset * 4;
+
+#elif defined(USE_SPARC_ASM)
+
+ /* XXX this hasn't been tested! */
+ unsigned int *code = (unsigned int *) entrypoint;
+#if (defined(__sparc_v9__) && (!defined(__linux__) || defined(__linux_sparc_64__)))
+ code[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */
+ code[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */
+ code[6] |= ((offset * 8) >> 10);
+ code[7] |= ((offset * 8) & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&code[6]);
+#else /* __sparc_v9__ && !linux */
+ code[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */
+ code[2] |= (offset * 4);
+ __glapi_sparc_icache_flush(&code[2]);
+#endif /* __sparc_v9__ && !linux */
+
+#else
+
+ /* an unimplemented architecture */
+ (void) entrypoint;
+ (void) offset;
+
+#endif /* USE_*_ASM */
+}
+
+
+/**
+ * Add a new extension function entrypoint.
+ * Return: GL_TRUE = success or GL_FALSE = failure
+ */
+GLboolean
+_glapi_add_entrypoint(const char *funcName, GLuint offset)
+{
+ /* trivial rejection test */
+#ifdef MANGLE
+ if (!funcName || funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l')
+ return GL_FALSE;
+#else
+ if (!funcName || funcName[0] != 'g' || funcName[1] != 'l')
+ return GL_FALSE;
+#endif
+
+ /* first check if the named function is already statically present */
+ {
+ GLint index = get_static_proc_offset(funcName);
+ if (index >= 0) {
+ return (GLboolean) ((GLuint) index == offset); /* bad offset! */
+ }
+ }
+
+ /* See if this function has already been dynamically added */
+ {
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
+ /* function already registered */
+ if (ExtEntryTable[i].Offset == offset) {
+ return GL_TRUE; /* offsets match */
+ }
+ else if (ExtEntryTable[i].Offset == (GLuint) ~0
+ && offset < DISPATCH_TABLE_SIZE) {
+ /* need to patch-up the dispatch code */
+ if (offset != (GLuint) ~0) {
+ fill_in_entrypoint_offset(ExtEntryTable[i].Address, offset);
+ ExtEntryTable[i].Offset = offset;
+ }
+ return GL_TRUE;
+ }
+ else {
+ return GL_FALSE; /* bad offset! */
+ }
+ }
+ }
+ }
+
+ /* This is a new function, try to add it. */
+ if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS ||
+ offset >= DISPATCH_TABLE_SIZE) {
+ /* No space left */
+ return GL_FALSE;
+ }
+ else {
+ _glapi_proc entrypoint = generate_entrypoint(offset);
+ if (!entrypoint)
+ return GL_FALSE; /* couldn't generate assembly */
+
+ /* OK! */
+ ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName);
+ ExtEntryTable[NumExtEntryPoints].Offset = offset;
+ ExtEntryTable[NumExtEntryPoints].Address = entrypoint;
+ NumExtEntryPoints++;
+
+ return GL_TRUE; /* success */
+ }
+
+ /* should never get here, silence compiler warnings */
+ return GL_FALSE;
+}
+
+
+/**
+ * Return offset of entrypoint for named function within dispatch table.
+ */
+GLint
+_glapi_get_proc_offset(const char *funcName)
+{
+ /* search extension functions first */
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
+ return ExtEntryTable[i].Offset;
+ }
+ }
+
+ /* search static functions */
+ return get_static_proc_offset(funcName);
+}
+
+
+
+/**
+ * Return pointer to the named function. If the function name isn't found
+ * in the name of static functions, try generating a new API entrypoint on
+ * the fly with assembly language.
+ */
+_glapi_proc
+_glapi_get_proc_address(const char *funcName)
+{
+ GLuint i;
+
+#ifdef MANGLE
+ if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l')
+ return NULL;
+#else
+ if (funcName[0] != 'g' || funcName[1] != 'l')
+ return NULL;
+#endif
+
+ /* search extension functions first */
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
+ return ExtEntryTable[i].Address;
+ }
+ }
+
+ /* search static functions */
+ {
+ const _glapi_proc func = get_static_proc_address(funcName);
+ if (func)
+ return func;
+ }
+
+ /* generate new entrypoint - use a temporary dispatch offset of
+ * ~0 (i.e. -1). Later, when the driver calls _glapi_add_entrypoint()
+ * we'll put in the proper offset. If that never happens, and the
+ * user calls this function, he'll segfault. That's what you get
+ * when you try calling a GL function that doesn't really exist.
+ */
+ if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) {
+ _glapi_proc entrypoint = generate_entrypoint(~0);
+ if (!entrypoint)
+ return GL_FALSE;
+
+ ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName);
+ ExtEntryTable[NumExtEntryPoints].Offset = ~0;
+ ExtEntryTable[NumExtEntryPoints].Address = entrypoint;
+ NumExtEntryPoints++;
+
+ return entrypoint;
+ }
+ else {
+ /* no space for new functions! */
+ return NULL;
+ }
+}
+
+
+
+/**
+ * Return the name of the function at the given dispatch offset.
+ * This is only intended for debugging.
+ */
+const char *
+_glapi_get_proc_name(GLuint offset)
+{
+ GLuint i;
+ const char * n;
+
+ /* search built-in functions */
+ n = get_static_proc_name(offset);
+ if ( n != NULL ) {
+ return n;
+ }
+
+ /* search added extension functions */
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (ExtEntryTable[i].Offset == offset) {
+ return ExtEntryTable[i].Name;
+ }
+ }
+ return NULL;
+}
+
+
+
+/**
+ * Return size of dispatch table struct as number of functions (or
+ * slots).
+ */
+GLuint
+_glapi_get_dispatch_table_size(void)
+{
+ return DISPATCH_TABLE_SIZE;
+}
+
+
+
+/**
+ * Get API dispatcher version string.
+ */
+const char *
+_glapi_get_version(void)
+{
+ return "20021001"; /* YYYYMMDD */
+}
+
+
+
+/**
+ * Make sure there are no NULL pointers in the given dispatch table.
+ * Intended for debugging purposes.
+ */
+void
+_glapi_check_table(const struct _glapi_table *table)
+{
+#ifdef DEBUG
+ const GLuint entries = _glapi_get_dispatch_table_size();
+ const void **tab = (const void **) table;
+ GLuint i;
+ for (i = 1; i < entries; i++) {
+ assert(tab[i]);
+ }
+
+ /* Do some spot checks to be sure that the dispatch table
+ * slots are assigned correctly.
+ */
+ {
+ GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
+ char *BeginFunc = (char*) &table->Begin;
+ GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
+ assert(BeginOffset == _gloffset_Begin);
+ assert(BeginOffset == offset);
+ }
+ {
+ GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
+ char *viewportFunc = (char*) &table->Viewport;
+ GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
+ assert(viewportOffset == _gloffset_Viewport);
+ assert(viewportOffset == offset);
+ }
+ {
+ GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
+ char *VertexPointerFunc = (char*) &table->VertexPointer;
+ GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
+ assert(VertexPointerOffset == _gloffset_VertexPointer);
+ assert(VertexPointerOffset == offset);
+ }
+ {
+ GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
+ char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
+ GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
+ assert(ResetMinMaxOffset == _gloffset_ResetMinmax);
+ assert(ResetMinMaxOffset == offset);
+ }
+ {
+ GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
+ char *blendColorFunc = (char*) &table->BlendColor;
+ GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
+ assert(blendColorOffset == _gloffset_BlendColor);
+ assert(blendColorOffset == offset);
+ }
+ {
+ GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT");
+ char *istextureFunc = (char*) &table->IsTextureEXT;
+ GLuint offset = (istextureFunc - (char *) table) / sizeof(void *);
+ assert(istextureOffset == _gloffset_IsTextureEXT);
+ assert(istextureOffset == offset);
+ }
+ {
+ GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
+ char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
+ GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
+ assert(secondaryColor3fOffset == _gloffset_SecondaryColor3fEXT);
+ assert(secondaryColor3fOffset == offset);
+ assert(_glapi_get_proc_address("glSecondaryColor3fEXT") == (_glapi_proc) &glSecondaryColor3fEXT);
+ }
+ {
+ GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV");
+ char *pointParameterivFunc = (char*) &table->PointParameterivNV;
+ GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *);
+ assert(pointParameterivOffset == _gloffset_PointParameterivNV);
+ assert(pointParameterivOffset == offset);
+ assert(_glapi_get_proc_address("glPointParameterivNV") == (_glapi_proc) &glPointParameterivNV);
+ }
+ {
+ GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV");
+ char *setFenceFunc = (char*) &table->SetFenceNV;
+ GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
+ assert(setFenceOffset == _gloffset_SetFenceNV);
+ assert(setFenceOffset == offset);
+ assert(_glapi_get_proc_address("glSetFenceNV") == (_glapi_proc) &glSetFenceNV);
+ }
+#else
+ (void) table;
+#endif
+}
Index: xc/extras/Mesa/src/mesa/glapi/glapi.h
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glapi.h:1.2
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glapi.h Fri Dec 17 11:38:02 2004
@@ -0,0 +1,129 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/glapi/glapi.h,v 1.2 2004/12/17 16:38:02 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \mainpage Mesa GL API Module
+ *
+ * \section GLAPIIntroduction Introduction
+ *
+ * The Mesa GL API module is responsible for dispatching all the
+ * gl*() functions. All GL functions are dispatched by jumping through
+ * the current dispatch table (basically a struct full of function
+ * pointers.)
+ *
+ * A per-thread current dispatch table and per-thread current context
+ * pointer are managed by this module too.
+ *
+ * This module is intended to be non-Mesa-specific so it can be used
+ * with the X/DRI libGL also.
+ */
+
+
+#ifndef _GLAPI_H
+#define _GLAPI_H
+
+
+#include "GL/gl.h"
+
+struct _glapi_table;
+
+typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
+
+typedef void (*_glapi_proc)(void); /* generic function pointer */
+
+
+extern void *_glapi_Context;
+
+extern struct _glapi_table *_glapi_Dispatch;
+
+
+extern void
+_glapi_noop_enable_warnings(GLboolean enable);
+
+extern void
+_glapi_set_warning_func(_glapi_warning_func func);
+
+extern void
+_glapi_check_multithread(void);
+
+
+extern void
+_glapi_set_context(void *context);
+
+
+extern void *
+_glapi_get_context(void);
+
+
+extern void
+_glapi_set_dispatch(struct _glapi_table *dispatch);
+
+
+extern struct _glapi_table *
+_glapi_get_dispatch(void);
+
+
+extern int
+_glapi_begin_dispatch_override(struct _glapi_table *override);
+
+
+extern void
+_glapi_end_dispatch_override(int layer);
+
+
+struct _glapi_table *
+_glapi_get_override_dispatch(int layer);
+
+
+extern GLuint
+_glapi_get_dispatch_table_size(void);
+
+
+extern const char *
+_glapi_get_version(void);
+
+
+extern void
+_glapi_check_table(const struct _glapi_table *table);
+
+
+extern GLboolean
+_glapi_add_entrypoint(const char *funcName, GLuint offset);
+
+
+extern GLint
+_glapi_get_proc_offset(const char *funcName);
+
+
+extern _glapi_proc
+_glapi_get_proc_address(const char *funcName);
+
+
+extern const char *
+_glapi_get_proc_name(GLuint offset);
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/glapi/glapioffsets.h
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glapioffsets.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glapioffsets.h Fri Dec 10 10:05:27 2004
@@ -0,0 +1,744 @@
+/* DO NOT EDIT - This file generated automatically by gl_offsets.py (from Mesa) script */
+
+/*
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL, IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _GLAPI_OFFSETS_H_
+#define _GLAPI_OFFSETS_H_
+
+#define _gloffset_NewList 0
+#define _gloffset_EndList 1
+#define _gloffset_CallList 2
+#define _gloffset_CallLists 3
+#define _gloffset_DeleteLists 4
+#define _gloffset_GenLists 5
+#define _gloffset_ListBase 6
+#define _gloffset_Begin 7
+#define _gloffset_Bitmap 8
+#define _gloffset_Color3b 9
+#define _gloffset_Color3bv 10
+#define _gloffset_Color3d 11
+#define _gloffset_Color3dv 12
+#define _gloffset_Color3f 13
+#define _gloffset_Color3fv 14
+#define _gloffset_Color3i 15
+#define _gloffset_Color3iv 16
+#define _gloffset_Color3s 17
+#define _gloffset_Color3sv 18
+#define _gloffset_Color3ub 19
+#define _gloffset_Color3ubv 20
+#define _gloffset_Color3ui 21
+#define _gloffset_Color3uiv 22
+#define _gloffset_Color3us 23
+#define _gloffset_Color3usv 24
+#define _gloffset_Color4b 25
+#define _gloffset_Color4bv 26
+#define _gloffset_Color4d 27
+#define _gloffset_Color4dv 28
+#define _gloffset_Color4f 29
+#define _gloffset_Color4fv 30
+#define _gloffset_Color4i 31
+#define _gloffset_Color4iv 32
+#define _gloffset_Color4s 33
+#define _gloffset_Color4sv 34
+#define _gloffset_Color4ub 35
+#define _gloffset_Color4ubv 36
+#define _gloffset_Color4ui 37
+#define _gloffset_Color4uiv 38
+#define _gloffset_Color4us 39
+#define _gloffset_Color4usv 40
+#define _gloffset_EdgeFlag 41
+#define _gloffset_EdgeFlagv 42
+#define _gloffset_End 43
+#define _gloffset_Indexd 44
+#define _gloffset_Indexdv 45
+#define _gloffset_Indexf 46
+#define _gloffset_Indexfv 47
+#define _gloffset_Indexi 48
+#define _gloffset_Indexiv 49
+#define _gloffset_Indexs 50
+#define _gloffset_Indexsv 51
+#define _gloffset_Normal3b 52
+#define _gloffset_Normal3bv 53
+#define _gloffset_Normal3d 54
+#define _gloffset_Normal3dv 55
+#define _gloffset_Normal3f 56
+#define _gloffset_Normal3fv 57
+#define _gloffset_Normal3i 58
+#define _gloffset_Normal3iv 59
+#define _gloffset_Normal3s 60
+#define _gloffset_Normal3sv 61
+#define _gloffset_RasterPos2d 62
+#define _gloffset_RasterPos2dv 63
+#define _gloffset_RasterPos2f 64
+#define _gloffset_RasterPos2fv 65
+#define _gloffset_RasterPos2i 66
+#define _gloffset_RasterPos2iv 67
+#define _gloffset_RasterPos2s 68
+#define _gloffset_RasterPos2sv 69
+#define _gloffset_RasterPos3d 70
+#define _gloffset_RasterPos3dv 71
+#define _gloffset_RasterPos3f 72
+#define _gloffset_RasterPos3fv 73
+#define _gloffset_RasterPos3i 74
+#define _gloffset_RasterPos3iv 75
+#define _gloffset_RasterPos3s 76
+#define _gloffset_RasterPos3sv 77
+#define _gloffset_RasterPos4d 78
+#define _gloffset_RasterPos4dv 79
+#define _gloffset_RasterPos4f 80
+#define _gloffset_RasterPos4fv 81
+#define _gloffset_RasterPos4i 82
+#define _gloffset_RasterPos4iv 83
+#define _gloffset_RasterPos4s 84
+#define _gloffset_RasterPos4sv 85
+#define _gloffset_Rectd 86
+#define _gloffset_Rectdv 87
+#define _gloffset_Rectf 88
+#define _gloffset_Rectfv 89
+#define _gloffset_Recti 90
+#define _gloffset_Rectiv 91
+#define _gloffset_Rects 92
+#define _gloffset_Rectsv 93
+#define _gloffset_TexCoord1d 94
+#define _gloffset_TexCoord1dv 95
+#define _gloffset_TexCoord1f 96
+#define _gloffset_TexCoord1fv 97
+#define _gloffset_TexCoord1i 98
+#define _gloffset_TexCoord1iv 99
+#define _gloffset_TexCoord1s 100
+#define _gloffset_TexCoord1sv 101
+#define _gloffset_TexCoord2d 102
+#define _gloffset_TexCoord2dv 103
+#define _gloffset_TexCoord2f 104
+#define _gloffset_TexCoord2fv 105
+#define _gloffset_TexCoord2i 106
+#define _gloffset_TexCoord2iv 107
+#define _gloffset_TexCoord2s 108
+#define _gloffset_TexCoord2sv 109
+#define _gloffset_TexCoord3d 110
+#define _gloffset_TexCoord3dv 111
+#define _gloffset_TexCoord3f 112
+#define _gloffset_TexCoord3fv 113
+#define _gloffset_TexCoord3i 114
+#define _gloffset_TexCoord3iv 115
+#define _gloffset_TexCoord3s 116
+#define _gloffset_TexCoord3sv 117
+#define _gloffset_TexCoord4d 118
+#define _gloffset_TexCoord4dv 119
+#define _gloffset_TexCoord4f 120
+#define _gloffset_TexCoord4fv 121
+#define _gloffset_TexCoord4i 122
+#define _gloffset_TexCoord4iv 123
+#define _gloffset_TexCoord4s 124
+#define _gloffset_TexCoord4sv 125
+#define _gloffset_Vertex2d 126
+#define _gloffset_Vertex2dv 127
+#define _gloffset_Vertex2f 128
+#define _gloffset_Vertex2fv 129
+#define _gloffset_Vertex2i 130
+#define _gloffset_Vertex2iv 131
+#define _gloffset_Vertex2s 132
+#define _gloffset_Vertex2sv 133
+#define _gloffset_Vertex3d 134
+#define _gloffset_Vertex3dv 135
+#define _gloffset_Vertex3f 136
+#define _gloffset_Vertex3fv 137
+#define _gloffset_Vertex3i 138
+#define _gloffset_Vertex3iv 139
+#define _gloffset_Vertex3s 140
+#define _gloffset_Vertex3sv 141
+#define _gloffset_Vertex4d 142
+#define _gloffset_Vertex4dv 143
+#define _gloffset_Vertex4f 144
+#define _gloffset_Vertex4fv 145
+#define _gloffset_Vertex4i 146
+#define _gloffset_Vertex4iv 147
+#define _gloffset_Vertex4s 148
+#define _gloffset_Vertex4sv 149
+#define _gloffset_ClipPlane 150
+#define _gloffset_ColorMaterial 151
+#define _gloffset_CullFace 152
+#define _gloffset_Fogf 153
+#define _gloffset_Fogfv 154
+#define _gloffset_Fogi 155
+#define _gloffset_Fogiv 156
+#define _gloffset_FrontFace 157
+#define _gloffset_Hint 158
+#define _gloffset_Lightf 159
+#define _gloffset_Lightfv 160
+#define _gloffset_Lighti 161
+#define _gloffset_Lightiv 162
+#define _gloffset_LightModelf 163
+#define _gloffset_LightModelfv 164
+#define _gloffset_LightModeli 165
+#define _gloffset_LightModeliv 166
+#define _gloffset_LineStipple 167
+#define _gloffset_LineWidth 168
+#define _gloffset_Materialf 169
+#define _gloffset_Materialfv 170
+#define _gloffset_Materiali 171
+#define _gloffset_Materialiv 172
+#define _gloffset_PointSize 173
+#define _gloffset_PolygonMode 174
+#define _gloffset_PolygonStipple 175
+#define _gloffset_Scissor 176
+#define _gloffset_ShadeModel 177
+#define _gloffset_TexParameterf 178
+#define _gloffset_TexParameterfv 179
+#define _gloffset_TexParameteri 180
+#define _gloffset_TexParameteriv 181
+#define _gloffset_TexImage1D 182
+#define _gloffset_TexImage2D 183
+#define _gloffset_TexEnvf 184
+#define _gloffset_TexEnvfv 185
+#define _gloffset_TexEnvi 186
+#define _gloffset_TexEnviv 187
+#define _gloffset_TexGend 188
+#define _gloffset_TexGendv 189
+#define _gloffset_TexGenf 190
+#define _gloffset_TexGenfv 191
+#define _gloffset_TexGeni 192
+#define _gloffset_TexGeniv 193
+#define _gloffset_FeedbackBuffer 194
+#define _gloffset_SelectBuffer 195
+#define _gloffset_RenderMode 196
+#define _gloffset_InitNames 197
+#define _gloffset_LoadName 198
+#define _gloffset_PassThrough 199
+#define _gloffset_PopName 200
+#define _gloffset_PushName 201
+#define _gloffset_DrawBuffer 202
+#define _gloffset_Clear 203
+#define _gloffset_ClearAccum 204
+#define _gloffset_ClearIndex 205
+#define _gloffset_ClearColor 206
+#define _gloffset_ClearStencil 207
+#define _gloffset_ClearDepth 208
+#define _gloffset_StencilMask 209
+#define _gloffset_ColorMask 210
+#define _gloffset_DepthMask 211
+#define _gloffset_IndexMask 212
+#define _gloffset_Accum 213
+#define _gloffset_Disable 214
+#define _gloffset_Enable 215
+#define _gloffset_Finish 216
+#define _gloffset_Flush 217
+#define _gloffset_PopAttrib 218
+#define _gloffset_PushAttrib 219
+#define _gloffset_Map1d 220
+#define _gloffset_Map1f 221
+#define _gloffset_Map2d 222
+#define _gloffset_Map2f 223
+#define _gloffset_MapGrid1d 224
+#define _gloffset_MapGrid1f 225
+#define _gloffset_MapGrid2d 226
+#define _gloffset_MapGrid2f 227
+#define _gloffset_EvalCoord1d 228
+#define _gloffset_EvalCoord1dv 229
+#define _gloffset_EvalCoord1f 230
+#define _gloffset_EvalCoord1fv 231
+#define _gloffset_EvalCoord2d 232
+#define _gloffset_EvalCoord2dv 233
+#define _gloffset_EvalCoord2f 234
+#define _gloffset_EvalCoord2fv 235
+#define _gloffset_EvalMesh1 236
+#define _gloffset_EvalPoint1 237
+#define _gloffset_EvalMesh2 238
+#define _gloffset_EvalPoint2 239
+#define _gloffset_AlphaFunc 240
+#define _gloffset_BlendFunc 241
+#define _gloffset_LogicOp 242
+#define _gloffset_StencilFunc 243
+#define _gloffset_StencilOp 244
+#define _gloffset_DepthFunc 245
+#define _gloffset_PixelZoom 246
+#define _gloffset_PixelTransferf 247
+#define _gloffset_PixelTransferi 248
+#define _gloffset_PixelStoref 249
+#define _gloffset_PixelStorei 250
+#define _gloffset_PixelMapfv 251
+#define _gloffset_PixelMapuiv 252
+#define _gloffset_PixelMapusv 253
+#define _gloffset_ReadBuffer 254
+#define _gloffset_CopyPixels 255
+#define _gloffset_ReadPixels 256
+#define _gloffset_DrawPixels 257
+#define _gloffset_GetBooleanv 258
+#define _gloffset_GetClipPlane 259
+#define _gloffset_GetDoublev 260
+#define _gloffset_GetError 261
+#define _gloffset_GetFloatv 262
+#define _gloffset_GetIntegerv 263
+#define _gloffset_GetLightfv 264
+#define _gloffset_GetLightiv 265
+#define _gloffset_GetMapdv 266
+#define _gloffset_GetMapfv 267
+#define _gloffset_GetMapiv 268
+#define _gloffset_GetMaterialfv 269
+#define _gloffset_GetMaterialiv 270
+#define _gloffset_GetPixelMapfv 271
+#define _gloffset_GetPixelMapuiv 272
+#define _gloffset_GetPixelMapusv 273
+#define _gloffset_GetPolygonStipple 274
+#define _gloffset_GetString 275
+#define _gloffset_GetTexEnvfv 276
+#define _gloffset_GetTexEnviv 277
+#define _gloffset_GetTexGendv 278
+#define _gloffset_GetTexGenfv 279
+#define _gloffset_GetTexGeniv 280
+#define _gloffset_GetTexImage 281
+#define _gloffset_GetTexParameterfv 282
+#define _gloffset_GetTexParameteriv 283
+#define _gloffset_GetTexLevelParameterfv 284
+#define _gloffset_GetTexLevelParameteriv 285
+#define _gloffset_IsEnabled 286
+#define _gloffset_IsList 287
+#define _gloffset_DepthRange 288
+#define _gloffset_Frustum 289
+#define _gloffset_LoadIdentity 290
+#define _gloffset_LoadMatrixf 291
+#define _gloffset_LoadMatrixd 292
+#define _gloffset_MatrixMode 293
+#define _gloffset_MultMatrixf 294
+#define _gloffset_MultMatrixd 295
+#define _gloffset_Ortho 296
+#define _gloffset_PopMatrix 297
+#define _gloffset_PushMatrix 298
+#define _gloffset_Rotated 299
+#define _gloffset_Rotatef 300
+#define _gloffset_Scaled 301
+#define _gloffset_Scalef 302
+#define _gloffset_Translated 303
+#define _gloffset_Translatef 304
+#define _gloffset_Viewport 305
+#define _gloffset_ArrayElement 306
+#define _gloffset_BindTexture 307
+#define _gloffset_ColorPointer 308
+#define _gloffset_DisableClientState 309
+#define _gloffset_DrawArrays 310
+#define _gloffset_DrawElements 311
+#define _gloffset_EdgeFlagPointer 312
+#define _gloffset_EnableClientState 313
+#define _gloffset_IndexPointer 314
+#define _gloffset_Indexub 315
+#define _gloffset_Indexubv 316
+#define _gloffset_InterleavedArrays 317
+#define _gloffset_NormalPointer 318
+#define _gloffset_PolygonOffset 319
+#define _gloffset_TexCoordPointer 320
+#define _gloffset_VertexPointer 321
+#define _gloffset_AreTexturesResident 322
+#define _gloffset_CopyTexImage1D 323
+#define _gloffset_CopyTexImage2D 324
+#define _gloffset_CopyTexSubImage1D 325
+#define _gloffset_CopyTexSubImage2D 326
+#define _gloffset_DeleteTextures 327
+#define _gloffset_GenTextures 328
+#define _gloffset_GetPointerv 329
+#define _gloffset_IsTexture 330
+#define _gloffset_PrioritizeTextures 331
+#define _gloffset_TexSubImage1D 332
+#define _gloffset_TexSubImage2D 333
+#define _gloffset_PopClientAttrib 334
+#define _gloffset_PushClientAttrib 335
+#define _gloffset_BlendColor 336
+#define _gloffset_BlendEquation 337
+#define _gloffset_DrawRangeElements 338
+#define _gloffset_ColorTable 339
+#define _gloffset_ColorTableParameterfv 340
+#define _gloffset_ColorTableParameteriv 341
+#define _gloffset_CopyColorTable 342
+#define _gloffset_GetColorTable 343
+#define _gloffset_GetColorTableParameterfv 344
+#define _gloffset_GetColorTableParameteriv 345
+#define _gloffset_ColorSubTable 346
+#define _gloffset_CopyColorSubTable 347
+#define _gloffset_ConvolutionFilter1D 348
+#define _gloffset_ConvolutionFilter2D 349
+#define _gloffset_ConvolutionParameterf 350
+#define _gloffset_ConvolutionParameterfv 351
+#define _gloffset_ConvolutionParameteri 352
+#define _gloffset_ConvolutionParameteriv 353
+#define _gloffset_CopyConvolutionFilter1D 354
+#define _gloffset_CopyConvolutionFilter2D 355
+#define _gloffset_GetConvolutionFilter 356
+#define _gloffset_GetConvolutionParameterfv 357
+#define _gloffset_GetConvolutionParameteriv 358
+#define _gloffset_GetSeparableFilter 359
+#define _gloffset_SeparableFilter2D 360
+#define _gloffset_GetHistogram 361
+#define _gloffset_GetHistogramParameterfv 362
+#define _gloffset_GetHistogramParameteriv 363
+#define _gloffset_GetMinmax 364
+#define _gloffset_GetMinmaxParameterfv 365
+#define _gloffset_GetMinmaxParameteriv 366
+#define _gloffset_Histogram 367
+#define _gloffset_Minmax 368
+#define _gloffset_ResetHistogram 369
+#define _gloffset_ResetMinmax 370
+#define _gloffset_TexImage3D 371
+#define _gloffset_TexSubImage3D 372
+#define _gloffset_CopyTexSubImage3D 373
+#define _gloffset_ActiveTextureARB 374
+#define _gloffset_ClientActiveTextureARB 375
+#define _gloffset_MultiTexCoord1dARB 376
+#define _gloffset_MultiTexCoord1dvARB 377
+#define _gloffset_MultiTexCoord1fARB 378
+#define _gloffset_MultiTexCoord1fvARB 379
+#define _gloffset_MultiTexCoord1iARB 380
+#define _gloffset_MultiTexCoord1ivARB 381
+#define _gloffset_MultiTexCoord1sARB 382
+#define _gloffset_MultiTexCoord1svARB 383
+#define _gloffset_MultiTexCoord2dARB 384
+#define _gloffset_MultiTexCoord2dvARB 385
+#define _gloffset_MultiTexCoord2fARB 386
+#define _gloffset_MultiTexCoord2fvARB 387
+#define _gloffset_MultiTexCoord2iARB 388
+#define _gloffset_MultiTexCoord2ivARB 389
+#define _gloffset_MultiTexCoord2sARB 390
+#define _gloffset_MultiTexCoord2svARB 391
+#define _gloffset_MultiTexCoord3dARB 392
+#define _gloffset_MultiTexCoord3dvARB 393
+#define _gloffset_MultiTexCoord3fARB 394
+#define _gloffset_MultiTexCoord3fvARB 395
+#define _gloffset_MultiTexCoord3iARB 396
+#define _gloffset_MultiTexCoord3ivARB 397
+#define _gloffset_MultiTexCoord3sARB 398
+#define _gloffset_MultiTexCoord3svARB 399
+#define _gloffset_MultiTexCoord4dARB 400
+#define _gloffset_MultiTexCoord4dvARB 401
+#define _gloffset_MultiTexCoord4fARB 402
+#define _gloffset_MultiTexCoord4fvARB 403
+#define _gloffset_MultiTexCoord4iARB 404
+#define _gloffset_MultiTexCoord4ivARB 405
+#define _gloffset_MultiTexCoord4sARB 406
+#define _gloffset_MultiTexCoord4svARB 407
+#define _gloffset_LoadTransposeMatrixfARB 408
+#define _gloffset_LoadTransposeMatrixdARB 409
+#define _gloffset_MultTransposeMatrixfARB 410
+#define _gloffset_MultTransposeMatrixdARB 411
+#define _gloffset_SampleCoverageARB 412
+#define _gloffset___unused413 413
+#define _gloffset_PolygonOffsetEXT 414
+#define _gloffset_GetTexFilterFuncSGIS 415
+#define _gloffset_TexFilterFuncSGIS 416
+#define _gloffset_GetHistogramEXT 417
+#define _gloffset_GetHistogramParameterfvEXT 418
+#define _gloffset_GetHistogramParameterivEXT 419
+#define _gloffset_GetMinmaxEXT 420
+#define _gloffset_GetMinmaxParameterfvEXT 421
+#define _gloffset_GetMinmaxParameterivEXT 422
+#define _gloffset_GetConvolutionFilterEXT 423
+#define _gloffset_GetConvolutionParameterfvEXT 424
+#define _gloffset_GetConvolutionParameterivEXT 425
+#define _gloffset_GetSeparableFilterEXT 426
+#define _gloffset_GetColorTableSGI 427
+#define _gloffset_GetColorTableParameterfvSGI 428
+#define _gloffset_GetColorTableParameterivSGI 429
+#define _gloffset_PixelTexGenSGIX 430
+#define _gloffset_PixelTexGenParameteriSGIS 431
+#define _gloffset_PixelTexGenParameterivSGIS 432
+#define _gloffset_PixelTexGenParameterfSGIS 433
+#define _gloffset_PixelTexGenParameterfvSGIS 434
+#define _gloffset_GetPixelTexGenParameterivSGIS 435
+#define _gloffset_GetPixelTexGenParameterfvSGIS 436
+#define _gloffset_TexImage4DSGIS 437
+#define _gloffset_TexSubImage4DSGIS 438
+#define _gloffset_AreTexturesResidentEXT 439
+#define _gloffset_GenTexturesEXT 440
+#define _gloffset_IsTextureEXT 441
+#define _gloffset_DetailTexFuncSGIS 442
+#define _gloffset_GetDetailTexFuncSGIS 443
+#define _gloffset_SharpenTexFuncSGIS 444
+#define _gloffset_GetSharpenTexFuncSGIS 445
+#define _gloffset_SampleMaskSGIS 446
+#define _gloffset_SamplePatternSGIS 447
+#define _gloffset_ColorPointerEXT 448
+#define _gloffset_EdgeFlagPointerEXT 449
+#define _gloffset_IndexPointerEXT 450
+#define _gloffset_NormalPointerEXT 451
+#define _gloffset_TexCoordPointerEXT 452
+#define _gloffset_VertexPointerEXT 453
+#define _gloffset_SpriteParameterfSGIX 454
+#define _gloffset_SpriteParameterfvSGIX 455
+#define _gloffset_SpriteParameteriSGIX 456
+#define _gloffset_SpriteParameterivSGIX 457
+#define _gloffset_PointParameterfEXT 458
+#define _gloffset_PointParameterfvEXT 459
+#define _gloffset_GetInstrumentsSGIX 460
+#define _gloffset_InstrumentsBufferSGIX 461
+#define _gloffset_PollInstrumentsSGIX 462
+#define _gloffset_ReadInstrumentsSGIX 463
+#define _gloffset_StartInstrumentsSGIX 464
+#define _gloffset_StopInstrumentsSGIX 465
+#define _gloffset_FrameZoomSGIX 466
+#define _gloffset_TagSampleBufferSGIX 467
+#define _gloffset_ReferencePlaneSGIX 468
+#define _gloffset_FlushRasterSGIX 469
+#define _gloffset_GetListParameterfvSGIX 470
+#define _gloffset_GetListParameterivSGIX 471
+#define _gloffset_ListParameterfSGIX 472
+#define _gloffset_ListParameterfvSGIX 473
+#define _gloffset_ListParameteriSGIX 474
+#define _gloffset_ListParameterivSGIX 475
+#define _gloffset_FragmentColorMaterialSGIX 476
+#define _gloffset_FragmentLightfSGIX 477
+#define _gloffset_FragmentLightfvSGIX 478
+#define _gloffset_FragmentLightiSGIX 479
+#define _gloffset_FragmentLightivSGIX 480
+#define _gloffset_FragmentLightModelfSGIX 481
+#define _gloffset_FragmentLightModelfvSGIX 482
+#define _gloffset_FragmentLightModeliSGIX 483
+#define _gloffset_FragmentLightModelivSGIX 484
+#define _gloffset_FragmentMaterialfSGIX 485
+#define _gloffset_FragmentMaterialfvSGIX 486
+#define _gloffset_FragmentMaterialiSGIX 487
+#define _gloffset_FragmentMaterialivSGIX 488
+#define _gloffset_GetFragmentLightfvSGIX 489
+#define _gloffset_GetFragmentLightivSGIX 490
+#define _gloffset_GetFragmentMaterialfvSGIX 491
+#define _gloffset_GetFragmentMaterialivSGIX 492
+#define _gloffset_LightEnviSGIX 493
+#define _gloffset_VertexWeightfEXT 494
+#define _gloffset_VertexWeightfvEXT 495
+#define _gloffset_VertexWeightPointerEXT 496
+#define _gloffset_FlushVertexArrayRangeNV 497
+#define _gloffset_VertexArrayRangeNV 498
+#define _gloffset_CombinerParameterfvNV 499
+#define _gloffset_CombinerParameterfNV 500
+#define _gloffset_CombinerParameterivNV 501
+#define _gloffset_CombinerParameteriNV 502
+#define _gloffset_CombinerInputNV 503
+#define _gloffset_CombinerOutputNV 504
+#define _gloffset_FinalCombinerInputNV 505
+#define _gloffset_GetCombinerInputParameterfvNV 506
+#define _gloffset_GetCombinerInputParameterivNV 507
+#define _gloffset_GetCombinerOutputParameterfvNV 508
+#define _gloffset_GetCombinerOutputParameterivNV 509
+#define _gloffset_GetFinalCombinerInputParameterfvNV 510
+#define _gloffset_GetFinalCombinerInputParameterivNV 511
+#define _gloffset_ResizeBuffersMESA 512
+#define _gloffset_WindowPos2dMESA 513
+#define _gloffset_WindowPos2dvMESA 514
+#define _gloffset_WindowPos2fMESA 515
+#define _gloffset_WindowPos2fvMESA 516
+#define _gloffset_WindowPos2iMESA 517
+#define _gloffset_WindowPos2ivMESA 518
+#define _gloffset_WindowPos2sMESA 519
+#define _gloffset_WindowPos2svMESA 520
+#define _gloffset_WindowPos3dMESA 521
+#define _gloffset_WindowPos3dvMESA 522
+#define _gloffset_WindowPos3fMESA 523
+#define _gloffset_WindowPos3fvMESA 524
+#define _gloffset_WindowPos3iMESA 525
+#define _gloffset_WindowPos3ivMESA 526
+#define _gloffset_WindowPos3sMESA 527
+#define _gloffset_WindowPos3svMESA 528
+#define _gloffset_WindowPos4dMESA 529
+#define _gloffset_WindowPos4dvMESA 530
+#define _gloffset_WindowPos4fMESA 531
+#define _gloffset_WindowPos4fvMESA 532
+#define _gloffset_WindowPos4iMESA 533
+#define _gloffset_WindowPos4ivMESA 534
+#define _gloffset_WindowPos4sMESA 535
+#define _gloffset_WindowPos4svMESA 536
+#define _gloffset_BlendFuncSeparateEXT 537
+#define _gloffset_IndexMaterialEXT 538
+#define _gloffset_IndexFuncEXT 539
+#define _gloffset_LockArraysEXT 540
+#define _gloffset_UnlockArraysEXT 541
+#define _gloffset_CullParameterdvEXT 542
+#define _gloffset_CullParameterfvEXT 543
+#define _gloffset_HintPGI 544
+#define _gloffset_FogCoordfEXT 545
+#define _gloffset_FogCoordfvEXT 546
+#define _gloffset_FogCoorddEXT 547
+#define _gloffset_FogCoorddvEXT 548
+#define _gloffset_FogCoordPointerEXT 549
+#define _gloffset_GetColorTableEXT 550
+#define _gloffset_GetColorTableParameterivEXT 551
+#define _gloffset_GetColorTableParameterfvEXT 552
+#define _gloffset_TbufferMask3DFX 553
+#define _gloffset_CompressedTexImage3DARB 554
+#define _gloffset_CompressedTexImage2DARB 555
+#define _gloffset_CompressedTexImage1DARB 556
+#define _gloffset_CompressedTexSubImage3DARB 557
+#define _gloffset_CompressedTexSubImage2DARB 558
+#define _gloffset_CompressedTexSubImage1DARB 559
+#define _gloffset_GetCompressedTexImageARB 560
+#define _gloffset_SecondaryColor3bEXT 561
+#define _gloffset_SecondaryColor3bvEXT 562
+#define _gloffset_SecondaryColor3dEXT 563
+#define _gloffset_SecondaryColor3dvEXT 564
+#define _gloffset_SecondaryColor3fEXT 565
+#define _gloffset_SecondaryColor3fvEXT 566
+#define _gloffset_SecondaryColor3iEXT 567
+#define _gloffset_SecondaryColor3ivEXT 568
+#define _gloffset_SecondaryColor3sEXT 569
+#define _gloffset_SecondaryColor3svEXT 570
+#define _gloffset_SecondaryColor3ubEXT 571
+#define _gloffset_SecondaryColor3ubvEXT 572
+#define _gloffset_SecondaryColor3uiEXT 573
+#define _gloffset_SecondaryColor3uivEXT 574
+#define _gloffset_SecondaryColor3usEXT 575
+#define _gloffset_SecondaryColor3usvEXT 576
+#define _gloffset_SecondaryColorPointerEXT 577
+#define _gloffset_AreProgramsResidentNV 578
+#define _gloffset_BindProgramNV 579
+#define _gloffset_DeleteProgramsNV 580
+#define _gloffset_ExecuteProgramNV 581
+#define _gloffset_GenProgramsNV 582
+#define _gloffset_GetProgramParameterdvNV 583
+#define _gloffset_GetProgramParameterfvNV 584
+#define _gloffset_GetProgramivNV 585
+#define _gloffset_GetProgramStringNV 586
+#define _gloffset_GetTrackMatrixivNV 587
+#define _gloffset_GetVertexAttribdvNV 588
+#define _gloffset_GetVertexAttribfvNV 589
+#define _gloffset_GetVertexAttribivNV 590
+#define _gloffset_GetVertexAttribPointervNV 591
+#define _gloffset_IsProgramNV 592
+#define _gloffset_LoadProgramNV 593
+#define _gloffset_ProgramParameter4dNV 594
+#define _gloffset_ProgramParameter4dvNV 595
+#define _gloffset_ProgramParameter4fNV 596
+#define _gloffset_ProgramParameter4fvNV 597
+#define _gloffset_ProgramParameters4dvNV 598
+#define _gloffset_ProgramParameters4fvNV 599
+#define _gloffset_RequestResidentProgramsNV 600
+#define _gloffset_TrackMatrixNV 601
+#define _gloffset_VertexAttribPointerNV 602
+#define _gloffset_VertexAttrib1dNV 603
+#define _gloffset_VertexAttrib1dvNV 604
+#define _gloffset_VertexAttrib1fNV 605
+#define _gloffset_VertexAttrib1fvNV 606
+#define _gloffset_VertexAttrib1sNV 607
+#define _gloffset_VertexAttrib1svNV 608
+#define _gloffset_VertexAttrib2dNV 609
+#define _gloffset_VertexAttrib2dvNV 610
+#define _gloffset_VertexAttrib2fNV 611
+#define _gloffset_VertexAttrib2fvNV 612
+#define _gloffset_VertexAttrib2sNV 613
+#define _gloffset_VertexAttrib2svNV 614
+#define _gloffset_VertexAttrib3dNV 615
+#define _gloffset_VertexAttrib3dvNV 616
+#define _gloffset_VertexAttrib3fNV 617
+#define _gloffset_VertexAttrib3fvNV 618
+#define _gloffset_VertexAttrib3sNV 619
+#define _gloffset_VertexAttrib3svNV 620
+#define _gloffset_VertexAttrib4dNV 621
+#define _gloffset_VertexAttrib4dvNV 622
+#define _gloffset_VertexAttrib4fNV 623
+#define _gloffset_VertexAttrib4fvNV 624
+#define _gloffset_VertexAttrib4sNV 625
+#define _gloffset_VertexAttrib4svNV 626
+#define _gloffset_VertexAttrib4ubNV 627
+#define _gloffset_VertexAttrib4ubvNV 628
+#define _gloffset_VertexAttribs1dvNV 629
+#define _gloffset_VertexAttribs1fvNV 630
+#define _gloffset_VertexAttribs1svNV 631
+#define _gloffset_VertexAttribs2dvNV 632
+#define _gloffset_VertexAttribs2fvNV 633
+#define _gloffset_VertexAttribs2svNV 634
+#define _gloffset_VertexAttribs3dvNV 635
+#define _gloffset_VertexAttribs3fvNV 636
+#define _gloffset_VertexAttribs3svNV 637
+#define _gloffset_VertexAttribs4dvNV 638
+#define _gloffset_VertexAttribs4fvNV 639
+#define _gloffset_VertexAttribs4svNV 640
+#define _gloffset_VertexAttribs4ubvNV 641
+#define _gloffset_PointParameteriNV 642
+#define _gloffset_PointParameterivNV 643
+#define _gloffset_MultiDrawArraysEXT 644
+#define _gloffset_MultiDrawElementsEXT 645
+#define _gloffset_ActiveStencilFaceEXT 646
+#define _gloffset_DeleteFencesNV 647
+#define _gloffset_GenFencesNV 648
+#define _gloffset_IsFenceNV 649
+#define _gloffset_TestFenceNV 650
+#define _gloffset_GetFenceivNV 651
+#define _gloffset_FinishFenceNV 652
+#define _gloffset_SetFenceNV 653
+#define _gloffset_VertexAttrib4bvARB 654
+#define _gloffset_VertexAttrib4ivARB 655
+#define _gloffset_VertexAttrib4ubvARB 656
+#define _gloffset_VertexAttrib4usvARB 657
+#define _gloffset_VertexAttrib4uivARB 658
+#define _gloffset_VertexAttrib4NbvARB 659
+#define _gloffset_VertexAttrib4NsvARB 660
+#define _gloffset_VertexAttrib4NivARB 661
+#define _gloffset_VertexAttrib4NusvARB 662
+#define _gloffset_VertexAttrib4NuivARB 663
+#define _gloffset_VertexAttribPointerARB 664
+#define _gloffset_EnableVertexAttribArrayARB 665
+#define _gloffset_DisableVertexAttribArrayARB 666
+#define _gloffset_ProgramStringARB 667
+#define _gloffset_ProgramEnvParameter4dARB 668
+#define _gloffset_ProgramEnvParameter4dvARB 669
+#define _gloffset_ProgramEnvParameter4fARB 670
+#define _gloffset_ProgramEnvParameter4fvARB 671
+#define _gloffset_ProgramLocalParameter4dARB 672
+#define _gloffset_ProgramLocalParameter4dvARB 673
+#define _gloffset_ProgramLocalParameter4fARB 674
+#define _gloffset_ProgramLocalParameter4fvARB 675
+#define _gloffset_GetProgramEnvParameterdvARB 676
+#define _gloffset_GetProgramEnvParameterfvARB 677
+#define _gloffset_GetProgramLocalParameterdvARB 678
+#define _gloffset_GetProgramLocalParameterfvARB 679
+#define _gloffset_GetProgramivARB 680
+#define _gloffset_GetProgramStringARB 681
+#define _gloffset_ProgramNamedParameter4fNV 682
+#define _gloffset_ProgramNamedParameter4dNV 683
+#define _gloffset_ProgramNamedParameter4fvNV 684
+#define _gloffset_ProgramNamedParameter4dvNV 685
+#define _gloffset_GetProgramNamedParameterfvNV 686
+#define _gloffset_GetProgramNamedParameterdvNV 687
+#define _gloffset_BindBufferARB 688
+#define _gloffset_BufferDataARB 689
+#define _gloffset_BufferSubDataARB 690
+#define _gloffset_DeleteBuffersARB 691
+#define _gloffset_GenBuffersARB 692
+#define _gloffset_GetBufferParameterivARB 693
+#define _gloffset_GetBufferPointervARB 694
+#define _gloffset_GetBufferSubDataARB 695
+#define _gloffset_IsBufferARB 696
+#define _gloffset_MapBufferARB 697
+#define _gloffset_UnmapBufferARB 698
+#define _gloffset_DepthBoundsEXT 699
+#define _gloffset_GenQueriesARB 700
+#define _gloffset_DeleteQueriesARB 701
+#define _gloffset_IsQueryARB 702
+#define _gloffset_BeginQueryARB 703
+#define _gloffset_EndQueryARB 704
+#define _gloffset_GetQueryivARB 705
+#define _gloffset_GetQueryObjectivARB 706
+#define _gloffset_GetQueryObjectuivARB 707
+#define _gloffset_MultiModeDrawArraysIBM 708
+#define _gloffset_MultiModeDrawElementsIBM 709
+#define _gloffset_BlendEquationSeparateEXT 710
+
+#endif
Index: xc/extras/Mesa/src/mesa/glapi/glapitable.h
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glapitable.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glapitable.h Fri Dec 10 10:05:31 2004
@@ -0,0 +1,751 @@
+/* DO NOT EDIT - This file generated automatically by a script */
+
+/*
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL, IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _GLAPI_TABLE_H_
+#define _GLAPI_TABLE_H_
+
+#ifndef GLAPIENTRYP
+#define GLAPIENTRYP
+#endif
+
+struct _glapi_table
+{
+ void (GLAPIENTRYP NewList)(GLuint list, GLenum mode); /* 0 */
+ void (GLAPIENTRYP EndList)(void); /* 1 */
+ void (GLAPIENTRYP CallList)(GLuint list); /* 2 */
+ void (GLAPIENTRYP CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */
+ void (GLAPIENTRYP DeleteLists)(GLuint list, GLsizei range); /* 4 */
+ GLuint (GLAPIENTRYP GenLists)(GLsizei range); /* 5 */
+ void (GLAPIENTRYP ListBase)(GLuint base); /* 6 */
+ void (GLAPIENTRYP Begin)(GLenum mode); /* 7 */
+ void (GLAPIENTRYP Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */
+ void (GLAPIENTRYP Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */
+ void (GLAPIENTRYP Color3bv)(const GLbyte * v); /* 10 */
+ void (GLAPIENTRYP Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */
+ void (GLAPIENTRYP Color3dv)(const GLdouble * v); /* 12 */
+ void (GLAPIENTRYP Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */
+ void (GLAPIENTRYP Color3fv)(const GLfloat * v); /* 14 */
+ void (GLAPIENTRYP Color3i)(GLint red, GLint green, GLint blue); /* 15 */
+ void (GLAPIENTRYP Color3iv)(const GLint * v); /* 16 */
+ void (GLAPIENTRYP Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */
+ void (GLAPIENTRYP Color3sv)(const GLshort * v); /* 18 */
+ void (GLAPIENTRYP Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */
+ void (GLAPIENTRYP Color3ubv)(const GLubyte * v); /* 20 */
+ void (GLAPIENTRYP Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */
+ void (GLAPIENTRYP Color3uiv)(const GLuint * v); /* 22 */
+ void (GLAPIENTRYP Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */
+ void (GLAPIENTRYP Color3usv)(const GLushort * v); /* 24 */
+ void (GLAPIENTRYP Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */
+ void (GLAPIENTRYP Color4bv)(const GLbyte * v); /* 26 */
+ void (GLAPIENTRYP Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */
+ void (GLAPIENTRYP Color4dv)(const GLdouble * v); /* 28 */
+ void (GLAPIENTRYP Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */
+ void (GLAPIENTRYP Color4fv)(const GLfloat * v); /* 30 */
+ void (GLAPIENTRYP Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */
+ void (GLAPIENTRYP Color4iv)(const GLint * v); /* 32 */
+ void (GLAPIENTRYP Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */
+ void (GLAPIENTRYP Color4sv)(const GLshort * v); /* 34 */
+ void (GLAPIENTRYP Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */
+ void (GLAPIENTRYP Color4ubv)(const GLubyte * v); /* 36 */
+ void (GLAPIENTRYP Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */
+ void (GLAPIENTRYP Color4uiv)(const GLuint * v); /* 38 */
+ void (GLAPIENTRYP Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */
+ void (GLAPIENTRYP Color4usv)(const GLushort * v); /* 40 */
+ void (GLAPIENTRYP EdgeFlag)(GLboolean flag); /* 41 */
+ void (GLAPIENTRYP EdgeFlagv)(const GLboolean * flag); /* 42 */
+ void (GLAPIENTRYP End)(void); /* 43 */
+ void (GLAPIENTRYP Indexd)(GLdouble c); /* 44 */
+ void (GLAPIENTRYP Indexdv)(const GLdouble * c); /* 45 */
+ void (GLAPIENTRYP Indexf)(GLfloat c); /* 46 */
+ void (GLAPIENTRYP Indexfv)(const GLfloat * c); /* 47 */
+ void (GLAPIENTRYP Indexi)(GLint c); /* 48 */
+ void (GLAPIENTRYP Indexiv)(const GLint * c); /* 49 */
+ void (GLAPIENTRYP Indexs)(GLshort c); /* 50 */
+ void (GLAPIENTRYP Indexsv)(const GLshort * c); /* 51 */
+ void (GLAPIENTRYP Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */
+ void (GLAPIENTRYP Normal3bv)(const GLbyte * v); /* 53 */
+ void (GLAPIENTRYP Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */
+ void (GLAPIENTRYP Normal3dv)(const GLdouble * v); /* 55 */
+ void (GLAPIENTRYP Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */
+ void (GLAPIENTRYP Normal3fv)(const GLfloat * v); /* 57 */
+ void (GLAPIENTRYP Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */
+ void (GLAPIENTRYP Normal3iv)(const GLint * v); /* 59 */
+ void (GLAPIENTRYP Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */
+ void (GLAPIENTRYP Normal3sv)(const GLshort * v); /* 61 */
+ void (GLAPIENTRYP RasterPos2d)(GLdouble x, GLdouble y); /* 62 */
+ void (GLAPIENTRYP RasterPos2dv)(const GLdouble * v); /* 63 */
+ void (GLAPIENTRYP RasterPos2f)(GLfloat x, GLfloat y); /* 64 */
+ void (GLAPIENTRYP RasterPos2fv)(const GLfloat * v); /* 65 */
+ void (GLAPIENTRYP RasterPos2i)(GLint x, GLint y); /* 66 */
+ void (GLAPIENTRYP RasterPos2iv)(const GLint * v); /* 67 */
+ void (GLAPIENTRYP RasterPos2s)(GLshort x, GLshort y); /* 68 */
+ void (GLAPIENTRYP RasterPos2sv)(const GLshort * v); /* 69 */
+ void (GLAPIENTRYP RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */
+ void (GLAPIENTRYP RasterPos3dv)(const GLdouble * v); /* 71 */
+ void (GLAPIENTRYP RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */
+ void (GLAPIENTRYP RasterPos3fv)(const GLfloat * v); /* 73 */
+ void (GLAPIENTRYP RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */
+ void (GLAPIENTRYP RasterPos3iv)(const GLint * v); /* 75 */
+ void (GLAPIENTRYP RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */
+ void (GLAPIENTRYP RasterPos3sv)(const GLshort * v); /* 77 */
+ void (GLAPIENTRYP RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */
+ void (GLAPIENTRYP RasterPos4dv)(const GLdouble * v); /* 79 */
+ void (GLAPIENTRYP RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */
+ void (GLAPIENTRYP RasterPos4fv)(const GLfloat * v); /* 81 */
+ void (GLAPIENTRYP RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */
+ void (GLAPIENTRYP RasterPos4iv)(const GLint * v); /* 83 */
+ void (GLAPIENTRYP RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */
+ void (GLAPIENTRYP RasterPos4sv)(const GLshort * v); /* 85 */
+ void (GLAPIENTRYP Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */
+ void (GLAPIENTRYP Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */
+ void (GLAPIENTRYP Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */
+ void (GLAPIENTRYP Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */
+ void (GLAPIENTRYP Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */
+ void (GLAPIENTRYP Rectiv)(const GLint * v1, const GLint * v2); /* 91 */
+ void (GLAPIENTRYP Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */
+ void (GLAPIENTRYP Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */
+ void (GLAPIENTRYP TexCoord1d)(GLdouble s); /* 94 */
+ void (GLAPIENTRYP TexCoord1dv)(const GLdouble * v); /* 95 */
+ void (GLAPIENTRYP TexCoord1f)(GLfloat s); /* 96 */
+ void (GLAPIENTRYP TexCoord1fv)(const GLfloat * v); /* 97 */
+ void (GLAPIENTRYP TexCoord1i)(GLint s); /* 98 */
+ void (GLAPIENTRYP TexCoord1iv)(const GLint * v); /* 99 */
+ void (GLAPIENTRYP TexCoord1s)(GLshort s); /* 100 */
+ void (GLAPIENTRYP TexCoord1sv)(const GLshort * v); /* 101 */
+ void (GLAPIENTRYP TexCoord2d)(GLdouble s, GLdouble t); /* 102 */
+ void (GLAPIENTRYP TexCoord2dv)(const GLdouble * v); /* 103 */
+ void (GLAPIENTRYP TexCoord2f)(GLfloat s, GLfloat t); /* 104 */
+ void (GLAPIENTRYP TexCoord2fv)(const GLfloat * v); /* 105 */
+ void (GLAPIENTRYP TexCoord2i)(GLint s, GLint t); /* 106 */
+ void (GLAPIENTRYP TexCoord2iv)(const GLint * v); /* 107 */
+ void (GLAPIENTRYP TexCoord2s)(GLshort s, GLshort t); /* 108 */
+ void (GLAPIENTRYP TexCoord2sv)(const GLshort * v); /* 109 */
+ void (GLAPIENTRYP TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */
+ void (GLAPIENTRYP TexCoord3dv)(const GLdouble * v); /* 111 */
+ void (GLAPIENTRYP TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */
+ void (GLAPIENTRYP TexCoord3fv)(const GLfloat * v); /* 113 */
+ void (GLAPIENTRYP TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */
+ void (GLAPIENTRYP TexCoord3iv)(const GLint * v); /* 115 */
+ void (GLAPIENTRYP TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */
+ void (GLAPIENTRYP TexCoord3sv)(const GLshort * v); /* 117 */
+ void (GLAPIENTRYP TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */
+ void (GLAPIENTRYP TexCoord4dv)(const GLdouble * v); /* 119 */
+ void (GLAPIENTRYP TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */
+ void (GLAPIENTRYP TexCoord4fv)(const GLfloat * v); /* 121 */
+ void (GLAPIENTRYP TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */
+ void (GLAPIENTRYP TexCoord4iv)(const GLint * v); /* 123 */
+ void (GLAPIENTRYP TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */
+ void (GLAPIENTRYP TexCoord4sv)(const GLshort * v); /* 125 */
+ void (GLAPIENTRYP Vertex2d)(GLdouble x, GLdouble y); /* 126 */
+ void (GLAPIENTRYP Vertex2dv)(const GLdouble * v); /* 127 */
+ void (GLAPIENTRYP Vertex2f)(GLfloat x, GLfloat y); /* 128 */
+ void (GLAPIENTRYP Vertex2fv)(const GLfloat * v); /* 129 */
+ void (GLAPIENTRYP Vertex2i)(GLint x, GLint y); /* 130 */
+ void (GLAPIENTRYP Vertex2iv)(const GLint * v); /* 131 */
+ void (GLAPIENTRYP Vertex2s)(GLshort x, GLshort y); /* 132 */
+ void (GLAPIENTRYP Vertex2sv)(const GLshort * v); /* 133 */
+ void (GLAPIENTRYP Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */
+ void (GLAPIENTRYP Vertex3dv)(const GLdouble * v); /* 135 */
+ void (GLAPIENTRYP Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */
+ void (GLAPIENTRYP Vertex3fv)(const GLfloat * v); /* 137 */
+ void (GLAPIENTRYP Vertex3i)(GLint x, GLint y, GLint z); /* 138 */
+ void (GLAPIENTRYP Vertex3iv)(const GLint * v); /* 139 */
+ void (GLAPIENTRYP Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */
+ void (GLAPIENTRYP Vertex3sv)(const GLshort * v); /* 141 */
+ void (GLAPIENTRYP Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */
+ void (GLAPIENTRYP Vertex4dv)(const GLdouble * v); /* 143 */
+ void (GLAPIENTRYP Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */
+ void (GLAPIENTRYP Vertex4fv)(const GLfloat * v); /* 145 */
+ void (GLAPIENTRYP Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */
+ void (GLAPIENTRYP Vertex4iv)(const GLint * v); /* 147 */
+ void (GLAPIENTRYP Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */
+ void (GLAPIENTRYP Vertex4sv)(const GLshort * v); /* 149 */
+ void (GLAPIENTRYP ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */
+ void (GLAPIENTRYP ColorMaterial)(GLenum face, GLenum mode); /* 151 */
+ void (GLAPIENTRYP CullFace)(GLenum mode); /* 152 */
+ void (GLAPIENTRYP Fogf)(GLenum pname, GLfloat param); /* 153 */
+ void (GLAPIENTRYP Fogfv)(GLenum pname, const GLfloat * params); /* 154 */
+ void (GLAPIENTRYP Fogi)(GLenum pname, GLint param); /* 155 */
+ void (GLAPIENTRYP Fogiv)(GLenum pname, const GLint * params); /* 156 */
+ void (GLAPIENTRYP FrontFace)(GLenum mode); /* 157 */
+ void (GLAPIENTRYP Hint)(GLenum target, GLenum mode); /* 158 */
+ void (GLAPIENTRYP Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */
+ void (GLAPIENTRYP Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */
+ void (GLAPIENTRYP Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */
+ void (GLAPIENTRYP Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */
+ void (GLAPIENTRYP LightModelf)(GLenum pname, GLfloat param); /* 163 */
+ void (GLAPIENTRYP LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */
+ void (GLAPIENTRYP LightModeli)(GLenum pname, GLint param); /* 165 */
+ void (GLAPIENTRYP LightModeliv)(GLenum pname, const GLint * params); /* 166 */
+ void (GLAPIENTRYP LineStipple)(GLint factor, GLushort pattern); /* 167 */
+ void (GLAPIENTRYP LineWidth)(GLfloat width); /* 168 */
+ void (GLAPIENTRYP Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */
+ void (GLAPIENTRYP Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */
+ void (GLAPIENTRYP Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */
+ void (GLAPIENTRYP Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */
+ void (GLAPIENTRYP PointSize)(GLfloat size); /* 173 */
+ void (GLAPIENTRYP PolygonMode)(GLenum face, GLenum mode); /* 174 */
+ void (GLAPIENTRYP PolygonStipple)(const GLubyte * mask); /* 175 */
+ void (GLAPIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */
+ void (GLAPIENTRYP ShadeModel)(GLenum mode); /* 177 */
+ void (GLAPIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */
+ void (GLAPIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */
+ void (GLAPIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */
+ void (GLAPIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */
+ void (GLAPIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */
+ void (GLAPIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */
+ void (GLAPIENTRYP TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */
+ void (GLAPIENTRYP TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */
+ void (GLAPIENTRYP TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */
+ void (GLAPIENTRYP TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */
+ void (GLAPIENTRYP TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */
+ void (GLAPIENTRYP TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */
+ void (GLAPIENTRYP TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */
+ void (GLAPIENTRYP TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */
+ void (GLAPIENTRYP TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */
+ void (GLAPIENTRYP TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */
+ void (GLAPIENTRYP FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */
+ void (GLAPIENTRYP SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */
+ GLint (GLAPIENTRYP RenderMode)(GLenum mode); /* 196 */
+ void (GLAPIENTRYP InitNames)(void); /* 197 */
+ void (GLAPIENTRYP LoadName)(GLuint name); /* 198 */
+ void (GLAPIENTRYP PassThrough)(GLfloat token); /* 199 */
+ void (GLAPIENTRYP PopName)(void); /* 200 */
+ void (GLAPIENTRYP PushName)(GLuint name); /* 201 */
+ void (GLAPIENTRYP DrawBuffer)(GLenum mode); /* 202 */
+ void (GLAPIENTRYP Clear)(GLbitfield mask); /* 203 */
+ void (GLAPIENTRYP ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */
+ void (GLAPIENTRYP ClearIndex)(GLfloat c); /* 205 */
+ void (GLAPIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */
+ void (GLAPIENTRYP ClearStencil)(GLint s); /* 207 */
+ void (GLAPIENTRYP ClearDepth)(GLclampd depth); /* 208 */
+ void (GLAPIENTRYP StencilMask)(GLuint mask); /* 209 */
+ void (GLAPIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */
+ void (GLAPIENTRYP DepthMask)(GLboolean flag); /* 211 */
+ void (GLAPIENTRYP IndexMask)(GLuint mask); /* 212 */
+ void (GLAPIENTRYP Accum)(GLenum op, GLfloat value); /* 213 */
+ void (GLAPIENTRYP Disable)(GLenum cap); /* 214 */
+ void (GLAPIENTRYP Enable)(GLenum cap); /* 215 */
+ void (GLAPIENTRYP Finish)(void); /* 216 */
+ void (GLAPIENTRYP Flush)(void); /* 217 */
+ void (GLAPIENTRYP PopAttrib)(void); /* 218 */
+ void (GLAPIENTRYP PushAttrib)(GLbitfield mask); /* 219 */
+ void (GLAPIENTRYP Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */
+ void (GLAPIENTRYP Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */
+ void (GLAPIENTRYP Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */
+ void (GLAPIENTRYP Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */
+ void (GLAPIENTRYP MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */
+ void (GLAPIENTRYP MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */
+ void (GLAPIENTRYP MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */
+ void (GLAPIENTRYP MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */
+ void (GLAPIENTRYP EvalCoord1d)(GLdouble u); /* 228 */
+ void (GLAPIENTRYP EvalCoord1dv)(const GLdouble * u); /* 229 */
+ void (GLAPIENTRYP EvalCoord1f)(GLfloat u); /* 230 */
+ void (GLAPIENTRYP EvalCoord1fv)(const GLfloat * u); /* 231 */
+ void (GLAPIENTRYP EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */
+ void (GLAPIENTRYP EvalCoord2dv)(const GLdouble * u); /* 233 */
+ void (GLAPIENTRYP EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */
+ void (GLAPIENTRYP EvalCoord2fv)(const GLfloat * u); /* 235 */
+ void (GLAPIENTRYP EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */
+ void (GLAPIENTRYP EvalPoint1)(GLint i); /* 237 */
+ void (GLAPIENTRYP EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */
+ void (GLAPIENTRYP EvalPoint2)(GLint i, GLint j); /* 239 */
+ void (GLAPIENTRYP AlphaFunc)(GLenum func, GLclampf ref); /* 240 */
+ void (GLAPIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */
+ void (GLAPIENTRYP LogicOp)(GLenum opcode); /* 242 */
+ void (GLAPIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */
+ void (GLAPIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */
+ void (GLAPIENTRYP DepthFunc)(GLenum func); /* 245 */
+ void (GLAPIENTRYP PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */
+ void (GLAPIENTRYP PixelTransferf)(GLenum pname, GLfloat param); /* 247 */
+ void (GLAPIENTRYP PixelTransferi)(GLenum pname, GLint param); /* 248 */
+ void (GLAPIENTRYP PixelStoref)(GLenum pname, GLfloat param); /* 249 */
+ void (GLAPIENTRYP PixelStorei)(GLenum pname, GLint param); /* 250 */
+ void (GLAPIENTRYP PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */
+ void (GLAPIENTRYP PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */
+ void (GLAPIENTRYP PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */
+ void (GLAPIENTRYP ReadBuffer)(GLenum mode); /* 254 */
+ void (GLAPIENTRYP CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */
+ void (GLAPIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */
+ void (GLAPIENTRYP DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */
+ void (GLAPIENTRYP GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */
+ void (GLAPIENTRYP GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */
+ void (GLAPIENTRYP GetDoublev)(GLenum pname, GLdouble * params); /* 260 */
+ GLenum (GLAPIENTRYP GetError)(void); /* 261 */
+ void (GLAPIENTRYP GetFloatv)(GLenum pname, GLfloat * params); /* 262 */
+ void (GLAPIENTRYP GetIntegerv)(GLenum pname, GLint * params); /* 263 */
+ void (GLAPIENTRYP GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */
+ void (GLAPIENTRYP GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */
+ void (GLAPIENTRYP GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */
+ void (GLAPIENTRYP GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */
+ void (GLAPIENTRYP GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */
+ void (GLAPIENTRYP GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */
+ void (GLAPIENTRYP GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */
+ void (GLAPIENTRYP GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */
+ void (GLAPIENTRYP GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */
+ void (GLAPIENTRYP GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */
+ void (GLAPIENTRYP GetPolygonStipple)(GLubyte * mask); /* 274 */
+ const GLubyte * (GLAPIENTRYP GetString)(GLenum name); /* 275 */
+ void (GLAPIENTRYP GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */
+ void (GLAPIENTRYP GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */
+ void (GLAPIENTRYP GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */
+ void (GLAPIENTRYP GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */
+ void (GLAPIENTRYP GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */
+ void (GLAPIENTRYP GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */
+ void (GLAPIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */
+ void (GLAPIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */
+ void (GLAPIENTRYP GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */
+ void (GLAPIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */
+ GLboolean (GLAPIENTRYP IsEnabled)(GLenum cap); /* 286 */
+ GLboolean (GLAPIENTRYP IsList)(GLuint list); /* 287 */
+ void (GLAPIENTRYP DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */
+ void (GLAPIENTRYP Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */
+ void (GLAPIENTRYP LoadIdentity)(void); /* 290 */
+ void (GLAPIENTRYP LoadMatrixf)(const GLfloat * m); /* 291 */
+ void (GLAPIENTRYP LoadMatrixd)(const GLdouble * m); /* 292 */
+ void (GLAPIENTRYP MatrixMode)(GLenum mode); /* 293 */
+ void (GLAPIENTRYP MultMatrixf)(const GLfloat * m); /* 294 */
+ void (GLAPIENTRYP MultMatrixd)(const GLdouble * m); /* 295 */
+ void (GLAPIENTRYP Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */
+ void (GLAPIENTRYP PopMatrix)(void); /* 297 */
+ void (GLAPIENTRYP PushMatrix)(void); /* 298 */
+ void (GLAPIENTRYP Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */
+ void (GLAPIENTRYP Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */
+ void (GLAPIENTRYP Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */
+ void (GLAPIENTRYP Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */
+ void (GLAPIENTRYP Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */
+ void (GLAPIENTRYP Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */
+ void (GLAPIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */
+ void (GLAPIENTRYP ArrayElement)(GLint i); /* 306 */
+ void (GLAPIENTRYP BindTexture)(GLenum target, GLuint texture); /* 307 */
+ void (GLAPIENTRYP ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */
+ void (GLAPIENTRYP DisableClientState)(GLenum array); /* 309 */
+ void (GLAPIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */
+ void (GLAPIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */
+ void (GLAPIENTRYP EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */
+ void (GLAPIENTRYP EnableClientState)(GLenum array); /* 313 */
+ void (GLAPIENTRYP IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */
+ void (GLAPIENTRYP Indexub)(GLubyte c); /* 315 */
+ void (GLAPIENTRYP Indexubv)(const GLubyte * c); /* 316 */
+ void (GLAPIENTRYP InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */
+ void (GLAPIENTRYP NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */
+ void (GLAPIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */
+ void (GLAPIENTRYP TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */
+ void (GLAPIENTRYP VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */
+ GLboolean (GLAPIENTRYP AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */
+ void (GLAPIENTRYP CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */
+ void (GLAPIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */
+ void (GLAPIENTRYP CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */
+ void (GLAPIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */
+ void (GLAPIENTRYP DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */
+ void (GLAPIENTRYP GenTextures)(GLsizei n, GLuint * textures); /* 328 */
+ void (GLAPIENTRYP GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */
+ GLboolean (GLAPIENTRYP IsTexture)(GLuint texture); /* 330 */
+ void (GLAPIENTRYP PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */
+ void (GLAPIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */
+ void (GLAPIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */
+ void (GLAPIENTRYP PopClientAttrib)(void); /* 334 */
+ void (GLAPIENTRYP PushClientAttrib)(GLbitfield mask); /* 335 */
+ void (GLAPIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */
+ void (GLAPIENTRYP BlendEquation)(GLenum mode); /* 337 */
+ void (GLAPIENTRYP DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */
+ void (GLAPIENTRYP ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */
+ void (GLAPIENTRYP ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */
+ void (GLAPIENTRYP ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */
+ void (GLAPIENTRYP CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */
+ void (GLAPIENTRYP GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */
+ void (GLAPIENTRYP GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */
+ void (GLAPIENTRYP GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */
+ void (GLAPIENTRYP ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */
+ void (GLAPIENTRYP CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */
+ void (GLAPIENTRYP ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */
+ void (GLAPIENTRYP ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */
+ void (GLAPIENTRYP ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */
+ void (GLAPIENTRYP ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */
+ void (GLAPIENTRYP ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */
+ void (GLAPIENTRYP ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */
+ void (GLAPIENTRYP CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */
+ void (GLAPIENTRYP CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */
+ void (GLAPIENTRYP GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */
+ void (GLAPIENTRYP GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */
+ void (GLAPIENTRYP GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */
+ void (GLAPIENTRYP GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */
+ void (GLAPIENTRYP SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */
+ void (GLAPIENTRYP GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */
+ void (GLAPIENTRYP GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */
+ void (GLAPIENTRYP GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */
+ void (GLAPIENTRYP GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */
+ void (GLAPIENTRYP GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */
+ void (GLAPIENTRYP GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */
+ void (GLAPIENTRYP Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */
+ void (GLAPIENTRYP Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */
+ void (GLAPIENTRYP ResetHistogram)(GLenum target); /* 369 */
+ void (GLAPIENTRYP ResetMinmax)(GLenum target); /* 370 */
+ void (GLAPIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */
+ void (GLAPIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */
+ void (GLAPIENTRYP CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */
+ void (GLAPIENTRYP ActiveTextureARB)(GLenum texture); /* 374 */
+ void (GLAPIENTRYP ClientActiveTextureARB)(GLenum texture); /* 375 */
+ void (GLAPIENTRYP MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */
+ void (GLAPIENTRYP MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */
+ void (GLAPIENTRYP MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */
+ void (GLAPIENTRYP MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */
+ void (GLAPIENTRYP MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */
+ void (GLAPIENTRYP MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */
+ void (GLAPIENTRYP MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */
+ void (GLAPIENTRYP MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */
+ void (GLAPIENTRYP MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */
+ void (GLAPIENTRYP MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */
+ void (GLAPIENTRYP MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */
+ void (GLAPIENTRYP MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */
+ void (GLAPIENTRYP MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */
+ void (GLAPIENTRYP MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */
+ void (GLAPIENTRYP MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */
+ void (GLAPIENTRYP MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */
+ void (GLAPIENTRYP MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */
+ void (GLAPIENTRYP MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */
+ void (GLAPIENTRYP MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */
+ void (GLAPIENTRYP MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */
+ void (GLAPIENTRYP MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */
+ void (GLAPIENTRYP MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */
+ void (GLAPIENTRYP MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */
+ void (GLAPIENTRYP MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */
+ void (GLAPIENTRYP MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */
+ void (GLAPIENTRYP MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */
+ void (GLAPIENTRYP MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */
+ void (GLAPIENTRYP MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */
+ void (GLAPIENTRYP MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */
+ void (GLAPIENTRYP MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */
+ void (GLAPIENTRYP MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */
+ void (GLAPIENTRYP MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */
+ void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 408 */
+ void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 409 */
+ void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 410 */
+ void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 411 */
+ void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 412 */
+ void (GLAPIENTRYP __unused413)(void); /* 413 */
+ void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 414 */
+ void (GLAPIENTRYP GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights); /* 415 */
+ void (GLAPIENTRYP TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights); /* 416 */
+ void (GLAPIENTRYP GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 417 */
+ void (GLAPIENTRYP GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 418 */
+ void (GLAPIENTRYP GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 419 */
+ void (GLAPIENTRYP GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 420 */
+ void (GLAPIENTRYP GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 421 */
+ void (GLAPIENTRYP GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 422 */
+ void (GLAPIENTRYP GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 423 */
+ void (GLAPIENTRYP GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 424 */
+ void (GLAPIENTRYP GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 425 */
+ void (GLAPIENTRYP GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 426 */
+ void (GLAPIENTRYP GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 427 */
+ void (GLAPIENTRYP GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params); /* 428 */
+ void (GLAPIENTRYP GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params); /* 429 */
+ void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 430 */
+ void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 431 */
+ void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 432 */
+ void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 433 */
+ void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */
+ void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */
+ void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */
+ void (GLAPIENTRYP TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */
+ void (GLAPIENTRYP TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels); /* 438 */
+ GLboolean (GLAPIENTRYP AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 439 */
+ void (GLAPIENTRYP GenTexturesEXT)(GLsizei n, GLuint * textures); /* 440 */
+ GLboolean (GLAPIENTRYP IsTextureEXT)(GLuint texture); /* 441 */
+ void (GLAPIENTRYP DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 442 */
+ void (GLAPIENTRYP GetDetailTexFuncSGIS)(GLenum target, GLfloat * points); /* 443 */
+ void (GLAPIENTRYP SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 444 */
+ void (GLAPIENTRYP GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points); /* 445 */
+ void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 446 */
+ void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 447 */
+ void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 448 */
+ void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 449 */
+ void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 450 */
+ void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 451 */
+ void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 452 */
+ void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 453 */
+ void (GLAPIENTRYP SpriteParameterfSGIX)(GLenum pname, GLfloat param); /* 454 */
+ void (GLAPIENTRYP SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params); /* 455 */
+ void (GLAPIENTRYP SpriteParameteriSGIX)(GLenum pname, GLint param); /* 456 */
+ void (GLAPIENTRYP SpriteParameterivSGIX)(GLenum pname, const GLint * params); /* 457 */
+ void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 458 */
+ void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 459 */
+ GLint (GLAPIENTRYP GetInstrumentsSGIX)(void); /* 460 */
+ void (GLAPIENTRYP InstrumentsBufferSGIX)(GLsizei size, GLint * buffer); /* 461 */
+ GLint (GLAPIENTRYP PollInstrumentsSGIX)(GLint * marker_p); /* 462 */
+ void (GLAPIENTRYP ReadInstrumentsSGIX)(GLint marker); /* 463 */
+ void (GLAPIENTRYP StartInstrumentsSGIX)(void); /* 464 */
+ void (GLAPIENTRYP StopInstrumentsSGIX)(GLint marker); /* 465 */
+ void (GLAPIENTRYP FrameZoomSGIX)(GLint factor); /* 466 */
+ void (GLAPIENTRYP TagSampleBufferSGIX)(void); /* 467 */
+ void (GLAPIENTRYP ReferencePlaneSGIX)(const GLdouble * equation); /* 468 */
+ void (GLAPIENTRYP FlushRasterSGIX)(void); /* 469 */
+ void (GLAPIENTRYP GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params); /* 470 */
+ void (GLAPIENTRYP GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params); /* 471 */
+ void (GLAPIENTRYP ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param); /* 472 */
+ void (GLAPIENTRYP ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params); /* 473 */
+ void (GLAPIENTRYP ListParameteriSGIX)(GLuint list, GLenum pname, GLint param); /* 474 */
+ void (GLAPIENTRYP ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params); /* 475 */
+ void (GLAPIENTRYP FragmentColorMaterialSGIX)(GLenum face, GLenum mode); /* 476 */
+ void (GLAPIENTRYP FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param); /* 477 */
+ void (GLAPIENTRYP FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params); /* 478 */
+ void (GLAPIENTRYP FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param); /* 479 */
+ void (GLAPIENTRYP FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params); /* 480 */
+ void (GLAPIENTRYP FragmentLightModelfSGIX)(GLenum pname, GLfloat param); /* 481 */
+ void (GLAPIENTRYP FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params); /* 482 */
+ void (GLAPIENTRYP FragmentLightModeliSGIX)(GLenum pname, GLint param); /* 483 */
+ void (GLAPIENTRYP FragmentLightModelivSGIX)(GLenum pname, const GLint * params); /* 484 */
+ void (GLAPIENTRYP FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param); /* 485 */
+ void (GLAPIENTRYP FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params); /* 486 */
+ void (GLAPIENTRYP FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param); /* 487 */
+ void (GLAPIENTRYP FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params); /* 488 */
+ void (GLAPIENTRYP GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params); /* 489 */
+ void (GLAPIENTRYP GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params); /* 490 */
+ void (GLAPIENTRYP GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params); /* 491 */
+ void (GLAPIENTRYP GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params); /* 492 */
+ void (GLAPIENTRYP LightEnviSGIX)(GLenum pname, GLint param); /* 493 */
+ void (GLAPIENTRYP VertexWeightfEXT)(GLfloat weight); /* 494 */
+ void (GLAPIENTRYP VertexWeightfvEXT)(const GLfloat * weight); /* 495 */
+ void (GLAPIENTRYP VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 496 */
+ void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 497 */
+ void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 498 */
+ void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 499 */
+ void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 500 */
+ void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 501 */
+ void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 502 */
+ void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 503 */
+ void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 504 */
+ void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 505 */
+ void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 506 */
+ void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 507 */
+ void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 508 */
+ void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 509 */
+ void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 510 */
+ void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 511 */
+ void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 512 */
+ void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 513 */
+ void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 514 */
+ void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 515 */
+ void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 516 */
+ void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 517 */
+ void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 518 */
+ void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 519 */
+ void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 520 */
+ void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 521 */
+ void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 522 */
+ void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 523 */
+ void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 524 */
+ void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 525 */
+ void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 526 */
+ void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 527 */
+ void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 528 */
+ void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 529 */
+ void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 530 */
+ void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 531 */
+ void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 532 */
+ void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 533 */
+ void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 534 */
+ void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 535 */
+ void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 536 */
+ void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 537 */
+ void (GLAPIENTRYP IndexMaterialEXT)(GLenum face, GLenum mode); /* 538 */
+ void (GLAPIENTRYP IndexFuncEXT)(GLenum func, GLclampf ref); /* 539 */
+ void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 540 */
+ void (GLAPIENTRYP UnlockArraysEXT)(void); /* 541 */
+ void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 542 */
+ void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 543 */
+ void (GLAPIENTRYP HintPGI)(GLenum target, GLint mode); /* 544 */
+ void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 545 */
+ void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 546 */
+ void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 547 */
+ void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 548 */
+ void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 549 */
+ void (GLAPIENTRYP GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */
+ void (GLAPIENTRYP GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */
+ void (GLAPIENTRYP GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */
+ void (GLAPIENTRYP TbufferMask3DFX)(GLuint mask); /* 553 */
+ void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */
+ void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */
+ void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */
+ void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */
+ void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */
+ void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */
+ void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 560 */
+ void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 561 */
+ void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 562 */
+ void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 563 */
+ void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 564 */
+ void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 565 */
+ void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 566 */
+ void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 567 */
+ void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 568 */
+ void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 569 */
+ void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 570 */
+ void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 571 */
+ void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 572 */
+ void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 573 */
+ void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 574 */
+ void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 575 */
+ void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 576 */
+ void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 577 */
+ GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 578 */
+ void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint id); /* 579 */
+ void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * ids); /* 580 */
+ void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 581 */
+ void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * ids); /* 582 */
+ void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 583 */
+ void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 584 */
+ void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 585 */
+ void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 586 */
+ void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 587 */
+ void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 588 */
+ void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 589 */
+ void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 590 */
+ void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 591 */
+ GLboolean (GLAPIENTRYP IsProgramNV)(GLuint id); /* 592 */
+ void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 593 */
+ void (GLAPIENTRYP ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 594 */
+ void (GLAPIENTRYP ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params); /* 595 */
+ void (GLAPIENTRYP ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 596 */
+ void (GLAPIENTRYP ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params); /* 597 */
+ void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 598 */
+ void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 599 */
+ void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 600 */
+ void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 601 */
+ void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */
+ void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 603 */
+ void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 604 */
+ void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 605 */
+ void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 606 */
+ void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 607 */
+ void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 608 */
+ void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 609 */
+ void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 610 */
+ void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 611 */
+ void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 612 */
+ void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 613 */
+ void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 614 */
+ void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 615 */
+ void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 616 */
+ void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 617 */
+ void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 618 */
+ void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 619 */
+ void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 620 */
+ void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 621 */
+ void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 622 */
+ void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 623 */
+ void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 624 */
+ void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 625 */
+ void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 626 */
+ void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 627 */
+ void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 628 */
+ void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 629 */
+ void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 630 */
+ void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 631 */
+ void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 632 */
+ void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 633 */
+ void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 634 */
+ void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 635 */
+ void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 636 */
+ void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 637 */
+ void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 638 */
+ void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 639 */
+ void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 640 */
+ void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */
+ void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint params); /* 642 */
+ void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */
+ void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */
+ void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */
+ void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 646 */
+ void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 647 */
+ void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 648 */
+ GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 649 */
+ GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 650 */
+ void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 651 */
+ void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 652 */
+ void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 653 */
+ void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 654 */
+ void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 655 */
+ void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 656 */
+ void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 657 */
+ void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 658 */
+ void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 659 */
+ void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 660 */
+ void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 661 */
+ void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 662 */
+ void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 663 */
+ void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 664 */
+ void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 665 */
+ void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 666 */
+ void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 667 */
+ void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 668 */
+ void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 669 */
+ void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 670 */
+ void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 671 */
+ void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 672 */
+ void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 673 */
+ void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 674 */
+ void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 675 */
+ void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 676 */
+ void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 677 */
+ void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 678 */
+ void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 679 */
+ void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 680 */
+ void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 681 */
+ void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 682 */
+ void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 683 */
+ void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 684 */
+ void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 685 */
+ void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 686 */
+ void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 687 */
+ void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 688 */
+ void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 689 */
+ void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 690 */
+ void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 691 */
+ void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 692 */
+ void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 693 */
+ void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 694 */
+ void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); /* 695 */
+ GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 696 */
+ GLvoid * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 697 */
+ GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 698 */
+ void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 699 */
+ void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 700 */
+ void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 701 */
+ GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 702 */
+ void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 703 */
+ void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 704 */
+ void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 705 */
+ void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 706 */
+ void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 707 */
+ void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 708 */
+ void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 709 */
+ void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 710 */
+};
+
+#endif
Index: xc/extras/Mesa/src/mesa/glapi/glapitemp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glapitemp.h:1.6
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glapitemp.h Fri Dec 10 12:47:24 2004
@@ -0,0 +1,5716 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/glapi/glapitemp.h,v 1.6 2004/12/10 17:47:24 alanh Exp $ */
+/* DO NOT EDIT - This file generated automatically by gl_apitemp.py (from Mesa) script */
+
+/*
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL, IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+
+/*
+ * This file is a template which generates the OpenGL API entry point
+ * functions. It should be included by a .c file which first defines
+ * the following macros:
+ * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32
+ * KEYWORD2 - usually nothing, but might be __stdcall on Win32
+ * NAME(n) - builds the final function name (usually add "gl" prefix)
+ * DISPATCH(func, args, msg) - code to do dispatch of named function.
+ * msg is a printf-style debug message.
+ * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value
+ *
+ * Here is an example which generates the usual OpenGL functions:
+ * #define KEYWORD1
+ * #define KEYWORD2
+ * #define NAME(func) gl##func
+ * #define DISPATCH(func, args, msg) \
+ * struct _glapi_table *dispatch = CurrentDispatch; \
+ * (*dispatch->func) args
+ * #define RETURN DISPATCH(func, args, msg) \
+ * struct _glapi_table *dispatch = CurrentDispatch; \
+ * return (*dispatch->func) args
+ *
+ */
+
+
+#if defined( NAME )
+#ifndef KEYWORD1
+#define KEYWORD1
+#endif
+
+#ifndef KEYWORD2
+#define KEYWORD2
+#endif
+
+#ifndef DISPATCH
+#error DISPATCH must be defined
+#endif
+
+#ifndef RETURN_DISPATCH
+#error RETURN_DISPATCH must be defined
+#endif
+
+GLAPI void GLAPIENTRY gl__unused413(void); /* silence warning */
+
+KEYWORD1 void KEYWORD2 NAME(NewList)(GLuint list, GLenum mode)
+{
+ DISPATCH(NewList, (list, mode), (F, "glNewList(%d, 0x%x);\n", list, mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EndList)(void)
+{
+ DISPATCH(EndList, (), (F, "glEndList();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list)
+{
+ DISPATCH(CallList, (list), (F, "glCallList(%d);\n", list));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid * lists)
+{
+ DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);\n", n, type, (const void *) lists));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteLists)(GLuint list, GLsizei range)
+{
+ DISPATCH(DeleteLists, (list, range), (F, "glDeleteLists(%d, %d);\n", list, range));
+}
+
+KEYWORD1 GLuint KEYWORD2 NAME(GenLists)(GLsizei range)
+{
+ RETURN_DISPATCH(GenLists, (range), (F, "glGenLists(%d);\n", range));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ListBase)(GLuint base)
+{
+ DISPATCH(ListBase, (base), (F, "glListBase(%d);\n", base));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Begin)(GLenum mode)
+{
+ DISPATCH(Begin, (mode), (F, "glBegin(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap)
+{
+ DISPATCH(Bitmap, (width, height, xorig, yorig, xmove, ymove, bitmap), (F, "glBitmap(%d, %d, %f, %f, %f, %f, %p);\n", width, height, xorig, yorig, xmove, ymove, (const void *) bitmap));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue)
+{
+ DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte * v)
+{
+ DISPATCH(Color3bv, (v), (F, "glColor3bv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue)
+{
+ DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%f, %f, %f);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble * v)
+{
+ DISPATCH(Color3dv, (v), (F, "glColor3dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue)
+{
+ DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%f, %f, %f);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat * v)
+{
+ DISPATCH(Color3fv, (v), (F, "glColor3fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue)
+{
+ DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint * v)
+{
+ DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue)
+{
+ DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort * v)
+{
+ DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue)
+{
+ DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte * v)
+{
+ DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue)
+{
+ DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint * v)
+{
+ DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue)
+{
+ DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort * v)
+{
+ DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
+{
+ DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte * v)
+{
+ DISPATCH(Color4bv, (v), (F, "glColor4bv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
+{
+ DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%f, %f, %f, %f);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble * v)
+{
+ DISPATCH(Color4dv, (v), (F, "glColor4dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4f(%f, %f, %f, %f);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat * v)
+{
+ DISPATCH(Color4fv, (v), (F, "glColor4fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4i)(GLint red, GLint green, GLint blue, GLint alpha)
+{
+ DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d, %d);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint * v)
+{
+ DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha)
+{
+ DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort * v)
+{
+ DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%d, %d, %d, %d);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte * v)
+{
+ DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha)
+{
+ DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%d, %d, %d, %d);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint * v)
+{
+ DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha)
+{
+ DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%d, %d, %d, %d);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort * v)
+{
+ DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag)
+{
+ DISPATCH(EdgeFlag, (flag), (F, "glEdgeFlag(%d);\n", flag));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean * flag)
+{
+ DISPATCH(EdgeFlagv, (flag), (F, "glEdgeFlagv(%p);\n", (const void *) flag));
+}
+
+KEYWORD1 void KEYWORD2 NAME(End)(void)
+{
+ DISPATCH(End, (), (F, "glEnd();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c)
+{
+ DISPATCH(Indexd, (c), (F, "glIndexd(%f);\n", c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble * c)
+{
+ DISPATCH(Indexdv, (c), (F, "glIndexdv(%p);\n", (const void *) c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c)
+{
+ DISPATCH(Indexf, (c), (F, "glIndexf(%f);\n", c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat * c)
+{
+ DISPATCH(Indexfv, (c), (F, "glIndexfv(%p);\n", (const void *) c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c)
+{
+ DISPATCH(Indexi, (c), (F, "glIndexi(%d);\n", c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint * c)
+{
+ DISPATCH(Indexiv, (c), (F, "glIndexiv(%p);\n", (const void *) c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c)
+{
+ DISPATCH(Indexs, (c), (F, "glIndexs(%d);\n", c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort * c)
+{
+ DISPATCH(Indexsv, (c), (F, "glIndexsv(%p);\n", (const void *) c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz)
+{
+ DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);\n", nx, ny, nz));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte * v)
+{
+ DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz)
+{
+ DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);\n", nx, ny, nz));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble * v)
+{
+ DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%f, %f, %f);\n", nx, ny, nz));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat * v)
+{
+ DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz)
+{
+ DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);\n", nx, ny, nz));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint * v)
+{
+ DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz)
+{
+ DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);\n", nx, ny, nz));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort * v)
+{
+ DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2d)(GLdouble x, GLdouble y)
+{
+ DISPATCH(RasterPos2d, (x, y), (F, "glRasterPos2d(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2dv)(const GLdouble * v)
+{
+ DISPATCH(RasterPos2dv, (v), (F, "glRasterPos2dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2f)(GLfloat x, GLfloat y)
+{
+ DISPATCH(RasterPos2f, (x, y), (F, "glRasterPos2f(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2fv)(const GLfloat * v)
+{
+ DISPATCH(RasterPos2fv, (v), (F, "glRasterPos2fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2i)(GLint x, GLint y)
+{
+ DISPATCH(RasterPos2i, (x, y), (F, "glRasterPos2i(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2iv)(const GLint * v)
+{
+ DISPATCH(RasterPos2iv, (v), (F, "glRasterPos2iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2s)(GLshort x, GLshort y)
+{
+ DISPATCH(RasterPos2s, (x, y), (F, "glRasterPos2s(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos2sv)(const GLshort * v)
+{
+ DISPATCH(RasterPos2sv, (v), (F, "glRasterPos2sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(RasterPos3d, (x, y, z), (F, "glRasterPos3d(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3dv)(const GLdouble * v)
+{
+ DISPATCH(RasterPos3dv, (v), (F, "glRasterPos3dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(RasterPos3f, (x, y, z), (F, "glRasterPos3f(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3fv)(const GLfloat * v)
+{
+ DISPATCH(RasterPos3fv, (v), (F, "glRasterPos3fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3i)(GLint x, GLint y, GLint z)
+{
+ DISPATCH(RasterPos3i, (x, y, z), (F, "glRasterPos3i(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3iv)(const GLint * v)
+{
+ DISPATCH(RasterPos3iv, (v), (F, "glRasterPos3iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3s)(GLshort x, GLshort y, GLshort z)
+{
+ DISPATCH(RasterPos3s, (x, y, z), (F, "glRasterPos3s(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos3sv)(const GLshort * v)
+{
+ DISPATCH(RasterPos3sv, (v), (F, "glRasterPos3sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(RasterPos4d, (x, y, z, w), (F, "glRasterPos4d(%f, %f, %f, %f);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4dv)(const GLdouble * v)
+{
+ DISPATCH(RasterPos4dv, (v), (F, "glRasterPos4dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(RasterPos4f, (x, y, z, w), (F, "glRasterPos4f(%f, %f, %f, %f);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4fv)(const GLfloat * v)
+{
+ DISPATCH(RasterPos4fv, (v), (F, "glRasterPos4fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4i)(GLint x, GLint y, GLint z, GLint w)
+{
+ DISPATCH(RasterPos4i, (x, y, z, w), (F, "glRasterPos4i(%d, %d, %d, %d);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4iv)(const GLint * v)
+{
+ DISPATCH(RasterPos4iv, (v), (F, "glRasterPos4iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ DISPATCH(RasterPos4s, (x, y, z, w), (F, "glRasterPos4s(%d, %d, %d, %d);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RasterPos4sv)(const GLshort * v)
+{
+ DISPATCH(RasterPos4sv, (v), (F, "glRasterPos4sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
+{
+ DISPATCH(Rectd, (x1, y1, x2, y2), (F, "glRectd(%f, %f, %f, %f);\n", x1, y1, x2, y2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rectdv)(const GLdouble * v1, const GLdouble * v2)
+{
+ DISPATCH(Rectdv, (v1, v2), (F, "glRectdv(%p, %p);\n", (const void *) v1, (const void *) v2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
+{
+ DISPATCH(Rectf, (x1, y1, x2, y2), (F, "glRectf(%f, %f, %f, %f);\n", x1, y1, x2, y2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rectfv)(const GLfloat * v1, const GLfloat * v2)
+{
+ DISPATCH(Rectfv, (v1, v2), (F, "glRectfv(%p, %p);\n", (const void *) v1, (const void *) v2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Recti)(GLint x1, GLint y1, GLint x2, GLint y2)
+{
+ DISPATCH(Recti, (x1, y1, x2, y2), (F, "glRecti(%d, %d, %d, %d);\n", x1, y1, x2, y2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rectiv)(const GLint * v1, const GLint * v2)
+{
+ DISPATCH(Rectiv, (v1, v2), (F, "glRectiv(%p, %p);\n", (const void *) v1, (const void *) v2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
+{
+ DISPATCH(Rects, (x1, y1, x2, y2), (F, "glRects(%d, %d, %d, %d);\n", x1, y1, x2, y2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rectsv)(const GLshort * v1, const GLshort * v2)
+{
+ DISPATCH(Rectsv, (v1, v2), (F, "glRectsv(%p, %p);\n", (const void *) v1, (const void *) v2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s)
+{
+ DISPATCH(TexCoord1d, (s), (F, "glTexCoord1d(%f);\n", s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble * v)
+{
+ DISPATCH(TexCoord1dv, (v), (F, "glTexCoord1dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s)
+{
+ DISPATCH(TexCoord1f, (s), (F, "glTexCoord1f(%f);\n", s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat * v)
+{
+ DISPATCH(TexCoord1fv, (v), (F, "glTexCoord1fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s)
+{
+ DISPATCH(TexCoord1i, (s), (F, "glTexCoord1i(%d);\n", s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint * v)
+{
+ DISPATCH(TexCoord1iv, (v), (F, "glTexCoord1iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s)
+{
+ DISPATCH(TexCoord1s, (s), (F, "glTexCoord1s(%d);\n", s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort * v)
+{
+ DISPATCH(TexCoord1sv, (v), (F, "glTexCoord1sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t)
+{
+ DISPATCH(TexCoord2d, (s, t), (F, "glTexCoord2d(%f, %f);\n", s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble * v)
+{
+ DISPATCH(TexCoord2dv, (v), (F, "glTexCoord2dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t)
+{
+ DISPATCH(TexCoord2f, (s, t), (F, "glTexCoord2f(%f, %f);\n", s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat * v)
+{
+ DISPATCH(TexCoord2fv, (v), (F, "glTexCoord2fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t)
+{
+ DISPATCH(TexCoord2i, (s, t), (F, "glTexCoord2i(%d, %d);\n", s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint * v)
+{
+ DISPATCH(TexCoord2iv, (v), (F, "glTexCoord2iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t)
+{
+ DISPATCH(TexCoord2s, (s, t), (F, "glTexCoord2s(%d, %d);\n", s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort * v)
+{
+ DISPATCH(TexCoord2sv, (v), (F, "glTexCoord2sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r)
+{
+ DISPATCH(TexCoord3d, (s, t, r), (F, "glTexCoord3d(%f, %f, %f);\n", s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble * v)
+{
+ DISPATCH(TexCoord3dv, (v), (F, "glTexCoord3dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r)
+{
+ DISPATCH(TexCoord3f, (s, t, r), (F, "glTexCoord3f(%f, %f, %f);\n", s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat * v)
+{
+ DISPATCH(TexCoord3fv, (v), (F, "glTexCoord3fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r)
+{
+ DISPATCH(TexCoord3i, (s, t, r), (F, "glTexCoord3i(%d, %d, %d);\n", s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint * v)
+{
+ DISPATCH(TexCoord3iv, (v), (F, "glTexCoord3iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r)
+{
+ DISPATCH(TexCoord3s, (s, t, r), (F, "glTexCoord3s(%d, %d, %d);\n", s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort * v)
+{
+ DISPATCH(TexCoord3sv, (v), (F, "glTexCoord3sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+ DISPATCH(TexCoord4d, (s, t, r, q), (F, "glTexCoord4d(%f, %f, %f, %f);\n", s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble * v)
+{
+ DISPATCH(TexCoord4dv, (v), (F, "glTexCoord4dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ DISPATCH(TexCoord4f, (s, t, r, q), (F, "glTexCoord4f(%f, %f, %f, %f);\n", s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat * v)
+{
+ DISPATCH(TexCoord4fv, (v), (F, "glTexCoord4fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q)
+{
+ DISPATCH(TexCoord4i, (s, t, r, q), (F, "glTexCoord4i(%d, %d, %d, %d);\n", s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint * v)
+{
+ DISPATCH(TexCoord4iv, (v), (F, "glTexCoord4iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q)
+{
+ DISPATCH(TexCoord4s, (s, t, r, q), (F, "glTexCoord4s(%d, %d, %d, %d);\n", s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort * v)
+{
+ DISPATCH(TexCoord4sv, (v), (F, "glTexCoord4sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y)
+{
+ DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble * v)
+{
+ DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y)
+{
+ DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat * v)
+{
+ DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y)
+{
+ DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint * v)
+{
+ DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y)
+{
+ DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort * v)
+{
+ DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble * v)
+{
+ DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat * v)
+{
+ DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z)
+{
+ DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint * v)
+{
+ DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z)
+{
+ DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort * v)
+{
+ DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble * v)
+{
+ DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat * v)
+{
+ DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w)
+{
+ DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint * v)
+{
+ DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort * v)
+{
+ DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClipPlane)(GLenum plane, const GLdouble * equation)
+{
+ DISPATCH(ClipPlane, (plane, equation), (F, "glClipPlane(0x%x, %p);\n", plane, (const void *) equation));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorMaterial)(GLenum face, GLenum mode)
+{
+ DISPATCH(ColorMaterial, (face, mode), (F, "glColorMaterial(0x%x, 0x%x);\n", face, mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CullFace)(GLenum mode)
+{
+ DISPATCH(CullFace, (mode), (F, "glCullFace(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Fogf)(GLenum pname, GLfloat param)
+{
+ DISPATCH(Fogf, (pname, param), (F, "glFogf(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Fogfv)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(Fogfv, (pname, params), (F, "glFogfv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Fogi)(GLenum pname, GLint param)
+{
+ DISPATCH(Fogi, (pname, param), (F, "glFogi(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Fogiv)(GLenum pname, const GLint * params)
+{
+ DISPATCH(Fogiv, (pname, params), (F, "glFogiv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FrontFace)(GLenum mode)
+{
+ DISPATCH(FrontFace, (mode), (F, "glFrontFace(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Hint)(GLenum target, GLenum mode)
+{
+ DISPATCH(Hint, (target, mode), (F, "glHint(0x%x, 0x%x);\n", target, mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Lightf)(GLenum light, GLenum pname, GLfloat param)
+{
+ DISPATCH(Lightf, (light, pname, param), (F, "glLightf(0x%x, 0x%x, %f);\n", light, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Lightfv)(GLenum light, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(Lightfv, (light, pname, params), (F, "glLightfv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Lighti)(GLenum light, GLenum pname, GLint param)
+{
+ DISPATCH(Lighti, (light, pname, param), (F, "glLighti(0x%x, 0x%x, %d);\n", light, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Lightiv)(GLenum light, GLenum pname, const GLint * params)
+{
+ DISPATCH(Lightiv, (light, pname, params), (F, "glLightiv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LightModelf)(GLenum pname, GLfloat param)
+{
+ DISPATCH(LightModelf, (pname, param), (F, "glLightModelf(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LightModelfv)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(LightModelfv, (pname, params), (F, "glLightModelfv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LightModeli)(GLenum pname, GLint param)
+{
+ DISPATCH(LightModeli, (pname, param), (F, "glLightModeli(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LightModeliv)(GLenum pname, const GLint * params)
+{
+ DISPATCH(LightModeliv, (pname, params), (F, "glLightModeliv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LineStipple)(GLint factor, GLushort pattern)
+{
+ DISPATCH(LineStipple, (factor, pattern), (F, "glLineStipple(%d, %d);\n", factor, pattern));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LineWidth)(GLfloat width)
+{
+ DISPATCH(LineWidth, (width), (F, "glLineWidth(%f);\n", width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param)
+{
+ DISPATCH(Materialf, (face, pname, param), (F, "glMaterialf(0x%x, 0x%x, %f);\n", face, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(Materialfv, (face, pname, params), (F, "glMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param)
+{
+ DISPATCH(Materiali, (face, pname, param), (F, "glMateriali(0x%x, 0x%x, %d);\n", face, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint * params)
+{
+ DISPATCH(Materialiv, (face, pname, params), (F, "glMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointSize)(GLfloat size)
+{
+ DISPATCH(PointSize, (size), (F, "glPointSize(%f);\n", size));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PolygonMode)(GLenum face, GLenum mode)
+{
+ DISPATCH(PolygonMode, (face, mode), (F, "glPolygonMode(0x%x, 0x%x);\n", face, mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PolygonStipple)(const GLubyte * mask)
+{
+ DISPATCH(PolygonStipple, (mask), (F, "glPolygonStipple(%p);\n", (const void *) mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(Scissor, (x, y, width, height), (F, "glScissor(%d, %d, %d, %d);\n", x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ShadeModel)(GLenum mode)
+{
+ DISPATCH(ShadeModel, (mode), (F, "glShadeModel(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param)
+{
+ DISPATCH(TexParameterf, (target, pname, param), (F, "glTexParameterf(0x%x, 0x%x, %f);\n", target, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(TexParameterfv, (target, pname, params), (F, "glTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param)
+{
+ DISPATCH(TexParameteri, (target, pname, param), (F, "glTexParameteri(0x%x, 0x%x, %d);\n", target, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint * params)
+{
+ DISPATCH(TexParameteriv, (target, pname, params), (F, "glTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, "glTexImage1D(0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, border, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, "glTexImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, border, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param)
+{
+ DISPATCH(TexEnvf, (target, pname, param), (F, "glTexEnvf(0x%x, 0x%x, %f);\n", target, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(TexEnvfv, (target, pname, params), (F, "glTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param)
+{
+ DISPATCH(TexEnvi, (target, pname, param), (F, "glTexEnvi(0x%x, 0x%x, %d);\n", target, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint * params)
+{
+ DISPATCH(TexEnviv, (target, pname, params), (F, "glTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param)
+{
+ DISPATCH(TexGend, (coord, pname, param), (F, "glTexGend(0x%x, 0x%x, %f);\n", coord, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble * params)
+{
+ DISPATCH(TexGendv, (coord, pname, params), (F, "glTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param)
+{
+ DISPATCH(TexGenf, (coord, pname, param), (F, "glTexGenf(0x%x, 0x%x, %f);\n", coord, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(TexGenfv, (coord, pname, params), (F, "glTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param)
+{
+ DISPATCH(TexGeni, (coord, pname, param), (F, "glTexGeni(0x%x, 0x%x, %d);\n", coord, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint * params)
+{
+ DISPATCH(TexGeniv, (coord, pname, params), (F, "glTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer)
+{
+ DISPATCH(FeedbackBuffer, (size, type, buffer), (F, "glFeedbackBuffer(%d, 0x%x, %p);\n", size, type, (const void *) buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SelectBuffer)(GLsizei size, GLuint * buffer)
+{
+ DISPATCH(SelectBuffer, (size, buffer), (F, "glSelectBuffer(%d, %p);\n", size, (const void *) buffer));
+}
+
+KEYWORD1 GLint KEYWORD2 NAME(RenderMode)(GLenum mode)
+{
+ RETURN_DISPATCH(RenderMode, (mode), (F, "glRenderMode(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(InitNames)(void)
+{
+ DISPATCH(InitNames, (), (F, "glInitNames();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadName)(GLuint name)
+{
+ DISPATCH(LoadName, (name), (F, "glLoadName(%d);\n", name));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PassThrough)(GLfloat token)
+{
+ DISPATCH(PassThrough, (token), (F, "glPassThrough(%f);\n", token));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PopName)(void)
+{
+ DISPATCH(PopName, (), (F, "glPopName();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PushName)(GLuint name)
+{
+ DISPATCH(PushName, (name), (F, "glPushName(%d);\n", name));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DrawBuffer)(GLenum mode)
+{
+ DISPATCH(DrawBuffer, (mode), (F, "glDrawBuffer(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Clear)(GLbitfield mask)
+{
+ DISPATCH(Clear, (mask), (F, "glClear(%d);\n", mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ DISPATCH(ClearAccum, (red, green, blue, alpha), (F, "glClearAccum(%f, %f, %f, %f);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClearIndex)(GLfloat c)
+{
+ DISPATCH(ClearIndex, (c), (F, "glClearIndex(%f);\n", c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ DISPATCH(ClearColor, (red, green, blue, alpha), (F, "glClearColor(%f, %f, %f, %f);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClearStencil)(GLint s)
+{
+ DISPATCH(ClearStencil, (s), (F, "glClearStencil(%d);\n", s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClearDepth)(GLclampd depth)
+{
+ DISPATCH(ClearDepth, (depth), (F, "glClearDepth(%f);\n", depth));
+}
+
+KEYWORD1 void KEYWORD2 NAME(StencilMask)(GLuint mask)
+{
+ DISPATCH(StencilMask, (mask), (F, "glStencilMask(%d);\n", mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ DISPATCH(ColorMask, (red, green, blue, alpha), (F, "glColorMask(%d, %d, %d, %d);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DepthMask)(GLboolean flag)
+{
+ DISPATCH(DepthMask, (flag), (F, "glDepthMask(%d);\n", flag));
+}
+
+KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask)
+{
+ DISPATCH(IndexMask, (mask), (F, "glIndexMask(%d);\n", mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Accum)(GLenum op, GLfloat value)
+{
+ DISPATCH(Accum, (op, value), (F, "glAccum(0x%x, %f);\n", op, value));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Disable)(GLenum cap)
+{
+ DISPATCH(Disable, (cap), (F, "glDisable(0x%x);\n", cap));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Enable)(GLenum cap)
+{
+ DISPATCH(Enable, (cap), (F, "glEnable(0x%x);\n", cap));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Finish)(void)
+{
+ DISPATCH(Finish, (), (F, "glFinish();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Flush)(void)
+{
+ DISPATCH(Flush, (), (F, "glFlush();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PopAttrib)(void)
+{
+ DISPATCH(PopAttrib, (), (F, "glPopAttrib();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PushAttrib)(GLbitfield mask)
+{
+ DISPATCH(PushAttrib, (mask), (F, "glPushAttrib(%d);\n", mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points)
+{
+ DISPATCH(Map1d, (target, u1, u2, stride, order, points), (F, "glMap1d(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points)
+{
+ DISPATCH(Map1f, (target, u1, u2, stride, order, points), (F, "glMap1f(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points)
+{
+ DISPATCH(Map2d, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2d(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points)
+{
+ DISPATCH(Map2f, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2f(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2)
+{
+ DISPATCH(MapGrid1d, (un, u1, u2), (F, "glMapGrid1d(%d, %f, %f);\n", un, u1, u2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2)
+{
+ DISPATCH(MapGrid1f, (un, u1, u2), (F, "glMapGrid1f(%d, %f, %f);\n", un, u1, u2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
+{
+ DISPATCH(MapGrid2d, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2d(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
+{
+ DISPATCH(MapGrid2f, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2f(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u)
+{
+ DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%f);\n", u));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble * u)
+{
+ DISPATCH(EvalCoord1dv, (u), (F, "glEvalCoord1dv(%p);\n", (const void *) u));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u)
+{
+ DISPATCH(EvalCoord1f, (u), (F, "glEvalCoord1f(%f);\n", u));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat * u)
+{
+ DISPATCH(EvalCoord1fv, (u), (F, "glEvalCoord1fv(%p);\n", (const void *) u));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v)
+{
+ DISPATCH(EvalCoord2d, (u, v), (F, "glEvalCoord2d(%f, %f);\n", u, v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble * u)
+{
+ DISPATCH(EvalCoord2dv, (u), (F, "glEvalCoord2dv(%p);\n", (const void *) u));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v)
+{
+ DISPATCH(EvalCoord2f, (u, v), (F, "glEvalCoord2f(%f, %f);\n", u, v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat * u)
+{
+ DISPATCH(EvalCoord2fv, (u), (F, "glEvalCoord2fv(%p);\n", (const void *) u));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalMesh1)(GLenum mode, GLint i1, GLint i2)
+{
+ DISPATCH(EvalMesh1, (mode, i1, i2), (F, "glEvalMesh1(0x%x, %d, %d);\n", mode, i1, i2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i)
+{
+ DISPATCH(EvalPoint1, (i), (F, "glEvalPoint1(%d);\n", i));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
+{
+ DISPATCH(EvalMesh2, (mode, i1, i2, j1, j2), (F, "glEvalMesh2(0x%x, %d, %d, %d, %d);\n", mode, i1, i2, j1, j2));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j)
+{
+ DISPATCH(EvalPoint2, (i, j), (F, "glEvalPoint2(%d, %d);\n", i, j));
+}
+
+KEYWORD1 void KEYWORD2 NAME(AlphaFunc)(GLenum func, GLclampf ref)
+{
+ DISPATCH(AlphaFunc, (func, ref), (F, "glAlphaFunc(0x%x, %f);\n", func, ref));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendFunc)(GLenum sfactor, GLenum dfactor)
+{
+ DISPATCH(BlendFunc, (sfactor, dfactor), (F, "glBlendFunc(0x%x, 0x%x);\n", sfactor, dfactor));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LogicOp)(GLenum opcode)
+{
+ DISPATCH(LogicOp, (opcode), (F, "glLogicOp(0x%x);\n", opcode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(StencilFunc)(GLenum func, GLint ref, GLuint mask)
+{
+ DISPATCH(StencilFunc, (func, ref, mask), (F, "glStencilFunc(0x%x, %d, %d);\n", func, ref, mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ DISPATCH(StencilOp, (fail, zfail, zpass), (F, "glStencilOp(0x%x, 0x%x, 0x%x);\n", fail, zfail, zpass));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DepthFunc)(GLenum func)
+{
+ DISPATCH(DepthFunc, (func), (F, "glDepthFunc(0x%x);\n", func));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelZoom)(GLfloat xfactor, GLfloat yfactor)
+{
+ DISPATCH(PixelZoom, (xfactor, yfactor), (F, "glPixelZoom(%f, %f);\n", xfactor, yfactor));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelTransferf)(GLenum pname, GLfloat param)
+{
+ DISPATCH(PixelTransferf, (pname, param), (F, "glPixelTransferf(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelTransferi)(GLenum pname, GLint param)
+{
+ DISPATCH(PixelTransferi, (pname, param), (F, "glPixelTransferi(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelStoref)(GLenum pname, GLfloat param)
+{
+ DISPATCH(PixelStoref, (pname, param), (F, "glPixelStoref(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelStorei)(GLenum pname, GLint param)
+{
+ DISPATCH(PixelStorei, (pname, param), (F, "glPixelStorei(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values)
+{
+ DISPATCH(PixelMapfv, (map, mapsize, values), (F, "glPixelMapfv(0x%x, %d, %p);\n", map, mapsize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values)
+{
+ DISPATCH(PixelMapuiv, (map, mapsize, values), (F, "glPixelMapuiv(0x%x, %d, %p);\n", map, mapsize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values)
+{
+ DISPATCH(PixelMapusv, (map, mapsize, values), (F, "glPixelMapusv(0x%x, %d, %p);\n", map, mapsize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ReadBuffer)(GLenum mode)
+{
+ DISPATCH(ReadBuffer, (mode), (F, "glReadBuffer(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
+{
+ DISPATCH(CopyPixels, (x, y, width, height, type), (F, "glCopyPixels(%d, %d, %d, %d, 0x%x);\n", x, y, width, height, type));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels)
+{
+ DISPATCH(ReadPixels, (x, y, width, height, format, type, pixels), (F, "glReadPixels(%d, %d, %d, %d, 0x%x, 0x%x, %p);\n", x, y, width, height, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(DrawPixels, (width, height, format, type, pixels), (F, "glDrawPixels(%d, %d, 0x%x, 0x%x, %p);\n", width, height, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetBooleanv)(GLenum pname, GLboolean * params)
+{
+ DISPATCH(GetBooleanv, (pname, params), (F, "glGetBooleanv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetClipPlane)(GLenum plane, GLdouble * equation)
+{
+ DISPATCH(GetClipPlane, (plane, equation), (F, "glGetClipPlane(0x%x, %p);\n", plane, (const void *) equation));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetDoublev)(GLenum pname, GLdouble * params)
+{
+ DISPATCH(GetDoublev, (pname, params), (F, "glGetDoublev(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 GLenum KEYWORD2 NAME(GetError)(void)
+{
+ RETURN_DISPATCH(GetError, (), (F, "glGetError();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFloatv)(GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetFloatv, (pname, params), (F, "glGetFloatv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetIntegerv)(GLenum pname, GLint * params)
+{
+ DISPATCH(GetIntegerv, (pname, params), (F, "glGetIntegerv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetLightfv)(GLenum light, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetLightfv, (light, pname, params), (F, "glGetLightfv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetLightiv)(GLenum light, GLenum pname, GLint * params)
+{
+ DISPATCH(GetLightiv, (light, pname, params), (F, "glGetLightiv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMapdv)(GLenum target, GLenum query, GLdouble * v)
+{
+ DISPATCH(GetMapdv, (target, query, v), (F, "glGetMapdv(0x%x, 0x%x, %p);\n", target, query, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMapfv)(GLenum target, GLenum query, GLfloat * v)
+{
+ DISPATCH(GetMapfv, (target, query, v), (F, "glGetMapfv(0x%x, 0x%x, %p);\n", target, query, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMapiv)(GLenum target, GLenum query, GLint * v)
+{
+ DISPATCH(GetMapiv, (target, query, v), (F, "glGetMapiv(0x%x, 0x%x, %p);\n", target, query, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetMaterialfv, (face, pname, params), (F, "glGetMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMaterialiv)(GLenum face, GLenum pname, GLint * params)
+{
+ DISPATCH(GetMaterialiv, (face, pname, params), (F, "glGetMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPixelMapfv)(GLenum map, GLfloat * values)
+{
+ DISPATCH(GetPixelMapfv, (map, values), (F, "glGetPixelMapfv(0x%x, %p);\n", map, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPixelMapuiv)(GLenum map, GLuint * values)
+{
+ DISPATCH(GetPixelMapuiv, (map, values), (F, "glGetPixelMapuiv(0x%x, %p);\n", map, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPixelMapusv)(GLenum map, GLushort * values)
+{
+ DISPATCH(GetPixelMapusv, (map, values), (F, "glGetPixelMapusv(0x%x, %p);\n", map, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPolygonStipple)(GLubyte * mask)
+{
+ DISPATCH(GetPolygonStipple, (mask), (F, "glGetPolygonStipple(%p);\n", (const void *) mask));
+}
+
+KEYWORD1 const GLubyte * KEYWORD2 NAME(GetString)(GLenum name)
+{
+ RETURN_DISPATCH(GetString, (name), (F, "glGetString(0x%x);\n", name));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetTexEnvfv, (target, pname, params), (F, "glGetTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexEnviv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetTexEnviv, (target, pname, params), (F, "glGetTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params)
+{
+ DISPATCH(GetTexGendv, (coord, pname, params), (F, "glGetTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetTexGenfv, (coord, pname, params), (F, "glGetTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexGeniv)(GLenum coord, GLenum pname, GLint * params)
+{
+ DISPATCH(GetTexGeniv, (coord, pname, params), (F, "glGetTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels)
+{
+ DISPATCH(GetTexImage, (target, level, format, type, pixels), (F, "glGetTexImage(0x%x, %d, 0x%x, 0x%x, %p);\n", target, level, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetTexParameterfv, (target, pname, params), (F, "glGetTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexParameteriv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetTexParameteriv, (target, pname, params), (F, "glGetTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetTexLevelParameterfv, (target, level, pname, params), (F, "glGetTexLevelParameterfv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params)
+{
+ DISPATCH(GetTexLevelParameteriv, (target, level, pname, params), (F, "glGetTexLevelParameteriv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (const void *) params));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap)
+{
+ RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);\n", cap));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list)
+{
+ RETURN_DISPATCH(IsList, (list), (F, "glIsList(%d);\n", list));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DepthRange)(GLclampd zNear, GLclampd zFar)
+{
+ DISPATCH(DepthRange, (zNear, zFar), (F, "glDepthRange(%f, %f);\n", zNear, zFar));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
+{
+ DISPATCH(Frustum, (left, right, bottom, top, zNear, zFar), (F, "glFrustum(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadIdentity)(void)
+{
+ DISPATCH(LoadIdentity, (), (F, "glLoadIdentity();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadMatrixf)(const GLfloat * m)
+{
+ DISPATCH(LoadMatrixf, (m), (F, "glLoadMatrixf(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadMatrixd)(const GLdouble * m)
+{
+ DISPATCH(LoadMatrixd, (m), (F, "glLoadMatrixd(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MatrixMode)(GLenum mode)
+{
+ DISPATCH(MatrixMode, (mode), (F, "glMatrixMode(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultMatrixf)(const GLfloat * m)
+{
+ DISPATCH(MultMatrixf, (m), (F, "glMultMatrixf(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultMatrixd)(const GLdouble * m)
+{
+ DISPATCH(MultMatrixd, (m), (F, "glMultMatrixd(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
+{
+ DISPATCH(Ortho, (left, right, bottom, top, zNear, zFar), (F, "glOrtho(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PopMatrix)(void)
+{
+ DISPATCH(PopMatrix, (), (F, "glPopMatrix();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PushMatrix)(void)
+{
+ DISPATCH(PushMatrix, (), (F, "glPushMatrix();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(Rotated, (angle, x, y, z), (F, "glRotated(%f, %f, %f, %f);\n", angle, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(Rotatef, (angle, x, y, z), (F, "glRotatef(%f, %f, %f, %f);\n", angle, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Scaled)(GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(Scaled, (x, y, z), (F, "glScaled(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Scalef)(GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(Scalef, (x, y, z), (F, "glScalef(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(Translated, (x, y, z), (F, "glTranslated(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);\n", x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i)
+{
+ DISPATCH(ArrayElement, (i), (F, "glArrayElement(%d);\n", i));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture)
+{
+ DISPATCH(BindTexture, (target, texture), (F, "glBindTexture(0x%x, %d);\n", target, texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(ColorPointer, (size, type, stride, pointer), (F, "glColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum array)
+{
+ DISPATCH(DisableClientState, (array), (F, "glDisableClientState(0x%x);\n", array));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count)
+{
+ DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArrays(0x%x, %d, %d);\n", mode, first, count));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices)
+{
+ DISPATCH(DrawElements, (mode, count, type, indices), (F, "glDrawElements(0x%x, %d, 0x%x, %p);\n", mode, count, type, (const void *) indices));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(EdgeFlagPointer, (stride, pointer), (F, "glEdgeFlagPointer(%d, %p);\n", stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum array)
+{
+ DISPATCH(EnableClientState, (array), (F, "glEnableClientState(0x%x);\n", array));
+}
+
+KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(IndexPointer, (type, stride, pointer), (F, "glIndexPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c)
+{
+ DISPATCH(Indexub, (c), (F, "glIndexub(%d);\n", c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte * c)
+{
+ DISPATCH(Indexubv, (c), (F, "glIndexubv(%p);\n", (const void *) c));
+}
+
+KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(InterleavedArrays, (format, stride, pointer), (F, "glInterleavedArrays(0x%x, %d, %p);\n", format, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(NormalPointer, (type, stride, pointer), (F, "glNormalPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units)
+{
+ DISPATCH(PolygonOffset, (factor, units), (F, "glPolygonOffset(%f, %f);\n", factor, units));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(TexCoordPointer, (size, type, stride, pointer), (F, "glTexCoordPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(VertexPointer, (size, type, stride, pointer), (F, "glVertexPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences)
+{
+ RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);\n", n, (const void *) textures, (const void *) residences));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
+{
+ DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+ DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1D(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2D(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint * textures)
+{
+ DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTextures(%d, %p);\n", n, (const void *) textures));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint * textures)
+{
+ DISPATCH(GenTextures, (n, textures), (F, "glGenTextures(%d, %p);\n", n, (const void *) textures));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid ** params)
+{
+ DISPATCH(GetPointerv, (pname, params), (F, "glGetPointerv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture)
+{
+ RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%d);\n", texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities)
+{
+ DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTextures(%d, %p, %p);\n", n, (const void *) textures, (const void *) priorities));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1D(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void)
+{
+ DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask)
+{
+ DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(%d);\n", mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColor(%f, %f, %f, %f);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode)
+{
+ DISPATCH(BlendEquation, (mode), (F, "glBlendEquation(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices)
+{
+ DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElements(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (const void *) indices));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table)
+{
+ DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTable(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params)
+{
+ DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTable(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table)
+{
+ DISPATCH(GetColorTable, (target, format, type, table), (F, "glGetColorTable(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) table));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, "glGetColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, "glGetColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data)
+{
+ DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTable(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTable(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image)
+{
+ DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1D(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) image));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image)
+{
+ DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (const void *) image));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params)
+{
+ DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterf(0x%x, 0x%x, %f);\n", target, pname, params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params)
+{
+ DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteri(0x%x, 0x%x, %d);\n", target, pname, params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params)
+{
+ DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1D(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2D(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image)
+{
+ DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, "glGetConvolutionFilter(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) image));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, "glGetConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, "glGetConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span)
+{
+ DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, "glGetSeparableFilter(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (const void *) row, (const void *) column, (const void *) span));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column)
+{
+ DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (const void *) row, (const void *) column));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values)
+{
+ DISPATCH(GetHistogram, (target, reset, format, type, values), (F, "glGetHistogram(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, "glGetHistogramParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, "glGetHistogramParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values)
+{
+ DISPATCH(GetMinmax, (target, reset, format, type, values), (F, "glGetMinmax(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, "glGetMinmaxParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, "glGetMinmaxParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
+{
+ DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogram(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink));
+}
+
+KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink)
+{
+ DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmax(0x%x, 0x%x, %d);\n", target, internalformat, sink));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target)
+{
+ DISPATCH(ResetHistogram, (target), (F, "glResetHistogram(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target)
+{
+ DISPATCH(ResetMinmax, (target), (F, "glResetMinmax(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3D(0x%x, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture)
+{
+ DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTextureARB(0x%x);\n", texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture)
+{
+ DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTextureARB(0x%x);\n", texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s)
+{
+ DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1dARB(0x%x, %f);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s)
+{
+ DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1fARB(0x%x, %f);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s)
+{
+ DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1iARB(0x%x, %d);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1ivARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s)
+{
+ DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1sARB(0x%x, %d);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1svARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t)
+{
+ DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2dARB(0x%x, %f, %f);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t)
+{
+ DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2fARB(0x%x, %f, %f);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t)
+{
+ DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2iARB(0x%x, %d, %d);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2ivARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t)
+{
+ DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2sARB(0x%x, %d, %d);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2svARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r)
+{
+ DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3dARB(0x%x, %f, %f, %f);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r)
+{
+ DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3fARB(0x%x, %f, %f, %f);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r)
+{
+ DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3iARB(0x%x, %d, %d, %d);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3ivARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r)
+{
+ DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3sARB(0x%x, %d, %d, %d);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3svARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+ DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4dARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4fARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fvARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q)
+{
+ DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4iARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4ivARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
+{
+ DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4sARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4svARB(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat * m)
+{
+ DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble * m)
+{
+ DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixdARB(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat * m)
+{
+ DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixfARB(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble * m)
+{
+ DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixdARB(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert)
+{
+ DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);\n", value, invert));
+}
+
+KEYWORD1 void KEYWORD2 NAME(__unused413)(void)
+{
+ DISPATCH(__unused413, (), (F, "gl__unused413();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias)
+{
+ DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights)
+{
+ DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, "glGetTexFilterFuncSGIS(0x%x, 0x%x, %p);\n", target, filter, (const void *) weights));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights)
+{
+ DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, "glTexFilterFuncSGIS(0x%x, 0x%x, %d, %p);\n", target, filter, n, (const void *) weights));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values)
+{
+ DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, "glGetHistogramEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, "glGetHistogramParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, "glGetHistogramParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values)
+{
+ DISPATCH(GetMinmaxEXT, (target, reset, format, type, values), (F, "glGetMinmaxEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, "glGetMinmaxParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, "glGetMinmaxParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image)
+{
+ DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, "glGetConvolutionFilterEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) image));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, "glGetConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, "glGetConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span)
+{
+ DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, "glGetSeparableFilterEXT(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (const void *) row, (const void *) column, (const void *) span));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table)
+{
+ DISPATCH(GetColorTableSGI, (target, format, type, table), (F, "glGetColorTableSGI(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) table));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, "glGetColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, "glGetColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode)
+{
+ DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum pname, GLint param)
+{
+ DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params)
+{
+ DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param)
+{
+ DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params)
+{
+ DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexImage4DSGIS, (target, level, internalformat, width, height, depth, size4d, border, format, type, pixels), (F, "glTexImage4DSGIS(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, size4d, border, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, pixels), (F, "glTexSubImage4DSGIS(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, (const void *) pixels));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences)
+{
+ RETURN_DISPATCH(AreTexturesResidentEXT, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d, %p, %p);\n", n, (const void *) textures, (const void *) residences));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint * textures)
+{
+ DISPATCH(GenTexturesEXT, (n, textures), (F, "glGenTexturesEXT(%d, %p);\n", n, (const void *) textures));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture)
+{
+ RETURN_DISPATCH(IsTextureEXT, (texture), (F, "glIsTextureEXT(%d);\n", texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points)
+{
+ DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, "glDetailTexFuncSGIS(0x%x, %d, %p);\n", target, n, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat * points)
+{
+ DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, "glGetDetailTexFuncSGIS(0x%x, %p);\n", target, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points)
+{
+ DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, "glSharpenTexFuncSGIS(0x%x, %d, %p);\n", target, n, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points)
+{
+ DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, "glGetSharpenTexFuncSGIS(0x%x, %p);\n", target, (const void *) points));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert)
+{
+ DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern)
+{
+ DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer)
+{
+ DISPATCH(ColorPointerEXT, (size, type, stride, count, pointer), (F, "glColorPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer)
+{
+ DISPATCH(EdgeFlagPointerEXT, (stride, count, pointer), (F, "glEdgeFlagPointerEXT(%d, %d, %p);\n", stride, count, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer)
+{
+ DISPATCH(IndexPointerEXT, (type, stride, count, pointer), (F, "glIndexPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer)
+{
+ DISPATCH(NormalPointerEXT, (type, stride, count, pointer), (F, "glNormalPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer)
+{
+ DISPATCH(TexCoordPointerEXT, (size, type, stride, count, pointer), (F, "glTexCoordPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer)
+{
+ DISPATCH(VertexPointerEXT, (size, type, stride, count, pointer), (F, "glVertexPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param)
+{
+ DISPATCH(SpriteParameterfSGIX, (pname, param), (F, "glSpriteParameterfSGIX(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(SpriteParameterfvSGIX, (pname, params), (F, "glSpriteParameterfvSGIX(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param)
+{
+ DISPATCH(SpriteParameteriSGIX, (pname, param), (F, "glSpriteParameteriSGIX(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint * params)
+{
+ DISPATCH(SpriteParameterivSGIX, (pname, params), (F, "glSpriteParameterivSGIX(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param)
+{
+ DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void)
+{
+ RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, "glGetInstrumentsSGIX();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint * buffer)
+{
+ DISPATCH(InstrumentsBufferSGIX, (size, buffer), (F, "glInstrumentsBufferSGIX(%d, %p);\n", size, (const void *) buffer));
+}
+
+KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint * marker_p)
+{
+ RETURN_DISPATCH(PollInstrumentsSGIX, (marker_p), (F, "glPollInstrumentsSGIX(%p);\n", (const void *) marker_p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker)
+{
+ DISPATCH(ReadInstrumentsSGIX, (marker), (F, "glReadInstrumentsSGIX(%d);\n", marker));
+}
+
+KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void)
+{
+ DISPATCH(StartInstrumentsSGIX, (), (F, "glStartInstrumentsSGIX();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker)
+{
+ DISPATCH(StopInstrumentsSGIX, (marker), (F, "glStopInstrumentsSGIX(%d);\n", marker));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor)
+{
+ DISPATCH(FrameZoomSGIX, (factor), (F, "glFrameZoomSGIX(%d);\n", factor));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void)
+{
+ DISPATCH(TagSampleBufferSGIX, (), (F, "glTagSampleBufferSGIX();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble * equation)
+{
+ DISPATCH(ReferencePlaneSGIX, (equation), (F, "glReferencePlaneSGIX(%p);\n", (const void *) equation));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void)
+{
+ DISPATCH(FlushRasterSGIX, (), (F, "glFlushRasterSGIX();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetListParameterfvSGIX, (list, pname, params), (F, "glGetListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params)
+{
+ DISPATCH(GetListParameterivSGIX, (list, pname, params), (F, "glGetListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param)
+{
+ DISPATCH(ListParameterfSGIX, (list, pname, param), (F, "glListParameterfSGIX(%d, 0x%x, %f);\n", list, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(ListParameterfvSGIX, (list, pname, params), (F, "glListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum pname, GLint param)
+{
+ DISPATCH(ListParameteriSGIX, (list, pname, param), (F, "glListParameteriSGIX(%d, 0x%x, %d);\n", list, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params)
+{
+ DISPATCH(ListParameterivSGIX, (list, pname, params), (F, "glListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode)
+{
+ DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, "glFragmentColorMaterialSGIX(0x%x, 0x%x);\n", face, mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param)
+{
+ DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, "glFragmentLightfSGIX(0x%x, 0x%x, %f);\n", light, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, "glFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param)
+{
+ DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, "glFragmentLightiSGIX(0x%x, 0x%x, %d);\n", light, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params)
+{
+ DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, "glFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param)
+{
+ DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, "glFragmentLightModelfSGIX(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, "glFragmentLightModelfvSGIX(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param)
+{
+ DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, "glFragmentLightModeliSGIX(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params)
+{
+ DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, "glFragmentLightModelivSGIX(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param)
+{
+ DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, "glFragmentMaterialfSGIX(0x%x, 0x%x, %f);\n", face, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, "glFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param)
+{
+ DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, "glFragmentMaterialiSGIX(0x%x, 0x%x, %d);\n", face, pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params)
+{
+ DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, "glFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetFragmentLightfvSGIX, (light, pname, params), (F, "glGetFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params)
+{
+ DISPATCH(GetFragmentLightivSGIX, (light, pname, params), (F, "glGetFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetFragmentMaterialfvSGIX, (face, pname, params), (F, "glGetFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params)
+{
+ DISPATCH(GetFragmentMaterialivSGIX, (face, pname, params), (F, "glGetFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param)
+{
+ DISPATCH(LightEnviSGIX, (pname, param), (F, "glLightEnviSGIX(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight)
+{
+ DISPATCH(VertexWeightfEXT, (weight), (F, "glVertexWeightfEXT(%f);\n", weight));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight)
+{
+ DISPATCH(VertexWeightfvEXT, (weight), (F, "glVertexWeightfvEXT(%p);\n", (const void *) weight));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, "glVertexWeightPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FlushVertexArrayRangeNV)(void)
+{
+ DISPATCH(FlushVertexArrayRangeNV, (), (F, "glFlushVertexArrayRangeNV();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer)
+{
+ DISPATCH(VertexArrayRangeNV, (length, pointer), (F, "glVertexArrayRangeNV(%d, %p);\n", length, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CombinerParameterfvNV)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(CombinerParameterfvNV, (pname, params), (F, "glCombinerParameterfvNV(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CombinerParameterfNV)(GLenum pname, GLfloat param)
+{
+ DISPATCH(CombinerParameterfNV, (pname, param), (F, "glCombinerParameterfNV(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CombinerParameterivNV)(GLenum pname, const GLint * params)
+{
+ DISPATCH(CombinerParameterivNV, (pname, params), (F, "glCombinerParameterivNV(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CombinerParameteriNV)(GLenum pname, GLint param)
+{
+ DISPATCH(CombinerParameteriNV, (pname, param), (F, "glCombinerParameteriNV(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)
+{
+ DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, "glCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);\n", stage, portion, variable, input, mapping, componentUsage));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum)
+{
+ DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, "glCombinerOutputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, %d, %d, %d);\n", stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)
+{
+ DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, "glFinalCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x);\n", variable, input, mapping, componentUsage));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterfvNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params)
+{
+ DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterivNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterfvNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params)
+{
+ DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterivNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterfvNV(0x%x, 0x%x, %p);\n", variable, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params)
+{
+ DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterivNV(0x%x, 0x%x, %p);\n", variable, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void)
+{
+ DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y)
+{
+ DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dMESA(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble * v)
+{
+ DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dvMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y)
+{
+ DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fMESA(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat * v)
+{
+ DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fvMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y)
+{
+ DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iMESA(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint * v)
+{
+ DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2ivMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y)
+{
+ DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sMESA(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort * v)
+{
+ DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2svMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dMESA(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble * v)
+{
+ DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dvMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fMESA(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat * v)
+{
+ DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fvMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3iMESA)(GLint x, GLint y, GLint z)
+{
+ DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iMESA(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint * v)
+{
+ DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3ivMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z)
+{
+ DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sMESA(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort * v)
+{
+ DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3svMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, "glWindowPos4dMESA(%f, %f, %f, %f);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble * v)
+{
+ DISPATCH(WindowPos4dvMESA, (v), (F, "glWindowPos4dvMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, "glWindowPos4fMESA(%f, %f, %f, %f);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat * v)
+{
+ DISPATCH(WindowPos4fvMESA, (v), (F, "glWindowPos4fvMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w)
+{
+ DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, "glWindowPos4iMESA(%d, %d, %d, %d);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint * v)
+{
+ DISPATCH(WindowPos4ivMESA, (v), (F, "glWindowPos4ivMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, "glWindowPos4sMESA(%d, %d, %d, %d);\n", x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v)
+{
+ DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
+{
+ DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode)
+{
+ DISPATCH(IndexMaterialEXT, (face, mode), (F, "glIndexMaterialEXT(0x%x, 0x%x);\n", face, mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLclampf ref)
+{
+ DISPATCH(IndexFuncEXT, (func, ref), (F, "glIndexFuncEXT(0x%x, %f);\n", func, ref));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count)
+{
+ DISPATCH(LockArraysEXT, (first, count), (F, "glLockArraysEXT(%d, %d);\n", first, count));
+}
+
+KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void)
+{
+ DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble * params)
+{
+ DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat * params)
+{
+ DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode)
+{
+ DISPATCH(HintPGI, (target, mode), (F, "glHintPGI(0x%x, %d);\n", target, mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord)
+{
+ DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%f);\n", coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord)
+{
+ DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoorddEXT)(GLdouble coord)
+{
+ DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%f);\n", coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoorddvEXT)(const GLdouble * coord)
+{
+ DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);\n", (const void *) coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);\n", type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data)
+{
+ DISPATCH(GetColorTableEXT, (target, format, type, data), (F, "glGetColorTableEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, "glGetColorTableParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, "glGetColorTableParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask)
+{
+ DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(%d);\n", mask));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img)
+{
+ DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImageARB(0x%x, %d, %p);\n", target, level, (const void *) img));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue)
+{
+ DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte * v)
+{
+ DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue)
+{
+ DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%f, %f, %f);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dvEXT)(const GLdouble * v)
+{
+ DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue)
+{
+ DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%f, %f, %f);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fvEXT)(const GLfloat * v)
+{
+ DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue)
+{
+ DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ivEXT)(const GLint * v)
+{
+ DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue)
+{
+ DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3svEXT)(const GLshort * v)
+{
+ DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue)
+{
+ DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubvEXT)(const GLubyte * v)
+{
+ DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue)
+{
+ DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uivEXT)(const GLuint * v)
+{
+ DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue)
+{
+ DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usvEXT)(const GLushort * v)
+{
+ DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences)
+{
+ RETURN_DISPATCH(AreProgramsResidentNV, (n, ids, residences), (F, "glAreProgramsResidentNV(%d, %p, %p);\n", n, (const void *) ids, (const void *) residences));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindProgramNV)(GLenum target, GLuint id)
+{
+ DISPATCH(BindProgramNV, (target, id), (F, "glBindProgramNV(0x%x, %d);\n", target, id));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteProgramsNV)(GLsizei n, const GLuint * ids)
+{
+ DISPATCH(DeleteProgramsNV, (n, ids), (F, "glDeleteProgramsNV(%d, %p);\n", n, (const void *) ids));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params)
+{
+ DISPATCH(ExecuteProgramNV, (target, id, params), (F, "glExecuteProgramNV(0x%x, %d, %p);\n", target, id, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenProgramsNV)(GLsizei n, GLuint * ids)
+{
+ DISPATCH(GenProgramsNV, (n, ids), (F, "glGenProgramsNV(%d, %p);\n", n, (const void *) ids));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params)
+{
+ DISPATCH(GetProgramParameterdvNV, (target, index, pname, params), (F, "glGetProgramParameterdvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetProgramParameterfvNV, (target, index, pname, params), (F, "glGetProgramParameterfvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramivNV)(GLuint id, GLenum pname, GLint * params)
+{
+ DISPATCH(GetProgramivNV, (id, pname, params), (F, "glGetProgramivNV(%d, 0x%x, %p);\n", id, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program)
+{
+ DISPATCH(GetProgramStringNV, (id, pname, program), (F, "glGetProgramStringNV(%d, 0x%x, %p);\n", id, pname, (const void *) program));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params)
+{
+ DISPATCH(GetTrackMatrixivNV, (target, address, pname, params), (F, "glGetTrackMatrixivNV(0x%x, %d, 0x%x, %p);\n", target, address, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params)
+{
+ DISPATCH(GetVertexAttribdvNV, (index, pname, params), (F, "glGetVertexAttribdvNV(%d, 0x%x, %p);\n", index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetVertexAttribfvNV, (index, pname, params), (F, "glGetVertexAttribfvNV(%d, 0x%x, %p);\n", index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params)
+{
+ DISPATCH(GetVertexAttribivNV, (index, pname, params), (F, "glGetVertexAttribivNV(%d, 0x%x, %p);\n", index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer)
+{
+ DISPATCH(GetVertexAttribPointervNV, (index, pname, pointer), (F, "glGetVertexAttribPointervNV(%d, 0x%x, %p);\n", index, pname, (const void *) pointer));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramNV)(GLuint id)
+{
+ RETURN_DISPATCH(IsProgramNV, (id), (F, "glIsProgramNV(%d);\n", id));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program)
+{
+ DISPATCH(LoadProgramNV, (target, id, len, program), (F, "glLoadProgramNV(0x%x, %d, %d, %p);\n", target, id, len, (const void *) program));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(ProgramParameter4dNV, (target, index, x, y, z, w), (F, "glProgramParameter4dNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params)
+{
+ DISPATCH(ProgramParameter4dvNV, (target, index, params), (F, "glProgramParameter4dvNV(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(ProgramParameter4fNV, (target, index, x, y, z, w), (F, "glProgramParameter4fNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params)
+{
+ DISPATCH(ProgramParameter4fvNV, (target, index, params), (F, "glProgramParameter4fvNV(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params)
+{
+ DISPATCH(ProgramParameters4dvNV, (target, index, num, params), (F, "glProgramParameters4dvNV(0x%x, %d, %d, %p);\n", target, index, num, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params)
+{
+ DISPATCH(ProgramParameters4fvNV, (target, index, num, params), (F, "glProgramParameters4fvNV(0x%x, %d, %d, %p);\n", target, index, num, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(RequestResidentProgramsNV)(GLsizei n, const GLuint * ids)
+{
+ DISPATCH(RequestResidentProgramsNV, (n, ids), (F, "glRequestResidentProgramsNV(%d, %p);\n", n, (const void *) ids));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform)
+{
+ DISPATCH(TrackMatrixNV, (target, address, matrix, transform), (F, "glTrackMatrixNV(0x%x, %d, 0x%x, 0x%x);\n", target, address, matrix, transform));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(VertexAttribPointerNV, (index, size, type, stride, pointer), (F, "glVertexAttribPointerNV(%d, %d, 0x%x, %d, %p);\n", index, size, type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dNV)(GLuint index, GLdouble x)
+{
+ DISPATCH(VertexAttrib1dNV, (index, x), (F, "glVertexAttrib1dNV(%d, %f);\n", index, x));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvNV)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib1dvNV, (index, v), (F, "glVertexAttrib1dvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fNV)(GLuint index, GLfloat x)
+{
+ DISPATCH(VertexAttrib1fNV, (index, x), (F, "glVertexAttrib1fNV(%d, %f);\n", index, x));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvNV)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib1fvNV, (index, v), (F, "glVertexAttrib1fvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sNV)(GLuint index, GLshort x)
+{
+ DISPATCH(VertexAttrib1sNV, (index, x), (F, "glVertexAttrib1sNV(%d, %d);\n", index, x));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svNV)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib1svNV, (index, v), (F, "glVertexAttrib1svNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y)
+{
+ DISPATCH(VertexAttrib2dNV, (index, x, y), (F, "glVertexAttrib2dNV(%d, %f, %f);\n", index, x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvNV)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib2dvNV, (index, v), (F, "glVertexAttrib2dvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y)
+{
+ DISPATCH(VertexAttrib2fNV, (index, x, y), (F, "glVertexAttrib2fNV(%d, %f, %f);\n", index, x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvNV)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib2fvNV, (index, v), (F, "glVertexAttrib2fvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y)
+{
+ DISPATCH(VertexAttrib2sNV, (index, x, y), (F, "glVertexAttrib2sNV(%d, %d, %d);\n", index, x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svNV)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib2svNV, (index, v), (F, "glVertexAttrib2svNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(VertexAttrib3dNV, (index, x, y, z), (F, "glVertexAttrib3dNV(%d, %f, %f, %f);\n", index, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvNV)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib3dvNV, (index, v), (F, "glVertexAttrib3dvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(VertexAttrib3fNV, (index, x, y, z), (F, "glVertexAttrib3fNV(%d, %f, %f, %f);\n", index, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvNV)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib3fvNV, (index, v), (F, "glVertexAttrib3fvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z)
+{
+ DISPATCH(VertexAttrib3sNV, (index, x, y, z), (F, "glVertexAttrib3sNV(%d, %d, %d, %d);\n", index, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svNV)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib3svNV, (index, v), (F, "glVertexAttrib3svNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(VertexAttrib4dNV, (index, x, y, z, w), (F, "glVertexAttrib4dNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvNV)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib4dvNV, (index, v), (F, "glVertexAttrib4dvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(VertexAttrib4fNV, (index, x, y, z, w), (F, "glVertexAttrib4fNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvNV)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib4fvNV, (index, v), (F, "glVertexAttrib4fvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ DISPATCH(VertexAttrib4sNV, (index, x, y, z, w), (F, "glVertexAttrib4sNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svNV)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib4svNV, (index, v), (F, "glVertexAttrib4svNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
+{
+ DISPATCH(VertexAttrib4ubNV, (index, x, y, z, w), (F, "glVertexAttrib4ubNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvNV)(GLuint index, const GLubyte * v)
+{
+ DISPATCH(VertexAttrib4ubvNV, (index, v), (F, "glVertexAttrib4ubvNV(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v)
+{
+ DISPATCH(VertexAttribs1dvNV, (index, n, v), (F, "glVertexAttribs1dvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v)
+{
+ DISPATCH(VertexAttribs1fvNV, (index, n, v), (F, "glVertexAttribs1fvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v)
+{
+ DISPATCH(VertexAttribs1svNV, (index, n, v), (F, "glVertexAttribs1svNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v)
+{
+ DISPATCH(VertexAttribs2dvNV, (index, n, v), (F, "glVertexAttribs2dvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v)
+{
+ DISPATCH(VertexAttribs2fvNV, (index, n, v), (F, "glVertexAttribs2fvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v)
+{
+ DISPATCH(VertexAttribs2svNV, (index, n, v), (F, "glVertexAttribs2svNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v)
+{
+ DISPATCH(VertexAttribs3dvNV, (index, n, v), (F, "glVertexAttribs3dvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v)
+{
+ DISPATCH(VertexAttribs3fvNV, (index, n, v), (F, "glVertexAttribs3fvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v)
+{
+ DISPATCH(VertexAttribs3svNV, (index, n, v), (F, "glVertexAttribs3svNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v)
+{
+ DISPATCH(VertexAttribs4dvNV, (index, n, v), (F, "glVertexAttribs4dvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v)
+{
+ DISPATCH(VertexAttribs4fvNV, (index, n, v), (F, "glVertexAttribs4fvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v)
+{
+ DISPATCH(VertexAttribs4svNV, (index, n, v), (F, "glVertexAttribs4svNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v)
+{
+ DISPATCH(VertexAttribs4ubvNV, (index, n, v), (F, "glVertexAttribs4ubvNV(%d, %d, %p);\n", index, n, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameteriNV)(GLenum pname, GLint params)
+{
+ DISPATCH(PointParameteriNV, (pname, params), (F, "glPointParameteriNV(0x%x, %d);\n", pname, params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * params)
+{
+ DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount)
+{
+ DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount)
+{
+ DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElementsEXT(0x%x, %p, 0x%x, %p, %d);\n", mode, (const void *) count, type, (const void *) indices, primcount));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ActiveStencilFaceEXT)(GLenum face)
+{
+ DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteFencesNV)(GLsizei n, const GLuint * fences)
+{
+ DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenFencesNV)(GLsizei n, GLuint * fences)
+{
+ DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsFenceNV)(GLuint fence)
+{
+ RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(TestFenceNV)(GLuint fence)
+{
+ RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetFenceivNV)(GLuint fence, GLenum pname, GLint * params)
+{
+ DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FinishFenceNV)(GLuint fence)
+{
+ DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SetFenceNV)(GLuint fence, GLenum condition)
+{
+ DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4bvARB)(GLuint index, const GLbyte * v)
+{
+ DISPATCH(VertexAttrib4bvARB, (index, v), (F, "glVertexAttrib4bvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ivARB)(GLuint index, const GLint * v)
+{
+ DISPATCH(VertexAttrib4ivARB, (index, v), (F, "glVertexAttrib4ivARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvARB)(GLuint index, const GLubyte * v)
+{
+ DISPATCH(VertexAttrib4ubvARB, (index, v), (F, "glVertexAttrib4ubvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4usvARB)(GLuint index, const GLushort * v)
+{
+ DISPATCH(VertexAttrib4usvARB, (index, v), (F, "glVertexAttrib4usvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4uivARB)(GLuint index, const GLuint * v)
+{
+ DISPATCH(VertexAttrib4uivARB, (index, v), (F, "glVertexAttrib4uivARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NbvARB)(GLuint index, const GLbyte * v)
+{
+ DISPATCH(VertexAttrib4NbvARB, (index, v), (F, "glVertexAttrib4NbvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NsvARB)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib4NsvARB, (index, v), (F, "glVertexAttrib4NsvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NivARB)(GLuint index, const GLint * v)
+{
+ DISPATCH(VertexAttrib4NivARB, (index, v), (F, "glVertexAttrib4NivARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NusvARB)(GLuint index, const GLushort * v)
+{
+ DISPATCH(VertexAttrib4NusvARB, (index, v), (F, "glVertexAttrib4NusvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NuivARB)(GLuint index, const GLuint * v)
+{
+ DISPATCH(VertexAttrib4NuivARB, (index, v), (F, "glVertexAttrib4NuivARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(VertexAttribPointerARB, (index, size, type, normalized, stride, pointer), (F, "glVertexAttribPointerARB(%d, %d, 0x%x, %d, %d, %p);\n", index, size, type, normalized, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EnableVertexAttribArrayARB)(GLuint index)
+{
+ DISPATCH(EnableVertexAttribArrayARB, (index), (F, "glEnableVertexAttribArrayARB(%d);\n", index));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DisableVertexAttribArrayARB)(GLuint index)
+{
+ DISPATCH(DisableVertexAttribArrayARB, (index), (F, "glDisableVertexAttribArrayARB(%d);\n", index));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string)
+{
+ DISPATCH(ProgramStringARB, (target, format, len, string), (F, "glProgramStringARB(0x%x, 0x%x, %d, %p);\n", target, format, len, (const void *) string));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(ProgramEnvParameter4dARB, (target, index, x, y, z, w), (F, "glProgramEnvParameter4dARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params)
+{
+ DISPATCH(ProgramEnvParameter4dvARB, (target, index, params), (F, "glProgramEnvParameter4dvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(ProgramEnvParameter4fARB, (target, index, x, y, z, w), (F, "glProgramEnvParameter4fARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params)
+{
+ DISPATCH(ProgramEnvParameter4fvARB, (target, index, params), (F, "glProgramEnvParameter4fvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(ProgramLocalParameter4dARB, (target, index, x, y, z, w), (F, "glProgramLocalParameter4dARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params)
+{
+ DISPATCH(ProgramLocalParameter4dvARB, (target, index, params), (F, "glProgramLocalParameter4dvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(ProgramLocalParameter4fARB, (target, index, x, y, z, w), (F, "glProgramLocalParameter4fARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params)
+{
+ DISPATCH(ProgramLocalParameter4fvARB, (target, index, params), (F, "glProgramLocalParameter4fvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params)
+{
+ DISPATCH(GetProgramEnvParameterdvARB, (target, index, params), (F, "glGetProgramEnvParameterdvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params)
+{
+ DISPATCH(GetProgramEnvParameterfvARB, (target, index, params), (F, "glGetProgramEnvParameterfvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params)
+{
+ DISPATCH(GetProgramLocalParameterdvARB, (target, index, params), (F, "glGetProgramLocalParameterdvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params)
+{
+ DISPATCH(GetProgramLocalParameterfvARB, (target, index, params), (F, "glGetProgramLocalParameterfvARB(0x%x, %d, %p);\n", target, index, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramivARB)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetProgramivARB, (target, pname, params), (F, "glGetProgramivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string)
+{
+ DISPATCH(GetProgramStringARB, (target, pname, string), (F, "glGetProgramStringARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) string));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(ProgramNamedParameter4fNV, (id, len, name, x, y, z, w), (F, "glProgramNamedParameter4fNV(%d, %d, %p, %f, %f, %f, %f);\n", id, len, (const void *) name, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(ProgramNamedParameter4dNV, (id, len, name, x, y, z, w), (F, "glProgramNamedParameter4dNV(%d, %d, %p, %f, %f, %f, %f);\n", id, len, (const void *) name, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v)
+{
+ DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v)
+{
+ DISPATCH(ProgramNamedParameter4dvNV, (id, len, name, v), (F, "glProgramNamedParameter4dvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params)
+{
+ DISPATCH(GetProgramNamedParameterfvNV, (id, len, name, params), (F, "glGetProgramNamedParameterfvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params)
+{
+ DISPATCH(GetProgramNamedParameterdvNV, (id, len, name, params), (F, "glGetProgramNamedParameterdvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindBufferARB)(GLenum target, GLuint buffer)
+{
+ DISPATCH(BindBufferARB, (target, buffer), (F, "glBindBufferARB(0x%x, %d);\n", target, buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage)
+{
+ DISPATCH(BufferDataARB, (target, size, data, usage), (F, "glBufferDataARB(0x%x, %d, %p, 0x%x);\n", target, size, (const void *) data, usage));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data)
+{
+ DISPATCH(BufferSubDataARB, (target, offset, size, data), (F, "glBufferSubDataARB(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteBuffersARB)(GLsizei n, const GLuint * buffer)
+{
+ DISPATCH(DeleteBuffersARB, (n, buffer), (F, "glDeleteBuffersARB(%d, %p);\n", n, (const void *) buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenBuffersARB)(GLsizei n, GLuint * buffer)
+{
+ DISPATCH(GenBuffersARB, (n, buffer), (F, "glGenBuffersARB(%d, %p);\n", n, (const void *) buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetBufferParameterivARB, (target, pname, params), (F, "glGetBufferParameterivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params)
+{
+ DISPATCH(GetBufferPointervARB, (target, pname, params), (F, "glGetBufferPointervARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data)
+{
+ DISPATCH(GetBufferSubDataARB, (target, offset, size, data), (F, "glGetBufferSubDataARB(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsBufferARB)(GLuint buffer)
+{
+ RETURN_DISPATCH(IsBufferARB, (buffer), (F, "glIsBufferARB(%d);\n", buffer));
+}
+
+KEYWORD1 GLvoid * KEYWORD2 NAME(MapBufferARB)(GLenum target, GLenum access)
+{
+ RETURN_DISPATCH(MapBufferARB, (target, access), (F, "glMapBufferARB(0x%x, 0x%x);\n", target, access));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(UnmapBufferARB)(GLenum target)
+{
+ RETURN_DISPATCH(UnmapBufferARB, (target), (F, "glUnmapBufferARB(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DepthBoundsEXT)(GLclampd zmin, GLclampd zmax)
+{
+ DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenQueriesARB)(GLsizei n, GLuint * ids)
+{
+ DISPATCH(GenQueriesARB, (n, ids), (F, "glGenQueriesARB(%d, %p);\n", n, (const void *) ids));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteQueriesARB)(GLsizei n, const GLuint * ids)
+{
+ DISPATCH(DeleteQueriesARB, (n, ids), (F, "glDeleteQueriesARB(%d, %p);\n", n, (const void *) ids));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsQueryARB)(GLuint id)
+{
+ RETURN_DISPATCH(IsQueryARB, (id), (F, "glIsQueryARB(%d);\n", id));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BeginQueryARB)(GLenum target, GLuint id)
+{
+ DISPATCH(BeginQueryARB, (target, id), (F, "glBeginQueryARB(0x%x, %d);\n", target, id));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EndQueryARB)(GLenum target)
+{
+ DISPATCH(EndQueryARB, (target), (F, "glEndQueryARB(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetQueryivARB)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetQueryivARB, (target, pname, params), (F, "glGetQueryivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params)
+{
+ DISPATCH(GetQueryObjectivARB, (id, pname, params), (F, "glGetQueryObjectivARB(%d, 0x%x, %p);\n", id, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params)
+{
+ DISPATCH(GetQueryObjectuivARB, (id, pname, params), (F, "glGetQueryObjectuivARB(%d, 0x%x, %p);\n", id, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride)
+{
+ DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride)
+{
+ DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA)
+{
+ DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ActiveTexture)(GLenum texture)
+{
+ DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTexture(0x%x);\n", texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ClientActiveTexture)(GLenum texture)
+{
+ DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTexture(0x%x);\n", texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1d)(GLenum target, GLdouble s)
+{
+ DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1d(0x%x, %f);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dv)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1f)(GLenum target, GLfloat s)
+{
+ DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1f(0x%x, %f);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fv)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1i)(GLenum target, GLint s)
+{
+ DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1i(0x%x, %d);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iv)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1iv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1s)(GLenum target, GLshort s)
+{
+ DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1s(0x%x, %d);\n", target, s));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sv)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1sv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t)
+{
+ DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2d(0x%x, %f, %f);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dv)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t)
+{
+ DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2f(0x%x, %f, %f);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fv)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2i)(GLenum target, GLint s, GLint t)
+{
+ DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2i(0x%x, %d, %d);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iv)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2iv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t)
+{
+ DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2s(0x%x, %d, %d);\n", target, s, t));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sv)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2sv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r)
+{
+ DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3d(0x%x, %f, %f, %f);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dv)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r)
+{
+ DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3f(0x%x, %f, %f, %f);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fv)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r)
+{
+ DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3i(0x%x, %d, %d, %d);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iv)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3iv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r)
+{
+ DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3s(0x%x, %d, %d, %d);\n", target, s, t, r));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sv)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3sv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+ DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4d(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dv)(GLenum target, const GLdouble * v)
+{
+ DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4f(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fv)(GLenum target, const GLfloat * v)
+{
+ DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q)
+{
+ DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4i(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iv)(GLenum target, const GLint * v)
+{
+ DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4iv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
+{
+ DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4s(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sv)(GLenum target, const GLshort * v)
+{
+ DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4sv(0x%x, %p);\n", target, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixf)(const GLfloat * m)
+{
+ DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixf(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixd)(const GLdouble * m)
+{
+ DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixd(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixf)(const GLfloat * m)
+{
+ DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixf(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixd)(const GLdouble * m)
+{
+ DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixd(%p);\n", (const void *) m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SampleCoverage)(GLclampf value, GLboolean invert)
+{
+ DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverage(%f, %d);\n", value, invert));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data)
+{
+ DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1D(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImage)(GLenum target, GLint level, GLvoid * img)
+{
+ DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImage(0x%x, %d, %p);\n", target, level, (const void *) img));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
+{
+ DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoordf)(GLfloat coord)
+{
+ DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordf(%f);\n", coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoordfv)(const GLfloat * coord)
+{
+ DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfv(%p);\n", (const void *) coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoordd)(GLdouble coord)
+{
+ DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoordd(%f);\n", coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoorddv)(const GLdouble * coord)
+{
+ DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddv(%p);\n", (const void *) coord));
+}
+
+KEYWORD1 void KEYWORD2 NAME(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount)
+{
+ DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArrays(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiDrawElements)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount)
+{
+ DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElements(0x%x, %p, 0x%x, %p, %d);\n", mode, (const void *) count, type, (const void *) indices, primcount));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterf)(GLenum pname, GLfloat param)
+{
+ DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterf(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterfv)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameteri)(GLenum pname, GLint param)
+{
+ DISPATCH(PointParameteriNV, (pname, param), (F, "glPointParameteri(0x%x, %d);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameteriv)(GLenum pname, const GLint * params)
+{
+ DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameteriv(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue)
+{
+ DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3b(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bv)(const GLbyte * v)
+{
+ DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue)
+{
+ DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3d(%f, %f, %f);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dv)(const GLdouble * v)
+{
+ DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue)
+{
+ DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3f(%f, %f, %f);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fv)(const GLfloat * v)
+{
+ DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3i)(GLint red, GLint green, GLint blue)
+{
+ DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3i(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iv)(const GLint * v)
+{
+ DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue)
+{
+ DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3s(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sv)(const GLshort * v)
+{
+ DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue)
+{
+ DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ub(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubv)(const GLubyte * v)
+{
+ DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue)
+{
+ DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3ui(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiv)(const GLuint * v)
+{
+ DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uiv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue)
+{
+ DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3us(%d, %d, %d);\n", red, green, blue));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usv)(const GLushort * v)
+{
+ DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+ DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2d)(GLdouble x, GLdouble y)
+{
+ DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2d(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2dv)(const GLdouble * v)
+{
+ DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2f)(GLfloat x, GLfloat y)
+{
+ DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2f(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2fv)(const GLfloat * v)
+{
+ DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2i)(GLint x, GLint y)
+{
+ DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2i(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2iv)(const GLint * v)
+{
+ DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2s)(GLshort x, GLshort y)
+{
+ DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2s(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2sv)(const GLshort * v)
+{
+ DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3d(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3dv)(const GLdouble * v)
+{
+ DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3f(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3fv)(const GLfloat * v)
+{
+ DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3i)(GLint x, GLint y, GLint z)
+{
+ DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3i(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3iv)(const GLint * v)
+{
+ DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3iv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3s)(GLshort x, GLshort y, GLshort z)
+{
+ DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3s(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3sv)(const GLshort * v)
+{
+ DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3sv(%p);\n", (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindBuffer)(GLenum target, GLuint buffer)
+{
+ DISPATCH(BindBufferARB, (target, buffer), (F, "glBindBuffer(0x%x, %d);\n", target, buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BufferData)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage)
+{
+ DISPATCH(BufferDataARB, (target, size, data, usage), (F, "glBufferData(0x%x, %d, %p, 0x%x);\n", target, size, (const void *) data, usage));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BufferSubData)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data)
+{
+ DISPATCH(BufferSubDataARB, (target, offset, size, data), (F, "glBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteBuffers)(GLsizei n, const GLuint * buffer)
+{
+ DISPATCH(DeleteBuffersARB, (n, buffer), (F, "glDeleteBuffers(%d, %p);\n", n, (const void *) buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenBuffers)(GLsizei n, GLuint * buffer)
+{
+ DISPATCH(GenBuffersARB, (n, buffer), (F, "glGenBuffers(%d, %p);\n", n, (const void *) buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetBufferParameteriv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetBufferParameterivARB, (target, pname, params), (F, "glGetBufferParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetBufferPointerv)(GLenum target, GLenum pname, GLvoid ** params)
+{
+ DISPATCH(GetBufferPointervARB, (target, pname, params), (F, "glGetBufferPointerv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetBufferSubData)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data)
+{
+ DISPATCH(GetBufferSubDataARB, (target, offset, size, data), (F, "glGetBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsBuffer)(GLuint buffer)
+{
+ RETURN_DISPATCH(IsBufferARB, (buffer), (F, "glIsBuffer(%d);\n", buffer));
+}
+
+KEYWORD1 GLvoid * KEYWORD2 NAME(MapBuffer)(GLenum target, GLenum access)
+{
+ RETURN_DISPATCH(MapBufferARB, (target, access), (F, "glMapBuffer(0x%x, 0x%x);\n", target, access));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(UnmapBuffer)(GLenum target)
+{
+ RETURN_DISPATCH(UnmapBufferARB, (target), (F, "glUnmapBuffer(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenQueries)(GLsizei n, GLuint * ids)
+{
+ DISPATCH(GenQueriesARB, (n, ids), (F, "glGenQueries(%d, %p);\n", n, (const void *) ids));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteQueries)(GLsizei n, const GLuint * ids)
+{
+ DISPATCH(DeleteQueriesARB, (n, ids), (F, "glDeleteQueries(%d, %p);\n", n, (const void *) ids));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsQuery)(GLuint id)
+{
+ RETURN_DISPATCH(IsQueryARB, (id), (F, "glIsQuery(%d);\n", id));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BeginQuery)(GLenum target, GLuint id)
+{
+ DISPATCH(BeginQueryARB, (target, id), (F, "glBeginQuery(0x%x, %d);\n", target, id));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EndQuery)(GLenum target)
+{
+ DISPATCH(EndQueryARB, (target), (F, "glEndQuery(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetQueryiv)(GLenum target, GLenum pname, GLint * params)
+{
+ DISPATCH(GetQueryivARB, (target, pname, params), (F, "glGetQueryiv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetQueryObjectiv)(GLuint id, GLenum pname, GLint * params)
+{
+ DISPATCH(GetQueryObjectivARB, (id, pname, params), (F, "glGetQueryObjectiv(%d, 0x%x, %p);\n", id, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetQueryObjectuiv)(GLuint id, GLenum pname, GLuint * params)
+{
+ DISPATCH(GetQueryObjectuivARB, (id, pname, params), (F, "glGetQueryObjectuiv(%d, 0x%x, %p);\n", id, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterfARB)(GLenum pname, GLfloat param)
+{
+ DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfARB(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterfvARB)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvARB(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2dARB)(GLdouble x, GLdouble y)
+{
+ DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dARB(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2fARB)(GLfloat x, GLfloat y)
+{
+ DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fARB(%f, %f);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2iARB)(GLint x, GLint y)
+{
+ DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iARB(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2sARB)(GLshort x, GLshort y)
+{
+ DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sARB(%d, %d);\n", x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2dvARB)(const GLdouble * p)
+{
+ DISPATCH(WindowPos2dvMESA, (p), (F, "glWindowPos2dvARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2fvARB)(const GLfloat * p)
+{
+ DISPATCH(WindowPos2fvMESA, (p), (F, "glWindowPos2fvARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2ivARB)(const GLint * p)
+{
+ DISPATCH(WindowPos2ivMESA, (p), (F, "glWindowPos2ivARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos2svARB)(const GLshort * p)
+{
+ DISPATCH(WindowPos2svMESA, (p), (F, "glWindowPos2svARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dARB(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fARB(%f, %f, %f);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3iARB)(GLint x, GLint y, GLint z)
+{
+ DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iARB(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3sARB)(GLshort x, GLshort y, GLshort z)
+{
+ DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sARB(%d, %d, %d);\n", x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3dvARB)(const GLdouble * p)
+{
+ DISPATCH(WindowPos3dvMESA, (p), (F, "glWindowPos3dvARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3fvARB)(const GLfloat * p)
+{
+ DISPATCH(WindowPos3fvMESA, (p), (F, "glWindowPos3fvARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3ivARB)(const GLint * p)
+{
+ DISPATCH(WindowPos3ivMESA, (p), (F, "glWindowPos3ivARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(WindowPos3svARB)(const GLshort * p)
+{
+ DISPATCH(WindowPos3svMESA, (p), (F, "glWindowPos3svARB(%p);\n", (const void *) p));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sARB)(GLuint index, GLshort x)
+{
+ DISPATCH(VertexAttrib1sNV, (index, x), (F, "glVertexAttrib1sARB(%d, %d);\n", index, x));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fARB)(GLuint index, GLfloat x)
+{
+ DISPATCH(VertexAttrib1fNV, (index, x), (F, "glVertexAttrib1fARB(%d, %f);\n", index, x));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dARB)(GLuint index, GLdouble x)
+{
+ DISPATCH(VertexAttrib1dNV, (index, x), (F, "glVertexAttrib1dARB(%d, %f);\n", index, x));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y)
+{
+ DISPATCH(VertexAttrib2sNV, (index, x, y), (F, "glVertexAttrib2sARB(%d, %d, %d);\n", index, x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y)
+{
+ DISPATCH(VertexAttrib2fNV, (index, x, y), (F, "glVertexAttrib2fARB(%d, %f, %f);\n", index, x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y)
+{
+ DISPATCH(VertexAttrib2dNV, (index, x, y), (F, "glVertexAttrib2dARB(%d, %f, %f);\n", index, x, y));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z)
+{
+ DISPATCH(VertexAttrib3sNV, (index, x, y, z), (F, "glVertexAttrib3sARB(%d, %d, %d, %d);\n", index, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ DISPATCH(VertexAttrib3fNV, (index, x, y, z), (F, "glVertexAttrib3fARB(%d, %f, %f, %f);\n", index, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+ DISPATCH(VertexAttrib3dNV, (index, x, y, z), (F, "glVertexAttrib3dARB(%d, %f, %f, %f);\n", index, x, y, z));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ DISPATCH(VertexAttrib4sNV, (index, x, y, z, w), (F, "glVertexAttrib4sARB(%d, %d, %d, %d, %d);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ DISPATCH(VertexAttrib4fNV, (index, x, y, z, w), (F, "glVertexAttrib4fARB(%d, %f, %f, %f, %f);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ DISPATCH(VertexAttrib4dNV, (index, x, y, z, w), (F, "glVertexAttrib4dARB(%d, %f, %f, %f, %f);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
+{
+ DISPATCH(VertexAttrib4ubNV, (index, x, y, z, w), (F, "glVertexAttrib4NubARB(%d, %d, %d, %d, %d);\n", index, x, y, z, w));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svARB)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib1svNV, (index, v), (F, "glVertexAttrib1svARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvARB)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib1fvNV, (index, v), (F, "glVertexAttrib1fvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvARB)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib1dvNV, (index, v), (F, "glVertexAttrib1dvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svARB)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib2svNV, (index, v), (F, "glVertexAttrib2svARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvARB)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib2fvNV, (index, v), (F, "glVertexAttrib2fvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvARB)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib2dvNV, (index, v), (F, "glVertexAttrib2dvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svARB)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib3svNV, (index, v), (F, "glVertexAttrib3svARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvARB)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib3fvNV, (index, v), (F, "glVertexAttrib3fvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvARB)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib3dvNV, (index, v), (F, "glVertexAttrib3dvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svARB)(GLuint index, const GLshort * v)
+{
+ DISPATCH(VertexAttrib4svNV, (index, v), (F, "glVertexAttrib4svARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvARB)(GLuint index, const GLfloat * v)
+{
+ DISPATCH(VertexAttrib4fvNV, (index, v), (F, "glVertexAttrib4fvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvARB)(GLuint index, const GLdouble * v)
+{
+ DISPATCH(VertexAttrib4dvNV, (index, v), (F, "glVertexAttrib4dvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NubvARB)(GLuint index, const GLubyte * v)
+{
+ DISPATCH(VertexAttrib4ubvNV, (index, v), (F, "glVertexAttrib4NubvARB(%d, %p);\n", index, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindProgramARB)(GLenum target, GLuint program)
+{
+ DISPATCH(BindProgramNV, (target, program), (F, "glBindProgramARB(0x%x, %d);\n", target, program));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteProgramsARB)(GLsizei n, const GLuint * programs)
+{
+ DISPATCH(DeleteProgramsNV, (n, programs), (F, "glDeleteProgramsARB(%d, %p);\n", n, (const void *) programs));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GenProgramsARB)(GLsizei n, GLuint * programs)
+{
+ DISPATCH(GenProgramsNV, (n, programs), (F, "glGenProgramsARB(%d, %p);\n", n, (const void *) programs));
+}
+
+KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramARB)(GLuint program)
+{
+ RETURN_DISPATCH(IsProgramNV, (program), (F, "glIsProgramARB(%d);\n", program));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params)
+{
+ DISPATCH(GetVertexAttribdvNV, (index, pname, params), (F, "glGetVertexAttribdvARB(%d, 0x%x, %p);\n", index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params)
+{
+ DISPATCH(GetVertexAttribfvNV, (index, pname, params), (F, "glGetVertexAttribfvARB(%d, 0x%x, %p);\n", index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params)
+{
+ DISPATCH(GetVertexAttribivNV, (index, pname, params), (F, "glGetVertexAttribivARB(%d, 0x%x, %p);\n", index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid ** params)
+{
+ DISPATCH(GetVertexAttribPointervNV, (index, pname, params), (F, "glGetVertexAttribPointervARB(%d, 0x%x, %p);\n", index, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColorEXT(%f, %f, %f, %f);\n", red, green, blue, alpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1DEXT(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)
+{
+ DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (const void *) pixels));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
+{
+ DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+ DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1DEXT(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
+{
+ DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogramEXT(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink)
+{
+ DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmaxEXT(0x%x, 0x%x, %d);\n", target, internalformat, sink));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target)
+{
+ DISPATCH(ResetHistogram, (target), (F, "glResetHistogramEXT(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target)
+{
+ DISPATCH(ResetMinmax, (target), (F, "glResetMinmaxEXT(0x%x);\n", target));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image)
+{
+ DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1DEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) image));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image)
+{
+ DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (const void *) image));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params)
+{
+ DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterfEXT(0x%x, 0x%x, %f);\n", target, pname, params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params)
+{
+ DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteriEXT(0x%x, 0x%x, %d);\n", target, pname, params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint * params)
+{
+ DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1DEXT(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column)
+{
+ DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (const void *) row, (const void *) column));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table)
+{
+ DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTableSGI(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat * params)
+{
+ DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint * params)
+{
+ DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTableSGI(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture)
+{
+ DISPATCH(BindTexture, (target, texture), (F, "glBindTextureEXT(0x%x, %d);\n", target, texture));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint * textures)
+{
+ DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTexturesEXT(%d, %p);\n", n, (const void *) textures));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint * textures, const GLclampf * priorities)
+{
+ DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTexturesEXT(%d, %p, %p);\n", n, (const void *) textures, (const void *) priorities));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i)
+{
+ DISPATCH(ArrayElement, (i), (F, "glArrayElementEXT(%d);\n", i));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count)
+{
+ DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArraysEXT(0x%x, %d, %d);\n", mode, first, count));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, GLvoid ** params)
+{
+ DISPATCH(GetPointerv, (pname, params), (F, "glGetPointervEXT(0x%x, %p);\n", pname, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode)
+{
+ DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data)
+{
+ DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTableEXT(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (const void *) data));
+}
+
+KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
+{
+ DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTableEXT(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid * table)
+{
+ DISPATCH(ColorTable, (target, internalFormat, width, format, type, table), (F, "glColorTableEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalFormat, width, format, type, (const void *) table));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices)
+{
+ DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (const void *) indices));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert)
+{
+ DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskEXT(%f, %d);\n", value, invert));
+}
+
+KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern)
+{
+ DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternEXT(0x%x);\n", pattern));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparateATI)(GLenum modeRGB, GLenum modeA)
+{
+ DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateATI(0x%x, 0x%x);\n", modeRGB, modeA));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateINGR)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
+{
+ DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum pname, GLfloat param)
+{
+ DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum pname, const GLfloat * params)
+{
+ DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
+}
+
+
+#endif /* defined( NAME ) */
+
+/*
+ * This is how a dispatch table can be initialized with all the functions
+ * we generated above.
+ */
+#ifdef DISPATCH_TABLE_NAME
+
+#ifndef TABLE_ENTRY
+#error TABLE_ENTRY must be defined
+#endif
+
+static _glapi_proc DISPATCH_TABLE_NAME[] = {
+ TABLE_ENTRY(NewList),
+ TABLE_ENTRY(EndList),
+ TABLE_ENTRY(CallList),
+ TABLE_ENTRY(CallLists),
+ TABLE_ENTRY(DeleteLists),
+ TABLE_ENTRY(GenLists),
+ TABLE_ENTRY(ListBase),
+ TABLE_ENTRY(Begin),
+ TABLE_ENTRY(Bitmap),
+ TABLE_ENTRY(Color3b),
+ TABLE_ENTRY(Color3bv),
+ TABLE_ENTRY(Color3d),
+ TABLE_ENTRY(Color3dv),
+ TABLE_ENTRY(Color3f),
+ TABLE_ENTRY(Color3fv),
+ TABLE_ENTRY(Color3i),
+ TABLE_ENTRY(Color3iv),
+ TABLE_ENTRY(Color3s),
+ TABLE_ENTRY(Color3sv),
+ TABLE_ENTRY(Color3ub),
+ TABLE_ENTRY(Color3ubv),
+ TABLE_ENTRY(Color3ui),
+ TABLE_ENTRY(Color3uiv),
+ TABLE_ENTRY(Color3us),
+ TABLE_ENTRY(Color3usv),
+ TABLE_ENTRY(Color4b),
+ TABLE_ENTRY(Color4bv),
+ TABLE_ENTRY(Color4d),
+ TABLE_ENTRY(Color4dv),
+ TABLE_ENTRY(Color4f),
+ TABLE_ENTRY(Color4fv),
+ TABLE_ENTRY(Color4i),
+ TABLE_ENTRY(Color4iv),
+ TABLE_ENTRY(Color4s),
+ TABLE_ENTRY(Color4sv),
+ TABLE_ENTRY(Color4ub),
+ TABLE_ENTRY(Color4ubv),
+ TABLE_ENTRY(Color4ui),
+ TABLE_ENTRY(Color4uiv),
+ TABLE_ENTRY(Color4us),
+ TABLE_ENTRY(Color4usv),
+ TABLE_ENTRY(EdgeFlag),
+ TABLE_ENTRY(EdgeFlagv),
+ TABLE_ENTRY(End),
+ TABLE_ENTRY(Indexd),
+ TABLE_ENTRY(Indexdv),
+ TABLE_ENTRY(Indexf),
+ TABLE_ENTRY(Indexfv),
+ TABLE_ENTRY(Indexi),
+ TABLE_ENTRY(Indexiv),
+ TABLE_ENTRY(Indexs),
+ TABLE_ENTRY(Indexsv),
+ TABLE_ENTRY(Normal3b),
+ TABLE_ENTRY(Normal3bv),
+ TABLE_ENTRY(Normal3d),
+ TABLE_ENTRY(Normal3dv),
+ TABLE_ENTRY(Normal3f),
+ TABLE_ENTRY(Normal3fv),
+ TABLE_ENTRY(Normal3i),
+ TABLE_ENTRY(Normal3iv),
+ TABLE_ENTRY(Normal3s),
+ TABLE_ENTRY(Normal3sv),
+ TABLE_ENTRY(RasterPos2d),
+ TABLE_ENTRY(RasterPos2dv),
+ TABLE_ENTRY(RasterPos2f),
+ TABLE_ENTRY(RasterPos2fv),
+ TABLE_ENTRY(RasterPos2i),
+ TABLE_ENTRY(RasterPos2iv),
+ TABLE_ENTRY(RasterPos2s),
+ TABLE_ENTRY(RasterPos2sv),
+ TABLE_ENTRY(RasterPos3d),
+ TABLE_ENTRY(RasterPos3dv),
+ TABLE_ENTRY(RasterPos3f),
+ TABLE_ENTRY(RasterPos3fv),
+ TABLE_ENTRY(RasterPos3i),
+ TABLE_ENTRY(RasterPos3iv),
+ TABLE_ENTRY(RasterPos3s),
+ TABLE_ENTRY(RasterPos3sv),
+ TABLE_ENTRY(RasterPos4d),
+ TABLE_ENTRY(RasterPos4dv),
+ TABLE_ENTRY(RasterPos4f),
+ TABLE_ENTRY(RasterPos4fv),
+ TABLE_ENTRY(RasterPos4i),
+ TABLE_ENTRY(RasterPos4iv),
+ TABLE_ENTRY(RasterPos4s),
+ TABLE_ENTRY(RasterPos4sv),
+ TABLE_ENTRY(Rectd),
+ TABLE_ENTRY(Rectdv),
+ TABLE_ENTRY(Rectf),
+ TABLE_ENTRY(Rectfv),
+ TABLE_ENTRY(Recti),
+ TABLE_ENTRY(Rectiv),
+ TABLE_ENTRY(Rects),
+ TABLE_ENTRY(Rectsv),
+ TABLE_ENTRY(TexCoord1d),
+ TABLE_ENTRY(TexCoord1dv),
+ TABLE_ENTRY(TexCoord1f),
+ TABLE_ENTRY(TexCoord1fv),
+ TABLE_ENTRY(TexCoord1i),
+ TABLE_ENTRY(TexCoord1iv),
+ TABLE_ENTRY(TexCoord1s),
+ TABLE_ENTRY(TexCoord1sv),
+ TABLE_ENTRY(TexCoord2d),
+ TABLE_ENTRY(TexCoord2dv),
+ TABLE_ENTRY(TexCoord2f),
+ TABLE_ENTRY(TexCoord2fv),
+ TABLE_ENTRY(TexCoord2i),
+ TABLE_ENTRY(TexCoord2iv),
+ TABLE_ENTRY(TexCoord2s),
+ TABLE_ENTRY(TexCoord2sv),
+ TABLE_ENTRY(TexCoord3d),
+ TABLE_ENTRY(TexCoord3dv),
+ TABLE_ENTRY(TexCoord3f),
+ TABLE_ENTRY(TexCoord3fv),
+ TABLE_ENTRY(TexCoord3i),
+ TABLE_ENTRY(TexCoord3iv),
+ TABLE_ENTRY(TexCoord3s),
+ TABLE_ENTRY(TexCoord3sv),
+ TABLE_ENTRY(TexCoord4d),
+ TABLE_ENTRY(TexCoord4dv),
+ TABLE_ENTRY(TexCoord4f),
+ TABLE_ENTRY(TexCoord4fv),
+ TABLE_ENTRY(TexCoord4i),
+ TABLE_ENTRY(TexCoord4iv),
+ TABLE_ENTRY(TexCoord4s),
+ TABLE_ENTRY(TexCoord4sv),
+ TABLE_ENTRY(Vertex2d),
+ TABLE_ENTRY(Vertex2dv),
+ TABLE_ENTRY(Vertex2f),
+ TABLE_ENTRY(Vertex2fv),
+ TABLE_ENTRY(Vertex2i),
+ TABLE_ENTRY(Vertex2iv),
+ TABLE_ENTRY(Vertex2s),
+ TABLE_ENTRY(Vertex2sv),
+ TABLE_ENTRY(Vertex3d),
+ TABLE_ENTRY(Vertex3dv),
+ TABLE_ENTRY(Vertex3f),
+ TABLE_ENTRY(Vertex3fv),
+ TABLE_ENTRY(Vertex3i),
+ TABLE_ENTRY(Vertex3iv),
+ TABLE_ENTRY(Vertex3s),
+ TABLE_ENTRY(Vertex3sv),
+ TABLE_ENTRY(Vertex4d),
+ TABLE_ENTRY(Vertex4dv),
+ TABLE_ENTRY(Vertex4f),
+ TABLE_ENTRY(Vertex4fv),
+ TABLE_ENTRY(Vertex4i),
+ TABLE_ENTRY(Vertex4iv),
+ TABLE_ENTRY(Vertex4s),
+ TABLE_ENTRY(Vertex4sv),
+ TABLE_ENTRY(ClipPlane),
+ TABLE_ENTRY(ColorMaterial),
+ TABLE_ENTRY(CullFace),
+ TABLE_ENTRY(Fogf),
+ TABLE_ENTRY(Fogfv),
+ TABLE_ENTRY(Fogi),
+ TABLE_ENTRY(Fogiv),
+ TABLE_ENTRY(FrontFace),
+ TABLE_ENTRY(Hint),
+ TABLE_ENTRY(Lightf),
+ TABLE_ENTRY(Lightfv),
+ TABLE_ENTRY(Lighti),
+ TABLE_ENTRY(Lightiv),
+ TABLE_ENTRY(LightModelf),
+ TABLE_ENTRY(LightModelfv),
+ TABLE_ENTRY(LightModeli),
+ TABLE_ENTRY(LightModeliv),
+ TABLE_ENTRY(LineStipple),
+ TABLE_ENTRY(LineWidth),
+ TABLE_ENTRY(Materialf),
+ TABLE_ENTRY(Materialfv),
+ TABLE_ENTRY(Materiali),
+ TABLE_ENTRY(Materialiv),
+ TABLE_ENTRY(PointSize),
+ TABLE_ENTRY(PolygonMode),
+ TABLE_ENTRY(PolygonStipple),
+ TABLE_ENTRY(Scissor),
+ TABLE_ENTRY(ShadeModel),
+ TABLE_ENTRY(TexParameterf),
+ TABLE_ENTRY(TexParameterfv),
+ TABLE_ENTRY(TexParameteri),
+ TABLE_ENTRY(TexParameteriv),
+ TABLE_ENTRY(TexImage1D),
+ TABLE_ENTRY(TexImage2D),
+ TABLE_ENTRY(TexEnvf),
+ TABLE_ENTRY(TexEnvfv),
+ TABLE_ENTRY(TexEnvi),
+ TABLE_ENTRY(TexEnviv),
+ TABLE_ENTRY(TexGend),
+ TABLE_ENTRY(TexGendv),
+ TABLE_ENTRY(TexGenf),
+ TABLE_ENTRY(TexGenfv),
+ TABLE_ENTRY(TexGeni),
+ TABLE_ENTRY(TexGeniv),
+ TABLE_ENTRY(FeedbackBuffer),
+ TABLE_ENTRY(SelectBuffer),
+ TABLE_ENTRY(RenderMode),
+ TABLE_ENTRY(InitNames),
+ TABLE_ENTRY(LoadName),
+ TABLE_ENTRY(PassThrough),
+ TABLE_ENTRY(PopName),
+ TABLE_ENTRY(PushName),
+ TABLE_ENTRY(DrawBuffer),
+ TABLE_ENTRY(Clear),
+ TABLE_ENTRY(ClearAccum),
+ TABLE_ENTRY(ClearIndex),
+ TABLE_ENTRY(ClearColor),
+ TABLE_ENTRY(ClearStencil),
+ TABLE_ENTRY(ClearDepth),
+ TABLE_ENTRY(StencilMask),
+ TABLE_ENTRY(ColorMask),
+ TABLE_ENTRY(DepthMask),
+ TABLE_ENTRY(IndexMask),
+ TABLE_ENTRY(Accum),
+ TABLE_ENTRY(Disable),
+ TABLE_ENTRY(Enable),
+ TABLE_ENTRY(Finish),
+ TABLE_ENTRY(Flush),
+ TABLE_ENTRY(PopAttrib),
+ TABLE_ENTRY(PushAttrib),
+ TABLE_ENTRY(Map1d),
+ TABLE_ENTRY(Map1f),
+ TABLE_ENTRY(Map2d),
+ TABLE_ENTRY(Map2f),
+ TABLE_ENTRY(MapGrid1d),
+ TABLE_ENTRY(MapGrid1f),
+ TABLE_ENTRY(MapGrid2d),
+ TABLE_ENTRY(MapGrid2f),
+ TABLE_ENTRY(EvalCoord1d),
+ TABLE_ENTRY(EvalCoord1dv),
+ TABLE_ENTRY(EvalCoord1f),
+ TABLE_ENTRY(EvalCoord1fv),
+ TABLE_ENTRY(EvalCoord2d),
+ TABLE_ENTRY(EvalCoord2dv),
+ TABLE_ENTRY(EvalCoord2f),
+ TABLE_ENTRY(EvalCoord2fv),
+ TABLE_ENTRY(EvalMesh1),
+ TABLE_ENTRY(EvalPoint1),
+ TABLE_ENTRY(EvalMesh2),
+ TABLE_ENTRY(EvalPoint2),
+ TABLE_ENTRY(AlphaFunc),
+ TABLE_ENTRY(BlendFunc),
+ TABLE_ENTRY(LogicOp),
+ TABLE_ENTRY(StencilFunc),
+ TABLE_ENTRY(StencilOp),
+ TABLE_ENTRY(DepthFunc),
+ TABLE_ENTRY(PixelZoom),
+ TABLE_ENTRY(PixelTransferf),
+ TABLE_ENTRY(PixelTransferi),
+ TABLE_ENTRY(PixelStoref),
+ TABLE_ENTRY(PixelStorei),
+ TABLE_ENTRY(PixelMapfv),
+ TABLE_ENTRY(PixelMapuiv),
+ TABLE_ENTRY(PixelMapusv),
+ TABLE_ENTRY(ReadBuffer),
+ TABLE_ENTRY(CopyPixels),
+ TABLE_ENTRY(ReadPixels),
+ TABLE_ENTRY(DrawPixels),
+ TABLE_ENTRY(GetBooleanv),
+ TABLE_ENTRY(GetClipPlane),
+ TABLE_ENTRY(GetDoublev),
+ TABLE_ENTRY(GetError),
+ TABLE_ENTRY(GetFloatv),
+ TABLE_ENTRY(GetIntegerv),
+ TABLE_ENTRY(GetLightfv),
+ TABLE_ENTRY(GetLightiv),
+ TABLE_ENTRY(GetMapdv),
+ TABLE_ENTRY(GetMapfv),
+ TABLE_ENTRY(GetMapiv),
+ TABLE_ENTRY(GetMaterialfv),
+ TABLE_ENTRY(GetMaterialiv),
+ TABLE_ENTRY(GetPixelMapfv),
+ TABLE_ENTRY(GetPixelMapuiv),
+ TABLE_ENTRY(GetPixelMapusv),
+ TABLE_ENTRY(GetPolygonStipple),
+ TABLE_ENTRY(GetString),
+ TABLE_ENTRY(GetTexEnvfv),
+ TABLE_ENTRY(GetTexEnviv),
+ TABLE_ENTRY(GetTexGendv),
+ TABLE_ENTRY(GetTexGenfv),
+ TABLE_ENTRY(GetTexGeniv),
+ TABLE_ENTRY(GetTexImage),
+ TABLE_ENTRY(GetTexParameterfv),
+ TABLE_ENTRY(GetTexParameteriv),
+ TABLE_ENTRY(GetTexLevelParameterfv),
+ TABLE_ENTRY(GetTexLevelParameteriv),
+ TABLE_ENTRY(IsEnabled),
+ TABLE_ENTRY(IsList),
+ TABLE_ENTRY(DepthRange),
+ TABLE_ENTRY(Frustum),
+ TABLE_ENTRY(LoadIdentity),
+ TABLE_ENTRY(LoadMatrixf),
+ TABLE_ENTRY(LoadMatrixd),
+ TABLE_ENTRY(MatrixMode),
+ TABLE_ENTRY(MultMatrixf),
+ TABLE_ENTRY(MultMatrixd),
+ TABLE_ENTRY(Ortho),
+ TABLE_ENTRY(PopMatrix),
+ TABLE_ENTRY(PushMatrix),
+ TABLE_ENTRY(Rotated),
+ TABLE_ENTRY(Rotatef),
+ TABLE_ENTRY(Scaled),
+ TABLE_ENTRY(Scalef),
+ TABLE_ENTRY(Translated),
+ TABLE_ENTRY(Translatef),
+ TABLE_ENTRY(Viewport),
+ TABLE_ENTRY(ArrayElement),
+ TABLE_ENTRY(BindTexture),
+ TABLE_ENTRY(ColorPointer),
+ TABLE_ENTRY(DisableClientState),
+ TABLE_ENTRY(DrawArrays),
+ TABLE_ENTRY(DrawElements),
+ TABLE_ENTRY(EdgeFlagPointer),
+ TABLE_ENTRY(EnableClientState),
+ TABLE_ENTRY(IndexPointer),
+ TABLE_ENTRY(Indexub),
+ TABLE_ENTRY(Indexubv),
+ TABLE_ENTRY(InterleavedArrays),
+ TABLE_ENTRY(NormalPointer),
+ TABLE_ENTRY(PolygonOffset),
+ TABLE_ENTRY(TexCoordPointer),
+ TABLE_ENTRY(VertexPointer),
+ TABLE_ENTRY(AreTexturesResident),
+ TABLE_ENTRY(CopyTexImage1D),
+ TABLE_ENTRY(CopyTexImage2D),
+ TABLE_ENTRY(CopyTexSubImage1D),
+ TABLE_ENTRY(CopyTexSubImage2D),
+ TABLE_ENTRY(DeleteTextures),
+ TABLE_ENTRY(GenTextures),
+ TABLE_ENTRY(GetPointerv),
+ TABLE_ENTRY(IsTexture),
+ TABLE_ENTRY(PrioritizeTextures),
+ TABLE_ENTRY(TexSubImage1D),
+ TABLE_ENTRY(TexSubImage2D),
+ TABLE_ENTRY(PopClientAttrib),
+ TABLE_ENTRY(PushClientAttrib),
+ TABLE_ENTRY(BlendColor),
+ TABLE_ENTRY(BlendEquation),
+ TABLE_ENTRY(DrawRangeElements),
+ TABLE_ENTRY(ColorTable),
+ TABLE_ENTRY(ColorTableParameterfv),
+ TABLE_ENTRY(ColorTableParameteriv),
+ TABLE_ENTRY(CopyColorTable),
+ TABLE_ENTRY(GetColorTable),
+ TABLE_ENTRY(GetColorTableParameterfv),
+ TABLE_ENTRY(GetColorTableParameteriv),
+ TABLE_ENTRY(ColorSubTable),
+ TABLE_ENTRY(CopyColorSubTable),
+ TABLE_ENTRY(ConvolutionFilter1D),
+ TABLE_ENTRY(ConvolutionFilter2D),
+ TABLE_ENTRY(ConvolutionParameterf),
+ TABLE_ENTRY(ConvolutionParameterfv),
+ TABLE_ENTRY(ConvolutionParameteri),
+ TABLE_ENTRY(ConvolutionParameteriv),
+ TABLE_ENTRY(CopyConvolutionFilter1D),
+ TABLE_ENTRY(CopyConvolutionFilter2D),
+ TABLE_ENTRY(GetConvolutionFilter),
+ TABLE_ENTRY(GetConvolutionParameterfv),
+ TABLE_ENTRY(GetConvolutionParameteriv),
+ TABLE_ENTRY(GetSeparableFilter),
+ TABLE_ENTRY(SeparableFilter2D),
+ TABLE_ENTRY(GetHistogram),
+ TABLE_ENTRY(GetHistogramParameterfv),
+ TABLE_ENTRY(GetHistogramParameteriv),
+ TABLE_ENTRY(GetMinmax),
+ TABLE_ENTRY(GetMinmaxParameterfv),
+ TABLE_ENTRY(GetMinmaxParameteriv),
+ TABLE_ENTRY(Histogram),
+ TABLE_ENTRY(Minmax),
+ TABLE_ENTRY(ResetHistogram),
+ TABLE_ENTRY(ResetMinmax),
+ TABLE_ENTRY(TexImage3D),
+ TABLE_ENTRY(TexSubImage3D),
+ TABLE_ENTRY(CopyTexSubImage3D),
+ TABLE_ENTRY(ActiveTextureARB),
+ TABLE_ENTRY(ClientActiveTextureARB),
+ TABLE_ENTRY(MultiTexCoord1dARB),
+ TABLE_ENTRY(MultiTexCoord1dvARB),
+ TABLE_ENTRY(MultiTexCoord1fARB),
+ TABLE_ENTRY(MultiTexCoord1fvARB),
+ TABLE_ENTRY(MultiTexCoord1iARB),
+ TABLE_ENTRY(MultiTexCoord1ivARB),
+ TABLE_ENTRY(MultiTexCoord1sARB),
+ TABLE_ENTRY(MultiTexCoord1svARB),
+ TABLE_ENTRY(MultiTexCoord2dARB),
+ TABLE_ENTRY(MultiTexCoord2dvARB),
+ TABLE_ENTRY(MultiTexCoord2fARB),
+ TABLE_ENTRY(MultiTexCoord2fvARB),
+ TABLE_ENTRY(MultiTexCoord2iARB),
+ TABLE_ENTRY(MultiTexCoord2ivARB),
+ TABLE_ENTRY(MultiTexCoord2sARB),
+ TABLE_ENTRY(MultiTexCoord2svARB),
+ TABLE_ENTRY(MultiTexCoord3dARB),
+ TABLE_ENTRY(MultiTexCoord3dvARB),
+ TABLE_ENTRY(MultiTexCoord3fARB),
+ TABLE_ENTRY(MultiTexCoord3fvARB),
+ TABLE_ENTRY(MultiTexCoord3iARB),
+ TABLE_ENTRY(MultiTexCoord3ivARB),
+ TABLE_ENTRY(MultiTexCoord3sARB),
+ TABLE_ENTRY(MultiTexCoord3svARB),
+ TABLE_ENTRY(MultiTexCoord4dARB),
+ TABLE_ENTRY(MultiTexCoord4dvARB),
+ TABLE_ENTRY(MultiTexCoord4fARB),
+ TABLE_ENTRY(MultiTexCoord4fvARB),
+ TABLE_ENTRY(MultiTexCoord4iARB),
+ TABLE_ENTRY(MultiTexCoord4ivARB),
+ TABLE_ENTRY(MultiTexCoord4sARB),
+ TABLE_ENTRY(MultiTexCoord4svARB),
+ TABLE_ENTRY(LoadTransposeMatrixfARB),
+ TABLE_ENTRY(LoadTransposeMatrixdARB),
+ TABLE_ENTRY(MultTransposeMatrixfARB),
+ TABLE_ENTRY(MultTransposeMatrixdARB),
+ TABLE_ENTRY(SampleCoverageARB),
+ TABLE_ENTRY(__unused413),
+ TABLE_ENTRY(PolygonOffsetEXT),
+ TABLE_ENTRY(GetTexFilterFuncSGIS),
+ TABLE_ENTRY(TexFilterFuncSGIS),
+ TABLE_ENTRY(GetHistogramEXT),
+ TABLE_ENTRY(GetHistogramParameterfvEXT),
+ TABLE_ENTRY(GetHistogramParameterivEXT),
+ TABLE_ENTRY(GetMinmaxEXT),
+ TABLE_ENTRY(GetMinmaxParameterfvEXT),
+ TABLE_ENTRY(GetMinmaxParameterivEXT),
+ TABLE_ENTRY(GetConvolutionFilterEXT),
+ TABLE_ENTRY(GetConvolutionParameterfvEXT),
+ TABLE_ENTRY(GetConvolutionParameterivEXT),
+ TABLE_ENTRY(GetSeparableFilterEXT),
+ TABLE_ENTRY(GetColorTableSGI),
+ TABLE_ENTRY(GetColorTableParameterfvSGI),
+ TABLE_ENTRY(GetColorTableParameterivSGI),
+ TABLE_ENTRY(PixelTexGenSGIX),
+ TABLE_ENTRY(PixelTexGenParameteriSGIS),
+ TABLE_ENTRY(PixelTexGenParameterivSGIS),
+ TABLE_ENTRY(PixelTexGenParameterfSGIS),
+ TABLE_ENTRY(PixelTexGenParameterfvSGIS),
+ TABLE_ENTRY(GetPixelTexGenParameterivSGIS),
+ TABLE_ENTRY(GetPixelTexGenParameterfvSGIS),
+ TABLE_ENTRY(TexImage4DSGIS),
+ TABLE_ENTRY(TexSubImage4DSGIS),
+ TABLE_ENTRY(AreTexturesResidentEXT),
+ TABLE_ENTRY(GenTexturesEXT),
+ TABLE_ENTRY(IsTextureEXT),
+ TABLE_ENTRY(DetailTexFuncSGIS),
+ TABLE_ENTRY(GetDetailTexFuncSGIS),
+ TABLE_ENTRY(SharpenTexFuncSGIS),
+ TABLE_ENTRY(GetSharpenTexFuncSGIS),
+ TABLE_ENTRY(SampleMaskSGIS),
+ TABLE_ENTRY(SamplePatternSGIS),
+ TABLE_ENTRY(ColorPointerEXT),
+ TABLE_ENTRY(EdgeFlagPointerEXT),
+ TABLE_ENTRY(IndexPointerEXT),
+ TABLE_ENTRY(NormalPointerEXT),
+ TABLE_ENTRY(TexCoordPointerEXT),
+ TABLE_ENTRY(VertexPointerEXT),
+ TABLE_ENTRY(SpriteParameterfSGIX),
+ TABLE_ENTRY(SpriteParameterfvSGIX),
+ TABLE_ENTRY(SpriteParameteriSGIX),
+ TABLE_ENTRY(SpriteParameterivSGIX),
+ TABLE_ENTRY(PointParameterfEXT),
+ TABLE_ENTRY(PointParameterfvEXT),
+ TABLE_ENTRY(GetInstrumentsSGIX),
+ TABLE_ENTRY(InstrumentsBufferSGIX),
+ TABLE_ENTRY(PollInstrumentsSGIX),
+ TABLE_ENTRY(ReadInstrumentsSGIX),
+ TABLE_ENTRY(StartInstrumentsSGIX),
+ TABLE_ENTRY(StopInstrumentsSGIX),
+ TABLE_ENTRY(FrameZoomSGIX),
+ TABLE_ENTRY(TagSampleBufferSGIX),
+ TABLE_ENTRY(ReferencePlaneSGIX),
+ TABLE_ENTRY(FlushRasterSGIX),
+ TABLE_ENTRY(GetListParameterfvSGIX),
+ TABLE_ENTRY(GetListParameterivSGIX),
+ TABLE_ENTRY(ListParameterfSGIX),
+ TABLE_ENTRY(ListParameterfvSGIX),
+ TABLE_ENTRY(ListParameteriSGIX),
+ TABLE_ENTRY(ListParameterivSGIX),
+ TABLE_ENTRY(FragmentColorMaterialSGIX),
+ TABLE_ENTRY(FragmentLightfSGIX),
+ TABLE_ENTRY(FragmentLightfvSGIX),
+ TABLE_ENTRY(FragmentLightiSGIX),
+ TABLE_ENTRY(FragmentLightivSGIX),
+ TABLE_ENTRY(FragmentLightModelfSGIX),
+ TABLE_ENTRY(FragmentLightModelfvSGIX),
+ TABLE_ENTRY(FragmentLightModeliSGIX),
+ TABLE_ENTRY(FragmentLightModelivSGIX),
+ TABLE_ENTRY(FragmentMaterialfSGIX),
+ TABLE_ENTRY(FragmentMaterialfvSGIX),
+ TABLE_ENTRY(FragmentMaterialiSGIX),
+ TABLE_ENTRY(FragmentMaterialivSGIX),
+ TABLE_ENTRY(GetFragmentLightfvSGIX),
+ TABLE_ENTRY(GetFragmentLightivSGIX),
+ TABLE_ENTRY(GetFragmentMaterialfvSGIX),
+ TABLE_ENTRY(GetFragmentMaterialivSGIX),
+ TABLE_ENTRY(LightEnviSGIX),
+ TABLE_ENTRY(VertexWeightfEXT),
+ TABLE_ENTRY(VertexWeightfvEXT),
+ TABLE_ENTRY(VertexWeightPointerEXT),
+ TABLE_ENTRY(FlushVertexArrayRangeNV),
+ TABLE_ENTRY(VertexArrayRangeNV),
+ TABLE_ENTRY(CombinerParameterfvNV),
+ TABLE_ENTRY(CombinerParameterfNV),
+ TABLE_ENTRY(CombinerParameterivNV),
+ TABLE_ENTRY(CombinerParameteriNV),
+ TABLE_ENTRY(CombinerInputNV),
+ TABLE_ENTRY(CombinerOutputNV),
+ TABLE_ENTRY(FinalCombinerInputNV),
+ TABLE_ENTRY(GetCombinerInputParameterfvNV),
+ TABLE_ENTRY(GetCombinerInputParameterivNV),
+ TABLE_ENTRY(GetCombinerOutputParameterfvNV),
+ TABLE_ENTRY(GetCombinerOutputParameterivNV),
+ TABLE_ENTRY(GetFinalCombinerInputParameterfvNV),
+ TABLE_ENTRY(GetFinalCombinerInputParameterivNV),
+ TABLE_ENTRY(ResizeBuffersMESA),
+ TABLE_ENTRY(WindowPos2dMESA),
+ TABLE_ENTRY(WindowPos2dvMESA),
+ TABLE_ENTRY(WindowPos2fMESA),
+ TABLE_ENTRY(WindowPos2fvMESA),
+ TABLE_ENTRY(WindowPos2iMESA),
+ TABLE_ENTRY(WindowPos2ivMESA),
+ TABLE_ENTRY(WindowPos2sMESA),
+ TABLE_ENTRY(WindowPos2svMESA),
+ TABLE_ENTRY(WindowPos3dMESA),
+ TABLE_ENTRY(WindowPos3dvMESA),
+ TABLE_ENTRY(WindowPos3fMESA),
+ TABLE_ENTRY(WindowPos3fvMESA),
+ TABLE_ENTRY(WindowPos3iMESA),
+ TABLE_ENTRY(WindowPos3ivMESA),
+ TABLE_ENTRY(WindowPos3sMESA),
+ TABLE_ENTRY(WindowPos3svMESA),
+ TABLE_ENTRY(WindowPos4dMESA),
+ TABLE_ENTRY(WindowPos4dvMESA),
+ TABLE_ENTRY(WindowPos4fMESA),
+ TABLE_ENTRY(WindowPos4fvMESA),
+ TABLE_ENTRY(WindowPos4iMESA),
+ TABLE_ENTRY(WindowPos4ivMESA),
+ TABLE_ENTRY(WindowPos4sMESA),
+ TABLE_ENTRY(WindowPos4svMESA),
+ TABLE_ENTRY(BlendFuncSeparateEXT),
+ TABLE_ENTRY(IndexMaterialEXT),
+ TABLE_ENTRY(IndexFuncEXT),
+ TABLE_ENTRY(LockArraysEXT),
+ TABLE_ENTRY(UnlockArraysEXT),
+ TABLE_ENTRY(CullParameterdvEXT),
+ TABLE_ENTRY(CullParameterfvEXT),
+ TABLE_ENTRY(HintPGI),
+ TABLE_ENTRY(FogCoordfEXT),
+ TABLE_ENTRY(FogCoordfvEXT),
+ TABLE_ENTRY(FogCoorddEXT),
+ TABLE_ENTRY(FogCoorddvEXT),
+ TABLE_ENTRY(FogCoordPointerEXT),
+ TABLE_ENTRY(GetColorTableEXT),
+ TABLE_ENTRY(GetColorTableParameterivEXT),
+ TABLE_ENTRY(GetColorTableParameterfvEXT),
+ TABLE_ENTRY(TbufferMask3DFX),
+ TABLE_ENTRY(CompressedTexImage3DARB),
+ TABLE_ENTRY(CompressedTexImage2DARB),
+ TABLE_ENTRY(CompressedTexImage1DARB),
+ TABLE_ENTRY(CompressedTexSubImage3DARB),
+ TABLE_ENTRY(CompressedTexSubImage2DARB),
+ TABLE_ENTRY(CompressedTexSubImage1DARB),
+ TABLE_ENTRY(GetCompressedTexImageARB),
+ TABLE_ENTRY(SecondaryColor3bEXT),
+ TABLE_ENTRY(SecondaryColor3bvEXT),
+ TABLE_ENTRY(SecondaryColor3dEXT),
+ TABLE_ENTRY(SecondaryColor3dvEXT),
+ TABLE_ENTRY(SecondaryColor3fEXT),
+ TABLE_ENTRY(SecondaryColor3fvEXT),
+ TABLE_ENTRY(SecondaryColor3iEXT),
+ TABLE_ENTRY(SecondaryColor3ivEXT),
+ TABLE_ENTRY(SecondaryColor3sEXT),
+ TABLE_ENTRY(SecondaryColor3svEXT),
+ TABLE_ENTRY(SecondaryColor3ubEXT),
+ TABLE_ENTRY(SecondaryColor3ubvEXT),
+ TABLE_ENTRY(SecondaryColor3uiEXT),
+ TABLE_ENTRY(SecondaryColor3uivEXT),
+ TABLE_ENTRY(SecondaryColor3usEXT),
+ TABLE_ENTRY(SecondaryColor3usvEXT),
+ TABLE_ENTRY(SecondaryColorPointerEXT),
+ TABLE_ENTRY(AreProgramsResidentNV),
+ TABLE_ENTRY(BindProgramNV),
+ TABLE_ENTRY(DeleteProgramsNV),
+ TABLE_ENTRY(ExecuteProgramNV),
+ TABLE_ENTRY(GenProgramsNV),
+ TABLE_ENTRY(GetProgramParameterdvNV),
+ TABLE_ENTRY(GetProgramParameterfvNV),
+ TABLE_ENTRY(GetProgramivNV),
+ TABLE_ENTRY(GetProgramStringNV),
+ TABLE_ENTRY(GetTrackMatrixivNV),
+ TABLE_ENTRY(GetVertexAttribdvNV),
+ TABLE_ENTRY(GetVertexAttribfvNV),
+ TABLE_ENTRY(GetVertexAttribivNV),
+ TABLE_ENTRY(GetVertexAttribPointervNV),
+ TABLE_ENTRY(IsProgramNV),
+ TABLE_ENTRY(LoadProgramNV),
+ TABLE_ENTRY(ProgramParameter4dNV),
+ TABLE_ENTRY(ProgramParameter4dvNV),
+ TABLE_ENTRY(ProgramParameter4fNV),
+ TABLE_ENTRY(ProgramParameter4fvNV),
+ TABLE_ENTRY(ProgramParameters4dvNV),
+ TABLE_ENTRY(ProgramParameters4fvNV),
+ TABLE_ENTRY(RequestResidentProgramsNV),
+ TABLE_ENTRY(TrackMatrixNV),
+ TABLE_ENTRY(VertexAttribPointerNV),
+ TABLE_ENTRY(VertexAttrib1dNV),
+ TABLE_ENTRY(VertexAttrib1dvNV),
+ TABLE_ENTRY(VertexAttrib1fNV),
+ TABLE_ENTRY(VertexAttrib1fvNV),
+ TABLE_ENTRY(VertexAttrib1sNV),
+ TABLE_ENTRY(VertexAttrib1svNV),
+ TABLE_ENTRY(VertexAttrib2dNV),
+ TABLE_ENTRY(VertexAttrib2dvNV),
+ TABLE_ENTRY(VertexAttrib2fNV),
+ TABLE_ENTRY(VertexAttrib2fvNV),
+ TABLE_ENTRY(VertexAttrib2sNV),
+ TABLE_ENTRY(VertexAttrib2svNV),
+ TABLE_ENTRY(VertexAttrib3dNV),
+ TABLE_ENTRY(VertexAttrib3dvNV),
+ TABLE_ENTRY(VertexAttrib3fNV),
+ TABLE_ENTRY(VertexAttrib3fvNV),
+ TABLE_ENTRY(VertexAttrib3sNV),
+ TABLE_ENTRY(VertexAttrib3svNV),
+ TABLE_ENTRY(VertexAttrib4dNV),
+ TABLE_ENTRY(VertexAttrib4dvNV),
+ TABLE_ENTRY(VertexAttrib4fNV),
+ TABLE_ENTRY(VertexAttrib4fvNV),
+ TABLE_ENTRY(VertexAttrib4sNV),
+ TABLE_ENTRY(VertexAttrib4svNV),
+ TABLE_ENTRY(VertexAttrib4ubNV),
+ TABLE_ENTRY(VertexAttrib4ubvNV),
+ TABLE_ENTRY(VertexAttribs1dvNV),
+ TABLE_ENTRY(VertexAttribs1fvNV),
+ TABLE_ENTRY(VertexAttribs1svNV),
+ TABLE_ENTRY(VertexAttribs2dvNV),
+ TABLE_ENTRY(VertexAttribs2fvNV),
+ TABLE_ENTRY(VertexAttribs2svNV),
+ TABLE_ENTRY(VertexAttribs3dvNV),
+ TABLE_ENTRY(VertexAttribs3fvNV),
+ TABLE_ENTRY(VertexAttribs3svNV),
+ TABLE_ENTRY(VertexAttribs4dvNV),
+ TABLE_ENTRY(VertexAttribs4fvNV),
+ TABLE_ENTRY(VertexAttribs4svNV),
+ TABLE_ENTRY(VertexAttribs4ubvNV),
+ TABLE_ENTRY(PointParameteriNV),
+ TABLE_ENTRY(PointParameterivNV),
+ TABLE_ENTRY(MultiDrawArraysEXT),
+ TABLE_ENTRY(MultiDrawElementsEXT),
+ TABLE_ENTRY(ActiveStencilFaceEXT),
+ TABLE_ENTRY(DeleteFencesNV),
+ TABLE_ENTRY(GenFencesNV),
+ TABLE_ENTRY(IsFenceNV),
+ TABLE_ENTRY(TestFenceNV),
+ TABLE_ENTRY(GetFenceivNV),
+ TABLE_ENTRY(FinishFenceNV),
+ TABLE_ENTRY(SetFenceNV),
+ TABLE_ENTRY(VertexAttrib4bvARB),
+ TABLE_ENTRY(VertexAttrib4ivARB),
+ TABLE_ENTRY(VertexAttrib4ubvARB),
+ TABLE_ENTRY(VertexAttrib4usvARB),
+ TABLE_ENTRY(VertexAttrib4uivARB),
+ TABLE_ENTRY(VertexAttrib4NbvARB),
+ TABLE_ENTRY(VertexAttrib4NsvARB),
+ TABLE_ENTRY(VertexAttrib4NivARB),
+ TABLE_ENTRY(VertexAttrib4NusvARB),
+ TABLE_ENTRY(VertexAttrib4NuivARB),
+ TABLE_ENTRY(VertexAttribPointerARB),
+ TABLE_ENTRY(EnableVertexAttribArrayARB),
+ TABLE_ENTRY(DisableVertexAttribArrayARB),
+ TABLE_ENTRY(ProgramStringARB),
+ TABLE_ENTRY(ProgramEnvParameter4dARB),
+ TABLE_ENTRY(ProgramEnvParameter4dvARB),
+ TABLE_ENTRY(ProgramEnvParameter4fARB),
+ TABLE_ENTRY(ProgramEnvParameter4fvARB),
+ TABLE_ENTRY(ProgramLocalParameter4dARB),
+ TABLE_ENTRY(ProgramLocalParameter4dvARB),
+ TABLE_ENTRY(ProgramLocalParameter4fARB),
+ TABLE_ENTRY(ProgramLocalParameter4fvARB),
+ TABLE_ENTRY(GetProgramEnvParameterdvARB),
+ TABLE_ENTRY(GetProgramEnvParameterfvARB),
+ TABLE_ENTRY(GetProgramLocalParameterdvARB),
+ TABLE_ENTRY(GetProgramLocalParameterfvARB),
+ TABLE_ENTRY(GetProgramivARB),
+ TABLE_ENTRY(GetProgramStringARB),
+ TABLE_ENTRY(ProgramNamedParameter4fNV),
+ TABLE_ENTRY(ProgramNamedParameter4dNV),
+ TABLE_ENTRY(ProgramNamedParameter4fvNV),
+ TABLE_ENTRY(ProgramNamedParameter4dvNV),
+ TABLE_ENTRY(GetProgramNamedParameterfvNV),
+ TABLE_ENTRY(GetProgramNamedParameterdvNV),
+ TABLE_ENTRY(BindBufferARB),
+ TABLE_ENTRY(BufferDataARB),
+ TABLE_ENTRY(BufferSubDataARB),
+ TABLE_ENTRY(DeleteBuffersARB),
+ TABLE_ENTRY(GenBuffersARB),
+ TABLE_ENTRY(GetBufferParameterivARB),
+ TABLE_ENTRY(GetBufferPointervARB),
+ TABLE_ENTRY(GetBufferSubDataARB),
+ TABLE_ENTRY(IsBufferARB),
+ TABLE_ENTRY(MapBufferARB),
+ TABLE_ENTRY(UnmapBufferARB),
+ TABLE_ENTRY(DepthBoundsEXT),
+ TABLE_ENTRY(GenQueriesARB),
+ TABLE_ENTRY(DeleteQueriesARB),
+ TABLE_ENTRY(IsQueryARB),
+ TABLE_ENTRY(BeginQueryARB),
+ TABLE_ENTRY(EndQueryARB),
+ TABLE_ENTRY(GetQueryivARB),
+ TABLE_ENTRY(GetQueryObjectivARB),
+ TABLE_ENTRY(GetQueryObjectuivARB),
+ TABLE_ENTRY(MultiModeDrawArraysIBM),
+ TABLE_ENTRY(MultiModeDrawElementsIBM),
+ TABLE_ENTRY(BlendEquationSeparateEXT),
+ /* A whole bunch of no-op functions. These might be called
+ * when someone tries to call a dynamically-registered
+ * extension function without a current rendering context.
+ */
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+ TABLE_ENTRY(Unused),
+};
+#endif /* DISPATCH_TABLE_NAME */
+
+
+/*
+ * This is just used to silence compiler warnings.
+ * We list the functions which are not otherwise used.
+ */
+#ifdef UNUSED_TABLE_NAME
+static _glapi_proc UNUSED_TABLE_NAME[] = {
+ TABLE_ENTRY(ActiveTexture),
+ TABLE_ENTRY(ClientActiveTexture),
+ TABLE_ENTRY(MultiTexCoord1d),
+ TABLE_ENTRY(MultiTexCoord1dv),
+ TABLE_ENTRY(MultiTexCoord1f),
+ TABLE_ENTRY(MultiTexCoord1fv),
+ TABLE_ENTRY(MultiTexCoord1i),
+ TABLE_ENTRY(MultiTexCoord1iv),
+ TABLE_ENTRY(MultiTexCoord1s),
+ TABLE_ENTRY(MultiTexCoord1sv),
+ TABLE_ENTRY(MultiTexCoord2d),
+ TABLE_ENTRY(MultiTexCoord2dv),
+ TABLE_ENTRY(MultiTexCoord2f),
+ TABLE_ENTRY(MultiTexCoord2fv),
+ TABLE_ENTRY(MultiTexCoord2i),
+ TABLE_ENTRY(MultiTexCoord2iv),
+ TABLE_ENTRY(MultiTexCoord2s),
+ TABLE_ENTRY(MultiTexCoord2sv),
+ TABLE_ENTRY(MultiTexCoord3d),
+ TABLE_ENTRY(MultiTexCoord3dv),
+ TABLE_ENTRY(MultiTexCoord3f),
+ TABLE_ENTRY(MultiTexCoord3fv),
+ TABLE_ENTRY(MultiTexCoord3i),
+ TABLE_ENTRY(MultiTexCoord3iv),
+ TABLE_ENTRY(MultiTexCoord3s),
+ TABLE_ENTRY(MultiTexCoord3sv),
+ TABLE_ENTRY(MultiTexCoord4d),
+ TABLE_ENTRY(MultiTexCoord4dv),
+ TABLE_ENTRY(MultiTexCoord4f),
+ TABLE_ENTRY(MultiTexCoord4fv),
+ TABLE_ENTRY(MultiTexCoord4i),
+ TABLE_ENTRY(MultiTexCoord4iv),
+ TABLE_ENTRY(MultiTexCoord4s),
+ TABLE_ENTRY(MultiTexCoord4sv),
+ TABLE_ENTRY(LoadTransposeMatrixf),
+ TABLE_ENTRY(LoadTransposeMatrixd),
+ TABLE_ENTRY(MultTransposeMatrixf),
+ TABLE_ENTRY(MultTransposeMatrixd),
+ TABLE_ENTRY(SampleCoverage),
+ TABLE_ENTRY(CompressedTexImage3D),
+ TABLE_ENTRY(CompressedTexImage2D),
+ TABLE_ENTRY(CompressedTexImage1D),
+ TABLE_ENTRY(CompressedTexSubImage3D),
+ TABLE_ENTRY(CompressedTexSubImage2D),
+ TABLE_ENTRY(CompressedTexSubImage1D),
+ TABLE_ENTRY(GetCompressedTexImage),
+ TABLE_ENTRY(BlendFuncSeparate),
+ TABLE_ENTRY(FogCoordf),
+ TABLE_ENTRY(FogCoordfv),
+ TABLE_ENTRY(FogCoordd),
+ TABLE_ENTRY(FogCoorddv),
+ TABLE_ENTRY(FogCoordPointer),
+ TABLE_ENTRY(MultiDrawArrays),
+ TABLE_ENTRY(MultiDrawElements),
+ TABLE_ENTRY(PointParameterf),
+ TABLE_ENTRY(PointParameterfv),
+ TABLE_ENTRY(PointParameteri),
+ TABLE_ENTRY(PointParameteriv),
+ TABLE_ENTRY(SecondaryColor3b),
+ TABLE_ENTRY(SecondaryColor3bv),
+ TABLE_ENTRY(SecondaryColor3d),
+ TABLE_ENTRY(SecondaryColor3dv),
+ TABLE_ENTRY(SecondaryColor3f),
+ TABLE_ENTRY(SecondaryColor3fv),
+ TABLE_ENTRY(SecondaryColor3i),
+ TABLE_ENTRY(SecondaryColor3iv),
+ TABLE_ENTRY(SecondaryColor3s),
+ TABLE_ENTRY(SecondaryColor3sv),
+ TABLE_ENTRY(SecondaryColor3ub),
+ TABLE_ENTRY(SecondaryColor3ubv),
+ TABLE_ENTRY(SecondaryColor3ui),
+ TABLE_ENTRY(SecondaryColor3uiv),
+ TABLE_ENTRY(SecondaryColor3us),
+ TABLE_ENTRY(SecondaryColor3usv),
+ TABLE_ENTRY(SecondaryColorPointer),
+ TABLE_ENTRY(WindowPos2d),
+ TABLE_ENTRY(WindowPos2dv),
+ TABLE_ENTRY(WindowPos2f),
+ TABLE_ENTRY(WindowPos2fv),
+ TABLE_ENTRY(WindowPos2i),
+ TABLE_ENTRY(WindowPos2iv),
+ TABLE_ENTRY(WindowPos2s),
+ TABLE_ENTRY(WindowPos2sv),
+ TABLE_ENTRY(WindowPos3d),
+ TABLE_ENTRY(WindowPos3dv),
+ TABLE_ENTRY(WindowPos3f),
+ TABLE_ENTRY(WindowPos3fv),
+ TABLE_ENTRY(WindowPos3i),
+ TABLE_ENTRY(WindowPos3iv),
+ TABLE_ENTRY(WindowPos3s),
+ TABLE_ENTRY(WindowPos3sv),
+ TABLE_ENTRY(BindBuffer),
+ TABLE_ENTRY(BufferData),
+ TABLE_ENTRY(BufferSubData),
+ TABLE_ENTRY(DeleteBuffers),
+ TABLE_ENTRY(GenBuffers),
+ TABLE_ENTRY(GetBufferParameteriv),
+ TABLE_ENTRY(GetBufferPointerv),
+ TABLE_ENTRY(GetBufferSubData),
+ TABLE_ENTRY(IsBuffer),
+ TABLE_ENTRY(MapBuffer),
+ TABLE_ENTRY(UnmapBuffer),
+ TABLE_ENTRY(GenQueries),
+ TABLE_ENTRY(DeleteQueries),
+ TABLE_ENTRY(IsQuery),
+ TABLE_ENTRY(BeginQuery),
+ TABLE_ENTRY(EndQuery),
+ TABLE_ENTRY(GetQueryiv),
+ TABLE_ENTRY(GetQueryObjectiv),
+ TABLE_ENTRY(GetQueryObjectuiv),
+ TABLE_ENTRY(PointParameterfARB),
+ TABLE_ENTRY(PointParameterfvARB),
+ TABLE_ENTRY(WindowPos2dARB),
+ TABLE_ENTRY(WindowPos2fARB),
+ TABLE_ENTRY(WindowPos2iARB),
+ TABLE_ENTRY(WindowPos2sARB),
+ TABLE_ENTRY(WindowPos2dvARB),
+ TABLE_ENTRY(WindowPos2fvARB),
+ TABLE_ENTRY(WindowPos2ivARB),
+ TABLE_ENTRY(WindowPos2svARB),
+ TABLE_ENTRY(WindowPos3dARB),
+ TABLE_ENTRY(WindowPos3fARB),
+ TABLE_ENTRY(WindowPos3iARB),
+ TABLE_ENTRY(WindowPos3sARB),
+ TABLE_ENTRY(WindowPos3dvARB),
+ TABLE_ENTRY(WindowPos3fvARB),
+ TABLE_ENTRY(WindowPos3ivARB),
+ TABLE_ENTRY(WindowPos3svARB),
+ TABLE_ENTRY(VertexAttrib1sARB),
+ TABLE_ENTRY(VertexAttrib1fARB),
+ TABLE_ENTRY(VertexAttrib1dARB),
+ TABLE_ENTRY(VertexAttrib2sARB),
+ TABLE_ENTRY(VertexAttrib2fARB),
+ TABLE_ENTRY(VertexAttrib2dARB),
+ TABLE_ENTRY(VertexAttrib3sARB),
+ TABLE_ENTRY(VertexAttrib3fARB),
+ TABLE_ENTRY(VertexAttrib3dARB),
+ TABLE_ENTRY(VertexAttrib4sARB),
+ TABLE_ENTRY(VertexAttrib4fARB),
+ TABLE_ENTRY(VertexAttrib4dARB),
+ TABLE_ENTRY(VertexAttrib4NubARB),
+ TABLE_ENTRY(VertexAttrib1svARB),
+ TABLE_ENTRY(VertexAttrib1fvARB),
+ TABLE_ENTRY(VertexAttrib1dvARB),
+ TABLE_ENTRY(VertexAttrib2svARB),
+ TABLE_ENTRY(VertexAttrib2fvARB),
+ TABLE_ENTRY(VertexAttrib2dvARB),
+ TABLE_ENTRY(VertexAttrib3svARB),
+ TABLE_ENTRY(VertexAttrib3fvARB),
+ TABLE_ENTRY(VertexAttrib3dvARB),
+ TABLE_ENTRY(VertexAttrib4svARB),
+ TABLE_ENTRY(VertexAttrib4fvARB),
+ TABLE_ENTRY(VertexAttrib4dvARB),
+ TABLE_ENTRY(VertexAttrib4NubvARB),
+ TABLE_ENTRY(BindProgramARB),
+ TABLE_ENTRY(DeleteProgramsARB),
+ TABLE_ENTRY(GenProgramsARB),
+ TABLE_ENTRY(IsProgramARB),
+ TABLE_ENTRY(GetVertexAttribdvARB),
+ TABLE_ENTRY(GetVertexAttribfvARB),
+ TABLE_ENTRY(GetVertexAttribivARB),
+ TABLE_ENTRY(GetVertexAttribPointervARB),
+ TABLE_ENTRY(BlendColorEXT),
+ TABLE_ENTRY(TexImage3DEXT),
+ TABLE_ENTRY(TexSubImage3DEXT),
+ TABLE_ENTRY(TexSubImage1DEXT),
+ TABLE_ENTRY(TexSubImage2DEXT),
+ TABLE_ENTRY(CopyTexImage1DEXT),
+ TABLE_ENTRY(CopyTexImage2DEXT),
+ TABLE_ENTRY(CopyTexSubImage1DEXT),
+ TABLE_ENTRY(CopyTexSubImage2DEXT),
+ TABLE_ENTRY(CopyTexSubImage3DEXT),
+ TABLE_ENTRY(HistogramEXT),
+ TABLE_ENTRY(MinmaxEXT),
+ TABLE_ENTRY(ResetHistogramEXT),
+ TABLE_ENTRY(ResetMinmaxEXT),
+ TABLE_ENTRY(ConvolutionFilter1DEXT),
+ TABLE_ENTRY(ConvolutionFilter2DEXT),
+ TABLE_ENTRY(ConvolutionParameterfEXT),
+ TABLE_ENTRY(ConvolutionParameterfvEXT),
+ TABLE_ENTRY(ConvolutionParameteriEXT),
+ TABLE_ENTRY(ConvolutionParameterivEXT),
+ TABLE_ENTRY(CopyConvolutionFilter1DEXT),
+ TABLE_ENTRY(CopyConvolutionFilter2DEXT),
+ TABLE_ENTRY(SeparableFilter2DEXT),
+ TABLE_ENTRY(ColorTableSGI),
+ TABLE_ENTRY(ColorTableParameterfvSGI),
+ TABLE_ENTRY(ColorTableParameterivSGI),
+ TABLE_ENTRY(CopyColorTableSGI),
+ TABLE_ENTRY(BindTextureEXT),
+ TABLE_ENTRY(DeleteTexturesEXT),
+ TABLE_ENTRY(PrioritizeTexturesEXT),
+ TABLE_ENTRY(ArrayElementEXT),
+ TABLE_ENTRY(DrawArraysEXT),
+ TABLE_ENTRY(GetPointervEXT),
+ TABLE_ENTRY(BlendEquationEXT),
+ TABLE_ENTRY(ColorSubTableEXT),
+ TABLE_ENTRY(CopyColorSubTableEXT),
+ TABLE_ENTRY(ColorTableEXT),
+ TABLE_ENTRY(DrawRangeElementsEXT),
+ TABLE_ENTRY(SampleMaskEXT),
+ TABLE_ENTRY(SamplePatternEXT),
+ TABLE_ENTRY(BlendEquationSeparateATI),
+ TABLE_ENTRY(BlendFuncSeparateINGR),
+ TABLE_ENTRY(PointParameterfSGIS),
+ TABLE_ENTRY(PointParameterfvSGIS),
+};
+#endif /*UNUSED_TABLE_NAME*/
+
+
+#undef KEYWORD1
+#undef KEYWORD2
+#undef NAME
+#undef DISPATCH
+#undef RETURN_DISPATCH
+#undef DISPATCH_TABLE_NAME
+#undef UNUSED_TABLE_NAME
+#undef TABLE_ENTRY
+
Index: xc/extras/Mesa/src/mesa/glapi/glapitemp.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glapitemp.py:1.1.1.2
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glapitemp.py Fri Dec 10 10:05:31 2004
@@ -0,0 +1,285 @@
+#!/usr/bin/env python
+
+# $Id: glapitemp.py,v 1.6 2004/06/29 19:08:20 idr Exp $
+
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Generate the glapitemp.h file.
+#
+# Usage:
+# gloffsets.py >glapitemp.h
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+import string
+import apiparser;
+
+
+def PrintHead():
+ print """
+/* DO NOT EDIT! This file is generated by the glapitemp.py script. */
+
+/*
+ * This file is a template which generates the OpenGL API entry point
+ * functions. It should be included by a .c file which first defines
+ * the following macros:
+ * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32
+ * KEYWORD2 - usually nothing, but might be __stdcall on Win32
+ * NAME(n) - builds the final function name (usually add "gl" prefix)
+ * DISPATCH(func, args, msg) - code to do dispatch of named function.
+ * msg is a printf-style debug message.
+ * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value
+ *
+ * Here's an example which generates the usual OpenGL functions:
+ * #define KEYWORD1
+ * #define KEYWORD2
+ * #define NAME(func) gl##func
+ * #define DISPATCH(func, args, msg) \\
+ * struct _glapi_table *dispatch = CurrentDispatch; \\
+ * (*dispatch->func) args
+ * #define RETURN DISPATCH(func, args, msg) \\
+ * struct _glapi_table *dispatch = CurrentDispatch; \\
+ * return (*dispatch->func) args
+ *
+ */
+
+
+#if defined( NAME )
+#ifndef KEYWORD1
+#define KEYWORD1
+#endif
+
+#ifndef KEYWORD2
+#define KEYWORD2
+#endif
+
+#ifndef DISPATCH
+#error DISPATCH must be defined
+#endif
+
+#ifndef RETURN_DISPATCH
+#error RETURN_DISPATCH must be defined
+#endif
+
+GLAPI void GLAPIENTRY gl__unused413(void); /* silence warning */
+"""
+
+#enddef
+
+
+def PrintTail():
+ print"""
+#undef KEYWORD1
+#undef KEYWORD2
+#undef NAME
+#undef DISPATCH
+#undef RETURN_DISPATCH
+#undef DISPATCH_TABLE_NAME
+#undef UNUSED_TABLE_NAME
+#undef TABLE_ENTRY
+"""
+#endif
+
+
+def MakeParamList(nameList):
+ n = len(nameList)
+ i = 1
+ result = ''
+ for name in nameList:
+ result = result + name
+ if i < n:
+ result = result + ', '
+ i = i + 1
+ return result
+#enddef
+
+
+def Contains(haystack, needle):
+ if string.find(haystack, needle) >= 0:
+ return 1
+ else:
+ return 0
+#enddef
+
+
+def MakePrintfString(funcName, argTypeList, argNameList):
+ result = '(F, "gl%s(' % (funcName)
+
+ n = len(argTypeList)
+ i = 1
+ isPointer = {}
+ floatv = {}
+ for argType in argTypeList:
+ isPointer[i] = 0
+ floatv[i] = 0
+ if argType == 'GLenum':
+ result = result + '0x%x'
+ elif argType in ['GLfloat', 'GLdouble', 'GLclampf', 'GLclampd']:
+ result = result + '%f'
+ elif argType in ['GLbyte', 'GLubyte', 'GLshort', 'GLushort', 'GLint', 'GLuint', 'GLboolean', 'GLsizei']:
+ result = result + '%d'
+ else:
+ result = result + '%p'
+ isPointer[i] = 1
+ if argType[0:13] == 'const GLfloat' or argType[0:14] == 'const GLdouble':
+ if Contains(funcName, '2fv') or Contains(funcName, '2dv'):
+ result = result + ' /* %g, %g */'
+ floatv[i] = 2
+ elif Contains(funcName, '3fv') or Contains(funcName, '3dv'):
+ result = result + ' /* %g, %g, %g */'
+ floatv[i] = 3
+ elif Contains(funcName, '4fv') or Contains(funcName, '4dv'):
+ result = result + ' /* %g, %g, %g, %g */'
+ floatv[i] = 4
+ #endif
+ if i < n:
+ result = result + ', '
+ i = i + 1
+ #endfor
+
+ result = result + ');\\n"'
+
+ n = len(argNameList)
+ i = 1
+ if n > 0:
+ result = result + ', '
+ for pname in argNameList:
+ if isPointer[i]:
+ result = result + '(const void *) '
+ result = result + pname
+ if floatv[i] == 2:
+ result = result + ', ' + pname + '[0], ' + pname + '[1]'
+ elif floatv[i] == 3:
+ result = result + ', ' + pname + '[0], ' + pname + '[1], ' + pname + '[2]'
+ elif floatv[i] == 4:
+ result = result + ', ' + pname + '[0], ' + pname + '[1], ' + pname + '[2], ' + pname + '[3]'
+ if i < n:
+ result = result + ', '
+ i = i + 1
+ result = result + ')'
+ return result
+#enddef
+
+
+records = []
+emittedFuncs = {}
+aliasedFuncs = []
+
+def FindOffset(funcName):
+ for (name, alias, offset) in records:
+ if name == funcName:
+ return offset
+ #endif
+ #endfor
+ return -1
+#enddef
+
+def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
+ argList = apiparser.MakeArgList(argTypeList, argNameList)
+ parms = MakeParamList(argNameList)
+ printString = MakePrintfString(name, argTypeList, argNameList)
+ if alias == '':
+ dispatchName = name
+ else:
+ dispatchName = alias
+ if offset < 0:
+ offset = FindOffset(dispatchName)
+ if offset >= 0:
+ print 'KEYWORD1 %s KEYWORD2 NAME(%s)(%s)' % (returnType, name, argList)
+ print '{'
+ if returnType == 'void':
+ print ' DISPATCH(%s, (%s), %s);' % (dispatchName, parms, printString)
+ else:
+ print ' RETURN_DISPATCH(%s, (%s), %s);' % (dispatchName, parms, printString)
+ print '}'
+ print ''
+ records.append((name, dispatchName, offset))
+ if not emittedFuncs.has_key(offset):
+ emittedFuncs[offset] = name
+ else:
+ aliasedFuncs.append(name)
+ else:
+ print '/* No dispatch for %s() */' % (name)
+#endif
+
+
+def PrintInitDispatch():
+ print """
+#endif /* defined( NAME ) */
+
+/*
+ * This is how a dispatch table can be initialized with all the functions
+ * we generated above.
+ */
+#ifdef DISPATCH_TABLE_NAME
+
+#ifndef TABLE_ENTRY
+#error TABLE_ENTRY must be defined
+#endif
+
+void *DISPATCH_TABLE_NAME[] = {"""
+ keys = emittedFuncs.keys()
+ keys.sort()
+ for k in keys:
+ print ' TABLE_ENTRY(%s),' % (emittedFuncs[k])
+
+ print ' /* A whole bunch of no-op functions. These might be called'
+ print ' * when someone tries to call a dynamically-registered'
+ print ' * extension function without a current rendering context.'
+ print ' */'
+ for i in range(1, 100):
+ print ' TABLE_ENTRY(Unused),'
+
+ print '};'
+ print '#endif /* DISPATCH_TABLE_NAME */'
+ print ''
+#enddef
+
+
+
+def PrintAliasedTable():
+ print """
+/*
+ * This is just used to silence compiler warnings.
+ * We list the functions which aren't otherwise used.
+ */
+#ifdef UNUSED_TABLE_NAME
+void *UNUSED_TABLE_NAME[] = {"""
+ for alias in aliasedFuncs:
+ print ' TABLE_ENTRY(%s),' % (alias)
+ #endfor
+ print '};'
+ print '#endif /*UNUSED_TABLE_NAME*/'
+ print ''
+#enddef
+
+
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", EmitFunction)
+PrintInitDispatch()
+PrintAliasedTable()
+PrintTail()
Index: xc/extras/Mesa/src/mesa/glapi/gloffsets.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gloffsets.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/gloffsets.py Thu Apr 8 05:17:35 2004
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+
+# $Id: gloffsets.py,v 1.5 2001/11/18 22:42:57 brianp Exp $
+
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Generate the glapioffsets.h file.
+#
+# Usage:
+# gloffsets.py >glapioffsets.h
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+
+import apiparser;
+
+
+def PrintHead():
+ print '/* DO NOT EDIT - This file generated automatically by gloffsets.py script */'
+ print '#ifndef _GLAPI_OFFSETS_H_'
+ print '#define _GLAPI_OFFSETS_H_'
+ print ''
+ return
+#enddef
+
+
+def PrintTail():
+ print ''
+ print '#endif'
+#enddef
+
+
+records = {}
+
+def AddOffset(name, returnType, argTypeList, argNameList, alias, offset):
+ argList = apiparser.MakeArgList(argTypeList, argNameList)
+ if offset >= 0 and not records.has_key(offset):
+ records[offset] = name
+ #print '#define _gloffset_%s %d' % (name, offset)
+#enddef
+
+
+def PrintRecords():
+ keys = records.keys()
+ keys.sort()
+ prevk = -1
+ for k in keys:
+ if k != prevk + 1:
+ #print 'Missing offset %d' % (prevk)
+ pass
+ prevk = int(k)
+ name = records[k]
+ print '#define _gloffset_%s %d' % (name, k)
+#endef
+
+
+
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", AddOffset)
+PrintRecords()
+PrintTail()
Index: xc/extras/Mesa/src/mesa/glapi/glprocs.h
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glprocs.h:1.1.1.4
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glprocs.h Fri Dec 10 10:32:32 2004
@@ -0,0 +1,1889 @@
+/* DO NOT EDIT - This file generated automatically by gl_procs.py (from Mesa) script */
+
+/*
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL, IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* This file is only included by glapi.c and is used for
+ * the GetProcAddress() function
+ */
+
+typedef struct {
+ GLint Name_offset;
+#ifdef NEED_FUNCTION_POINTER
+ _glapi_proc Address;
+#endif
+ GLuint Offset;
+} glprocs_table_t;
+
+#ifdef NEED_FUNCTION_POINTER
+# define NAME_FUNC_OFFSET(n,f,o) { n , (_glapi_proc) f , o }
+#else
+# define NAME_FUNC_OFFSET(n,f,o) { n , o }
+#endif
+
+
+static const char gl_string_table[] =
+ "glNewList\0"
+ "glEndList\0"
+ "glCallList\0"
+ "glCallLists\0"
+ "glDeleteLists\0"
+ "glGenLists\0"
+ "glListBase\0"
+ "glBegin\0"
+ "glBitmap\0"
+ "glColor3b\0"
+ "glColor3bv\0"
+ "glColor3d\0"
+ "glColor3dv\0"
+ "glColor3f\0"
+ "glColor3fv\0"
+ "glColor3i\0"
+ "glColor3iv\0"
+ "glColor3s\0"
+ "glColor3sv\0"
+ "glColor3ub\0"
+ "glColor3ubv\0"
+ "glColor3ui\0"
+ "glColor3uiv\0"
+ "glColor3us\0"
+ "glColor3usv\0"
+ "glColor4b\0"
+ "glColor4bv\0"
+ "glColor4d\0"
+ "glColor4dv\0"
+ "glColor4f\0"
+ "glColor4fv\0"
+ "glColor4i\0"
+ "glColor4iv\0"
+ "glColor4s\0"
+ "glColor4sv\0"
+ "glColor4ub\0"
+ "glColor4ubv\0"
+ "glColor4ui\0"
+ "glColor4uiv\0"
+ "glColor4us\0"
+ "glColor4usv\0"
+ "glEdgeFlag\0"
+ "glEdgeFlagv\0"
+ "glEnd\0"
+ "glIndexd\0"
+ "glIndexdv\0"
+ "glIndexf\0"
+ "glIndexfv\0"
+ "glIndexi\0"
+ "glIndexiv\0"
+ "glIndexs\0"
+ "glIndexsv\0"
+ "glNormal3b\0"
+ "glNormal3bv\0"
+ "glNormal3d\0"
+ "glNormal3dv\0"
+ "glNormal3f\0"
+ "glNormal3fv\0"
+ "glNormal3i\0"
+ "glNormal3iv\0"
+ "glNormal3s\0"
+ "glNormal3sv\0"
+ "glRasterPos2d\0"
+ "glRasterPos2dv\0"
+ "glRasterPos2f\0"
+ "glRasterPos2fv\0"
+ "glRasterPos2i\0"
+ "glRasterPos2iv\0"
+ "glRasterPos2s\0"
+ "glRasterPos2sv\0"
+ "glRasterPos3d\0"
+ "glRasterPos3dv\0"
+ "glRasterPos3f\0"
+ "glRasterPos3fv\0"
+ "glRasterPos3i\0"
+ "glRasterPos3iv\0"
+ "glRasterPos3s\0"
+ "glRasterPos3sv\0"
+ "glRasterPos4d\0"
+ "glRasterPos4dv\0"
+ "glRasterPos4f\0"
+ "glRasterPos4fv\0"
+ "glRasterPos4i\0"
+ "glRasterPos4iv\0"
+ "glRasterPos4s\0"
+ "glRasterPos4sv\0"
+ "glRectd\0"
+ "glRectdv\0"
+ "glRectf\0"
+ "glRectfv\0"
+ "glRecti\0"
+ "glRectiv\0"
+ "glRects\0"
+ "glRectsv\0"
+ "glTexCoord1d\0"
+ "glTexCoord1dv\0"
+ "glTexCoord1f\0"
+ "glTexCoord1fv\0"
+ "glTexCoord1i\0"
+ "glTexCoord1iv\0"
+ "glTexCoord1s\0"
+ "glTexCoord1sv\0"
+ "glTexCoord2d\0"
+ "glTexCoord2dv\0"
+ "glTexCoord2f\0"
+ "glTexCoord2fv\0"
+ "glTexCoord2i\0"
+ "glTexCoord2iv\0"
+ "glTexCoord2s\0"
+ "glTexCoord2sv\0"
+ "glTexCoord3d\0"
+ "glTexCoord3dv\0"
+ "glTexCoord3f\0"
+ "glTexCoord3fv\0"
+ "glTexCoord3i\0"
+ "glTexCoord3iv\0"
+ "glTexCoord3s\0"
+ "glTexCoord3sv\0"
+ "glTexCoord4d\0"
+ "glTexCoord4dv\0"
+ "glTexCoord4f\0"
+ "glTexCoord4fv\0"
+ "glTexCoord4i\0"
+ "glTexCoord4iv\0"
+ "glTexCoord4s\0"
+ "glTexCoord4sv\0"
+ "glVertex2d\0"
+ "glVertex2dv\0"
+ "glVertex2f\0"
+ "glVertex2fv\0"
+ "glVertex2i\0"
+ "glVertex2iv\0"
+ "glVertex2s\0"
+ "glVertex2sv\0"
+ "glVertex3d\0"
+ "glVertex3dv\0"
+ "glVertex3f\0"
+ "glVertex3fv\0"
+ "glVertex3i\0"
+ "glVertex3iv\0"
+ "glVertex3s\0"
+ "glVertex3sv\0"
+ "glVertex4d\0"
+ "glVertex4dv\0"
+ "glVertex4f\0"
+ "glVertex4fv\0"
+ "glVertex4i\0"
+ "glVertex4iv\0"
+ "glVertex4s\0"
+ "glVertex4sv\0"
+ "glClipPlane\0"
+ "glColorMaterial\0"
+ "glCullFace\0"
+ "glFogf\0"
+ "glFogfv\0"
+ "glFogi\0"
+ "glFogiv\0"
+ "glFrontFace\0"
+ "glHint\0"
+ "glLightf\0"
+ "glLightfv\0"
+ "glLighti\0"
+ "glLightiv\0"
+ "glLightModelf\0"
+ "glLightModelfv\0"
+ "glLightModeli\0"
+ "glLightModeliv\0"
+ "glLineStipple\0"
+ "glLineWidth\0"
+ "glMaterialf\0"
+ "glMaterialfv\0"
+ "glMateriali\0"
+ "glMaterialiv\0"
+ "glPointSize\0"
+ "glPolygonMode\0"
+ "glPolygonStipple\0"
+ "glScissor\0"
+ "glShadeModel\0"
+ "glTexParameterf\0"
+ "glTexParameterfv\0"
+ "glTexParameteri\0"
+ "glTexParameteriv\0"
+ "glTexImage1D\0"
+ "glTexImage2D\0"
+ "glTexEnvf\0"
+ "glTexEnvfv\0"
+ "glTexEnvi\0"
+ "glTexEnviv\0"
+ "glTexGend\0"
+ "glTexGendv\0"
+ "glTexGenf\0"
+ "glTexGenfv\0"
+ "glTexGeni\0"
+ "glTexGeniv\0"
+ "glFeedbackBuffer\0"
+ "glSelectBuffer\0"
+ "glRenderMode\0"
+ "glInitNames\0"
+ "glLoadName\0"
+ "glPassThrough\0"
+ "glPopName\0"
+ "glPushName\0"
+ "glDrawBuffer\0"
+ "glClear\0"
+ "glClearAccum\0"
+ "glClearIndex\0"
+ "glClearColor\0"
+ "glClearStencil\0"
+ "glClearDepth\0"
+ "glStencilMask\0"
+ "glColorMask\0"
+ "glDepthMask\0"
+ "glIndexMask\0"
+ "glAccum\0"
+ "glDisable\0"
+ "glEnable\0"
+ "glFinish\0"
+ "glFlush\0"
+ "glPopAttrib\0"
+ "glPushAttrib\0"
+ "glMap1d\0"
+ "glMap1f\0"
+ "glMap2d\0"
+ "glMap2f\0"
+ "glMapGrid1d\0"
+ "glMapGrid1f\0"
+ "glMapGrid2d\0"
+ "glMapGrid2f\0"
+ "glEvalCoord1d\0"
+ "glEvalCoord1dv\0"
+ "glEvalCoord1f\0"
+ "glEvalCoord1fv\0"
+ "glEvalCoord2d\0"
+ "glEvalCoord2dv\0"
+ "glEvalCoord2f\0"
+ "glEvalCoord2fv\0"
+ "glEvalMesh1\0"
+ "glEvalPoint1\0"
+ "glEvalMesh2\0"
+ "glEvalPoint2\0"
+ "glAlphaFunc\0"
+ "glBlendFunc\0"
+ "glLogicOp\0"
+ "glStencilFunc\0"
+ "glStencilOp\0"
+ "glDepthFunc\0"
+ "glPixelZoom\0"
+ "glPixelTransferf\0"
+ "glPixelTransferi\0"
+ "glPixelStoref\0"
+ "glPixelStorei\0"
+ "glPixelMapfv\0"
+ "glPixelMapuiv\0"
+ "glPixelMapusv\0"
+ "glReadBuffer\0"
+ "glCopyPixels\0"
+ "glReadPixels\0"
+ "glDrawPixels\0"
+ "glGetBooleanv\0"
+ "glGetClipPlane\0"
+ "glGetDoublev\0"
+ "glGetError\0"
+ "glGetFloatv\0"
+ "glGetIntegerv\0"
+ "glGetLightfv\0"
+ "glGetLightiv\0"
+ "glGetMapdv\0"
+ "glGetMapfv\0"
+ "glGetMapiv\0"
+ "glGetMaterialfv\0"
+ "glGetMaterialiv\0"
+ "glGetPixelMapfv\0"
+ "glGetPixelMapuiv\0"
+ "glGetPixelMapusv\0"
+ "glGetPolygonStipple\0"
+ "glGetString\0"
+ "glGetTexEnvfv\0"
+ "glGetTexEnviv\0"
+ "glGetTexGendv\0"
+ "glGetTexGenfv\0"
+ "glGetTexGeniv\0"
+ "glGetTexImage\0"
+ "glGetTexParameterfv\0"
+ "glGetTexParameteriv\0"
+ "glGetTexLevelParameterfv\0"
+ "glGetTexLevelParameteriv\0"
+ "glIsEnabled\0"
+ "glIsList\0"
+ "glDepthRange\0"
+ "glFrustum\0"
+ "glLoadIdentity\0"
+ "glLoadMatrixf\0"
+ "glLoadMatrixd\0"
+ "glMatrixMode\0"
+ "glMultMatrixf\0"
+ "glMultMatrixd\0"
+ "glOrtho\0"
+ "glPopMatrix\0"
+ "glPushMatrix\0"
+ "glRotated\0"
+ "glRotatef\0"
+ "glScaled\0"
+ "glScalef\0"
+ "glTranslated\0"
+ "glTranslatef\0"
+ "glViewport\0"
+ "glArrayElement\0"
+ "glBindTexture\0"
+ "glColorPointer\0"
+ "glDisableClientState\0"
+ "glDrawArrays\0"
+ "glDrawElements\0"
+ "glEdgeFlagPointer\0"
+ "glEnableClientState\0"
+ "glIndexPointer\0"
+ "glIndexub\0"
+ "glIndexubv\0"
+ "glInterleavedArrays\0"
+ "glNormalPointer\0"
+ "glPolygonOffset\0"
+ "glTexCoordPointer\0"
+ "glVertexPointer\0"
+ "glAreTexturesResident\0"
+ "glCopyTexImage1D\0"
+ "glCopyTexImage2D\0"
+ "glCopyTexSubImage1D\0"
+ "glCopyTexSubImage2D\0"
+ "glDeleteTextures\0"
+ "glGenTextures\0"
+ "glGetPointerv\0"
+ "glIsTexture\0"
+ "glPrioritizeTextures\0"
+ "glTexSubImage1D\0"
+ "glTexSubImage2D\0"
+ "glPopClientAttrib\0"
+ "glPushClientAttrib\0"
+ "glBlendColor\0"
+ "glBlendEquation\0"
+ "glDrawRangeElements\0"
+ "glColorTable\0"
+ "glColorTableParameterfv\0"
+ "glColorTableParameteriv\0"
+ "glCopyColorTable\0"
+ "glGetColorTable\0"
+ "glGetColorTableParameterfv\0"
+ "glGetColorTableParameteriv\0"
+ "glColorSubTable\0"
+ "glCopyColorSubTable\0"
+ "glConvolutionFilter1D\0"
+ "glConvolutionFilter2D\0"
+ "glConvolutionParameterf\0"
+ "glConvolutionParameterfv\0"
+ "glConvolutionParameteri\0"
+ "glConvolutionParameteriv\0"
+ "glCopyConvolutionFilter1D\0"
+ "glCopyConvolutionFilter2D\0"
+ "glGetConvolutionFilter\0"
+ "glGetConvolutionParameterfv\0"
+ "glGetConvolutionParameteriv\0"
+ "glGetSeparableFilter\0"
+ "glSeparableFilter2D\0"
+ "glGetHistogram\0"
+ "glGetHistogramParameterfv\0"
+ "glGetHistogramParameteriv\0"
+ "glGetMinmax\0"
+ "glGetMinmaxParameterfv\0"
+ "glGetMinmaxParameteriv\0"
+ "glHistogram\0"
+ "glMinmax\0"
+ "glResetHistogram\0"
+ "glResetMinmax\0"
+ "glTexImage3D\0"
+ "glTexSubImage3D\0"
+ "glCopyTexSubImage3D\0"
+ "glActiveTextureARB\0"
+ "glClientActiveTextureARB\0"
+ "glMultiTexCoord1dARB\0"
+ "glMultiTexCoord1dvARB\0"
+ "glMultiTexCoord1fARB\0"
+ "glMultiTexCoord1fvARB\0"
+ "glMultiTexCoord1iARB\0"
+ "glMultiTexCoord1ivARB\0"
+ "glMultiTexCoord1sARB\0"
+ "glMultiTexCoord1svARB\0"
+ "glMultiTexCoord2dARB\0"
+ "glMultiTexCoord2dvARB\0"
+ "glMultiTexCoord2fARB\0"
+ "glMultiTexCoord2fvARB\0"
+ "glMultiTexCoord2iARB\0"
+ "glMultiTexCoord2ivARB\0"
+ "glMultiTexCoord2sARB\0"
+ "glMultiTexCoord2svARB\0"
+ "glMultiTexCoord3dARB\0"
+ "glMultiTexCoord3dvARB\0"
+ "glMultiTexCoord3fARB\0"
+ "glMultiTexCoord3fvARB\0"
+ "glMultiTexCoord3iARB\0"
+ "glMultiTexCoord3ivARB\0"
+ "glMultiTexCoord3sARB\0"
+ "glMultiTexCoord3svARB\0"
+ "glMultiTexCoord4dARB\0"
+ "glMultiTexCoord4dvARB\0"
+ "glMultiTexCoord4fARB\0"
+ "glMultiTexCoord4fvARB\0"
+ "glMultiTexCoord4iARB\0"
+ "glMultiTexCoord4ivARB\0"
+ "glMultiTexCoord4sARB\0"
+ "glMultiTexCoord4svARB\0"
+ "glLoadTransposeMatrixfARB\0"
+ "glLoadTransposeMatrixdARB\0"
+ "glMultTransposeMatrixfARB\0"
+ "glMultTransposeMatrixdARB\0"
+ "glSampleCoverageARB\0"
+ "gl__unused413\0"
+ "glPolygonOffsetEXT\0"
+ "glGetTexFilterFuncSGIS\0"
+ "glTexFilterFuncSGIS\0"
+ "glGetHistogramEXT\0"
+ "glGetHistogramParameterfvEXT\0"
+ "glGetHistogramParameterivEXT\0"
+ "glGetMinmaxEXT\0"
+ "glGetMinmaxParameterfvEXT\0"
+ "glGetMinmaxParameterivEXT\0"
+ "glGetConvolutionFilterEXT\0"
+ "glGetConvolutionParameterfvEXT\0"
+ "glGetConvolutionParameterivEXT\0"
+ "glGetSeparableFilterEXT\0"
+ "glGetColorTableSGI\0"
+ "glGetColorTableParameterfvSGI\0"
+ "glGetColorTableParameterivSGI\0"
+ "glPixelTexGenSGIX\0"
+ "glPixelTexGenParameteriSGIS\0"
+ "glPixelTexGenParameterivSGIS\0"
+ "glPixelTexGenParameterfSGIS\0"
+ "glPixelTexGenParameterfvSGIS\0"
+ "glGetPixelTexGenParameterivSGIS\0"
+ "glGetPixelTexGenParameterfvSGIS\0"
+ "glTexImage4DSGIS\0"
+ "glTexSubImage4DSGIS\0"
+ "glAreTexturesResidentEXT\0"
+ "glGenTexturesEXT\0"
+ "glIsTextureEXT\0"
+ "glDetailTexFuncSGIS\0"
+ "glGetDetailTexFuncSGIS\0"
+ "glSharpenTexFuncSGIS\0"
+ "glGetSharpenTexFuncSGIS\0"
+ "glSampleMaskSGIS\0"
+ "glSamplePatternSGIS\0"
+ "glColorPointerEXT\0"
+ "glEdgeFlagPointerEXT\0"
+ "glIndexPointerEXT\0"
+ "glNormalPointerEXT\0"
+ "glTexCoordPointerEXT\0"
+ "glVertexPointerEXT\0"
+ "glSpriteParameterfSGIX\0"
+ "glSpriteParameterfvSGIX\0"
+ "glSpriteParameteriSGIX\0"
+ "glSpriteParameterivSGIX\0"
+ "glPointParameterfEXT\0"
+ "glPointParameterfvEXT\0"
+ "glGetInstrumentsSGIX\0"
+ "glInstrumentsBufferSGIX\0"
+ "glPollInstrumentsSGIX\0"
+ "glReadInstrumentsSGIX\0"
+ "glStartInstrumentsSGIX\0"
+ "glStopInstrumentsSGIX\0"
+ "glFrameZoomSGIX\0"
+ "glTagSampleBufferSGIX\0"
+ "glReferencePlaneSGIX\0"
+ "glFlushRasterSGIX\0"
+ "glGetListParameterfvSGIX\0"
+ "glGetListParameterivSGIX\0"
+ "glListParameterfSGIX\0"
+ "glListParameterfvSGIX\0"
+ "glListParameteriSGIX\0"
+ "glListParameterivSGIX\0"
+ "glFragmentColorMaterialSGIX\0"
+ "glFragmentLightfSGIX\0"
+ "glFragmentLightfvSGIX\0"
+ "glFragmentLightiSGIX\0"
+ "glFragmentLightivSGIX\0"
+ "glFragmentLightModelfSGIX\0"
+ "glFragmentLightModelfvSGIX\0"
+ "glFragmentLightModeliSGIX\0"
+ "glFragmentLightModelivSGIX\0"
+ "glFragmentMaterialfSGIX\0"
+ "glFragmentMaterialfvSGIX\0"
+ "glFragmentMaterialiSGIX\0"
+ "glFragmentMaterialivSGIX\0"
+ "glGetFragmentLightfvSGIX\0"
+ "glGetFragmentLightivSGIX\0"
+ "glGetFragmentMaterialfvSGIX\0"
+ "glGetFragmentMaterialivSGIX\0"
+ "glLightEnviSGIX\0"
+ "glVertexWeightfEXT\0"
+ "glVertexWeightfvEXT\0"
+ "glVertexWeightPointerEXT\0"
+ "glFlushVertexArrayRangeNV\0"
+ "glVertexArrayRangeNV\0"
+ "glCombinerParameterfvNV\0"
+ "glCombinerParameterfNV\0"
+ "glCombinerParameterivNV\0"
+ "glCombinerParameteriNV\0"
+ "glCombinerInputNV\0"
+ "glCombinerOutputNV\0"
+ "glFinalCombinerInputNV\0"
+ "glGetCombinerInputParameterfvNV\0"
+ "glGetCombinerInputParameterivNV\0"
+ "glGetCombinerOutputParameterfvNV\0"
+ "glGetCombinerOutputParameterivNV\0"
+ "glGetFinalCombinerInputParameterfvNV\0"
+ "glGetFinalCombinerInputParameterivNV\0"
+ "glResizeBuffersMESA\0"
+ "glWindowPos2dMESA\0"
+ "glWindowPos2dvMESA\0"
+ "glWindowPos2fMESA\0"
+ "glWindowPos2fvMESA\0"
+ "glWindowPos2iMESA\0"
+ "glWindowPos2ivMESA\0"
+ "glWindowPos2sMESA\0"
+ "glWindowPos2svMESA\0"
+ "glWindowPos3dMESA\0"
+ "glWindowPos3dvMESA\0"
+ "glWindowPos3fMESA\0"
+ "glWindowPos3fvMESA\0"
+ "glWindowPos3iMESA\0"
+ "glWindowPos3ivMESA\0"
+ "glWindowPos3sMESA\0"
+ "glWindowPos3svMESA\0"
+ "glWindowPos4dMESA\0"
+ "glWindowPos4dvMESA\0"
+ "glWindowPos4fMESA\0"
+ "glWindowPos4fvMESA\0"
+ "glWindowPos4iMESA\0"
+ "glWindowPos4ivMESA\0"
+ "glWindowPos4sMESA\0"
+ "glWindowPos4svMESA\0"
+ "glBlendFuncSeparateEXT\0"
+ "glIndexMaterialEXT\0"
+ "glIndexFuncEXT\0"
+ "glLockArraysEXT\0"
+ "glUnlockArraysEXT\0"
+ "glCullParameterdvEXT\0"
+ "glCullParameterfvEXT\0"
+ "glHintPGI\0"
+ "glFogCoordfEXT\0"
+ "glFogCoordfvEXT\0"
+ "glFogCoorddEXT\0"
+ "glFogCoorddvEXT\0"
+ "glFogCoordPointerEXT\0"
+ "glGetColorTableEXT\0"
+ "glGetColorTableParameterivEXT\0"
+ "glGetColorTableParameterfvEXT\0"
+ "glTbufferMask3DFX\0"
+ "glCompressedTexImage3DARB\0"
+ "glCompressedTexImage2DARB\0"
+ "glCompressedTexImage1DARB\0"
+ "glCompressedTexSubImage3DARB\0"
+ "glCompressedTexSubImage2DARB\0"
+ "glCompressedTexSubImage1DARB\0"
+ "glGetCompressedTexImageARB\0"
+ "glSecondaryColor3bEXT\0"
+ "glSecondaryColor3bvEXT\0"
+ "glSecondaryColor3dEXT\0"
+ "glSecondaryColor3dvEXT\0"
+ "glSecondaryColor3fEXT\0"
+ "glSecondaryColor3fvEXT\0"
+ "glSecondaryColor3iEXT\0"
+ "glSecondaryColor3ivEXT\0"
+ "glSecondaryColor3sEXT\0"
+ "glSecondaryColor3svEXT\0"
+ "glSecondaryColor3ubEXT\0"
+ "glSecondaryColor3ubvEXT\0"
+ "glSecondaryColor3uiEXT\0"
+ "glSecondaryColor3uivEXT\0"
+ "glSecondaryColor3usEXT\0"
+ "glSecondaryColor3usvEXT\0"
+ "glSecondaryColorPointerEXT\0"
+ "glAreProgramsResidentNV\0"
+ "glBindProgramNV\0"
+ "glDeleteProgramsNV\0"
+ "glExecuteProgramNV\0"
+ "glGenProgramsNV\0"
+ "glGetProgramParameterdvNV\0"
+ "glGetProgramParameterfvNV\0"
+ "glGetProgramivNV\0"
+ "glGetProgramStringNV\0"
+ "glGetTrackMatrixivNV\0"
+ "glGetVertexAttribdvNV\0"
+ "glGetVertexAttribfvNV\0"
+ "glGetVertexAttribivNV\0"
+ "glGetVertexAttribPointervNV\0"
+ "glIsProgramNV\0"
+ "glLoadProgramNV\0"
+ "glProgramParameter4dNV\0"
+ "glProgramParameter4dvNV\0"
+ "glProgramParameter4fNV\0"
+ "glProgramParameter4fvNV\0"
+ "glProgramParameters4dvNV\0"
+ "glProgramParameters4fvNV\0"
+ "glRequestResidentProgramsNV\0"
+ "glTrackMatrixNV\0"
+ "glVertexAttribPointerNV\0"
+ "glVertexAttrib1dNV\0"
+ "glVertexAttrib1dvNV\0"
+ "glVertexAttrib1fNV\0"
+ "glVertexAttrib1fvNV\0"
+ "glVertexAttrib1sNV\0"
+ "glVertexAttrib1svNV\0"
+ "glVertexAttrib2dNV\0"
+ "glVertexAttrib2dvNV\0"
+ "glVertexAttrib2fNV\0"
+ "glVertexAttrib2fvNV\0"
+ "glVertexAttrib2sNV\0"
+ "glVertexAttrib2svNV\0"
+ "glVertexAttrib3dNV\0"
+ "glVertexAttrib3dvNV\0"
+ "glVertexAttrib3fNV\0"
+ "glVertexAttrib3fvNV\0"
+ "glVertexAttrib3sNV\0"
+ "glVertexAttrib3svNV\0"
+ "glVertexAttrib4dNV\0"
+ "glVertexAttrib4dvNV\0"
+ "glVertexAttrib4fNV\0"
+ "glVertexAttrib4fvNV\0"
+ "glVertexAttrib4sNV\0"
+ "glVertexAttrib4svNV\0"
+ "glVertexAttrib4ubNV\0"
+ "glVertexAttrib4ubvNV\0"
+ "glVertexAttribs1dvNV\0"
+ "glVertexAttribs1fvNV\0"
+ "glVertexAttribs1svNV\0"
+ "glVertexAttribs2dvNV\0"
+ "glVertexAttribs2fvNV\0"
+ "glVertexAttribs2svNV\0"
+ "glVertexAttribs3dvNV\0"
+ "glVertexAttribs3fvNV\0"
+ "glVertexAttribs3svNV\0"
+ "glVertexAttribs4dvNV\0"
+ "glVertexAttribs4fvNV\0"
+ "glVertexAttribs4svNV\0"
+ "glVertexAttribs4ubvNV\0"
+ "glPointParameteriNV\0"
+ "glPointParameterivNV\0"
+ "glMultiDrawArraysEXT\0"
+ "glMultiDrawElementsEXT\0"
+ "glActiveStencilFaceEXT\0"
+ "glDeleteFencesNV\0"
+ "glGenFencesNV\0"
+ "glIsFenceNV\0"
+ "glTestFenceNV\0"
+ "glGetFenceivNV\0"
+ "glFinishFenceNV\0"
+ "glSetFenceNV\0"
+ "glVertexAttrib4bvARB\0"
+ "glVertexAttrib4ivARB\0"
+ "glVertexAttrib4ubvARB\0"
+ "glVertexAttrib4usvARB\0"
+ "glVertexAttrib4uivARB\0"
+ "glVertexAttrib4NbvARB\0"
+ "glVertexAttrib4NsvARB\0"
+ "glVertexAttrib4NivARB\0"
+ "glVertexAttrib4NusvARB\0"
+ "glVertexAttrib4NuivARB\0"
+ "glVertexAttribPointerARB\0"
+ "glEnableVertexAttribArrayARB\0"
+ "glDisableVertexAttribArrayARB\0"
+ "glProgramStringARB\0"
+ "glProgramEnvParameter4dARB\0"
+ "glProgramEnvParameter4dvARB\0"
+ "glProgramEnvParameter4fARB\0"
+ "glProgramEnvParameter4fvARB\0"
+ "glProgramLocalParameter4dARB\0"
+ "glProgramLocalParameter4dvARB\0"
+ "glProgramLocalParameter4fARB\0"
+ "glProgramLocalParameter4fvARB\0"
+ "glGetProgramEnvParameterdvARB\0"
+ "glGetProgramEnvParameterfvARB\0"
+ "glGetProgramLocalParameterdvARB\0"
+ "glGetProgramLocalParameterfvARB\0"
+ "glGetProgramivARB\0"
+ "glGetProgramStringARB\0"
+ "glProgramNamedParameter4fNV\0"
+ "glProgramNamedParameter4dNV\0"
+ "glProgramNamedParameter4fvNV\0"
+ "glProgramNamedParameter4dvNV\0"
+ "glGetProgramNamedParameterfvNV\0"
+ "glGetProgramNamedParameterdvNV\0"
+ "glBindBufferARB\0"
+ "glBufferDataARB\0"
+ "glBufferSubDataARB\0"
+ "glDeleteBuffersARB\0"
+ "glGenBuffersARB\0"
+ "glGetBufferParameterivARB\0"
+ "glGetBufferPointervARB\0"
+ "glGetBufferSubDataARB\0"
+ "glIsBufferARB\0"
+ "glMapBufferARB\0"
+ "glUnmapBufferARB\0"
+ "glDepthBoundsEXT\0"
+ "glGenQueriesARB\0"
+ "glDeleteQueriesARB\0"
+ "glIsQueryARB\0"
+ "glBeginQueryARB\0"
+ "glEndQueryARB\0"
+ "glGetQueryivARB\0"
+ "glGetQueryObjectivARB\0"
+ "glGetQueryObjectuivARB\0"
+ "glMultiModeDrawArraysIBM\0"
+ "glMultiModeDrawElementsIBM\0"
+ "glBlendEquationSeparateEXT\0"
+ "glActiveTexture\0"
+ "glClientActiveTexture\0"
+ "glMultiTexCoord1d\0"
+ "glMultiTexCoord1dv\0"
+ "glMultiTexCoord1f\0"
+ "glMultiTexCoord1fv\0"
+ "glMultiTexCoord1i\0"
+ "glMultiTexCoord1iv\0"
+ "glMultiTexCoord1s\0"
+ "glMultiTexCoord1sv\0"
+ "glMultiTexCoord2d\0"
+ "glMultiTexCoord2dv\0"
+ "glMultiTexCoord2f\0"
+ "glMultiTexCoord2fv\0"
+ "glMultiTexCoord2i\0"
+ "glMultiTexCoord2iv\0"
+ "glMultiTexCoord2s\0"
+ "glMultiTexCoord2sv\0"
+ "glMultiTexCoord3d\0"
+ "glMultiTexCoord3dv\0"
+ "glMultiTexCoord3f\0"
+ "glMultiTexCoord3fv\0"
+ "glMultiTexCoord3i\0"
+ "glMultiTexCoord3iv\0"
+ "glMultiTexCoord3s\0"
+ "glMultiTexCoord3sv\0"
+ "glMultiTexCoord4d\0"
+ "glMultiTexCoord4dv\0"
+ "glMultiTexCoord4f\0"
+ "glMultiTexCoord4fv\0"
+ "glMultiTexCoord4i\0"
+ "glMultiTexCoord4iv\0"
+ "glMultiTexCoord4s\0"
+ "glMultiTexCoord4sv\0"
+ "glLoadTransposeMatrixf\0"
+ "glLoadTransposeMatrixd\0"
+ "glMultTransposeMatrixf\0"
+ "glMultTransposeMatrixd\0"
+ "glSampleCoverage\0"
+ "glCompressedTexImage3D\0"
+ "glCompressedTexImage2D\0"
+ "glCompressedTexImage1D\0"
+ "glCompressedTexSubImage3D\0"
+ "glCompressedTexSubImage2D\0"
+ "glCompressedTexSubImage1D\0"
+ "glGetCompressedTexImage\0"
+ "glBlendFuncSeparate\0"
+ "glFogCoordf\0"
+ "glFogCoordfv\0"
+ "glFogCoordd\0"
+ "glFogCoorddv\0"
+ "glFogCoordPointer\0"
+ "glMultiDrawArrays\0"
+ "glMultiDrawElements\0"
+ "glPointParameterf\0"
+ "glPointParameterfv\0"
+ "glPointParameteri\0"
+ "glPointParameteriv\0"
+ "glSecondaryColor3b\0"
+ "glSecondaryColor3bv\0"
+ "glSecondaryColor3d\0"
+ "glSecondaryColor3dv\0"
+ "glSecondaryColor3f\0"
+ "glSecondaryColor3fv\0"
+ "glSecondaryColor3i\0"
+ "glSecondaryColor3iv\0"
+ "glSecondaryColor3s\0"
+ "glSecondaryColor3sv\0"
+ "glSecondaryColor3ub\0"
+ "glSecondaryColor3ubv\0"
+ "glSecondaryColor3ui\0"
+ "glSecondaryColor3uiv\0"
+ "glSecondaryColor3us\0"
+ "glSecondaryColor3usv\0"
+ "glSecondaryColorPointer\0"
+ "glWindowPos2d\0"
+ "glWindowPos2dv\0"
+ "glWindowPos2f\0"
+ "glWindowPos2fv\0"
+ "glWindowPos2i\0"
+ "glWindowPos2iv\0"
+ "glWindowPos2s\0"
+ "glWindowPos2sv\0"
+ "glWindowPos3d\0"
+ "glWindowPos3dv\0"
+ "glWindowPos3f\0"
+ "glWindowPos3fv\0"
+ "glWindowPos3i\0"
+ "glWindowPos3iv\0"
+ "glWindowPos3s\0"
+ "glWindowPos3sv\0"
+ "glBindBuffer\0"
+ "glBufferData\0"
+ "glBufferSubData\0"
+ "glDeleteBuffers\0"
+ "glGenBuffers\0"
+ "glGetBufferParameteriv\0"
+ "glGetBufferPointerv\0"
+ "glGetBufferSubData\0"
+ "glIsBuffer\0"
+ "glMapBuffer\0"
+ "glUnmapBuffer\0"
+ "glGenQueries\0"
+ "glDeleteQueries\0"
+ "glIsQuery\0"
+ "glBeginQuery\0"
+ "glEndQuery\0"
+ "glGetQueryiv\0"
+ "glGetQueryObjectiv\0"
+ "glGetQueryObjectuiv\0"
+ "glPointParameterfARB\0"
+ "glPointParameterfvARB\0"
+ "glWindowPos2dARB\0"
+ "glWindowPos2fARB\0"
+ "glWindowPos2iARB\0"
+ "glWindowPos2sARB\0"
+ "glWindowPos2dvARB\0"
+ "glWindowPos2fvARB\0"
+ "glWindowPos2ivARB\0"
+ "glWindowPos2svARB\0"
+ "glWindowPos3dARB\0"
+ "glWindowPos3fARB\0"
+ "glWindowPos3iARB\0"
+ "glWindowPos3sARB\0"
+ "glWindowPos3dvARB\0"
+ "glWindowPos3fvARB\0"
+ "glWindowPos3ivARB\0"
+ "glWindowPos3svARB\0"
+ "glVertexAttrib1sARB\0"
+ "glVertexAttrib1fARB\0"
+ "glVertexAttrib1dARB\0"
+ "glVertexAttrib2sARB\0"
+ "glVertexAttrib2fARB\0"
+ "glVertexAttrib2dARB\0"
+ "glVertexAttrib3sARB\0"
+ "glVertexAttrib3fARB\0"
+ "glVertexAttrib3dARB\0"
+ "glVertexAttrib4sARB\0"
+ "glVertexAttrib4fARB\0"
+ "glVertexAttrib4dARB\0"
+ "glVertexAttrib4NubARB\0"
+ "glVertexAttrib1svARB\0"
+ "glVertexAttrib1fvARB\0"
+ "glVertexAttrib1dvARB\0"
+ "glVertexAttrib2svARB\0"
+ "glVertexAttrib2fvARB\0"
+ "glVertexAttrib2dvARB\0"
+ "glVertexAttrib3svARB\0"
+ "glVertexAttrib3fvARB\0"
+ "glVertexAttrib3dvARB\0"
+ "glVertexAttrib4svARB\0"
+ "glVertexAttrib4fvARB\0"
+ "glVertexAttrib4dvARB\0"
+ "glVertexAttrib4NubvARB\0"
+ "glBindProgramARB\0"
+ "glDeleteProgramsARB\0"
+ "glGenProgramsARB\0"
+ "glIsProgramARB\0"
+ "glGetVertexAttribdvARB\0"
+ "glGetVertexAttribfvARB\0"
+ "glGetVertexAttribivARB\0"
+ "glGetVertexAttribPointervARB\0"
+ "glBlendColorEXT\0"
+ "glTexImage3DEXT\0"
+ "glTexSubImage3DEXT\0"
+ "glTexSubImage1DEXT\0"
+ "glTexSubImage2DEXT\0"
+ "glCopyTexImage1DEXT\0"
+ "glCopyTexImage2DEXT\0"
+ "glCopyTexSubImage1DEXT\0"
+ "glCopyTexSubImage2DEXT\0"
+ "glCopyTexSubImage3DEXT\0"
+ "glHistogramEXT\0"
+ "glMinmaxEXT\0"
+ "glResetHistogramEXT\0"
+ "glResetMinmaxEXT\0"
+ "glConvolutionFilter1DEXT\0"
+ "glConvolutionFilter2DEXT\0"
+ "glConvolutionParameterfEXT\0"
+ "glConvolutionParameterfvEXT\0"
+ "glConvolutionParameteriEXT\0"
+ "glConvolutionParameterivEXT\0"
+ "glCopyConvolutionFilter1DEXT\0"
+ "glCopyConvolutionFilter2DEXT\0"
+ "glSeparableFilter2DEXT\0"
+ "glColorTableSGI\0"
+ "glColorTableParameterfvSGI\0"
+ "glColorTableParameterivSGI\0"
+ "glCopyColorTableSGI\0"
+ "glBindTextureEXT\0"
+ "glDeleteTexturesEXT\0"
+ "glPrioritizeTexturesEXT\0"
+ "glArrayElementEXT\0"
+ "glDrawArraysEXT\0"
+ "glGetPointervEXT\0"
+ "glBlendEquationEXT\0"
+ "glColorSubTableEXT\0"
+ "glCopyColorSubTableEXT\0"
+ "glColorTableEXT\0"
+ "glDrawRangeElementsEXT\0"
+ "glSampleMaskEXT\0"
+ "glSamplePatternEXT\0"
+ "glBlendEquationSeparateATI\0"
+ "glBlendFuncSeparateINGR\0"
+ "glPointParameterfSGIS\0"
+ "glPointParameterfvSGIS\0"
+ ;
+
+static const glprocs_table_t static_functions[] = {
+ NAME_FUNC_OFFSET( 0, glNewList, _gloffset_NewList ),
+ NAME_FUNC_OFFSET( 10, glEndList, _gloffset_EndList ),
+ NAME_FUNC_OFFSET( 20, glCallList, _gloffset_CallList ),
+ NAME_FUNC_OFFSET( 31, glCallLists, _gloffset_CallLists ),
+ NAME_FUNC_OFFSET( 43, glDeleteLists, _gloffset_DeleteLists ),
+ NAME_FUNC_OFFSET( 57, glGenLists, _gloffset_GenLists ),
+ NAME_FUNC_OFFSET( 68, glListBase, _gloffset_ListBase ),
+ NAME_FUNC_OFFSET( 79, glBegin, _gloffset_Begin ),
+ NAME_FUNC_OFFSET( 87, glBitmap, _gloffset_Bitmap ),
+ NAME_FUNC_OFFSET( 96, glColor3b, _gloffset_Color3b ),
+ NAME_FUNC_OFFSET( 106, glColor3bv, _gloffset_Color3bv ),
+ NAME_FUNC_OFFSET( 117, glColor3d, _gloffset_Color3d ),
+ NAME_FUNC_OFFSET( 127, glColor3dv, _gloffset_Color3dv ),
+ NAME_FUNC_OFFSET( 138, glColor3f, _gloffset_Color3f ),
+ NAME_FUNC_OFFSET( 148, glColor3fv, _gloffset_Color3fv ),
+ NAME_FUNC_OFFSET( 159, glColor3i, _gloffset_Color3i ),
+ NAME_FUNC_OFFSET( 169, glColor3iv, _gloffset_Color3iv ),
+ NAME_FUNC_OFFSET( 180, glColor3s, _gloffset_Color3s ),
+ NAME_FUNC_OFFSET( 190, glColor3sv, _gloffset_Color3sv ),
+ NAME_FUNC_OFFSET( 201, glColor3ub, _gloffset_Color3ub ),
+ NAME_FUNC_OFFSET( 212, glColor3ubv, _gloffset_Color3ubv ),
+ NAME_FUNC_OFFSET( 224, glColor3ui, _gloffset_Color3ui ),
+ NAME_FUNC_OFFSET( 235, glColor3uiv, _gloffset_Color3uiv ),
+ NAME_FUNC_OFFSET( 247, glColor3us, _gloffset_Color3us ),
+ NAME_FUNC_OFFSET( 258, glColor3usv, _gloffset_Color3usv ),
+ NAME_FUNC_OFFSET( 270, glColor4b, _gloffset_Color4b ),
+ NAME_FUNC_OFFSET( 280, glColor4bv, _gloffset_Color4bv ),
+ NAME_FUNC_OFFSET( 291, glColor4d, _gloffset_Color4d ),
+ NAME_FUNC_OFFSET( 301, glColor4dv, _gloffset_Color4dv ),
+ NAME_FUNC_OFFSET( 312, glColor4f, _gloffset_Color4f ),
+ NAME_FUNC_OFFSET( 322, glColor4fv, _gloffset_Color4fv ),
+ NAME_FUNC_OFFSET( 333, glColor4i, _gloffset_Color4i ),
+ NAME_FUNC_OFFSET( 343, glColor4iv, _gloffset_Color4iv ),
+ NAME_FUNC_OFFSET( 354, glColor4s, _gloffset_Color4s ),
+ NAME_FUNC_OFFSET( 364, glColor4sv, _gloffset_Color4sv ),
+ NAME_FUNC_OFFSET( 375, glColor4ub, _gloffset_Color4ub ),
+ NAME_FUNC_OFFSET( 386, glColor4ubv, _gloffset_Color4ubv ),
+ NAME_FUNC_OFFSET( 398, glColor4ui, _gloffset_Color4ui ),
+ NAME_FUNC_OFFSET( 409, glColor4uiv, _gloffset_Color4uiv ),
+ NAME_FUNC_OFFSET( 421, glColor4us, _gloffset_Color4us ),
+ NAME_FUNC_OFFSET( 432, glColor4usv, _gloffset_Color4usv ),
+ NAME_FUNC_OFFSET( 444, glEdgeFlag, _gloffset_EdgeFlag ),
+ NAME_FUNC_OFFSET( 455, glEdgeFlagv, _gloffset_EdgeFlagv ),
+ NAME_FUNC_OFFSET( 467, glEnd, _gloffset_End ),
+ NAME_FUNC_OFFSET( 473, glIndexd, _gloffset_Indexd ),
+ NAME_FUNC_OFFSET( 482, glIndexdv, _gloffset_Indexdv ),
+ NAME_FUNC_OFFSET( 492, glIndexf, _gloffset_Indexf ),
+ NAME_FUNC_OFFSET( 501, glIndexfv, _gloffset_Indexfv ),
+ NAME_FUNC_OFFSET( 511, glIndexi, _gloffset_Indexi ),
+ NAME_FUNC_OFFSET( 520, glIndexiv, _gloffset_Indexiv ),
+ NAME_FUNC_OFFSET( 530, glIndexs, _gloffset_Indexs ),
+ NAME_FUNC_OFFSET( 539, glIndexsv, _gloffset_Indexsv ),
+ NAME_FUNC_OFFSET( 549, glNormal3b, _gloffset_Normal3b ),
+ NAME_FUNC_OFFSET( 560, glNormal3bv, _gloffset_Normal3bv ),
+ NAME_FUNC_OFFSET( 572, glNormal3d, _gloffset_Normal3d ),
+ NAME_FUNC_OFFSET( 583, glNormal3dv, _gloffset_Normal3dv ),
+ NAME_FUNC_OFFSET( 595, glNormal3f, _gloffset_Normal3f ),
+ NAME_FUNC_OFFSET( 606, glNormal3fv, _gloffset_Normal3fv ),
+ NAME_FUNC_OFFSET( 618, glNormal3i, _gloffset_Normal3i ),
+ NAME_FUNC_OFFSET( 629, glNormal3iv, _gloffset_Normal3iv ),
+ NAME_FUNC_OFFSET( 641, glNormal3s, _gloffset_Normal3s ),
+ NAME_FUNC_OFFSET( 652, glNormal3sv, _gloffset_Normal3sv ),
+ NAME_FUNC_OFFSET( 664, glRasterPos2d, _gloffset_RasterPos2d ),
+ NAME_FUNC_OFFSET( 678, glRasterPos2dv, _gloffset_RasterPos2dv ),
+ NAME_FUNC_OFFSET( 693, glRasterPos2f, _gloffset_RasterPos2f ),
+ NAME_FUNC_OFFSET( 707, glRasterPos2fv, _gloffset_RasterPos2fv ),
+ NAME_FUNC_OFFSET( 722, glRasterPos2i, _gloffset_RasterPos2i ),
+ NAME_FUNC_OFFSET( 736, glRasterPos2iv, _gloffset_RasterPos2iv ),
+ NAME_FUNC_OFFSET( 751, glRasterPos2s, _gloffset_RasterPos2s ),
+ NAME_FUNC_OFFSET( 765, glRasterPos2sv, _gloffset_RasterPos2sv ),
+ NAME_FUNC_OFFSET( 780, glRasterPos3d, _gloffset_RasterPos3d ),
+ NAME_FUNC_OFFSET( 794, glRasterPos3dv, _gloffset_RasterPos3dv ),
+ NAME_FUNC_OFFSET( 809, glRasterPos3f, _gloffset_RasterPos3f ),
+ NAME_FUNC_OFFSET( 823, glRasterPos3fv, _gloffset_RasterPos3fv ),
+ NAME_FUNC_OFFSET( 838, glRasterPos3i, _gloffset_RasterPos3i ),
+ NAME_FUNC_OFFSET( 852, glRasterPos3iv, _gloffset_RasterPos3iv ),
+ NAME_FUNC_OFFSET( 867, glRasterPos3s, _gloffset_RasterPos3s ),
+ NAME_FUNC_OFFSET( 881, glRasterPos3sv, _gloffset_RasterPos3sv ),
+ NAME_FUNC_OFFSET( 896, glRasterPos4d, _gloffset_RasterPos4d ),
+ NAME_FUNC_OFFSET( 910, glRasterPos4dv, _gloffset_RasterPos4dv ),
+ NAME_FUNC_OFFSET( 925, glRasterPos4f, _gloffset_RasterPos4f ),
+ NAME_FUNC_OFFSET( 939, glRasterPos4fv, _gloffset_RasterPos4fv ),
+ NAME_FUNC_OFFSET( 954, glRasterPos4i, _gloffset_RasterPos4i ),
+ NAME_FUNC_OFFSET( 968, glRasterPos4iv, _gloffset_RasterPos4iv ),
+ NAME_FUNC_OFFSET( 983, glRasterPos4s, _gloffset_RasterPos4s ),
+ NAME_FUNC_OFFSET( 997, glRasterPos4sv, _gloffset_RasterPos4sv ),
+ NAME_FUNC_OFFSET( 1012, glRectd, _gloffset_Rectd ),
+ NAME_FUNC_OFFSET( 1020, glRectdv, _gloffset_Rectdv ),
+ NAME_FUNC_OFFSET( 1029, glRectf, _gloffset_Rectf ),
+ NAME_FUNC_OFFSET( 1037, glRectfv, _gloffset_Rectfv ),
+ NAME_FUNC_OFFSET( 1046, glRecti, _gloffset_Recti ),
+ NAME_FUNC_OFFSET( 1054, glRectiv, _gloffset_Rectiv ),
+ NAME_FUNC_OFFSET( 1063, glRects, _gloffset_Rects ),
+ NAME_FUNC_OFFSET( 1071, glRectsv, _gloffset_Rectsv ),
+ NAME_FUNC_OFFSET( 1080, glTexCoord1d, _gloffset_TexCoord1d ),
+ NAME_FUNC_OFFSET( 1093, glTexCoord1dv, _gloffset_TexCoord1dv ),
+ NAME_FUNC_OFFSET( 1107, glTexCoord1f, _gloffset_TexCoord1f ),
+ NAME_FUNC_OFFSET( 1120, glTexCoord1fv, _gloffset_TexCoord1fv ),
+ NAME_FUNC_OFFSET( 1134, glTexCoord1i, _gloffset_TexCoord1i ),
+ NAME_FUNC_OFFSET( 1147, glTexCoord1iv, _gloffset_TexCoord1iv ),
+ NAME_FUNC_OFFSET( 1161, glTexCoord1s, _gloffset_TexCoord1s ),
+ NAME_FUNC_OFFSET( 1174, glTexCoord1sv, _gloffset_TexCoord1sv ),
+ NAME_FUNC_OFFSET( 1188, glTexCoord2d, _gloffset_TexCoord2d ),
+ NAME_FUNC_OFFSET( 1201, glTexCoord2dv, _gloffset_TexCoord2dv ),
+ NAME_FUNC_OFFSET( 1215, glTexCoord2f, _gloffset_TexCoord2f ),
+ NAME_FUNC_OFFSET( 1228, glTexCoord2fv, _gloffset_TexCoord2fv ),
+ NAME_FUNC_OFFSET( 1242, glTexCoord2i, _gloffset_TexCoord2i ),
+ NAME_FUNC_OFFSET( 1255, glTexCoord2iv, _gloffset_TexCoord2iv ),
+ NAME_FUNC_OFFSET( 1269, glTexCoord2s, _gloffset_TexCoord2s ),
+ NAME_FUNC_OFFSET( 1282, glTexCoord2sv, _gloffset_TexCoord2sv ),
+ NAME_FUNC_OFFSET( 1296, glTexCoord3d, _gloffset_TexCoord3d ),
+ NAME_FUNC_OFFSET( 1309, glTexCoord3dv, _gloffset_TexCoord3dv ),
+ NAME_FUNC_OFFSET( 1323, glTexCoord3f, _gloffset_TexCoord3f ),
+ NAME_FUNC_OFFSET( 1336, glTexCoord3fv, _gloffset_TexCoord3fv ),
+ NAME_FUNC_OFFSET( 1350, glTexCoord3i, _gloffset_TexCoord3i ),
+ NAME_FUNC_OFFSET( 1363, glTexCoord3iv, _gloffset_TexCoord3iv ),
+ NAME_FUNC_OFFSET( 1377, glTexCoord3s, _gloffset_TexCoord3s ),
+ NAME_FUNC_OFFSET( 1390, glTexCoord3sv, _gloffset_TexCoord3sv ),
+ NAME_FUNC_OFFSET( 1404, glTexCoord4d, _gloffset_TexCoord4d ),
+ NAME_FUNC_OFFSET( 1417, glTexCoord4dv, _gloffset_TexCoord4dv ),
+ NAME_FUNC_OFFSET( 1431, glTexCoord4f, _gloffset_TexCoord4f ),
+ NAME_FUNC_OFFSET( 1444, glTexCoord4fv, _gloffset_TexCoord4fv ),
+ NAME_FUNC_OFFSET( 1458, glTexCoord4i, _gloffset_TexCoord4i ),
+ NAME_FUNC_OFFSET( 1471, glTexCoord4iv, _gloffset_TexCoord4iv ),
+ NAME_FUNC_OFFSET( 1485, glTexCoord4s, _gloffset_TexCoord4s ),
+ NAME_FUNC_OFFSET( 1498, glTexCoord4sv, _gloffset_TexCoord4sv ),
+ NAME_FUNC_OFFSET( 1512, glVertex2d, _gloffset_Vertex2d ),
+ NAME_FUNC_OFFSET( 1523, glVertex2dv, _gloffset_Vertex2dv ),
+ NAME_FUNC_OFFSET( 1535, glVertex2f, _gloffset_Vertex2f ),
+ NAME_FUNC_OFFSET( 1546, glVertex2fv, _gloffset_Vertex2fv ),
+ NAME_FUNC_OFFSET( 1558, glVertex2i, _gloffset_Vertex2i ),
+ NAME_FUNC_OFFSET( 1569, glVertex2iv, _gloffset_Vertex2iv ),
+ NAME_FUNC_OFFSET( 1581, glVertex2s, _gloffset_Vertex2s ),
+ NAME_FUNC_OFFSET( 1592, glVertex2sv, _gloffset_Vertex2sv ),
+ NAME_FUNC_OFFSET( 1604, glVertex3d, _gloffset_Vertex3d ),
+ NAME_FUNC_OFFSET( 1615, glVertex3dv, _gloffset_Vertex3dv ),
+ NAME_FUNC_OFFSET( 1627, glVertex3f, _gloffset_Vertex3f ),
+ NAME_FUNC_OFFSET( 1638, glVertex3fv, _gloffset_Vertex3fv ),
+ NAME_FUNC_OFFSET( 1650, glVertex3i, _gloffset_Vertex3i ),
+ NAME_FUNC_OFFSET( 1661, glVertex3iv, _gloffset_Vertex3iv ),
+ NAME_FUNC_OFFSET( 1673, glVertex3s, _gloffset_Vertex3s ),
+ NAME_FUNC_OFFSET( 1684, glVertex3sv, _gloffset_Vertex3sv ),
+ NAME_FUNC_OFFSET( 1696, glVertex4d, _gloffset_Vertex4d ),
+ NAME_FUNC_OFFSET( 1707, glVertex4dv, _gloffset_Vertex4dv ),
+ NAME_FUNC_OFFSET( 1719, glVertex4f, _gloffset_Vertex4f ),
+ NAME_FUNC_OFFSET( 1730, glVertex4fv, _gloffset_Vertex4fv ),
+ NAME_FUNC_OFFSET( 1742, glVertex4i, _gloffset_Vertex4i ),
+ NAME_FUNC_OFFSET( 1753, glVertex4iv, _gloffset_Vertex4iv ),
+ NAME_FUNC_OFFSET( 1765, glVertex4s, _gloffset_Vertex4s ),
+ NAME_FUNC_OFFSET( 1776, glVertex4sv, _gloffset_Vertex4sv ),
+ NAME_FUNC_OFFSET( 1788, glClipPlane, _gloffset_ClipPlane ),
+ NAME_FUNC_OFFSET( 1800, glColorMaterial, _gloffset_ColorMaterial ),
+ NAME_FUNC_OFFSET( 1816, glCullFace, _gloffset_CullFace ),
+ NAME_FUNC_OFFSET( 1827, glFogf, _gloffset_Fogf ),
+ NAME_FUNC_OFFSET( 1834, glFogfv, _gloffset_Fogfv ),
+ NAME_FUNC_OFFSET( 1842, glFogi, _gloffset_Fogi ),
+ NAME_FUNC_OFFSET( 1849, glFogiv, _gloffset_Fogiv ),
+ NAME_FUNC_OFFSET( 1857, glFrontFace, _gloffset_FrontFace ),
+ NAME_FUNC_OFFSET( 1869, glHint, _gloffset_Hint ),
+ NAME_FUNC_OFFSET( 1876, glLightf, _gloffset_Lightf ),
+ NAME_FUNC_OFFSET( 1885, glLightfv, _gloffset_Lightfv ),
+ NAME_FUNC_OFFSET( 1895, glLighti, _gloffset_Lighti ),
+ NAME_FUNC_OFFSET( 1904, glLightiv, _gloffset_Lightiv ),
+ NAME_FUNC_OFFSET( 1914, glLightModelf, _gloffset_LightModelf ),
+ NAME_FUNC_OFFSET( 1928, glLightModelfv, _gloffset_LightModelfv ),
+ NAME_FUNC_OFFSET( 1943, glLightModeli, _gloffset_LightModeli ),
+ NAME_FUNC_OFFSET( 1957, glLightModeliv, _gloffset_LightModeliv ),
+ NAME_FUNC_OFFSET( 1972, glLineStipple, _gloffset_LineStipple ),
+ NAME_FUNC_OFFSET( 1986, glLineWidth, _gloffset_LineWidth ),
+ NAME_FUNC_OFFSET( 1998, glMaterialf, _gloffset_Materialf ),
+ NAME_FUNC_OFFSET( 2010, glMaterialfv, _gloffset_Materialfv ),
+ NAME_FUNC_OFFSET( 2023, glMateriali, _gloffset_Materiali ),
+ NAME_FUNC_OFFSET( 2035, glMaterialiv, _gloffset_Materialiv ),
+ NAME_FUNC_OFFSET( 2048, glPointSize, _gloffset_PointSize ),
+ NAME_FUNC_OFFSET( 2060, glPolygonMode, _gloffset_PolygonMode ),
+ NAME_FUNC_OFFSET( 2074, glPolygonStipple, _gloffset_PolygonStipple ),
+ NAME_FUNC_OFFSET( 2091, glScissor, _gloffset_Scissor ),
+ NAME_FUNC_OFFSET( 2101, glShadeModel, _gloffset_ShadeModel ),
+ NAME_FUNC_OFFSET( 2114, glTexParameterf, _gloffset_TexParameterf ),
+ NAME_FUNC_OFFSET( 2130, glTexParameterfv, _gloffset_TexParameterfv ),
+ NAME_FUNC_OFFSET( 2147, glTexParameteri, _gloffset_TexParameteri ),
+ NAME_FUNC_OFFSET( 2163, glTexParameteriv, _gloffset_TexParameteriv ),
+ NAME_FUNC_OFFSET( 2180, glTexImage1D, _gloffset_TexImage1D ),
+ NAME_FUNC_OFFSET( 2193, glTexImage2D, _gloffset_TexImage2D ),
+ NAME_FUNC_OFFSET( 2206, glTexEnvf, _gloffset_TexEnvf ),
+ NAME_FUNC_OFFSET( 2216, glTexEnvfv, _gloffset_TexEnvfv ),
+ NAME_FUNC_OFFSET( 2227, glTexEnvi, _gloffset_TexEnvi ),
+ NAME_FUNC_OFFSET( 2237, glTexEnviv, _gloffset_TexEnviv ),
+ NAME_FUNC_OFFSET( 2248, glTexGend, _gloffset_TexGend ),
+ NAME_FUNC_OFFSET( 2258, glTexGendv, _gloffset_TexGendv ),
+ NAME_FUNC_OFFSET( 2269, glTexGenf, _gloffset_TexGenf ),
+ NAME_FUNC_OFFSET( 2279, glTexGenfv, _gloffset_TexGenfv ),
+ NAME_FUNC_OFFSET( 2290, glTexGeni, _gloffset_TexGeni ),
+ NAME_FUNC_OFFSET( 2300, glTexGeniv, _gloffset_TexGeniv ),
+ NAME_FUNC_OFFSET( 2311, glFeedbackBuffer, _gloffset_FeedbackBuffer ),
+ NAME_FUNC_OFFSET( 2328, glSelectBuffer, _gloffset_SelectBuffer ),
+ NAME_FUNC_OFFSET( 2343, glRenderMode, _gloffset_RenderMode ),
+ NAME_FUNC_OFFSET( 2356, glInitNames, _gloffset_InitNames ),
+ NAME_FUNC_OFFSET( 2368, glLoadName, _gloffset_LoadName ),
+ NAME_FUNC_OFFSET( 2379, glPassThrough, _gloffset_PassThrough ),
+ NAME_FUNC_OFFSET( 2393, glPopName, _gloffset_PopName ),
+ NAME_FUNC_OFFSET( 2403, glPushName, _gloffset_PushName ),
+ NAME_FUNC_OFFSET( 2414, glDrawBuffer, _gloffset_DrawBuffer ),
+ NAME_FUNC_OFFSET( 2427, glClear, _gloffset_Clear ),
+ NAME_FUNC_OFFSET( 2435, glClearAccum, _gloffset_ClearAccum ),
+ NAME_FUNC_OFFSET( 2448, glClearIndex, _gloffset_ClearIndex ),
+ NAME_FUNC_OFFSET( 2461, glClearColor, _gloffset_ClearColor ),
+ NAME_FUNC_OFFSET( 2474, glClearStencil, _gloffset_ClearStencil ),
+ NAME_FUNC_OFFSET( 2489, glClearDepth, _gloffset_ClearDepth ),
+ NAME_FUNC_OFFSET( 2502, glStencilMask, _gloffset_StencilMask ),
+ NAME_FUNC_OFFSET( 2516, glColorMask, _gloffset_ColorMask ),
+ NAME_FUNC_OFFSET( 2528, glDepthMask, _gloffset_DepthMask ),
+ NAME_FUNC_OFFSET( 2540, glIndexMask, _gloffset_IndexMask ),
+ NAME_FUNC_OFFSET( 2552, glAccum, _gloffset_Accum ),
+ NAME_FUNC_OFFSET( 2560, glDisable, _gloffset_Disable ),
+ NAME_FUNC_OFFSET( 2570, glEnable, _gloffset_Enable ),
+ NAME_FUNC_OFFSET( 2579, glFinish, _gloffset_Finish ),
+ NAME_FUNC_OFFSET( 2588, glFlush, _gloffset_Flush ),
+ NAME_FUNC_OFFSET( 2596, glPopAttrib, _gloffset_PopAttrib ),
+ NAME_FUNC_OFFSET( 2608, glPushAttrib, _gloffset_PushAttrib ),
+ NAME_FUNC_OFFSET( 2621, glMap1d, _gloffset_Map1d ),
+ NAME_FUNC_OFFSET( 2629, glMap1f, _gloffset_Map1f ),
+ NAME_FUNC_OFFSET( 2637, glMap2d, _gloffset_Map2d ),
+ NAME_FUNC_OFFSET( 2645, glMap2f, _gloffset_Map2f ),
+ NAME_FUNC_OFFSET( 2653, glMapGrid1d, _gloffset_MapGrid1d ),
+ NAME_FUNC_OFFSET( 2665, glMapGrid1f, _gloffset_MapGrid1f ),
+ NAME_FUNC_OFFSET( 2677, glMapGrid2d, _gloffset_MapGrid2d ),
+ NAME_FUNC_OFFSET( 2689, glMapGrid2f, _gloffset_MapGrid2f ),
+ NAME_FUNC_OFFSET( 2701, glEvalCoord1d, _gloffset_EvalCoord1d ),
+ NAME_FUNC_OFFSET( 2715, glEvalCoord1dv, _gloffset_EvalCoord1dv ),
+ NAME_FUNC_OFFSET( 2730, glEvalCoord1f, _gloffset_EvalCoord1f ),
+ NAME_FUNC_OFFSET( 2744, glEvalCoord1fv, _gloffset_EvalCoord1fv ),
+ NAME_FUNC_OFFSET( 2759, glEvalCoord2d, _gloffset_EvalCoord2d ),
+ NAME_FUNC_OFFSET( 2773, glEvalCoord2dv, _gloffset_EvalCoord2dv ),
+ NAME_FUNC_OFFSET( 2788, glEvalCoord2f, _gloffset_EvalCoord2f ),
+ NAME_FUNC_OFFSET( 2802, glEvalCoord2fv, _gloffset_EvalCoord2fv ),
+ NAME_FUNC_OFFSET( 2817, glEvalMesh1, _gloffset_EvalMesh1 ),
+ NAME_FUNC_OFFSET( 2829, glEvalPoint1, _gloffset_EvalPoint1 ),
+ NAME_FUNC_OFFSET( 2842, glEvalMesh2, _gloffset_EvalMesh2 ),
+ NAME_FUNC_OFFSET( 2854, glEvalPoint2, _gloffset_EvalPoint2 ),
+ NAME_FUNC_OFFSET( 2867, glAlphaFunc, _gloffset_AlphaFunc ),
+ NAME_FUNC_OFFSET( 2879, glBlendFunc, _gloffset_BlendFunc ),
+ NAME_FUNC_OFFSET( 2891, glLogicOp, _gloffset_LogicOp ),
+ NAME_FUNC_OFFSET( 2901, glStencilFunc, _gloffset_StencilFunc ),
+ NAME_FUNC_OFFSET( 2915, glStencilOp, _gloffset_StencilOp ),
+ NAME_FUNC_OFFSET( 2927, glDepthFunc, _gloffset_DepthFunc ),
+ NAME_FUNC_OFFSET( 2939, glPixelZoom, _gloffset_PixelZoom ),
+ NAME_FUNC_OFFSET( 2951, glPixelTransferf, _gloffset_PixelTransferf ),
+ NAME_FUNC_OFFSET( 2968, glPixelTransferi, _gloffset_PixelTransferi ),
+ NAME_FUNC_OFFSET( 2985, glPixelStoref, _gloffset_PixelStoref ),
+ NAME_FUNC_OFFSET( 2999, glPixelStorei, _gloffset_PixelStorei ),
+ NAME_FUNC_OFFSET( 3013, glPixelMapfv, _gloffset_PixelMapfv ),
+ NAME_FUNC_OFFSET( 3026, glPixelMapuiv, _gloffset_PixelMapuiv ),
+ NAME_FUNC_OFFSET( 3040, glPixelMapusv, _gloffset_PixelMapusv ),
+ NAME_FUNC_OFFSET( 3054, glReadBuffer, _gloffset_ReadBuffer ),
+ NAME_FUNC_OFFSET( 3067, glCopyPixels, _gloffset_CopyPixels ),
+ NAME_FUNC_OFFSET( 3080, glReadPixels, _gloffset_ReadPixels ),
+ NAME_FUNC_OFFSET( 3093, glDrawPixels, _gloffset_DrawPixels ),
+ NAME_FUNC_OFFSET( 3106, glGetBooleanv, _gloffset_GetBooleanv ),
+ NAME_FUNC_OFFSET( 3120, glGetClipPlane, _gloffset_GetClipPlane ),
+ NAME_FUNC_OFFSET( 3135, glGetDoublev, _gloffset_GetDoublev ),
+ NAME_FUNC_OFFSET( 3148, glGetError, _gloffset_GetError ),
+ NAME_FUNC_OFFSET( 3159, glGetFloatv, _gloffset_GetFloatv ),
+ NAME_FUNC_OFFSET( 3171, glGetIntegerv, _gloffset_GetIntegerv ),
+ NAME_FUNC_OFFSET( 3185, glGetLightfv, _gloffset_GetLightfv ),
+ NAME_FUNC_OFFSET( 3198, glGetLightiv, _gloffset_GetLightiv ),
+ NAME_FUNC_OFFSET( 3211, glGetMapdv, _gloffset_GetMapdv ),
+ NAME_FUNC_OFFSET( 3222, glGetMapfv, _gloffset_GetMapfv ),
+ NAME_FUNC_OFFSET( 3233, glGetMapiv, _gloffset_GetMapiv ),
+ NAME_FUNC_OFFSET( 3244, glGetMaterialfv, _gloffset_GetMaterialfv ),
+ NAME_FUNC_OFFSET( 3260, glGetMaterialiv, _gloffset_GetMaterialiv ),
+ NAME_FUNC_OFFSET( 3276, glGetPixelMapfv, _gloffset_GetPixelMapfv ),
+ NAME_FUNC_OFFSET( 3292, glGetPixelMapuiv, _gloffset_GetPixelMapuiv ),
+ NAME_FUNC_OFFSET( 3309, glGetPixelMapusv, _gloffset_GetPixelMapusv ),
+ NAME_FUNC_OFFSET( 3326, glGetPolygonStipple, _gloffset_GetPolygonStipple ),
+ NAME_FUNC_OFFSET( 3346, glGetString, _gloffset_GetString ),
+ NAME_FUNC_OFFSET( 3358, glGetTexEnvfv, _gloffset_GetTexEnvfv ),
+ NAME_FUNC_OFFSET( 3372, glGetTexEnviv, _gloffset_GetTexEnviv ),
+ NAME_FUNC_OFFSET( 3386, glGetTexGendv, _gloffset_GetTexGendv ),
+ NAME_FUNC_OFFSET( 3400, glGetTexGenfv, _gloffset_GetTexGenfv ),
+ NAME_FUNC_OFFSET( 3414, glGetTexGeniv, _gloffset_GetTexGeniv ),
+ NAME_FUNC_OFFSET( 3428, glGetTexImage, _gloffset_GetTexImage ),
+ NAME_FUNC_OFFSET( 3442, glGetTexParameterfv, _gloffset_GetTexParameterfv ),
+ NAME_FUNC_OFFSET( 3462, glGetTexParameteriv, _gloffset_GetTexParameteriv ),
+ NAME_FUNC_OFFSET( 3482, glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv ),
+ NAME_FUNC_OFFSET( 3507, glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv ),
+ NAME_FUNC_OFFSET( 3532, glIsEnabled, _gloffset_IsEnabled ),
+ NAME_FUNC_OFFSET( 3544, glIsList, _gloffset_IsList ),
+ NAME_FUNC_OFFSET( 3553, glDepthRange, _gloffset_DepthRange ),
+ NAME_FUNC_OFFSET( 3566, glFrustum, _gloffset_Frustum ),
+ NAME_FUNC_OFFSET( 3576, glLoadIdentity, _gloffset_LoadIdentity ),
+ NAME_FUNC_OFFSET( 3591, glLoadMatrixf, _gloffset_LoadMatrixf ),
+ NAME_FUNC_OFFSET( 3605, glLoadMatrixd, _gloffset_LoadMatrixd ),
+ NAME_FUNC_OFFSET( 3619, glMatrixMode, _gloffset_MatrixMode ),
+ NAME_FUNC_OFFSET( 3632, glMultMatrixf, _gloffset_MultMatrixf ),
+ NAME_FUNC_OFFSET( 3646, glMultMatrixd, _gloffset_MultMatrixd ),
+ NAME_FUNC_OFFSET( 3660, glOrtho, _gloffset_Ortho ),
+ NAME_FUNC_OFFSET( 3668, glPopMatrix, _gloffset_PopMatrix ),
+ NAME_FUNC_OFFSET( 3680, glPushMatrix, _gloffset_PushMatrix ),
+ NAME_FUNC_OFFSET( 3693, glRotated, _gloffset_Rotated ),
+ NAME_FUNC_OFFSET( 3703, glRotatef, _gloffset_Rotatef ),
+ NAME_FUNC_OFFSET( 3713, glScaled, _gloffset_Scaled ),
+ NAME_FUNC_OFFSET( 3722, glScalef, _gloffset_Scalef ),
+ NAME_FUNC_OFFSET( 3731, glTranslated, _gloffset_Translated ),
+ NAME_FUNC_OFFSET( 3744, glTranslatef, _gloffset_Translatef ),
+ NAME_FUNC_OFFSET( 3757, glViewport, _gloffset_Viewport ),
+ NAME_FUNC_OFFSET( 3768, glArrayElement, _gloffset_ArrayElement ),
+ NAME_FUNC_OFFSET( 3783, glBindTexture, _gloffset_BindTexture ),
+ NAME_FUNC_OFFSET( 3797, glColorPointer, _gloffset_ColorPointer ),
+ NAME_FUNC_OFFSET( 3812, glDisableClientState, _gloffset_DisableClientState ),
+ NAME_FUNC_OFFSET( 3833, glDrawArrays, _gloffset_DrawArrays ),
+ NAME_FUNC_OFFSET( 3846, glDrawElements, _gloffset_DrawElements ),
+ NAME_FUNC_OFFSET( 3861, glEdgeFlagPointer, _gloffset_EdgeFlagPointer ),
+ NAME_FUNC_OFFSET( 3879, glEnableClientState, _gloffset_EnableClientState ),
+ NAME_FUNC_OFFSET( 3899, glIndexPointer, _gloffset_IndexPointer ),
+ NAME_FUNC_OFFSET( 3914, glIndexub, _gloffset_Indexub ),
+ NAME_FUNC_OFFSET( 3924, glIndexubv, _gloffset_Indexubv ),
+ NAME_FUNC_OFFSET( 3935, glInterleavedArrays, _gloffset_InterleavedArrays ),
+ NAME_FUNC_OFFSET( 3955, glNormalPointer, _gloffset_NormalPointer ),
+ NAME_FUNC_OFFSET( 3971, glPolygonOffset, _gloffset_PolygonOffset ),
+ NAME_FUNC_OFFSET( 3987, glTexCoordPointer, _gloffset_TexCoordPointer ),
+ NAME_FUNC_OFFSET( 4005, glVertexPointer, _gloffset_VertexPointer ),
+ NAME_FUNC_OFFSET( 4021, glAreTexturesResident, _gloffset_AreTexturesResident ),
+ NAME_FUNC_OFFSET( 4043, glCopyTexImage1D, _gloffset_CopyTexImage1D ),
+ NAME_FUNC_OFFSET( 4060, glCopyTexImage2D, _gloffset_CopyTexImage2D ),
+ NAME_FUNC_OFFSET( 4077, glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D ),
+ NAME_FUNC_OFFSET( 4097, glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D ),
+ NAME_FUNC_OFFSET( 4117, glDeleteTextures, _gloffset_DeleteTextures ),
+ NAME_FUNC_OFFSET( 4134, glGenTextures, _gloffset_GenTextures ),
+ NAME_FUNC_OFFSET( 4148, glGetPointerv, _gloffset_GetPointerv ),
+ NAME_FUNC_OFFSET( 4162, glIsTexture, _gloffset_IsTexture ),
+ NAME_FUNC_OFFSET( 4174, glPrioritizeTextures, _gloffset_PrioritizeTextures ),
+ NAME_FUNC_OFFSET( 4195, glTexSubImage1D, _gloffset_TexSubImage1D ),
+ NAME_FUNC_OFFSET( 4211, glTexSubImage2D, _gloffset_TexSubImage2D ),
+ NAME_FUNC_OFFSET( 4227, glPopClientAttrib, _gloffset_PopClientAttrib ),
+ NAME_FUNC_OFFSET( 4245, glPushClientAttrib, _gloffset_PushClientAttrib ),
+ NAME_FUNC_OFFSET( 4264, glBlendColor, _gloffset_BlendColor ),
+ NAME_FUNC_OFFSET( 4277, glBlendEquation, _gloffset_BlendEquation ),
+ NAME_FUNC_OFFSET( 4293, glDrawRangeElements, _gloffset_DrawRangeElements ),
+ NAME_FUNC_OFFSET( 4313, glColorTable, _gloffset_ColorTable ),
+ NAME_FUNC_OFFSET( 4326, glColorTableParameterfv, _gloffset_ColorTableParameterfv ),
+ NAME_FUNC_OFFSET( 4350, glColorTableParameteriv, _gloffset_ColorTableParameteriv ),
+ NAME_FUNC_OFFSET( 4374, glCopyColorTable, _gloffset_CopyColorTable ),
+ NAME_FUNC_OFFSET( 4391, glGetColorTable, _gloffset_GetColorTable ),
+ NAME_FUNC_OFFSET( 4407, glGetColorTableParameterfv, _gloffset_GetColorTableParameterfv ),
+ NAME_FUNC_OFFSET( 4434, glGetColorTableParameteriv, _gloffset_GetColorTableParameteriv ),
+ NAME_FUNC_OFFSET( 4461, glColorSubTable, _gloffset_ColorSubTable ),
+ NAME_FUNC_OFFSET( 4477, glCopyColorSubTable, _gloffset_CopyColorSubTable ),
+ NAME_FUNC_OFFSET( 4497, glConvolutionFilter1D, _gloffset_ConvolutionFilter1D ),
+ NAME_FUNC_OFFSET( 4519, glConvolutionFilter2D, _gloffset_ConvolutionFilter2D ),
+ NAME_FUNC_OFFSET( 4541, glConvolutionParameterf, _gloffset_ConvolutionParameterf ),
+ NAME_FUNC_OFFSET( 4565, glConvolutionParameterfv, _gloffset_ConvolutionParameterfv ),
+ NAME_FUNC_OFFSET( 4590, glConvolutionParameteri, _gloffset_ConvolutionParameteri ),
+ NAME_FUNC_OFFSET( 4614, glConvolutionParameteriv, _gloffset_ConvolutionParameteriv ),
+ NAME_FUNC_OFFSET( 4639, glCopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D ),
+ NAME_FUNC_OFFSET( 4665, glCopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D ),
+ NAME_FUNC_OFFSET( 4691, glGetConvolutionFilter, _gloffset_GetConvolutionFilter ),
+ NAME_FUNC_OFFSET( 4714, glGetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv ),
+ NAME_FUNC_OFFSET( 4742, glGetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv ),
+ NAME_FUNC_OFFSET( 4770, glGetSeparableFilter, _gloffset_GetSeparableFilter ),
+ NAME_FUNC_OFFSET( 4791, glSeparableFilter2D, _gloffset_SeparableFilter2D ),
+ NAME_FUNC_OFFSET( 4811, glGetHistogram, _gloffset_GetHistogram ),
+ NAME_FUNC_OFFSET( 4826, glGetHistogramParameterfv, _gloffset_GetHistogramParameterfv ),
+ NAME_FUNC_OFFSET( 4852, glGetHistogramParameteriv, _gloffset_GetHistogramParameteriv ),
+ NAME_FUNC_OFFSET( 4878, glGetMinmax, _gloffset_GetMinmax ),
+ NAME_FUNC_OFFSET( 4890, glGetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv ),
+ NAME_FUNC_OFFSET( 4913, glGetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv ),
+ NAME_FUNC_OFFSET( 4936, glHistogram, _gloffset_Histogram ),
+ NAME_FUNC_OFFSET( 4948, glMinmax, _gloffset_Minmax ),
+ NAME_FUNC_OFFSET( 4957, glResetHistogram, _gloffset_ResetHistogram ),
+ NAME_FUNC_OFFSET( 4974, glResetMinmax, _gloffset_ResetMinmax ),
+ NAME_FUNC_OFFSET( 4988, glTexImage3D, _gloffset_TexImage3D ),
+ NAME_FUNC_OFFSET( 5001, glTexSubImage3D, _gloffset_TexSubImage3D ),
+ NAME_FUNC_OFFSET( 5017, glCopyTexSubImage3D, _gloffset_CopyTexSubImage3D ),
+ NAME_FUNC_OFFSET( 5037, glActiveTextureARB, _gloffset_ActiveTextureARB ),
+ NAME_FUNC_OFFSET( 5056, glClientActiveTextureARB, _gloffset_ClientActiveTextureARB ),
+ NAME_FUNC_OFFSET( 5081, glMultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB ),
+ NAME_FUNC_OFFSET( 5102, glMultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB ),
+ NAME_FUNC_OFFSET( 5124, glMultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB ),
+ NAME_FUNC_OFFSET( 5145, glMultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB ),
+ NAME_FUNC_OFFSET( 5167, glMultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB ),
+ NAME_FUNC_OFFSET( 5188, glMultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB ),
+ NAME_FUNC_OFFSET( 5210, glMultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB ),
+ NAME_FUNC_OFFSET( 5231, glMultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB ),
+ NAME_FUNC_OFFSET( 5253, glMultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB ),
+ NAME_FUNC_OFFSET( 5274, glMultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB ),
+ NAME_FUNC_OFFSET( 5296, glMultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB ),
+ NAME_FUNC_OFFSET( 5317, glMultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB ),
+ NAME_FUNC_OFFSET( 5339, glMultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB ),
+ NAME_FUNC_OFFSET( 5360, glMultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB ),
+ NAME_FUNC_OFFSET( 5382, glMultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB ),
+ NAME_FUNC_OFFSET( 5403, glMultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB ),
+ NAME_FUNC_OFFSET( 5425, glMultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB ),
+ NAME_FUNC_OFFSET( 5446, glMultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB ),
+ NAME_FUNC_OFFSET( 5468, glMultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB ),
+ NAME_FUNC_OFFSET( 5489, glMultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB ),
+ NAME_FUNC_OFFSET( 5511, glMultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB ),
+ NAME_FUNC_OFFSET( 5532, glMultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB ),
+ NAME_FUNC_OFFSET( 5554, glMultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB ),
+ NAME_FUNC_OFFSET( 5575, glMultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB ),
+ NAME_FUNC_OFFSET( 5597, glMultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB ),
+ NAME_FUNC_OFFSET( 5618, glMultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB ),
+ NAME_FUNC_OFFSET( 5640, glMultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB ),
+ NAME_FUNC_OFFSET( 5661, glMultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB ),
+ NAME_FUNC_OFFSET( 5683, glMultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB ),
+ NAME_FUNC_OFFSET( 5704, glMultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB ),
+ NAME_FUNC_OFFSET( 5726, glMultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB ),
+ NAME_FUNC_OFFSET( 5747, glMultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB ),
+ NAME_FUNC_OFFSET( 5769, glLoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB ),
+ NAME_FUNC_OFFSET( 5795, glLoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB ),
+ NAME_FUNC_OFFSET( 5821, glMultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB ),
+ NAME_FUNC_OFFSET( 5847, glMultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB ),
+ NAME_FUNC_OFFSET( 5873, glSampleCoverageARB, _gloffset_SampleCoverageARB ),
+ NAME_FUNC_OFFSET( 5893, gl__unused413, _gloffset___unused413 ),
+ NAME_FUNC_OFFSET( 5907, glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT ),
+ NAME_FUNC_OFFSET( 5926, glGetTexFilterFuncSGIS, _gloffset_GetTexFilterFuncSGIS ),
+ NAME_FUNC_OFFSET( 5949, glTexFilterFuncSGIS, _gloffset_TexFilterFuncSGIS ),
+ NAME_FUNC_OFFSET( 5969, glGetHistogramEXT, _gloffset_GetHistogramEXT ),
+ NAME_FUNC_OFFSET( 5987, glGetHistogramParameterfvEXT, _gloffset_GetHistogramParameterfvEXT ),
+ NAME_FUNC_OFFSET( 6016, glGetHistogramParameterivEXT, _gloffset_GetHistogramParameterivEXT ),
+ NAME_FUNC_OFFSET( 6045, glGetMinmaxEXT, _gloffset_GetMinmaxEXT ),
+ NAME_FUNC_OFFSET( 6060, glGetMinmaxParameterfvEXT, _gloffset_GetMinmaxParameterfvEXT ),
+ NAME_FUNC_OFFSET( 6086, glGetMinmaxParameterivEXT, _gloffset_GetMinmaxParameterivEXT ),
+ NAME_FUNC_OFFSET( 6112, glGetConvolutionFilterEXT, _gloffset_GetConvolutionFilterEXT ),
+ NAME_FUNC_OFFSET( 6138, glGetConvolutionParameterfvEXT, _gloffset_GetConvolutionParameterfvEXT ),
+ NAME_FUNC_OFFSET( 6169, glGetConvolutionParameterivEXT, _gloffset_GetConvolutionParameterivEXT ),
+ NAME_FUNC_OFFSET( 6200, glGetSeparableFilterEXT, _gloffset_GetSeparableFilterEXT ),
+ NAME_FUNC_OFFSET( 6224, glGetColorTableSGI, _gloffset_GetColorTableSGI ),
+ NAME_FUNC_OFFSET( 6243, glGetColorTableParameterfvSGI, _gloffset_GetColorTableParameterfvSGI ),
+ NAME_FUNC_OFFSET( 6273, glGetColorTableParameterivSGI, _gloffset_GetColorTableParameterivSGI ),
+ NAME_FUNC_OFFSET( 6303, glPixelTexGenSGIX, _gloffset_PixelTexGenSGIX ),
+ NAME_FUNC_OFFSET( 6321, glPixelTexGenParameteriSGIS, _gloffset_PixelTexGenParameteriSGIS ),
+ NAME_FUNC_OFFSET( 6349, glPixelTexGenParameterivSGIS, _gloffset_PixelTexGenParameterivSGIS ),
+ NAME_FUNC_OFFSET( 6378, glPixelTexGenParameterfSGIS, _gloffset_PixelTexGenParameterfSGIS ),
+ NAME_FUNC_OFFSET( 6406, glPixelTexGenParameterfvSGIS, _gloffset_PixelTexGenParameterfvSGIS ),
+ NAME_FUNC_OFFSET( 6435, glGetPixelTexGenParameterivSGIS, _gloffset_GetPixelTexGenParameterivSGIS ),
+ NAME_FUNC_OFFSET( 6467, glGetPixelTexGenParameterfvSGIS, _gloffset_GetPixelTexGenParameterfvSGIS ),
+ NAME_FUNC_OFFSET( 6499, glTexImage4DSGIS, _gloffset_TexImage4DSGIS ),
+ NAME_FUNC_OFFSET( 6516, glTexSubImage4DSGIS, _gloffset_TexSubImage4DSGIS ),
+ NAME_FUNC_OFFSET( 6536, glAreTexturesResidentEXT, _gloffset_AreTexturesResidentEXT ),
+ NAME_FUNC_OFFSET( 6561, glGenTexturesEXT, _gloffset_GenTexturesEXT ),
+ NAME_FUNC_OFFSET( 6578, glIsTextureEXT, _gloffset_IsTextureEXT ),
+ NAME_FUNC_OFFSET( 6593, glDetailTexFuncSGIS, _gloffset_DetailTexFuncSGIS ),
+ NAME_FUNC_OFFSET( 6613, glGetDetailTexFuncSGIS, _gloffset_GetDetailTexFuncSGIS ),
+ NAME_FUNC_OFFSET( 6636, glSharpenTexFuncSGIS, _gloffset_SharpenTexFuncSGIS ),
+ NAME_FUNC_OFFSET( 6657, glGetSharpenTexFuncSGIS, _gloffset_GetSharpenTexFuncSGIS ),
+ NAME_FUNC_OFFSET( 6681, glSampleMaskSGIS, _gloffset_SampleMaskSGIS ),
+ NAME_FUNC_OFFSET( 6698, glSamplePatternSGIS, _gloffset_SamplePatternSGIS ),
+ NAME_FUNC_OFFSET( 6718, glColorPointerEXT, _gloffset_ColorPointerEXT ),
+ NAME_FUNC_OFFSET( 6736, glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT ),
+ NAME_FUNC_OFFSET( 6757, glIndexPointerEXT, _gloffset_IndexPointerEXT ),
+ NAME_FUNC_OFFSET( 6775, glNormalPointerEXT, _gloffset_NormalPointerEXT ),
+ NAME_FUNC_OFFSET( 6794, glTexCoordPointerEXT, _gloffset_TexCoordPointerEXT ),
+ NAME_FUNC_OFFSET( 6815, glVertexPointerEXT, _gloffset_VertexPointerEXT ),
+ NAME_FUNC_OFFSET( 6834, glSpriteParameterfSGIX, _gloffset_SpriteParameterfSGIX ),
+ NAME_FUNC_OFFSET( 6857, glSpriteParameterfvSGIX, _gloffset_SpriteParameterfvSGIX ),
+ NAME_FUNC_OFFSET( 6881, glSpriteParameteriSGIX, _gloffset_SpriteParameteriSGIX ),
+ NAME_FUNC_OFFSET( 6904, glSpriteParameterivSGIX, _gloffset_SpriteParameterivSGIX ),
+ NAME_FUNC_OFFSET( 6928, glPointParameterfEXT, _gloffset_PointParameterfEXT ),
+ NAME_FUNC_OFFSET( 6949, glPointParameterfvEXT, _gloffset_PointParameterfvEXT ),
+ NAME_FUNC_OFFSET( 6971, glGetInstrumentsSGIX, _gloffset_GetInstrumentsSGIX ),
+ NAME_FUNC_OFFSET( 6992, glInstrumentsBufferSGIX, _gloffset_InstrumentsBufferSGIX ),
+ NAME_FUNC_OFFSET( 7016, glPollInstrumentsSGIX, _gloffset_PollInstrumentsSGIX ),
+ NAME_FUNC_OFFSET( 7038, glReadInstrumentsSGIX, _gloffset_ReadInstrumentsSGIX ),
+ NAME_FUNC_OFFSET( 7060, glStartInstrumentsSGIX, _gloffset_StartInstrumentsSGIX ),
+ NAME_FUNC_OFFSET( 7083, glStopInstrumentsSGIX, _gloffset_StopInstrumentsSGIX ),
+ NAME_FUNC_OFFSET( 7105, glFrameZoomSGIX, _gloffset_FrameZoomSGIX ),
+ NAME_FUNC_OFFSET( 7121, glTagSampleBufferSGIX, _gloffset_TagSampleBufferSGIX ),
+ NAME_FUNC_OFFSET( 7143, glReferencePlaneSGIX, _gloffset_ReferencePlaneSGIX ),
+ NAME_FUNC_OFFSET( 7164, glFlushRasterSGIX, _gloffset_FlushRasterSGIX ),
+ NAME_FUNC_OFFSET( 7182, glGetListParameterfvSGIX, _gloffset_GetListParameterfvSGIX ),
+ NAME_FUNC_OFFSET( 7207, glGetListParameterivSGIX, _gloffset_GetListParameterivSGIX ),
+ NAME_FUNC_OFFSET( 7232, glListParameterfSGIX, _gloffset_ListParameterfSGIX ),
+ NAME_FUNC_OFFSET( 7253, glListParameterfvSGIX, _gloffset_ListParameterfvSGIX ),
+ NAME_FUNC_OFFSET( 7275, glListParameteriSGIX, _gloffset_ListParameteriSGIX ),
+ NAME_FUNC_OFFSET( 7296, glListParameterivSGIX, _gloffset_ListParameterivSGIX ),
+ NAME_FUNC_OFFSET( 7318, glFragmentColorMaterialSGIX, _gloffset_FragmentColorMaterialSGIX ),
+ NAME_FUNC_OFFSET( 7346, glFragmentLightfSGIX, _gloffset_FragmentLightfSGIX ),
+ NAME_FUNC_OFFSET( 7367, glFragmentLightfvSGIX, _gloffset_FragmentLightfvSGIX ),
+ NAME_FUNC_OFFSET( 7389, glFragmentLightiSGIX, _gloffset_FragmentLightiSGIX ),
+ NAME_FUNC_OFFSET( 7410, glFragmentLightivSGIX, _gloffset_FragmentLightivSGIX ),
+ NAME_FUNC_OFFSET( 7432, glFragmentLightModelfSGIX, _gloffset_FragmentLightModelfSGIX ),
+ NAME_FUNC_OFFSET( 7458, glFragmentLightModelfvSGIX, _gloffset_FragmentLightModelfvSGIX ),
+ NAME_FUNC_OFFSET( 7485, glFragmentLightModeliSGIX, _gloffset_FragmentLightModeliSGIX ),
+ NAME_FUNC_OFFSET( 7511, glFragmentLightModelivSGIX, _gloffset_FragmentLightModelivSGIX ),
+ NAME_FUNC_OFFSET( 7538, glFragmentMaterialfSGIX, _gloffset_FragmentMaterialfSGIX ),
+ NAME_FUNC_OFFSET( 7562, glFragmentMaterialfvSGIX, _gloffset_FragmentMaterialfvSGIX ),
+ NAME_FUNC_OFFSET( 7587, glFragmentMaterialiSGIX, _gloffset_FragmentMaterialiSGIX ),
+ NAME_FUNC_OFFSET( 7611, glFragmentMaterialivSGIX, _gloffset_FragmentMaterialivSGIX ),
+ NAME_FUNC_OFFSET( 7636, glGetFragmentLightfvSGIX, _gloffset_GetFragmentLightfvSGIX ),
+ NAME_FUNC_OFFSET( 7661, glGetFragmentLightivSGIX, _gloffset_GetFragmentLightivSGIX ),
+ NAME_FUNC_OFFSET( 7686, glGetFragmentMaterialfvSGIX, _gloffset_GetFragmentMaterialfvSGIX ),
+ NAME_FUNC_OFFSET( 7714, glGetFragmentMaterialivSGIX, _gloffset_GetFragmentMaterialivSGIX ),
+ NAME_FUNC_OFFSET( 7742, glLightEnviSGIX, _gloffset_LightEnviSGIX ),
+ NAME_FUNC_OFFSET( 7758, glVertexWeightfEXT, _gloffset_VertexWeightfEXT ),
+ NAME_FUNC_OFFSET( 7777, glVertexWeightfvEXT, _gloffset_VertexWeightfvEXT ),
+ NAME_FUNC_OFFSET( 7797, glVertexWeightPointerEXT, _gloffset_VertexWeightPointerEXT ),
+ NAME_FUNC_OFFSET( 7822, glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV ),
+ NAME_FUNC_OFFSET( 7848, glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV ),
+ NAME_FUNC_OFFSET( 7869, glCombinerParameterfvNV, _gloffset_CombinerParameterfvNV ),
+ NAME_FUNC_OFFSET( 7893, glCombinerParameterfNV, _gloffset_CombinerParameterfNV ),
+ NAME_FUNC_OFFSET( 7916, glCombinerParameterivNV, _gloffset_CombinerParameterivNV ),
+ NAME_FUNC_OFFSET( 7940, glCombinerParameteriNV, _gloffset_CombinerParameteriNV ),
+ NAME_FUNC_OFFSET( 7963, glCombinerInputNV, _gloffset_CombinerInputNV ),
+ NAME_FUNC_OFFSET( 7981, glCombinerOutputNV, _gloffset_CombinerOutputNV ),
+ NAME_FUNC_OFFSET( 8000, glFinalCombinerInputNV, _gloffset_FinalCombinerInputNV ),
+ NAME_FUNC_OFFSET( 8023, glGetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV ),
+ NAME_FUNC_OFFSET( 8055, glGetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV ),
+ NAME_FUNC_OFFSET( 8087, glGetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV ),
+ NAME_FUNC_OFFSET( 8120, glGetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV ),
+ NAME_FUNC_OFFSET( 8153, glGetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV ),
+ NAME_FUNC_OFFSET( 8190, glGetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV ),
+ NAME_FUNC_OFFSET( 8227, glResizeBuffersMESA, _gloffset_ResizeBuffersMESA ),
+ NAME_FUNC_OFFSET( 8247, glWindowPos2dMESA, _gloffset_WindowPos2dMESA ),
+ NAME_FUNC_OFFSET( 8265, glWindowPos2dvMESA, _gloffset_WindowPos2dvMESA ),
+ NAME_FUNC_OFFSET( 8284, glWindowPos2fMESA, _gloffset_WindowPos2fMESA ),
+ NAME_FUNC_OFFSET( 8302, glWindowPos2fvMESA, _gloffset_WindowPos2fvMESA ),
+ NAME_FUNC_OFFSET( 8321, glWindowPos2iMESA, _gloffset_WindowPos2iMESA ),
+ NAME_FUNC_OFFSET( 8339, glWindowPos2ivMESA, _gloffset_WindowPos2ivMESA ),
+ NAME_FUNC_OFFSET( 8358, glWindowPos2sMESA, _gloffset_WindowPos2sMESA ),
+ NAME_FUNC_OFFSET( 8376, glWindowPos2svMESA, _gloffset_WindowPos2svMESA ),
+ NAME_FUNC_OFFSET( 8395, glWindowPos3dMESA, _gloffset_WindowPos3dMESA ),
+ NAME_FUNC_OFFSET( 8413, glWindowPos3dvMESA, _gloffset_WindowPos3dvMESA ),
+ NAME_FUNC_OFFSET( 8432, glWindowPos3fMESA, _gloffset_WindowPos3fMESA ),
+ NAME_FUNC_OFFSET( 8450, glWindowPos3fvMESA, _gloffset_WindowPos3fvMESA ),
+ NAME_FUNC_OFFSET( 8469, glWindowPos3iMESA, _gloffset_WindowPos3iMESA ),
+ NAME_FUNC_OFFSET( 8487, glWindowPos3ivMESA, _gloffset_WindowPos3ivMESA ),
+ NAME_FUNC_OFFSET( 8506, glWindowPos3sMESA, _gloffset_WindowPos3sMESA ),
+ NAME_FUNC_OFFSET( 8524, glWindowPos3svMESA, _gloffset_WindowPos3svMESA ),
+ NAME_FUNC_OFFSET( 8543, glWindowPos4dMESA, _gloffset_WindowPos4dMESA ),
+ NAME_FUNC_OFFSET( 8561, glWindowPos4dvMESA, _gloffset_WindowPos4dvMESA ),
+ NAME_FUNC_OFFSET( 8580, glWindowPos4fMESA, _gloffset_WindowPos4fMESA ),
+ NAME_FUNC_OFFSET( 8598, glWindowPos4fvMESA, _gloffset_WindowPos4fvMESA ),
+ NAME_FUNC_OFFSET( 8617, glWindowPos4iMESA, _gloffset_WindowPos4iMESA ),
+ NAME_FUNC_OFFSET( 8635, glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA ),
+ NAME_FUNC_OFFSET( 8654, glWindowPos4sMESA, _gloffset_WindowPos4sMESA ),
+ NAME_FUNC_OFFSET( 8672, glWindowPos4svMESA, _gloffset_WindowPos4svMESA ),
+ NAME_FUNC_OFFSET( 8691, glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT ),
+ NAME_FUNC_OFFSET( 8714, glIndexMaterialEXT, _gloffset_IndexMaterialEXT ),
+ NAME_FUNC_OFFSET( 8733, glIndexFuncEXT, _gloffset_IndexFuncEXT ),
+ NAME_FUNC_OFFSET( 8748, glLockArraysEXT, _gloffset_LockArraysEXT ),
+ NAME_FUNC_OFFSET( 8764, glUnlockArraysEXT, _gloffset_UnlockArraysEXT ),
+ NAME_FUNC_OFFSET( 8782, glCullParameterdvEXT, _gloffset_CullParameterdvEXT ),
+ NAME_FUNC_OFFSET( 8803, glCullParameterfvEXT, _gloffset_CullParameterfvEXT ),
+ NAME_FUNC_OFFSET( 8824, glHintPGI, _gloffset_HintPGI ),
+ NAME_FUNC_OFFSET( 8834, glFogCoordfEXT, _gloffset_FogCoordfEXT ),
+ NAME_FUNC_OFFSET( 8849, glFogCoordfvEXT, _gloffset_FogCoordfvEXT ),
+ NAME_FUNC_OFFSET( 8865, glFogCoorddEXT, _gloffset_FogCoorddEXT ),
+ NAME_FUNC_OFFSET( 8880, glFogCoorddvEXT, _gloffset_FogCoorddvEXT ),
+ NAME_FUNC_OFFSET( 8896, glFogCoordPointerEXT, _gloffset_FogCoordPointerEXT ),
+ NAME_FUNC_OFFSET( 8917, glGetColorTableEXT, _gloffset_GetColorTableEXT ),
+ NAME_FUNC_OFFSET( 8936, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameterivEXT ),
+ NAME_FUNC_OFFSET( 8966, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfvEXT ),
+ NAME_FUNC_OFFSET( 8996, glTbufferMask3DFX, _gloffset_TbufferMask3DFX ),
+ NAME_FUNC_OFFSET( 9014, glCompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB ),
+ NAME_FUNC_OFFSET( 9040, glCompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB ),
+ NAME_FUNC_OFFSET( 9066, glCompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB ),
+ NAME_FUNC_OFFSET( 9092, glCompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB ),
+ NAME_FUNC_OFFSET( 9121, glCompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB ),
+ NAME_FUNC_OFFSET( 9150, glCompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB ),
+ NAME_FUNC_OFFSET( 9179, glGetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB ),
+ NAME_FUNC_OFFSET( 9206, glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT ),
+ NAME_FUNC_OFFSET( 9228, glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT ),
+ NAME_FUNC_OFFSET( 9251, glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT ),
+ NAME_FUNC_OFFSET( 9273, glSecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT ),
+ NAME_FUNC_OFFSET( 9296, glSecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT ),
+ NAME_FUNC_OFFSET( 9318, glSecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT ),
+ NAME_FUNC_OFFSET( 9341, glSecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT ),
+ NAME_FUNC_OFFSET( 9363, glSecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT ),
+ NAME_FUNC_OFFSET( 9386, glSecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT ),
+ NAME_FUNC_OFFSET( 9408, glSecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT ),
+ NAME_FUNC_OFFSET( 9431, glSecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT ),
+ NAME_FUNC_OFFSET( 9454, glSecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT ),
+ NAME_FUNC_OFFSET( 9478, glSecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT ),
+ NAME_FUNC_OFFSET( 9501, glSecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT ),
+ NAME_FUNC_OFFSET( 9525, glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT ),
+ NAME_FUNC_OFFSET( 9548, glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT ),
+ NAME_FUNC_OFFSET( 9572, glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT ),
+ NAME_FUNC_OFFSET( 9599, glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV ),
+ NAME_FUNC_OFFSET( 9623, glBindProgramNV, _gloffset_BindProgramNV ),
+ NAME_FUNC_OFFSET( 9639, glDeleteProgramsNV, _gloffset_DeleteProgramsNV ),
+ NAME_FUNC_OFFSET( 9658, glExecuteProgramNV, _gloffset_ExecuteProgramNV ),
+ NAME_FUNC_OFFSET( 9677, glGenProgramsNV, _gloffset_GenProgramsNV ),
+ NAME_FUNC_OFFSET( 9693, glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV ),
+ NAME_FUNC_OFFSET( 9719, glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV ),
+ NAME_FUNC_OFFSET( 9745, glGetProgramivNV, _gloffset_GetProgramivNV ),
+ NAME_FUNC_OFFSET( 9762, glGetProgramStringNV, _gloffset_GetProgramStringNV ),
+ NAME_FUNC_OFFSET( 9783, glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV ),
+ NAME_FUNC_OFFSET( 9804, glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV ),
+ NAME_FUNC_OFFSET( 9826, glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV ),
+ NAME_FUNC_OFFSET( 9848, glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV ),
+ NAME_FUNC_OFFSET( 9870, glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV ),
+ NAME_FUNC_OFFSET( 9898, glIsProgramNV, _gloffset_IsProgramNV ),
+ NAME_FUNC_OFFSET( 9912, glLoadProgramNV, _gloffset_LoadProgramNV ),
+ NAME_FUNC_OFFSET( 9928, glProgramParameter4dNV, _gloffset_ProgramParameter4dNV ),
+ NAME_FUNC_OFFSET( 9951, glProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV ),
+ NAME_FUNC_OFFSET( 9975, glProgramParameter4fNV, _gloffset_ProgramParameter4fNV ),
+ NAME_FUNC_OFFSET( 9998, glProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV ),
+ NAME_FUNC_OFFSET( 10022, glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV ),
+ NAME_FUNC_OFFSET( 10047, glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV ),
+ NAME_FUNC_OFFSET( 10072, glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV ),
+ NAME_FUNC_OFFSET( 10100, glTrackMatrixNV, _gloffset_TrackMatrixNV ),
+ NAME_FUNC_OFFSET( 10116, glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV ),
+ NAME_FUNC_OFFSET( 10140, glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV ),
+ NAME_FUNC_OFFSET( 10159, glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV ),
+ NAME_FUNC_OFFSET( 10179, glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV ),
+ NAME_FUNC_OFFSET( 10198, glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV ),
+ NAME_FUNC_OFFSET( 10218, glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV ),
+ NAME_FUNC_OFFSET( 10237, glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV ),
+ NAME_FUNC_OFFSET( 10257, glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV ),
+ NAME_FUNC_OFFSET( 10276, glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV ),
+ NAME_FUNC_OFFSET( 10296, glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV ),
+ NAME_FUNC_OFFSET( 10315, glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV ),
+ NAME_FUNC_OFFSET( 10335, glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV ),
+ NAME_FUNC_OFFSET( 10354, glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV ),
+ NAME_FUNC_OFFSET( 10374, glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV ),
+ NAME_FUNC_OFFSET( 10393, glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV ),
+ NAME_FUNC_OFFSET( 10413, glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV ),
+ NAME_FUNC_OFFSET( 10432, glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV ),
+ NAME_FUNC_OFFSET( 10452, glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV ),
+ NAME_FUNC_OFFSET( 10471, glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV ),
+ NAME_FUNC_OFFSET( 10491, glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV ),
+ NAME_FUNC_OFFSET( 10510, glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV ),
+ NAME_FUNC_OFFSET( 10530, glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV ),
+ NAME_FUNC_OFFSET( 10549, glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV ),
+ NAME_FUNC_OFFSET( 10569, glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV ),
+ NAME_FUNC_OFFSET( 10588, glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV ),
+ NAME_FUNC_OFFSET( 10608, glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV ),
+ NAME_FUNC_OFFSET( 10628, glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV ),
+ NAME_FUNC_OFFSET( 10649, glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV ),
+ NAME_FUNC_OFFSET( 10670, glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV ),
+ NAME_FUNC_OFFSET( 10691, glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV ),
+ NAME_FUNC_OFFSET( 10712, glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV ),
+ NAME_FUNC_OFFSET( 10733, glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV ),
+ NAME_FUNC_OFFSET( 10754, glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV ),
+ NAME_FUNC_OFFSET( 10775, glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV ),
+ NAME_FUNC_OFFSET( 10796, glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV ),
+ NAME_FUNC_OFFSET( 10817, glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV ),
+ NAME_FUNC_OFFSET( 10838, glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV ),
+ NAME_FUNC_OFFSET( 10859, glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV ),
+ NAME_FUNC_OFFSET( 10880, glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV ),
+ NAME_FUNC_OFFSET( 10901, glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV ),
+ NAME_FUNC_OFFSET( 10923, glPointParameteriNV, _gloffset_PointParameteriNV ),
+ NAME_FUNC_OFFSET( 10943, glPointParameterivNV, _gloffset_PointParameterivNV ),
+ NAME_FUNC_OFFSET( 10964, glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT ),
+ NAME_FUNC_OFFSET( 10985, glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT ),
+ NAME_FUNC_OFFSET( 11008, glActiveStencilFaceEXT, _gloffset_ActiveStencilFaceEXT ),
+ NAME_FUNC_OFFSET( 11031, glDeleteFencesNV, _gloffset_DeleteFencesNV ),
+ NAME_FUNC_OFFSET( 11048, glGenFencesNV, _gloffset_GenFencesNV ),
+ NAME_FUNC_OFFSET( 11062, glIsFenceNV, _gloffset_IsFenceNV ),
+ NAME_FUNC_OFFSET( 11074, glTestFenceNV, _gloffset_TestFenceNV ),
+ NAME_FUNC_OFFSET( 11088, glGetFenceivNV, _gloffset_GetFenceivNV ),
+ NAME_FUNC_OFFSET( 11103, glFinishFenceNV, _gloffset_FinishFenceNV ),
+ NAME_FUNC_OFFSET( 11119, glSetFenceNV, _gloffset_SetFenceNV ),
+ NAME_FUNC_OFFSET( 11132, glVertexAttrib4bvARB, _gloffset_VertexAttrib4bvARB ),
+ NAME_FUNC_OFFSET( 11153, glVertexAttrib4ivARB, _gloffset_VertexAttrib4ivARB ),
+ NAME_FUNC_OFFSET( 11174, glVertexAttrib4ubvARB, _gloffset_VertexAttrib4ubvARB ),
+ NAME_FUNC_OFFSET( 11196, glVertexAttrib4usvARB, _gloffset_VertexAttrib4usvARB ),
+ NAME_FUNC_OFFSET( 11218, glVertexAttrib4uivARB, _gloffset_VertexAttrib4uivARB ),
+ NAME_FUNC_OFFSET( 11240, glVertexAttrib4NbvARB, _gloffset_VertexAttrib4NbvARB ),
+ NAME_FUNC_OFFSET( 11262, glVertexAttrib4NsvARB, _gloffset_VertexAttrib4NsvARB ),
+ NAME_FUNC_OFFSET( 11284, glVertexAttrib4NivARB, _gloffset_VertexAttrib4NivARB ),
+ NAME_FUNC_OFFSET( 11306, glVertexAttrib4NusvARB, _gloffset_VertexAttrib4NusvARB ),
+ NAME_FUNC_OFFSET( 11329, glVertexAttrib4NuivARB, _gloffset_VertexAttrib4NuivARB ),
+ NAME_FUNC_OFFSET( 11352, glVertexAttribPointerARB, _gloffset_VertexAttribPointerARB ),
+ NAME_FUNC_OFFSET( 11377, glEnableVertexAttribArrayARB, _gloffset_EnableVertexAttribArrayARB ),
+ NAME_FUNC_OFFSET( 11406, glDisableVertexAttribArrayARB, _gloffset_DisableVertexAttribArrayARB ),
+ NAME_FUNC_OFFSET( 11436, glProgramStringARB, _gloffset_ProgramStringARB ),
+ NAME_FUNC_OFFSET( 11455, glProgramEnvParameter4dARB, _gloffset_ProgramEnvParameter4dARB ),
+ NAME_FUNC_OFFSET( 11482, glProgramEnvParameter4dvARB, _gloffset_ProgramEnvParameter4dvARB ),
+ NAME_FUNC_OFFSET( 11510, glProgramEnvParameter4fARB, _gloffset_ProgramEnvParameter4fARB ),
+ NAME_FUNC_OFFSET( 11537, glProgramEnvParameter4fvARB, _gloffset_ProgramEnvParameter4fvARB ),
+ NAME_FUNC_OFFSET( 11565, glProgramLocalParameter4dARB, _gloffset_ProgramLocalParameter4dARB ),
+ NAME_FUNC_OFFSET( 11594, glProgramLocalParameter4dvARB, _gloffset_ProgramLocalParameter4dvARB ),
+ NAME_FUNC_OFFSET( 11624, glProgramLocalParameter4fARB, _gloffset_ProgramLocalParameter4fARB ),
+ NAME_FUNC_OFFSET( 11653, glProgramLocalParameter4fvARB, _gloffset_ProgramLocalParameter4fvARB ),
+ NAME_FUNC_OFFSET( 11683, glGetProgramEnvParameterdvARB, _gloffset_GetProgramEnvParameterdvARB ),
+ NAME_FUNC_OFFSET( 11713, glGetProgramEnvParameterfvARB, _gloffset_GetProgramEnvParameterfvARB ),
+ NAME_FUNC_OFFSET( 11743, glGetProgramLocalParameterdvARB, _gloffset_GetProgramLocalParameterdvARB ),
+ NAME_FUNC_OFFSET( 11775, glGetProgramLocalParameterfvARB, _gloffset_GetProgramLocalParameterfvARB ),
+ NAME_FUNC_OFFSET( 11807, glGetProgramivARB, _gloffset_GetProgramivARB ),
+ NAME_FUNC_OFFSET( 11825, glGetProgramStringARB, _gloffset_GetProgramStringARB ),
+ NAME_FUNC_OFFSET( 11847, glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV ),
+ NAME_FUNC_OFFSET( 11875, glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV ),
+ NAME_FUNC_OFFSET( 11903, glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV ),
+ NAME_FUNC_OFFSET( 11932, glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV ),
+ NAME_FUNC_OFFSET( 11961, glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV ),
+ NAME_FUNC_OFFSET( 11992, glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV ),
+ NAME_FUNC_OFFSET( 12023, glBindBufferARB, _gloffset_BindBufferARB ),
+ NAME_FUNC_OFFSET( 12039, glBufferDataARB, _gloffset_BufferDataARB ),
+ NAME_FUNC_OFFSET( 12055, glBufferSubDataARB, _gloffset_BufferSubDataARB ),
+ NAME_FUNC_OFFSET( 12074, glDeleteBuffersARB, _gloffset_DeleteBuffersARB ),
+ NAME_FUNC_OFFSET( 12093, glGenBuffersARB, _gloffset_GenBuffersARB ),
+ NAME_FUNC_OFFSET( 12109, glGetBufferParameterivARB, _gloffset_GetBufferParameterivARB ),
+ NAME_FUNC_OFFSET( 12135, glGetBufferPointervARB, _gloffset_GetBufferPointervARB ),
+ NAME_FUNC_OFFSET( 12158, glGetBufferSubDataARB, _gloffset_GetBufferSubDataARB ),
+ NAME_FUNC_OFFSET( 12180, glIsBufferARB, _gloffset_IsBufferARB ),
+ NAME_FUNC_OFFSET( 12194, glMapBufferARB, _gloffset_MapBufferARB ),
+ NAME_FUNC_OFFSET( 12209, glUnmapBufferARB, _gloffset_UnmapBufferARB ),
+ NAME_FUNC_OFFSET( 12226, glDepthBoundsEXT, _gloffset_DepthBoundsEXT ),
+ NAME_FUNC_OFFSET( 12243, glGenQueriesARB, _gloffset_GenQueriesARB ),
+ NAME_FUNC_OFFSET( 12259, glDeleteQueriesARB, _gloffset_DeleteQueriesARB ),
+ NAME_FUNC_OFFSET( 12278, glIsQueryARB, _gloffset_IsQueryARB ),
+ NAME_FUNC_OFFSET( 12291, glBeginQueryARB, _gloffset_BeginQueryARB ),
+ NAME_FUNC_OFFSET( 12307, glEndQueryARB, _gloffset_EndQueryARB ),
+ NAME_FUNC_OFFSET( 12321, glGetQueryivARB, _gloffset_GetQueryivARB ),
+ NAME_FUNC_OFFSET( 12337, glGetQueryObjectivARB, _gloffset_GetQueryObjectivARB ),
+ NAME_FUNC_OFFSET( 12359, glGetQueryObjectuivARB, _gloffset_GetQueryObjectuivARB ),
+ NAME_FUNC_OFFSET( 12382, glMultiModeDrawArraysIBM, _gloffset_MultiModeDrawArraysIBM ),
+ NAME_FUNC_OFFSET( 12407, glMultiModeDrawElementsIBM, _gloffset_MultiModeDrawElementsIBM ),
+ NAME_FUNC_OFFSET( 12434, glBlendEquationSeparateEXT, _gloffset_BlendEquationSeparateEXT ),
+ NAME_FUNC_OFFSET( 12461, glActiveTexture, _gloffset_ActiveTextureARB ),
+ NAME_FUNC_OFFSET( 12477, glClientActiveTexture, _gloffset_ClientActiveTextureARB ),
+ NAME_FUNC_OFFSET( 12499, glMultiTexCoord1d, _gloffset_MultiTexCoord1dARB ),
+ NAME_FUNC_OFFSET( 12517, glMultiTexCoord1dv, _gloffset_MultiTexCoord1dvARB ),
+ NAME_FUNC_OFFSET( 12536, glMultiTexCoord1f, _gloffset_MultiTexCoord1fARB ),
+ NAME_FUNC_OFFSET( 12554, glMultiTexCoord1fv, _gloffset_MultiTexCoord1fvARB ),
+ NAME_FUNC_OFFSET( 12573, glMultiTexCoord1i, _gloffset_MultiTexCoord1iARB ),
+ NAME_FUNC_OFFSET( 12591, glMultiTexCoord1iv, _gloffset_MultiTexCoord1ivARB ),
+ NAME_FUNC_OFFSET( 12610, glMultiTexCoord1s, _gloffset_MultiTexCoord1sARB ),
+ NAME_FUNC_OFFSET( 12628, glMultiTexCoord1sv, _gloffset_MultiTexCoord1svARB ),
+ NAME_FUNC_OFFSET( 12647, glMultiTexCoord2d, _gloffset_MultiTexCoord2dARB ),
+ NAME_FUNC_OFFSET( 12665, glMultiTexCoord2dv, _gloffset_MultiTexCoord2dvARB ),
+ NAME_FUNC_OFFSET( 12684, glMultiTexCoord2f, _gloffset_MultiTexCoord2fARB ),
+ NAME_FUNC_OFFSET( 12702, glMultiTexCoord2fv, _gloffset_MultiTexCoord2fvARB ),
+ NAME_FUNC_OFFSET( 12721, glMultiTexCoord2i, _gloffset_MultiTexCoord2iARB ),
+ NAME_FUNC_OFFSET( 12739, glMultiTexCoord2iv, _gloffset_MultiTexCoord2ivARB ),
+ NAME_FUNC_OFFSET( 12758, glMultiTexCoord2s, _gloffset_MultiTexCoord2sARB ),
+ NAME_FUNC_OFFSET( 12776, glMultiTexCoord2sv, _gloffset_MultiTexCoord2svARB ),
+ NAME_FUNC_OFFSET( 12795, glMultiTexCoord3d, _gloffset_MultiTexCoord3dARB ),
+ NAME_FUNC_OFFSET( 12813, glMultiTexCoord3dv, _gloffset_MultiTexCoord3dvARB ),
+ NAME_FUNC_OFFSET( 12832, glMultiTexCoord3f, _gloffset_MultiTexCoord3fARB ),
+ NAME_FUNC_OFFSET( 12850, glMultiTexCoord3fv, _gloffset_MultiTexCoord3fvARB ),
+ NAME_FUNC_OFFSET( 12869, glMultiTexCoord3i, _gloffset_MultiTexCoord3iARB ),
+ NAME_FUNC_OFFSET( 12887, glMultiTexCoord3iv, _gloffset_MultiTexCoord3ivARB ),
+ NAME_FUNC_OFFSET( 12906, glMultiTexCoord3s, _gloffset_MultiTexCoord3sARB ),
+ NAME_FUNC_OFFSET( 12924, glMultiTexCoord3sv, _gloffset_MultiTexCoord3svARB ),
+ NAME_FUNC_OFFSET( 12943, glMultiTexCoord4d, _gloffset_MultiTexCoord4dARB ),
+ NAME_FUNC_OFFSET( 12961, glMultiTexCoord4dv, _gloffset_MultiTexCoord4dvARB ),
+ NAME_FUNC_OFFSET( 12980, glMultiTexCoord4f, _gloffset_MultiTexCoord4fARB ),
+ NAME_FUNC_OFFSET( 12998, glMultiTexCoord4fv, _gloffset_MultiTexCoord4fvARB ),
+ NAME_FUNC_OFFSET( 13017, glMultiTexCoord4i, _gloffset_MultiTexCoord4iARB ),
+ NAME_FUNC_OFFSET( 13035, glMultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB ),
+ NAME_FUNC_OFFSET( 13054, glMultiTexCoord4s, _gloffset_MultiTexCoord4sARB ),
+ NAME_FUNC_OFFSET( 13072, glMultiTexCoord4sv, _gloffset_MultiTexCoord4svARB ),
+ NAME_FUNC_OFFSET( 13091, glLoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB ),
+ NAME_FUNC_OFFSET( 13114, glLoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB ),
+ NAME_FUNC_OFFSET( 13137, glMultTransposeMatrixf, _gloffset_MultTransposeMatrixfARB ),
+ NAME_FUNC_OFFSET( 13160, glMultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB ),
+ NAME_FUNC_OFFSET( 13183, glSampleCoverage, _gloffset_SampleCoverageARB ),
+ NAME_FUNC_OFFSET( 13200, glCompressedTexImage3D, _gloffset_CompressedTexImage3DARB ),
+ NAME_FUNC_OFFSET( 13223, glCompressedTexImage2D, _gloffset_CompressedTexImage2DARB ),
+ NAME_FUNC_OFFSET( 13246, glCompressedTexImage1D, _gloffset_CompressedTexImage1DARB ),
+ NAME_FUNC_OFFSET( 13269, glCompressedTexSubImage3D, _gloffset_CompressedTexSubImage3DARB ),
+ NAME_FUNC_OFFSET( 13295, glCompressedTexSubImage2D, _gloffset_CompressedTexSubImage2DARB ),
+ NAME_FUNC_OFFSET( 13321, glCompressedTexSubImage1D, _gloffset_CompressedTexSubImage1DARB ),
+ NAME_FUNC_OFFSET( 13347, glGetCompressedTexImage, _gloffset_GetCompressedTexImageARB ),
+ NAME_FUNC_OFFSET( 13371, glBlendFuncSeparate, _gloffset_BlendFuncSeparateEXT ),
+ NAME_FUNC_OFFSET( 13391, glFogCoordf, _gloffset_FogCoordfEXT ),
+ NAME_FUNC_OFFSET( 13403, glFogCoordfv, _gloffset_FogCoordfvEXT ),
+ NAME_FUNC_OFFSET( 13416, glFogCoordd, _gloffset_FogCoorddEXT ),
+ NAME_FUNC_OFFSET( 13428, glFogCoorddv, _gloffset_FogCoorddvEXT ),
+ NAME_FUNC_OFFSET( 13441, glFogCoordPointer, _gloffset_FogCoordPointerEXT ),
+ NAME_FUNC_OFFSET( 13459, glMultiDrawArrays, _gloffset_MultiDrawArraysEXT ),
+ NAME_FUNC_OFFSET( 13477, glMultiDrawElements, _gloffset_MultiDrawElementsEXT ),
+ NAME_FUNC_OFFSET( 13497, glPointParameterf, _gloffset_PointParameterfEXT ),
+ NAME_FUNC_OFFSET( 13515, glPointParameterfv, _gloffset_PointParameterfvEXT ),
+ NAME_FUNC_OFFSET( 13534, glPointParameteri, _gloffset_PointParameteriNV ),
+ NAME_FUNC_OFFSET( 13552, glPointParameteriv, _gloffset_PointParameterivNV ),
+ NAME_FUNC_OFFSET( 13571, glSecondaryColor3b, _gloffset_SecondaryColor3bEXT ),
+ NAME_FUNC_OFFSET( 13590, glSecondaryColor3bv, _gloffset_SecondaryColor3bvEXT ),
+ NAME_FUNC_OFFSET( 13610, glSecondaryColor3d, _gloffset_SecondaryColor3dEXT ),
+ NAME_FUNC_OFFSET( 13629, glSecondaryColor3dv, _gloffset_SecondaryColor3dvEXT ),
+ NAME_FUNC_OFFSET( 13649, glSecondaryColor3f, _gloffset_SecondaryColor3fEXT ),
+ NAME_FUNC_OFFSET( 13668, glSecondaryColor3fv, _gloffset_SecondaryColor3fvEXT ),
+ NAME_FUNC_OFFSET( 13688, glSecondaryColor3i, _gloffset_SecondaryColor3iEXT ),
+ NAME_FUNC_OFFSET( 13707, glSecondaryColor3iv, _gloffset_SecondaryColor3ivEXT ),
+ NAME_FUNC_OFFSET( 13727, glSecondaryColor3s, _gloffset_SecondaryColor3sEXT ),
+ NAME_FUNC_OFFSET( 13746, glSecondaryColor3sv, _gloffset_SecondaryColor3svEXT ),
+ NAME_FUNC_OFFSET( 13766, glSecondaryColor3ub, _gloffset_SecondaryColor3ubEXT ),
+ NAME_FUNC_OFFSET( 13786, glSecondaryColor3ubv, _gloffset_SecondaryColor3ubvEXT ),
+ NAME_FUNC_OFFSET( 13807, glSecondaryColor3ui, _gloffset_SecondaryColor3uiEXT ),
+ NAME_FUNC_OFFSET( 13827, glSecondaryColor3uiv, _gloffset_SecondaryColor3uivEXT ),
+ NAME_FUNC_OFFSET( 13848, glSecondaryColor3us, _gloffset_SecondaryColor3usEXT ),
+ NAME_FUNC_OFFSET( 13868, glSecondaryColor3usv, _gloffset_SecondaryColor3usvEXT ),
+ NAME_FUNC_OFFSET( 13889, glSecondaryColorPointer, _gloffset_SecondaryColorPointerEXT ),
+ NAME_FUNC_OFFSET( 13913, glWindowPos2d, _gloffset_WindowPos2dMESA ),
+ NAME_FUNC_OFFSET( 13927, glWindowPos2dv, _gloffset_WindowPos2dvMESA ),
+ NAME_FUNC_OFFSET( 13942, glWindowPos2f, _gloffset_WindowPos2fMESA ),
+ NAME_FUNC_OFFSET( 13956, glWindowPos2fv, _gloffset_WindowPos2fvMESA ),
+ NAME_FUNC_OFFSET( 13971, glWindowPos2i, _gloffset_WindowPos2iMESA ),
+ NAME_FUNC_OFFSET( 13985, glWindowPos2iv, _gloffset_WindowPos2ivMESA ),
+ NAME_FUNC_OFFSET( 14000, glWindowPos2s, _gloffset_WindowPos2sMESA ),
+ NAME_FUNC_OFFSET( 14014, glWindowPos2sv, _gloffset_WindowPos2svMESA ),
+ NAME_FUNC_OFFSET( 14029, glWindowPos3d, _gloffset_WindowPos3dMESA ),
+ NAME_FUNC_OFFSET( 14043, glWindowPos3dv, _gloffset_WindowPos3dvMESA ),
+ NAME_FUNC_OFFSET( 14058, glWindowPos3f, _gloffset_WindowPos3fMESA ),
+ NAME_FUNC_OFFSET( 14072, glWindowPos3fv, _gloffset_WindowPos3fvMESA ),
+ NAME_FUNC_OFFSET( 14087, glWindowPos3i, _gloffset_WindowPos3iMESA ),
+ NAME_FUNC_OFFSET( 14101, glWindowPos3iv, _gloffset_WindowPos3ivMESA ),
+ NAME_FUNC_OFFSET( 14116, glWindowPos3s, _gloffset_WindowPos3sMESA ),
+ NAME_FUNC_OFFSET( 14130, glWindowPos3sv, _gloffset_WindowPos3svMESA ),
+ NAME_FUNC_OFFSET( 14145, glBindBuffer, _gloffset_BindBufferARB ),
+ NAME_FUNC_OFFSET( 14158, glBufferData, _gloffset_BufferDataARB ),
+ NAME_FUNC_OFFSET( 14171, glBufferSubData, _gloffset_BufferSubDataARB ),
+ NAME_FUNC_OFFSET( 14187, glDeleteBuffers, _gloffset_DeleteBuffersARB ),
+ NAME_FUNC_OFFSET( 14203, glGenBuffers, _gloffset_GenBuffersARB ),
+ NAME_FUNC_OFFSET( 14216, glGetBufferParameteriv, _gloffset_GetBufferParameterivARB ),
+ NAME_FUNC_OFFSET( 14239, glGetBufferPointerv, _gloffset_GetBufferPointervARB ),
+ NAME_FUNC_OFFSET( 14259, glGetBufferSubData, _gloffset_GetBufferSubDataARB ),
+ NAME_FUNC_OFFSET( 14278, glIsBuffer, _gloffset_IsBufferARB ),
+ NAME_FUNC_OFFSET( 14289, glMapBuffer, _gloffset_MapBufferARB ),
+ NAME_FUNC_OFFSET( 14301, glUnmapBuffer, _gloffset_UnmapBufferARB ),
+ NAME_FUNC_OFFSET( 14315, glGenQueries, _gloffset_GenQueriesARB ),
+ NAME_FUNC_OFFSET( 14328, glDeleteQueries, _gloffset_DeleteQueriesARB ),
+ NAME_FUNC_OFFSET( 14344, glIsQuery, _gloffset_IsQueryARB ),
+ NAME_FUNC_OFFSET( 14354, glBeginQuery, _gloffset_BeginQueryARB ),
+ NAME_FUNC_OFFSET( 14367, glEndQuery, _gloffset_EndQueryARB ),
+ NAME_FUNC_OFFSET( 14378, glGetQueryiv, _gloffset_GetQueryivARB ),
+ NAME_FUNC_OFFSET( 14391, glGetQueryObjectiv, _gloffset_GetQueryObjectivARB ),
+ NAME_FUNC_OFFSET( 14410, glGetQueryObjectuiv, _gloffset_GetQueryObjectuivARB ),
+ NAME_FUNC_OFFSET( 14430, glPointParameterfARB, _gloffset_PointParameterfEXT ),
+ NAME_FUNC_OFFSET( 14451, glPointParameterfvARB, _gloffset_PointParameterfvEXT ),
+ NAME_FUNC_OFFSET( 14473, glWindowPos2dARB, _gloffset_WindowPos2dMESA ),
+ NAME_FUNC_OFFSET( 14490, glWindowPos2fARB, _gloffset_WindowPos2fMESA ),
+ NAME_FUNC_OFFSET( 14507, glWindowPos2iARB, _gloffset_WindowPos2iMESA ),
+ NAME_FUNC_OFFSET( 14524, glWindowPos2sARB, _gloffset_WindowPos2sMESA ),
+ NAME_FUNC_OFFSET( 14541, glWindowPos2dvARB, _gloffset_WindowPos2dvMESA ),
+ NAME_FUNC_OFFSET( 14559, glWindowPos2fvARB, _gloffset_WindowPos2fvMESA ),
+ NAME_FUNC_OFFSET( 14577, glWindowPos2ivARB, _gloffset_WindowPos2ivMESA ),
+ NAME_FUNC_OFFSET( 14595, glWindowPos2svARB, _gloffset_WindowPos2svMESA ),
+ NAME_FUNC_OFFSET( 14613, glWindowPos3dARB, _gloffset_WindowPos3dMESA ),
+ NAME_FUNC_OFFSET( 14630, glWindowPos3fARB, _gloffset_WindowPos3fMESA ),
+ NAME_FUNC_OFFSET( 14647, glWindowPos3iARB, _gloffset_WindowPos3iMESA ),
+ NAME_FUNC_OFFSET( 14664, glWindowPos3sARB, _gloffset_WindowPos3sMESA ),
+ NAME_FUNC_OFFSET( 14681, glWindowPos3dvARB, _gloffset_WindowPos3dvMESA ),
+ NAME_FUNC_OFFSET( 14699, glWindowPos3fvARB, _gloffset_WindowPos3fvMESA ),
+ NAME_FUNC_OFFSET( 14717, glWindowPos3ivARB, _gloffset_WindowPos3ivMESA ),
+ NAME_FUNC_OFFSET( 14735, glWindowPos3svARB, _gloffset_WindowPos3svMESA ),
+ NAME_FUNC_OFFSET( 14753, glVertexAttrib1sARB, _gloffset_VertexAttrib1sNV ),
+ NAME_FUNC_OFFSET( 14773, glVertexAttrib1fARB, _gloffset_VertexAttrib1fNV ),
+ NAME_FUNC_OFFSET( 14793, glVertexAttrib1dARB, _gloffset_VertexAttrib1dNV ),
+ NAME_FUNC_OFFSET( 14813, glVertexAttrib2sARB, _gloffset_VertexAttrib2sNV ),
+ NAME_FUNC_OFFSET( 14833, glVertexAttrib2fARB, _gloffset_VertexAttrib2fNV ),
+ NAME_FUNC_OFFSET( 14853, glVertexAttrib2dARB, _gloffset_VertexAttrib2dNV ),
+ NAME_FUNC_OFFSET( 14873, glVertexAttrib3sARB, _gloffset_VertexAttrib3sNV ),
+ NAME_FUNC_OFFSET( 14893, glVertexAttrib3fARB, _gloffset_VertexAttrib3fNV ),
+ NAME_FUNC_OFFSET( 14913, glVertexAttrib3dARB, _gloffset_VertexAttrib3dNV ),
+ NAME_FUNC_OFFSET( 14933, glVertexAttrib4sARB, _gloffset_VertexAttrib4sNV ),
+ NAME_FUNC_OFFSET( 14953, glVertexAttrib4fARB, _gloffset_VertexAttrib4fNV ),
+ NAME_FUNC_OFFSET( 14973, glVertexAttrib4dARB, _gloffset_VertexAttrib4dNV ),
+ NAME_FUNC_OFFSET( 14993, glVertexAttrib4NubARB, _gloffset_VertexAttrib4ubNV ),
+ NAME_FUNC_OFFSET( 15015, glVertexAttrib1svARB, _gloffset_VertexAttrib1svNV ),
+ NAME_FUNC_OFFSET( 15036, glVertexAttrib1fvARB, _gloffset_VertexAttrib1fvNV ),
+ NAME_FUNC_OFFSET( 15057, glVertexAttrib1dvARB, _gloffset_VertexAttrib1dvNV ),
+ NAME_FUNC_OFFSET( 15078, glVertexAttrib2svARB, _gloffset_VertexAttrib2svNV ),
+ NAME_FUNC_OFFSET( 15099, glVertexAttrib2fvARB, _gloffset_VertexAttrib2fvNV ),
+ NAME_FUNC_OFFSET( 15120, glVertexAttrib2dvARB, _gloffset_VertexAttrib2dvNV ),
+ NAME_FUNC_OFFSET( 15141, glVertexAttrib3svARB, _gloffset_VertexAttrib3svNV ),
+ NAME_FUNC_OFFSET( 15162, glVertexAttrib3fvARB, _gloffset_VertexAttrib3fvNV ),
+ NAME_FUNC_OFFSET( 15183, glVertexAttrib3dvARB, _gloffset_VertexAttrib3dvNV ),
+ NAME_FUNC_OFFSET( 15204, glVertexAttrib4svARB, _gloffset_VertexAttrib4svNV ),
+ NAME_FUNC_OFFSET( 15225, glVertexAttrib4fvARB, _gloffset_VertexAttrib4fvNV ),
+ NAME_FUNC_OFFSET( 15246, glVertexAttrib4dvARB, _gloffset_VertexAttrib4dvNV ),
+ NAME_FUNC_OFFSET( 15267, glVertexAttrib4NubvARB, _gloffset_VertexAttrib4ubvNV ),
+ NAME_FUNC_OFFSET( 15290, glBindProgramARB, _gloffset_BindProgramNV ),
+ NAME_FUNC_OFFSET( 15307, glDeleteProgramsARB, _gloffset_DeleteProgramsNV ),
+ NAME_FUNC_OFFSET( 15327, glGenProgramsARB, _gloffset_GenProgramsNV ),
+ NAME_FUNC_OFFSET( 15344, glIsProgramARB, _gloffset_IsProgramNV ),
+ NAME_FUNC_OFFSET( 15359, glGetVertexAttribdvARB, _gloffset_GetVertexAttribdvNV ),
+ NAME_FUNC_OFFSET( 15382, glGetVertexAttribfvARB, _gloffset_GetVertexAttribfvNV ),
+ NAME_FUNC_OFFSET( 15405, glGetVertexAttribivARB, _gloffset_GetVertexAttribivNV ),
+ NAME_FUNC_OFFSET( 15428, glGetVertexAttribPointervARB, _gloffset_GetVertexAttribPointervNV ),
+ NAME_FUNC_OFFSET( 15457, glBlendColorEXT, _gloffset_BlendColor ),
+ NAME_FUNC_OFFSET( 15473, glTexImage3DEXT, _gloffset_TexImage3D ),
+ NAME_FUNC_OFFSET( 15489, glTexSubImage3DEXT, _gloffset_TexSubImage3D ),
+ NAME_FUNC_OFFSET( 15508, glTexSubImage1DEXT, _gloffset_TexSubImage1D ),
+ NAME_FUNC_OFFSET( 15527, glTexSubImage2DEXT, _gloffset_TexSubImage2D ),
+ NAME_FUNC_OFFSET( 15546, glCopyTexImage1DEXT, _gloffset_CopyTexImage1D ),
+ NAME_FUNC_OFFSET( 15566, glCopyTexImage2DEXT, _gloffset_CopyTexImage2D ),
+ NAME_FUNC_OFFSET( 15586, glCopyTexSubImage1DEXT, _gloffset_CopyTexSubImage1D ),
+ NAME_FUNC_OFFSET( 15609, glCopyTexSubImage2DEXT, _gloffset_CopyTexSubImage2D ),
+ NAME_FUNC_OFFSET( 15632, glCopyTexSubImage3DEXT, _gloffset_CopyTexSubImage3D ),
+ NAME_FUNC_OFFSET( 15655, glHistogramEXT, _gloffset_Histogram ),
+ NAME_FUNC_OFFSET( 15670, glMinmaxEXT, _gloffset_Minmax ),
+ NAME_FUNC_OFFSET( 15682, glResetHistogramEXT, _gloffset_ResetHistogram ),
+ NAME_FUNC_OFFSET( 15702, glResetMinmaxEXT, _gloffset_ResetMinmax ),
+ NAME_FUNC_OFFSET( 15719, glConvolutionFilter1DEXT, _gloffset_ConvolutionFilter1D ),
+ NAME_FUNC_OFFSET( 15744, glConvolutionFilter2DEXT, _gloffset_ConvolutionFilter2D ),
+ NAME_FUNC_OFFSET( 15769, glConvolutionParameterfEXT, _gloffset_ConvolutionParameterf ),
+ NAME_FUNC_OFFSET( 15796, glConvolutionParameterfvEXT, _gloffset_ConvolutionParameterfv ),
+ NAME_FUNC_OFFSET( 15824, glConvolutionParameteriEXT, _gloffset_ConvolutionParameteri ),
+ NAME_FUNC_OFFSET( 15851, glConvolutionParameterivEXT, _gloffset_ConvolutionParameteriv ),
+ NAME_FUNC_OFFSET( 15879, glCopyConvolutionFilter1DEXT, _gloffset_CopyConvolutionFilter1D ),
+ NAME_FUNC_OFFSET( 15908, glCopyConvolutionFilter2DEXT, _gloffset_CopyConvolutionFilter2D ),
+ NAME_FUNC_OFFSET( 15937, glSeparableFilter2DEXT, _gloffset_SeparableFilter2D ),
+ NAME_FUNC_OFFSET( 15960, glColorTableSGI, _gloffset_ColorTable ),
+ NAME_FUNC_OFFSET( 15976, glColorTableParameterfvSGI, _gloffset_ColorTableParameterfv ),
+ NAME_FUNC_OFFSET( 16003, glColorTableParameterivSGI, _gloffset_ColorTableParameteriv ),
+ NAME_FUNC_OFFSET( 16030, glCopyColorTableSGI, _gloffset_CopyColorTable ),
+ NAME_FUNC_OFFSET( 16050, glBindTextureEXT, _gloffset_BindTexture ),
+ NAME_FUNC_OFFSET( 16067, glDeleteTexturesEXT, _gloffset_DeleteTextures ),
+ NAME_FUNC_OFFSET( 16087, glPrioritizeTexturesEXT, _gloffset_PrioritizeTextures ),
+ NAME_FUNC_OFFSET( 16111, glArrayElementEXT, _gloffset_ArrayElement ),
+ NAME_FUNC_OFFSET( 16129, glDrawArraysEXT, _gloffset_DrawArrays ),
+ NAME_FUNC_OFFSET( 16145, glGetPointervEXT, _gloffset_GetPointerv ),
+ NAME_FUNC_OFFSET( 16162, glBlendEquationEXT, _gloffset_BlendEquation ),
+ NAME_FUNC_OFFSET( 16181, glColorSubTableEXT, _gloffset_ColorSubTable ),
+ NAME_FUNC_OFFSET( 16200, glCopyColorSubTableEXT, _gloffset_CopyColorSubTable ),
+ NAME_FUNC_OFFSET( 16223, glColorTableEXT, _gloffset_ColorTable ),
+ NAME_FUNC_OFFSET( 16239, glDrawRangeElementsEXT, _gloffset_DrawRangeElements ),
+ NAME_FUNC_OFFSET( 16262, glSampleMaskEXT, _gloffset_SampleMaskSGIS ),
+ NAME_FUNC_OFFSET( 16278, glSamplePatternEXT, _gloffset_SamplePatternSGIS ),
+ NAME_FUNC_OFFSET( 16297, glBlendEquationSeparateATI, _gloffset_BlendEquationSeparateEXT ),
+ NAME_FUNC_OFFSET( 16324, glBlendFuncSeparateINGR, _gloffset_BlendFuncSeparateEXT ),
+ NAME_FUNC_OFFSET( 16348, glPointParameterfSGIS, _gloffset_PointParameterfEXT ),
+ NAME_FUNC_OFFSET( 16370, glPointParameterfvSGIS, _gloffset_PointParameterfvEXT ),
+ NAME_FUNC_OFFSET( -1, NULL, 0 )
+};
+
+#undef NAME_FUNC_OFFSET
Index: xc/extras/Mesa/src/mesa/glapi/glprocs.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glprocs.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glprocs.py Thu Apr 8 05:17:35 2004
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+# $Id: glprocs.py,v 1.1 2001/11/18 22:42:57 brianp Exp $
+
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Generate the glprocs.h file.
+#
+# Usage:
+# gloffsets.py >glprocs.h
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+
+import apiparser
+import string
+
+
+def PrintHead():
+ print '/* DO NOT EDIT - This file generated automatically by glprocs.py script */'
+ print ''
+ print '/* This file is only included by glapi.c and is used for'
+ print ' * the GetProcAddress() function'
+ print ' */'
+ print ''
+ print 'static struct name_address_offset static_functions[] = {'
+ return
+#enddef
+
+
+def PrintTail():
+ print ' { NULL, NULL } /* end of list marker */'
+ print '};'
+#enddef
+
+
+records = []
+
+def FindOffset(funcName):
+ for (name, alias, offset) in records:
+ if name == funcName:
+ return offset
+ #endif
+ #endfor
+ return -1
+#enddef
+
+
+def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset):
+ if alias == '':
+ dispatchName = name
+ else:
+ dispatchName = alias
+ if offset < 0:
+ offset = FindOffset(dispatchName)
+ if offset >= 0 and string.find(name, "unused") == -1:
+ print ' { "gl%s", (GLvoid *) gl%s, _gloffset_%s },' % (name, name, dispatchName)
+ # save this info in case we need to look up an alias later
+ records.append((name, dispatchName, offset))
+
+#enddef
+
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", EmitEntry)
+PrintTail()
Index: xc/extras/Mesa/src/mesa/glapi/glsparcasm.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glsparcasm.py:1.1.1.2
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glsparcasm.py Fri Dec 10 10:32:32 2004
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+
+# Mesa 3-D graphics library
+# Version: 5.1
+#
+# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Generate the src/SPARC/glapi_sparc.S file.
+#
+# Usage:
+# gloffsets.py >glapi_sparc.S
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+import apiparser;
+
+
+def PrintHead():
+ print '/* DO NOT EDIT - This file generated automatically with glsparcasm.py script */'
+ print '#include "glapioffsets.h"'
+ print ''
+ print '/* The _glapi_Dispatch symbol addresses get relocated into the'
+ print ' * sethi/or instruction sequences below at library init time.'
+ print ' */'
+ print ''
+ print ''
+ print '.text'
+ print '.align 32'
+ print '.globl __glapi_sparc_icache_flush'
+ print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
+ print '\tflush\t%o0'
+ print '\tretl'
+ print '\tnop'
+ print ''
+ print '.data'
+ print '.align 64'
+ print ''
+ print '.globl _mesa_sparc_glapi_begin'
+ print '.type _mesa_sparc_glapi_begin,#function'
+ print '_mesa_sparc_glapi_begin:'
+ return
+#endif
+
+def PrintTail():
+ print '\t nop'
+ print ''
+ print '.globl _mesa_sparc_glapi_end'
+ print '.type _mesa_sparc_glapi_end,#function'
+ print '_mesa_sparc_glapi_end:'
+ print ''
+#endif
+
+
+
+records = []
+
+def FindOffset(funcName):
+ for (name, alias, offset) in records:
+ if name == funcName:
+ return offset
+ #endif
+ #endfor
+ return -1
+#enddef
+
+def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
+ argList = apiparser.MakeArgList(argTypeList, argNameList)
+ if alias != '':
+ dispatchName = alias
+ else:
+ dispatchName = name
+ #endif
+
+ if offset < 0:
+ # try to find offset from alias name
+ assert dispatchName != ''
+ offset = FindOffset(dispatchName)
+ if offset == -1:
+ #print 'Cannot dispatch %s' % name
+ return
+ #endif
+ #endif
+
+ # save this info in case we need to look up an alias later
+ records.append((name, dispatchName, offset))
+
+ # print the assembly code
+ print ''
+ print '.globl gl%s' % (name)
+ print '.type gl%s,#function' % (name)
+ print 'gl%s:' % (name)
+ print '#if (defined(__sparc_v9__) && (!defined(__linux__) || defined(__linux_sparc_64__)))'
+ print '\tsethi\t%hi(0x00000000), %g2'
+ print '\tsethi\t%hi(0x00000000), %g1'
+ print '\tor\t%g2, %lo(0x00000000), %g2'
+ print '\tor\t%g1, %lo(0x00000000), %g1'
+ print '\tsllx\t%g2, 32, %g2'
+ print '\tldx\t[%g1 + %g2], %g1'
+ print "\tsethi\t%%hi(8 * _gloffset_%s), %%g2" % (dispatchName)
+ print "\tor\t%%g2, %%lo(8 * _gloffset_%s), %%g2" % (dispatchName)
+ print '\tldx\t[%g1 + %g2], %g3'
+ print '#else'
+ print '\tsethi\t%hi(0x00000000), %g1'
+ print '\tld\t[%g1 + %lo(0x00000000)], %g1'
+ print "\tld\t[%%g1 + (4 * _gloffset_%s)], %%g3" % (dispatchName)
+ print '#endif'
+ print '\tjmpl\t%g3, %g0'
+ print '\tnop'
+#enddef
+
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", EmitFunction)
+PrintTail()
Index: xc/extras/Mesa/src/mesa/glapi/gltable.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/gltable.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/gltable.py Thu Apr 8 05:17:35 2004
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+
+# Mesa 3-D graphics library
+# Version: 5.1
+#
+# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Generate the glapitable.h file.
+#
+# Usage:
+# python gloffsets.py >glapitable.h
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+import apiparser;
+
+
+def PrintHead():
+ print '/* DO NOT EDIT - This file generated automatically with gltable.py script */'
+ print '#ifndef _GLAPI_TABLE_H_'
+ print '#define _GLAPI_TABLE_H_'
+ print ''
+ print '#ifndef GLAPIENTRYP'
+ print '#define GLAPIENTRYP'
+ print '#endif'
+ print ''
+ print 'struct _glapi_table'
+ print '{'
+ return
+#endif
+
+
+def PrintTail():
+ print '};'
+ print ''
+ print '#endif'
+#endif
+
+
+records = {}
+
+def DoRecord(name, returnType, argTypeList, argNameList, alias, offset):
+ argList = apiparser.MakeArgList(argTypeList, argNameList)
+ if offset >= 0 and not records.has_key(offset):
+ records[offset] = (name, returnType, argList)
+ #print '#define _gloffset_%s %d' % (name, offset)
+#endif
+
+
+def PrintRecords():
+ keys = records.keys()
+ keys.sort()
+ prevk = -1
+ for k in keys:
+ if k != prevk + 1:
+ #print 'Missing offset %d' % (prevk)
+ pass
+ prevk = int(k)
+ (name, returnType, argList) = records[k]
+ print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % (returnType, name, argList, k)
+#endef
+
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", DoRecord)
+PrintRecords()
+PrintTail()
+
Index: xc/extras/Mesa/src/mesa/glapi/glthread.c
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glthread.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glthread.c Thu Apr 8 05:17:35 2004
@@ -0,0 +1,367 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * XXX There's probably some work to do in order to make this file
+ * truly reusable outside of Mesa. First, the glheader.h include must go.
+ */
+
+
+#include "glheader.h"
+#include "glthread.h"
+
+
+/*
+ * This file should still compile even when THREADS is not defined.
+ * This is to make things easier to deal with on the makefile scene..
+ */
+#ifdef THREADS
+#include
+
+/*
+ * Error messages
+ */
+#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data"
+#define GET_TSD_ERROR "_glthread_: failed to get thread specific data"
+#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data"
+
+
+/*
+ * Magic number to determine if a TSD object has been initialized.
+ * Kind of a hack but there doesn't appear to be a better cross-platform
+ * solution.
+ */
+#define INIT_MAGIC 0xff8adc98
+
+
+
+/*
+ * POSIX Threads -- The best way to go if your platform supports them.
+ * Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly
+ * has them, and many of the free Unixes now have them.
+ * Be sure to use appropriate -mt or -D_REENTRANT type
+ * compile flags when building.
+ */
+#ifdef PTHREADS
+
+unsigned long
+_glthread_GetID(void)
+{
+ return (unsigned long) pthread_self();
+}
+
+
+void
+_glthread_InitTSD(_glthread_TSD *tsd)
+{
+ if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
+ perror(INIT_TSD_ERROR);
+ exit(-1);
+ }
+ tsd->initMagic = INIT_MAGIC;
+}
+
+
+void *
+_glthread_GetTSD(_glthread_TSD *tsd)
+{
+ if (tsd->initMagic != (int) INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ return pthread_getspecific(tsd->key);
+}
+
+
+void
+_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+{
+ if (tsd->initMagic != (int) INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ if (pthread_setspecific(tsd->key, ptr) != 0) {
+ perror(SET_TSD_ERROR);
+ exit(-1);
+ }
+}
+
+#endif /* PTHREADS */
+
+
+
+/*
+ * Solaris/Unix International Threads -- Use only if POSIX threads
+ * aren't available on your Unix platform. Solaris 2.[34] are examples
+ * of platforms where this is the case. Be sure to use -mt and/or
+ * -D_REENTRANT when compiling.
+ */
+#ifdef SOLARIS_THREADS
+#define USE_LOCK_FOR_KEY /* undef this to try a version without
+ lock for the global key... */
+
+unsigned long
+_glthread_GetID(void)
+{
+ abort(); /* XXX not implemented yet */
+ return (unsigned long) 0;
+}
+
+
+void
+_glthread_InitTSD(_glthread_TSD *tsd)
+{
+ if ((errno = mutex_init(&tsd->keylock, 0, NULL)) != 0 ||
+ (errno = thr_keycreate(&(tsd->key), free)) != 0) {
+ perror(INIT_TSD_ERROR);
+ exit(-1);
+ }
+ tsd->initMagic = INIT_MAGIC;
+}
+
+
+void *
+_glthread_GetTSD(_glthread_TSD *tsd)
+{
+ void* ret;
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+#ifdef USE_LOCK_FOR_KEY
+ mutex_lock(&tsd->keylock);
+ thr_getspecific(tsd->key, &ret);
+ mutex_unlock(&tsd->keylock);
+#else
+ if ((errno = thr_getspecific(tsd->key, &ret)) != 0) {
+ perror(GET_TSD_ERROR);
+ exit(-1);
+ }
+#endif
+ return ret;
+}
+
+
+void
+_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+{
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ if ((errno = thr_setspecific(tsd->key, ptr)) != 0) {
+ perror(SET_TSD_ERROR);
+ exit(-1);
+ }
+}
+
+#undef USE_LOCK_FOR_KEY
+#endif /* SOLARIS_THREADS */
+
+
+
+/*
+ * Win32 Threads. The only available option for Windows 95/NT.
+ * Be sure that you compile using the Multithreaded runtime, otherwise
+ * bad things will happen.
+ */
+#ifdef WIN32_THREADS
+
+unsigned long
+_glthread_GetID(void)
+{
+ abort(); /* XXX not implemented yet */
+ return (unsigned long) 0;
+}
+
+
+void
+_glthread_InitTSD(_glthread_TSD *tsd)
+{
+ tsd->key = TlsAlloc();
+ if (tsd->key == 0xffffffff) {
+ /* Can Windows handle stderr messages for non-console
+ applications? Does Windows have perror? */
+ /* perror(SET_INIT_ERROR);*/
+ exit(-1);
+ }
+ tsd->initMagic = INIT_MAGIC;
+}
+
+
+void *
+_glthread_GetTSD(_glthread_TSD *tsd)
+{
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ return TlsGetValue(tsd->key);
+}
+
+
+void
+_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+{
+ /* the following code assumes that the _glthread_TSD has been initialized
+ to zero at creation */
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ if (TlsSetValue(tsd->key, ptr) == 0) {
+ /* Can Windows handle stderr messages for non-console
+ applications? Does Windows have perror? */
+ /* perror(SET_TSD_ERROR);*/
+ exit(-1);
+ }
+}
+
+#endif /* WIN32_THREADS */
+
+
+
+/*
+ * XFree86 has its own thread wrapper, Xthreads.h
+ * We wrap it again for GL.
+ */
+#ifdef XTHREADS
+
+unsigned long
+_glthread_GetID(void)
+{
+ return (unsigned long) xthread_self();
+}
+
+
+void
+_glthread_InitTSD(_glthread_TSD *tsd)
+{
+ if (xthread_key_create(&tsd->key, NULL) != 0) {
+ perror(INIT_TSD_ERROR);
+ exit(-1);
+ }
+ tsd->initMagic = INIT_MAGIC;
+}
+
+
+void *
+_glthread_GetTSD(_glthread_TSD *tsd)
+{
+ void *ptr;
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ xthread_get_specific(tsd->key, &ptr);
+ return ptr;
+}
+
+
+void
+_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+{
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ xthread_set_specific(tsd->key, ptr);
+}
+
+#endif /* XTHREAD */
+
+
+
+/*
+ * BeOS threads
+ */
+#ifdef BEOS_THREADS
+
+unsigned long
+_glthread_GetID(void)
+{
+ return (unsigned long) find_thread(NULL);
+}
+
+void
+_glthread_InitTSD(_glthread_TSD *tsd)
+{
+ tsd->key = tls_allocate();
+ tsd->initMagic = INIT_MAGIC;
+}
+
+void *
+_glthread_GetTSD(_glthread_TSD *tsd)
+{
+ if (tsd->initMagic != (int) INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ return tls_get(tsd->key);
+}
+
+void
+_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+{
+ if (tsd->initMagic != (int) INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ tls_set(tsd->key, ptr);
+}
+
+#endif /* BEOS_THREADS */
+
+
+
+#else /* THREADS */
+
+
+/*
+ * no-op functions
+ */
+
+unsigned long
+_glthread_GetID(void)
+{
+ return 0;
+}
+
+
+void
+_glthread_InitTSD(_glthread_TSD *tsd)
+{
+ (void) tsd;
+}
+
+
+void *
+_glthread_GetTSD(_glthread_TSD *tsd)
+{
+ (void) tsd;
+ return NULL;
+}
+
+
+void
+_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+{
+ (void) tsd;
+ (void) ptr;
+}
+
+
+#endif /* THREADS */
Index: xc/extras/Mesa/src/mesa/glapi/glthread.h
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glthread.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glthread.h Fri Dec 10 10:32:35 2004
@@ -0,0 +1,321 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Thread support for gl dispatch.
+ *
+ * Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu)
+ * and Christoph Poliwoda (poliwoda@volumegraphics.com)
+ * Revised by Keith Whitwell
+ * Adapted for new gl dispatcher by Brian Paul
+ *
+ *
+ *
+ * DOCUMENTATION
+ *
+ * This thread module exports the following types:
+ * _glthread_TSD Thread-specific data area
+ * _glthread_Thread Thread datatype
+ * _glthread_Mutex Mutual exclusion lock
+ *
+ * Macros:
+ * _glthread_DECLARE_STATIC_MUTEX(name) Declare a non-local mutex
+ * _glthread_INIT_MUTEX(name) Initialize a mutex
+ * _glthread_LOCK_MUTEX(name) Lock a mutex
+ * _glthread_UNLOCK_MUTEX(name) Unlock a mutex
+ *
+ * Functions:
+ * _glthread_GetID(v) Get integer thread ID
+ * _glthread_InitTSD() Initialize thread-specific data
+ * _glthread_GetTSD() Get thread-specific data
+ * _glthread_SetTSD() Set thread-specific data
+ *
+ */
+
+/*
+ * If this file is accidentally included by a non-threaded build,
+ * it should not cause the build to fail, or otherwise cause problems.
+ * In general, it should only be included when needed however.
+ */
+
+#ifndef GLTHREAD_H
+#define GLTHREAD_H
+
+
+#if defined(PTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
+ defined(XTHREADS) || defined(BEOS_THREADS)
+#define THREADS
+#endif
+
+#ifdef VMS
+#include
+#endif
+
+/*
+ * POSIX threads. This should be your choice in the Unix world
+ * whenever possible. When building with POSIX threads, be sure
+ * to enable any compiler flags which will cause the MT-safe
+ * libc (if one exists) to be used when linking, as well as any
+ * header macros for MT-safe errno, etc. For Solaris, this is the -mt
+ * compiler flag. On Solaris with gcc, use -D_REENTRANT to enable
+ * proper compiling for MT-safe libc etc.
+ */
+#if defined(PTHREADS)
+#include /* POSIX threads headers */
+
+typedef struct {
+ pthread_key_t key;
+ int initMagic;
+} _glthread_TSD;
+
+typedef pthread_t _glthread_Thread;
+
+typedef pthread_mutex_t _glthread_Mutex;
+
+#define _glthread_DECLARE_STATIC_MUTEX(name) \
+ static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER
+
+#define _glthread_INIT_MUTEX(name) \
+ pthread_mutex_init(&(name), NULL)
+
+#define _glthread_DESTROY_MUTEX(name) \
+ pthread_mutex_destroy(&(name))
+
+#define _glthread_LOCK_MUTEX(name) \
+ (void) pthread_mutex_lock(&(name))
+
+#define _glthread_UNLOCK_MUTEX(name) \
+ (void) pthread_mutex_unlock(&(name))
+
+/* This is temporarilly removed because driver binaries cannot count on
+ * the existance of _gl_DispatchTSD in libGL. It only exists in "new"
+ * libGL. We may be able to ressurect this optimization at some point
+ * for DRI driver or for software Mesa.
+ */
+#if 0
+extern struct _glapi_table * _glapi_DispatchTSD;
+extern _glthread_TSD _gl_DispatchTSD;
+
+#define GL_CALL(name) \
+ (((__builtin_expect( _glapi_DispatchTSD != NULL, 1 )) \
+ ? _glapi_DispatchTSD : (struct _glapi_table *) pthread_getspecific(_gl_DispatchTSD.key))-> name)
+#endif
+
+#endif /* PTHREADS */
+
+
+
+
+/*
+ * Solaris threads. Use only up to Solaris 2.4.
+ * Solaris 2.5 and higher provide POSIX threads.
+ * Be sure to compile with -mt on the Solaris compilers, or
+ * use -D_REENTRANT if using gcc.
+ */
+#ifdef SOLARIS_THREADS
+#include
+
+typedef struct {
+ thread_key_t key;
+ mutex_t keylock;
+ int initMagic;
+} _glthread_TSD;
+
+typedef thread_t _glthread_Thread;
+
+typedef mutex_t _glthread_Mutex;
+
+/* XXX need to really implement mutex-related macros */
+#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
+#define _glthread_INIT_MUTEX(name) (void) name
+#define _glthread_DESTROY_MUTEX(name) (void) name
+#define _glthread_LOCK_MUTEX(name) (void) name
+#define _glthread_UNLOCK_MUTEX(name) (void) name
+
+#endif /* SOLARIS_THREADS */
+
+
+
+
+/*
+ * Windows threads. Should work with Windows NT and 95.
+ * IMPORTANT: Link with multithreaded runtime library when THREADS are
+ * used!
+ */
+#ifdef WIN32_THREADS
+#include
+
+typedef struct {
+ DWORD key;
+ int initMagic;
+} _glthread_TSD;
+
+typedef HANDLE _glthread_Thread;
+
+typedef CRITICAL_SECTION _glthread_Mutex;
+
+/* XXX need to really implement mutex-related macros */
+#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
+#define _glthread_INIT_MUTEX(name) (void) name
+#define _glthread_DESTROY_MUTEX(name) (void) name
+#define _glthread_LOCK_MUTEX(name) (void) name
+#define _glthread_UNLOCK_MUTEX(name) (void) name
+
+#endif /* WIN32_THREADS */
+
+
+
+
+/*
+ * XFree86 has its own thread wrapper, Xthreads.h
+ * We wrap it again for GL.
+ */
+#ifdef XTHREADS
+#include
+
+typedef struct {
+ xthread_key_t key;
+ int initMagic;
+} _glthread_TSD;
+
+typedef xthread_t _glthread_Thread;
+
+typedef xmutex_rec _glthread_Mutex;
+
+#ifdef XMUTEX_INITIALIZER
+#define _glthread_DECLARE_STATIC_MUTEX(name) \
+ static _glthread_Mutex name = XMUTEX_INITIALIZER
+#else
+#define _glthread_DECLARE_STATIC_MUTEX(name) \
+ static _glthread_Mutex name
+#endif
+
+#define _glthread_INIT_MUTEX(name) \
+ xmutex_init(&(name))
+
+#define _glthread_DESTROY_MUTEX(name) \
+ xmutex_clear(&(name))
+
+#define _glthread_LOCK_MUTEX(name) \
+ (void) xmutex_lock(&(name))
+
+#define _glthread_UNLOCK_MUTEX(name) \
+ (void) xmutex_unlock(&(name))
+
+#endif /* XTHREADS */
+
+
+
+/*
+ * BeOS threads. R5.x required.
+ */
+#ifdef BEOS_THREADS
+
+#include
+#include
+
+typedef struct {
+ int32 key;
+ int initMagic;
+} _glthread_TSD;
+
+typedef thread_id _glthread_Thread;
+
+/* Use Benaphore, aka speeder semaphore */
+typedef struct {
+ int32 lock;
+ sem_id sem;
+} benaphore;
+typedef benaphore _glthread_Mutex;
+
+#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, 0 }
+#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0
+#define _glthread_DESTROY_MUTEX(name) delete_sem(name.sem), name.lock = 0
+#define _glthread_LOCK_MUTEX(name) if (name.sem == 0) _glthread_INIT_MUTEX(name); \
+ if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem)
+#define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem)
+
+#endif /* BEOS_THREADS */
+
+
+
+#ifndef THREADS
+
+/*
+ * THREADS not defined
+ */
+
+typedef GLuint _glthread_TSD;
+
+typedef GLuint _glthread_Thread;
+
+typedef GLuint _glthread_Mutex;
+
+#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
+
+#define _glthread_INIT_MUTEX(name) (void) name
+
+#define _glthread_DESTROY_MUTEX(name) (void) name
+
+#define _glthread_LOCK_MUTEX(name) (void) name
+
+#define _glthread_UNLOCK_MUTEX(name) (void) name
+
+#endif /* THREADS */
+
+
+
+/*
+ * Platform independent thread specific data API.
+ */
+
+extern unsigned long
+_glthread_GetID(void);
+
+
+extern void
+_glthread_InitTSD(_glthread_TSD *);
+
+
+extern void *
+_glthread_GetTSD(_glthread_TSD *);
+
+
+extern void
+_glthread_SetTSD(_glthread_TSD *, void *);
+
+#ifndef GL_CALL
+# if defined(THREADS)
+extern struct _glapi_table * _glapi_DispatchTSD;
+# define GL_CALL(name) \
+ (((__builtin_expect( _glapi_DispatchTSD != NULL, 1 )) \
+ ? _glapi_DispatchTSD : _glapi_get_dispatch())-> name)
+# else
+# define GL_CALL(name) (*(_glapi_Dispatch-> name))
+# endif /* defined(THREADS) */
+#endif /* ndef GL_CALL */
+
+
+#endif /* THREADS_H */
Index: xc/extras/Mesa/src/mesa/glapi/glx86asm.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/glx86asm.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:23 2005
+++ xc/extras/Mesa/src/mesa/glapi/glx86asm.py Thu Apr 8 05:17:35 2004
@@ -0,0 +1,136 @@
+#!/usr/bin/env python
+
+
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Generate the src/X86/glapi_x86.S file.
+#
+# Usage:
+# gloffsets.py >glapi_x86.S
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+import apiparser
+
+
+def PrintHead():
+ print '/* DO NOT EDIT - This file generated automatically with glx86asm.py script */'
+ print '#include "assyntax.h"'
+ print '#include "glapioffsets.h"'
+ print ''
+ print '#ifndef __WIN32__'
+ print ''
+ print '#if defined(STDCALL_API)'
+ print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2))'
+ print '#elif defined(USE_MGL_NAMESPACE)'
+ print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n))'
+ print '#else'
+ print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n))'
+ print '#endif'
+ print ''
+ print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))'
+ print ''
+ print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)'
+ print '#define GLOBL_FN(x) GLOBL x ; .type x,@function'
+ print '#else'
+ print '#define GLOBL_FN(x) GLOBL x'
+ print '#endif'
+ print ''
+ print 'SEG_TEXT'
+ print ''
+ print 'EXTERN GLNAME(_glapi_Dispatch)'
+ print ''
+ return
+#enddef
+
+
+def PrintTail():
+ print ''
+ print '#endif /* __WIN32__ */'
+#enddef
+
+
+
+records = []
+
+def FindOffset(funcName):
+ for (name, alias, offset) in records:
+ if name == funcName:
+ return offset
+ #endif
+ #endfor
+ return -1
+#enddef
+
+# Find the size of the arguments on the stack for _stdcall name mangling
+def FindStackSize(typeList):
+ result = 0
+ for typ in typeList:
+ if typ == 'GLdouble' or typ == 'GLclampd':
+ result += 8;
+ else:
+ result += 4;
+ #endif
+ #endfor
+ return result
+#enddef
+
+def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
+ argList = apiparser.MakeArgList(argTypeList, argNameList)
+ if alias != '':
+ dispatchName = alias
+ else:
+ dispatchName = name
+ #endif
+
+ if offset < 0:
+ # try to find offset from alias name
+ assert dispatchName != ''
+ offset = FindOffset(dispatchName)
+ if offset == -1:
+ #print 'Cannot dispatch %s' % name
+ return
+ #endif
+ #endif
+
+ # save this info in case we need to look up an alias later
+ records.append((name, dispatchName, offset))
+
+ # Find the argument stack size for _stdcall name mangling
+ stackSize = FindStackSize(argTypeList)
+
+ # print the assembly code
+ print 'ALIGNTEXT16'
+ print "GLOBL_FN(GL_PREFIX(%s,%s@%s))" % (name, name, stackSize)
+ print "GL_PREFIX(%s,%s@%s):" % (name, name, stackSize)
+ print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)'
+ print "\tJMP(GL_OFFSET(_gloffset_%s))" % (dispatchName)
+ print ''
+#enddef
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", EmitFunction)
+PrintTail()
Index: xc/extras/Mesa/src/mesa/glapi/license.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/license.py:1.1.1.1
--- /dev/null Wed Mar 16 21:01:24 2005
+++ xc/extras/Mesa/src/mesa/glapi/license.py Fri Dec 10 10:05:29 2004
@@ -0,0 +1,47 @@
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+bsd_license_template = """%s
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sub license,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+%s,
+AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE."""
Index: xc/extras/Mesa/src/mesa/glapi/mesadef.py
diff -u /dev/null xc/extras/Mesa/src/mesa/glapi/mesadef.py:1.1.1.2
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/glapi/mesadef.py Fri Dec 10 10:05:28 2004
@@ -0,0 +1,223 @@
+#!/usr/bin/env python
+
+# $Id: mesadef.py,v 1.2 2004/05/10 07:42:27 dborca Exp $
+
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Generate the mesa.def file for Windows.
+#
+# Usage:
+# mesadef.py >mesa.def
+# Then copy to src/mesa/drivers/windows/gdi
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+
+import apiparser
+import string
+
+
+def PrintHead():
+ print '; DO NOT EDIT - This file generated automatically by mesadef.py script'
+ print 'DESCRIPTION \'Mesa (OpenGL work-alike) for Win32\''
+ print 'VERSION 6.0'
+ print ';'
+ print '; Module definition file for Mesa (OPENGL32.DLL)'
+ print ';'
+ print '; Note: The OpenGL functions use the STDCALL'
+ print '; function calling convention. Microsoft\'s'
+ print '; OPENGL32 uses this convention and so must the'
+ print '; Mesa OPENGL32 so that the Mesa DLL can be used'
+ print '; as a drop-in replacement.'
+ print ';'
+ print '; The linker exports STDCALL entry points with'
+ print '; \'decorated\' names; e.g., _glBegin@0, where the'
+ print '; trailing number is the number of bytes of '
+ print '; parameter data pushed onto the stack. The'
+ print '; callee is responsible for popping this data'
+ print '; off the stack, usually via a RETF n instruction.'
+ print ';'
+ print '; However, the Microsoft OPENGL32.DLL does not export'
+ print '; the decorated names, even though the calling convention'
+ print '; is STDCALL. So, this module definition file is'
+ print '; needed to force the Mesa OPENGL32.DLL to export the'
+ print '; symbols in the same manner as the Microsoft DLL.'
+ print '; Were it not for this problem, this file would not'
+ print '; be needed (for the gl* functions) since the entry'
+ print '; points are compiled with dllexport declspec.'
+ print ';'
+ print '; However, this file is still needed to export "internal"'
+ print '; Mesa symbols for the benefit of the OSMESA32.DLL.'
+ print ';'
+ print 'EXPORTS'
+ return
+#enddef
+
+
+def PrintTail():
+ print ';'
+ print '; WGL API'
+ print '\twglChoosePixelFormat'
+ print '\twglCopyContext'
+ print '\twglCreateContext'
+ print '\twglCreateLayerContext'
+ print '\twglDeleteContext'
+ print '\twglDescribeLayerPlane'
+ print '\twglDescribePixelFormat'
+ print '\twglGetCurrentContext'
+ print '\twglGetCurrentDC'
+ print '\twglGetLayerPaletteEntries'
+ print '\twglGetPixelFormat'
+ print '\twglGetProcAddress'
+ print '\twglMakeCurrent'
+ print '\twglRealizeLayerPalette'
+ print '\twglSetLayerPaletteEntries'
+ print '\twglSetPixelFormat'
+ print '\twglShareLists'
+ print '\twglSwapBuffers'
+ print '\twglSwapLayerBuffers'
+ print '\twglUseFontBitmapsA'
+ print '\twglUseFontBitmapsW'
+ print '\twglUseFontOutlinesA'
+ print '\twglUseFontOutlinesW'
+ print ';'
+ print '; Mesa internals - mostly for OSMESA'
+ print '\t_ac_CreateContext'
+ print '\t_ac_DestroyContext'
+ print '\t_ac_InvalidateState'
+ print '\t_glapi_get_context'
+ print '\t_glapi_get_proc_address'
+ print '\t_mesa_buffer_data'
+ print '\t_mesa_buffer_map'
+ print '\t_mesa_buffer_subdata'
+ print '\t_mesa_bzero'
+ print '\t_mesa_calloc'
+ print '\t_mesa_choose_tex_format'
+ print '\t_mesa_compressed_texture_size'
+ print '\t_mesa_create_framebuffer'
+ print '\t_mesa_create_visual'
+ print '\t_mesa_delete_buffer_object'
+ print '\t_mesa_delete_texture_object'
+ print '\t_mesa_destroy_framebuffer'
+ print '\t_mesa_destroy_visual'
+ print '\t_mesa_enable_1_3_extensions'
+ print '\t_mesa_enable_1_4_extensions'
+ print '\t_mesa_enable_1_5_extensions'
+ print '\t_mesa_enable_sw_extensions'
+ print '\t_mesa_error'
+ print '\t_mesa_free'
+ print '\t_mesa_free_context_data'
+ print '\t_mesa_get_current_context'
+ print '\t_mesa_init_default_imports'
+ print '\t_mesa_initialize_context'
+ print '\t_mesa_make_current'
+ print '\t_mesa_memcpy'
+ print '\t_mesa_memset'
+ print '\t_mesa_new_buffer_object'
+ print '\t_mesa_new_texture_object'
+ print '\t_mesa_problem'
+ print '\t_mesa_ResizeBuffersMESA'
+ print '\t_mesa_store_compressed_teximage1d'
+ print '\t_mesa_store_compressed_teximage2d'
+ print '\t_mesa_store_compressed_teximage3d'
+ print '\t_mesa_store_compressed_texsubimage1d'
+ print '\t_mesa_store_compressed_texsubimage2d'
+ print '\t_mesa_store_compressed_texsubimage3d'
+ print '\t_mesa_store_teximage1d'
+ print '\t_mesa_store_teximage2d'
+ print '\t_mesa_store_teximage3d'
+ print '\t_mesa_store_texsubimage1d'
+ print '\t_mesa_store_texsubimage2d'
+ print '\t_mesa_store_texsubimage3d'
+ print '\t_mesa_strcmp'
+ print '\t_mesa_test_proxy_teximage'
+ print '\t_mesa_Viewport'
+ print '\t_swrast_Accum'
+ print '\t_swrast_alloc_buffers'
+ print '\t_swrast_Bitmap'
+ print '\t_swrast_CopyPixels'
+ print '\t_swrast_DrawBuffer'
+ print '\t_swrast_DrawPixels'
+ print '\t_swrast_GetDeviceDriverReference'
+ print '\t_swrast_Clear'
+ print '\t_swrast_choose_line'
+ print '\t_swrast_choose_triangle'
+ print '\t_swrast_CopyColorSubTable'
+ print '\t_swrast_CopyColorTable'
+ print '\t_swrast_CopyConvolutionFilter1D'
+ print '\t_swrast_CopyConvolutionFilter2D'
+ print '\t_swrast_copy_teximage1d'
+ print '\t_swrast_copy_teximage2d'
+ print '\t_swrast_copy_texsubimage1d'
+ print '\t_swrast_copy_texsubimage2d'
+ print '\t_swrast_copy_texsubimage3d'
+ print '\t_swrast_CreateContext'
+ print '\t_swrast_DestroyContext'
+ print '\t_swrast_InvalidateState'
+ print '\t_swrast_ReadPixels'
+ print '\t_swrast_zbuffer_address'
+ print '\t_swsetup_Wakeup'
+ print '\t_swsetup_CreateContext'
+ print '\t_swsetup_DestroyContext'
+ print '\t_swsetup_InvalidateState'
+ print '\t_tnl_CreateContext'
+ print '\t_tnl_DestroyContext'
+ print '\t_tnl_InvalidateState'
+ print '\t_tnl_MakeCurrent'
+ print '\t_tnl_run_pipeline'
+#enddef
+
+
+records = []
+
+def FindOffset(funcName):
+ for (name, alias, offset) in records:
+ if name == funcName:
+ return offset
+ #endif
+ #endfor
+ return -1
+#enddef
+
+
+def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset):
+ if alias == '':
+ dispatchName = name
+ else:
+ dispatchName = alias
+ if offset < 0:
+ offset = FindOffset(dispatchName)
+ if offset >= 0 and string.find(name, "unused") == -1:
+ print '\tgl%s' % (name)
+ # save this info in case we need to look up an alias later
+ records.append((name, dispatchName, offset))
+
+#enddef
+
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", EmitEntry)
+PrintTail()
Index: xc/extras/Mesa/src/mesa/main/KNOWN_BUGS
diff -u /dev/null xc/extras/Mesa/src/mesa/main/KNOWN_BUGS:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/KNOWN_BUGS Thu Apr 8 05:17:36 2004
@@ -0,0 +1,21 @@
+
+
+Performance issues with EXT_point_parameters & quake2
+
+
+
+Using glPolygonMode() where the front and back modes aren't the
+same causes poor performance on 3Dfx.
+
+
+
+Broken drivers: some of the Mesa device drivers (such as BeOS, D3D,
+etc) haven't been updated for Mesa 3.3's device driver changes.
+
+
+
+glDrawRangeElements() should use vertex array locking to improve performance
+but trying to do so causes a rendering error. Reported by Scott McMillan.
+Fixed by disabling locking in glDrawRangeElements (varray.c) but that's
+really just hiding a bug in array locking.
+
Index: xc/extras/Mesa/src/mesa/main/accum.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/accum.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/accum.c Thu Apr 8 05:17:36 2004
@@ -0,0 +1,97 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "accum.h"
+#include "context.h"
+#include "imports.h"
+#include "macros.h"
+#include "state.h"
+#include "mtypes.h"
+
+
+void GLAPIENTRY
+_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
+{
+ GLfloat tmp[4];
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ tmp[0] = CLAMP( red, -1.0F, 1.0F );
+ tmp[1] = CLAMP( green, -1.0F, 1.0F );
+ tmp[2] = CLAMP( blue, -1.0F, 1.0F );
+ tmp[3] = CLAMP( alpha, -1.0F, 1.0F );
+
+ if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_ACCUM);
+ COPY_4FV( ctx->Accum.ClearColor, tmp );
+}
+
+
+void GLAPIENTRY
+_mesa_Accum( GLenum op, GLfloat value )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint xpos, ypos, width, height;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->Visual.accumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glAccum");
+ return;
+ }
+
+ if (ctx->NewState)
+ _mesa_update_state( ctx );
+
+ if (ctx->RenderMode != GL_RENDER) {
+ /* no-op */
+ return;
+ }
+
+ /* Determine region to operate upon. */
+ if (ctx->Scissor.Enabled) {
+ xpos = ctx->Scissor.X;
+ ypos = ctx->Scissor.Y;
+ width = ctx->Scissor.Width;
+ height = ctx->Scissor.Height;
+ }
+ else {
+ /* whole window */
+ xpos = 0;
+ ypos = 0;
+ width = ctx->DrawBuffer->Width;
+ height = ctx->DrawBuffer->Height;
+ }
+
+ ctx->Driver.Accum( ctx, op, value, xpos, ypos, width, height );
+}
+
+void
+_mesa_init_accum( GLcontext *ctx )
+{
+ /* Accumulate buffer group */
+ ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 );
+}
Index: xc/extras/Mesa/src/mesa/main/accum.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/accum.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/accum.h Thu Apr 8 05:17:36 2004
@@ -0,0 +1,62 @@
+/**
+ * \file accum.h
+ * Accumulation buffer operations.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef ACCUM_H
+#define ACCUM_H
+
+
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_Accum( GLenum op, GLfloat value );
+
+
+extern void GLAPIENTRY
+_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
+
+extern void
+_mesa_init_accum( GLcontext *ctx );
+
+#else
+
+/** No-op */
+#define _mesa_init_accum( c ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/api_arrayelt.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_arrayelt.c:1.1.1.5
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_arrayelt.c Fri Dec 10 10:32:26 2004
@@ -0,0 +1,1011 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* Author:
+ * Keith Whitwell
+ */
+
+#include "glheader.h"
+#include "api_arrayelt.h"
+#include "context.h"
+#include "glapi.h"
+#include "imports.h"
+#include "macros.h"
+#include "mtypes.h"
+
+typedef void (GLAPIENTRY *array_func)( const void * );
+
+typedef struct {
+ const struct gl_client_array *array;
+ array_func func;
+} AEarray;
+
+typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data );
+
+typedef struct {
+ const struct gl_client_array *array;
+ attrib_func func;
+ GLuint index;
+} AEattrib;
+
+typedef struct {
+ AEarray arrays[32];
+ AEattrib attribs[VERT_ATTRIB_MAX + 1];
+ GLuint NewState;
+} AEcontext;
+
+#define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context)
+
+/*
+ * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
+ * in the range [0, 7]. Luckily these type tokens are sequentially
+ * numbered in gl.h, except for GL_DOUBLE.
+ */
+#define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 )
+
+static void GLAPIENTRY Color3bv(const GLbyte *v)
+{
+ GL_CALL(Color3bv)(v);
+}
+
+static void GLAPIENTRY Color3ubv(const GLubyte *v)
+{
+ GL_CALL(Color3ubv)(v);
+}
+
+static void GLAPIENTRY Color3sv(const GLshort *v)
+{
+ GL_CALL(Color3sv)(v);
+}
+
+static void GLAPIENTRY Color3usv(const GLushort *v)
+{
+ GL_CALL(Color3usv)(v);
+}
+
+static void GLAPIENTRY Color3iv(const GLint *v)
+{
+ GL_CALL(Color3iv)(v);
+}
+
+static void GLAPIENTRY Color3uiv(const GLuint *v)
+{
+ GL_CALL(Color3uiv)(v);
+}
+
+static void GLAPIENTRY Color3fv(const GLfloat *v)
+{
+ GL_CALL(Color3fv)(v);
+}
+
+static void GLAPIENTRY Color3dv(const GLdouble *v)
+{
+ GL_CALL(Color3dv)(v);
+}
+
+static void GLAPIENTRY Color4bv(const GLbyte *v)
+{
+ GL_CALL(Color4bv)(v);
+}
+
+static void GLAPIENTRY Color4ubv(const GLubyte *v)
+{
+ GL_CALL(Color4ubv)(v);
+}
+
+static void GLAPIENTRY Color4sv(const GLshort *v)
+{
+ GL_CALL(Color4sv)(v);
+}
+
+static void GLAPIENTRY Color4usv(const GLushort *v)
+{
+ GL_CALL(Color4usv)(v);
+}
+
+static void GLAPIENTRY Color4iv(const GLint *v)
+{
+ GL_CALL(Color4iv)(v);
+}
+
+static void GLAPIENTRY Color4uiv(const GLuint *v)
+{
+ GL_CALL(Color4uiv)(v);
+}
+
+static void GLAPIENTRY Color4fv(const GLfloat *v)
+{
+ GL_CALL(Color4fv)(v);
+}
+
+static void GLAPIENTRY Color4dv(const GLdouble *v)
+{
+ GL_CALL(Color4dv)(v);
+}
+
+static const array_func ColorFuncs[2][8] = {
+ {
+ (array_func) Color3bv,
+ (array_func) Color3ubv,
+ (array_func) Color3sv,
+ (array_func) Color3usv,
+ (array_func) Color3iv,
+ (array_func) Color3uiv,
+ (array_func) Color3fv,
+ (array_func) Color3dv,
+ },
+ {
+ (array_func) Color4bv,
+ (array_func) Color4ubv,
+ (array_func) Color4sv,
+ (array_func) Color4usv,
+ (array_func) Color4iv,
+ (array_func) Color4uiv,
+ (array_func) Color4fv,
+ (array_func) Color4dv,
+ },
+};
+
+static void GLAPIENTRY Vertex2sv(const GLshort *v)
+{
+ GL_CALL(Vertex2sv)(v);
+}
+
+static void GLAPIENTRY Vertex2iv(const GLint *v)
+{
+ GL_CALL(Vertex2iv)(v);
+}
+
+static void GLAPIENTRY Vertex2fv(const GLfloat *v)
+{
+ GL_CALL(Vertex2fv)(v);
+}
+
+static void GLAPIENTRY Vertex2dv(const GLdouble *v)
+{
+ GL_CALL(Vertex2dv)(v);
+}
+
+static void GLAPIENTRY Vertex3sv(const GLshort *v)
+{
+ GL_CALL(Vertex3sv)(v);
+}
+
+static void GLAPIENTRY Vertex3iv(const GLint *v)
+{
+ GL_CALL(Vertex3iv)(v);
+}
+
+static void GLAPIENTRY Vertex3fv(const GLfloat *v)
+{
+ GL_CALL(Vertex3fv)(v);
+}
+
+static void GLAPIENTRY Vertex3dv(const GLdouble *v)
+{
+ GL_CALL(Vertex3dv)(v);
+}
+
+static void GLAPIENTRY Vertex4sv(const GLshort *v)
+{
+ GL_CALL(Vertex4sv)(v);
+}
+
+static void GLAPIENTRY Vertex4iv(const GLint *v)
+{
+ GL_CALL(Vertex4iv)(v);
+}
+
+static void GLAPIENTRY Vertex4fv(const GLfloat *v)
+{
+ GL_CALL(Vertex4fv)(v);
+}
+
+static void GLAPIENTRY Vertex4dv(const GLdouble *v)
+{
+ GL_CALL(Vertex4dv)(v);
+}
+
+static const array_func VertexFuncs[3][8] = {
+ {
+ 0,
+ 0,
+ (array_func) Vertex2sv,
+ 0,
+ (array_func) Vertex2iv,
+ 0,
+ (array_func) Vertex2fv,
+ (array_func) Vertex2dv,
+ },
+ {
+ 0,
+ 0,
+ (array_func) Vertex3sv,
+ 0,
+ (array_func) Vertex3iv,
+ 0,
+ (array_func) Vertex3fv,
+ (array_func) Vertex3dv,
+ },
+ {
+ 0,
+ 0,
+ (array_func) Vertex4sv,
+ 0,
+ (array_func) Vertex4iv,
+ 0,
+ (array_func) Vertex4fv,
+ (array_func) Vertex4dv,
+ },
+};
+
+static void GLAPIENTRY Indexubv(const GLubyte *c)
+{
+ GL_CALL(Indexubv)(c);
+}
+
+static void GLAPIENTRY Indexsv(const GLshort *c)
+{
+ GL_CALL(Indexsv)(c);
+}
+
+static void GLAPIENTRY Indexiv(const GLint *c)
+{
+ GL_CALL(Indexiv)(c);
+}
+
+static void GLAPIENTRY Indexfv(const GLfloat *c)
+{
+ GL_CALL(Indexfv)(c);
+}
+
+static void GLAPIENTRY Indexdv(const GLdouble *c)
+{
+ GL_CALL(Indexdv)(c);
+}
+
+static const array_func IndexFuncs[8] = {
+ 0,
+ (array_func) Indexubv,
+ (array_func) Indexsv,
+ 0,
+ (array_func) Indexiv,
+ 0,
+ (array_func) Indexfv,
+ (array_func) Indexdv,
+};
+
+static void GLAPIENTRY Normal3bv(const GLbyte *v)
+{
+ GL_CALL(Normal3bv)(v);
+}
+
+static void GLAPIENTRY Normal3sv(const GLshort *v)
+{
+ GL_CALL(Normal3sv)(v);
+}
+
+static void GLAPIENTRY Normal3iv(const GLint *v)
+{
+ GL_CALL(Normal3iv)(v);
+}
+
+static void GLAPIENTRY Normal3fv(const GLfloat *v)
+{
+ GL_CALL(Normal3fv)(v);
+}
+
+static void GLAPIENTRY Normal3dv(const GLdouble *v)
+{
+ GL_CALL(Normal3dv)(v);
+}
+
+static const array_func NormalFuncs[8] = {
+ (array_func) Normal3bv,
+ 0,
+ (array_func) Normal3sv,
+ 0,
+ (array_func) Normal3iv,
+ 0,
+ (array_func) Normal3fv,
+ (array_func) Normal3dv,
+};
+
+/* Wrapper functions in case glSecondaryColor*EXT doesn't exist */
+static void GLAPIENTRY SecondaryColor3bvEXT(const GLbyte *c)
+{
+ GL_CALL(SecondaryColor3bvEXT)(c);
+}
+
+static void GLAPIENTRY SecondaryColor3ubvEXT(const GLubyte *c)
+{
+ GL_CALL(SecondaryColor3ubvEXT)(c);
+}
+
+static void GLAPIENTRY SecondaryColor3svEXT(const GLshort *c)
+{
+ GL_CALL(SecondaryColor3svEXT)(c);
+}
+
+static void GLAPIENTRY SecondaryColor3usvEXT(const GLushort *c)
+{
+ GL_CALL(SecondaryColor3usvEXT)(c);
+}
+
+static void GLAPIENTRY SecondaryColor3ivEXT(const GLint *c)
+{
+ GL_CALL(SecondaryColor3ivEXT)(c);
+}
+
+static void GLAPIENTRY SecondaryColor3uivEXT(const GLuint *c)
+{
+ GL_CALL(SecondaryColor3uivEXT)(c);
+}
+
+static void GLAPIENTRY SecondaryColor3fvEXT(const GLfloat *c)
+{
+ GL_CALL(SecondaryColor3fvEXT)(c);
+}
+
+static void GLAPIENTRY SecondaryColor3dvEXT(const GLdouble *c)
+{
+ GL_CALL(SecondaryColor3dvEXT)(c);
+}
+
+static const array_func SecondaryColorFuncs[8] = {
+ (array_func) SecondaryColor3bvEXT,
+ (array_func) SecondaryColor3ubvEXT,
+ (array_func) SecondaryColor3svEXT,
+ (array_func) SecondaryColor3usvEXT,
+ (array_func) SecondaryColor3ivEXT,
+ (array_func) SecondaryColor3uivEXT,
+ (array_func) SecondaryColor3fvEXT,
+ (array_func) SecondaryColor3dvEXT,
+};
+
+
+/* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */
+static void GLAPIENTRY FogCoordfvEXT(const GLfloat *f)
+{
+ GL_CALL(FogCoordfvEXT)(f);
+}
+
+static void GLAPIENTRY FogCoorddvEXT(const GLdouble *f)
+{
+ GL_CALL(FogCoorddvEXT)(f);
+}
+
+static const array_func FogCoordFuncs[8] = {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ (array_func) FogCoordfvEXT,
+ (array_func) FogCoorddvEXT
+};
+
+/**********************************************************************/
+
+/* GL_BYTE attributes */
+
+static void GLAPIENTRY VertexAttrib1Nbv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, BYTE_TO_FLOAT(v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib1bv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, v[0]);
+}
+
+static void GLAPIENTRY VertexAttrib2Nbv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib2bv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
+}
+
+static void GLAPIENTRY VertexAttrib3Nbv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, BYTE_TO_FLOAT(v[0]),
+ BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib3bv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
+}
+
+static void GLAPIENTRY VertexAttrib4Nbv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, BYTE_TO_FLOAT(v[0]),
+ BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2]),
+ BYTE_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY VertexAttrib4bv(GLuint index, const GLbyte *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
+}
+
+/* GL_UNSIGNED_BYTE attributes */
+
+static void GLAPIENTRY VertexAttrib1Nubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, UBYTE_TO_FLOAT(v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib1ubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, v[0]);
+}
+
+static void GLAPIENTRY VertexAttrib2Nubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib2ubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
+}
+
+static void GLAPIENTRY VertexAttrib3Nubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]));
+}
+static void GLAPIENTRY VertexAttrib3ubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
+}
+
+static void GLAPIENTRY VertexAttrib4Nubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]),
+ UBYTE_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY VertexAttrib4ubv(GLuint index, const GLubyte *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
+}
+
+/* GL_SHORT attributes */
+
+static void GLAPIENTRY VertexAttrib1Nsv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, SHORT_TO_FLOAT(v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib1sv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, v[0]);
+}
+
+static void GLAPIENTRY VertexAttrib2Nsv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, SHORT_TO_FLOAT(v[0]),
+ SHORT_TO_FLOAT(v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib2sv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
+}
+
+static void GLAPIENTRY VertexAttrib3Nsv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, SHORT_TO_FLOAT(v[0]),
+ SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib3sv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
+}
+
+static void GLAPIENTRY VertexAttrib4Nsv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, SHORT_TO_FLOAT(v[0]),
+ SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2]),
+ SHORT_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY VertexAttrib4sv(GLuint index, const GLshort *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
+}
+
+/* GL_UNSIGNED_SHORT attributes */
+
+static void GLAPIENTRY VertexAttrib1Nusv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, USHORT_TO_FLOAT(v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib1usv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, v[0]);
+}
+
+static void GLAPIENTRY VertexAttrib2Nusv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, USHORT_TO_FLOAT(v[0]),
+ USHORT_TO_FLOAT(v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib2usv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
+}
+
+static void GLAPIENTRY VertexAttrib3Nusv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, USHORT_TO_FLOAT(v[0]),
+ USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib3usv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
+}
+
+static void GLAPIENTRY VertexAttrib4Nusv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, USHORT_TO_FLOAT(v[0]),
+ USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2]),
+ USHORT_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY VertexAttrib4usv(GLuint index, const GLushort *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
+}
+
+/* GL_INT attributes */
+
+static void GLAPIENTRY VertexAttrib1Niv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, INT_TO_FLOAT(v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib1iv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, v[0]);
+}
+
+static void GLAPIENTRY VertexAttrib2Niv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, INT_TO_FLOAT(v[0]),
+ INT_TO_FLOAT(v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib2iv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
+}
+
+static void GLAPIENTRY VertexAttrib3Niv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, INT_TO_FLOAT(v[0]),
+ INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib3iv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
+}
+
+static void GLAPIENTRY VertexAttrib4Niv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, INT_TO_FLOAT(v[0]),
+ INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2]),
+ INT_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY VertexAttrib4iv(GLuint index, const GLint *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
+}
+
+/* GL_UNSIGNED_INT attributes */
+
+static void GLAPIENTRY VertexAttrib1Nuiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, UINT_TO_FLOAT(v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib1uiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib1fNV)(index, v[0]);
+}
+
+static void GLAPIENTRY VertexAttrib2Nuiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, UINT_TO_FLOAT(v[0]),
+ UINT_TO_FLOAT(v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib2uiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
+}
+
+static void GLAPIENTRY VertexAttrib3Nuiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, UINT_TO_FLOAT(v[0]),
+ UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib3uiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
+}
+
+static void GLAPIENTRY VertexAttrib4Nuiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, UINT_TO_FLOAT(v[0]),
+ UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2]),
+ UINT_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY VertexAttrib4uiv(GLuint index, const GLuint *v)
+{
+ GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
+}
+
+/* GL_FLOAT attributes */
+
+static void GLAPIENTRY VertexAttrib1fv(GLuint index, const GLfloat *v)
+{
+ GL_CALL(VertexAttrib1fvNV)(index, v);
+}
+
+static void GLAPIENTRY VertexAttrib2fv(GLuint index, const GLfloat *v)
+{
+ GL_CALL(VertexAttrib2fvNV)(index, v);
+}
+
+static void GLAPIENTRY VertexAttrib3fv(GLuint index, const GLfloat *v)
+{
+ GL_CALL(VertexAttrib3fvNV)(index, v);
+}
+
+static void GLAPIENTRY VertexAttrib4fv(GLuint index, const GLfloat *v)
+{
+ GL_CALL(VertexAttrib4fvNV)(index, v);
+}
+
+/* GL_DOUBLE attributes */
+
+static void GLAPIENTRY VertexAttrib1dv(GLuint index, const GLdouble *v)
+{
+ GL_CALL(VertexAttrib1dvNV)(index, v);
+}
+
+static void GLAPIENTRY VertexAttrib2dv(GLuint index, const GLdouble *v)
+{
+ GL_CALL(VertexAttrib2dvNV)(index, v);
+}
+
+static void GLAPIENTRY VertexAttrib3dv(GLuint index, const GLdouble *v)
+{
+ GL_CALL(VertexAttrib3dvNV)(index, v);
+}
+
+static void GLAPIENTRY VertexAttrib4dv(GLuint index, const GLdouble *v)
+{
+ GL_CALL(VertexAttrib4dvNV)(index, v);
+}
+
+
+/*
+ * Array [size][type] of VertexAttrib functions
+ */
+static const attrib_func AttribFuncs[2][4][8] = {
+ {
+ /* non-normalized */
+ {
+ /* size 1 */
+ (attrib_func) VertexAttrib1bv,
+ (attrib_func) VertexAttrib1ubv,
+ (attrib_func) VertexAttrib1sv,
+ (attrib_func) VertexAttrib1usv,
+ (attrib_func) VertexAttrib1iv,
+ (attrib_func) VertexAttrib1uiv,
+ (attrib_func) VertexAttrib1fv,
+ (attrib_func) VertexAttrib1dv
+ },
+ {
+ /* size 2 */
+ (attrib_func) VertexAttrib2bv,
+ (attrib_func) VertexAttrib2ubv,
+ (attrib_func) VertexAttrib2sv,
+ (attrib_func) VertexAttrib2usv,
+ (attrib_func) VertexAttrib2iv,
+ (attrib_func) VertexAttrib2uiv,
+ (attrib_func) VertexAttrib2fv,
+ (attrib_func) VertexAttrib2dv
+ },
+ {
+ /* size 3 */
+ (attrib_func) VertexAttrib3bv,
+ (attrib_func) VertexAttrib3ubv,
+ (attrib_func) VertexAttrib3sv,
+ (attrib_func) VertexAttrib3usv,
+ (attrib_func) VertexAttrib3iv,
+ (attrib_func) VertexAttrib3uiv,
+ (attrib_func) VertexAttrib3fv,
+ (attrib_func) VertexAttrib3dv
+ },
+ {
+ /* size 4 */
+ (attrib_func) VertexAttrib4bv,
+ (attrib_func) VertexAttrib4ubv,
+ (attrib_func) VertexAttrib4sv,
+ (attrib_func) VertexAttrib4usv,
+ (attrib_func) VertexAttrib4iv,
+ (attrib_func) VertexAttrib4uiv,
+ (attrib_func) VertexAttrib4fv,
+ (attrib_func) VertexAttrib4dv
+ }
+ },
+ {
+ /* normalized (except for float/double) */
+ {
+ /* size 1 */
+ (attrib_func) VertexAttrib1Nbv,
+ (attrib_func) VertexAttrib1Nubv,
+ (attrib_func) VertexAttrib1Nsv,
+ (attrib_func) VertexAttrib1Nusv,
+ (attrib_func) VertexAttrib1Niv,
+ (attrib_func) VertexAttrib1Nuiv,
+ (attrib_func) VertexAttrib1fv,
+ (attrib_func) VertexAttrib1dv
+ },
+ {
+ /* size 2 */
+ (attrib_func) VertexAttrib2Nbv,
+ (attrib_func) VertexAttrib2Nubv,
+ (attrib_func) VertexAttrib2Nsv,
+ (attrib_func) VertexAttrib2Nusv,
+ (attrib_func) VertexAttrib2Niv,
+ (attrib_func) VertexAttrib2Nuiv,
+ (attrib_func) VertexAttrib2fv,
+ (attrib_func) VertexAttrib2dv
+ },
+ {
+ /* size 3 */
+ (attrib_func) VertexAttrib3Nbv,
+ (attrib_func) VertexAttrib3Nubv,
+ (attrib_func) VertexAttrib3Nsv,
+ (attrib_func) VertexAttrib3Nusv,
+ (attrib_func) VertexAttrib3Niv,
+ (attrib_func) VertexAttrib3Nuiv,
+ (attrib_func) VertexAttrib3fv,
+ (attrib_func) VertexAttrib3dv
+ },
+ {
+ /* size 4 */
+ (attrib_func) VertexAttrib4Nbv,
+ (attrib_func) VertexAttrib4Nubv,
+ (attrib_func) VertexAttrib4Nsv,
+ (attrib_func) VertexAttrib4Nusv,
+ (attrib_func) VertexAttrib4Niv,
+ (attrib_func) VertexAttrib4Nuiv,
+ (attrib_func) VertexAttrib4fv,
+ (attrib_func) VertexAttrib4dv
+ }
+ }
+};
+
+static void GLAPIENTRY EdgeFlagv(const GLboolean *flag)
+{
+ GL_CALL(EdgeFlagv)(flag);
+}
+
+/**********************************************************************/
+
+
+GLboolean _ae_create_context( GLcontext *ctx )
+{
+ if (ctx->aelt_context)
+ return GL_TRUE;
+
+ ctx->aelt_context = MALLOC( sizeof(AEcontext) );
+ if (!ctx->aelt_context)
+ return GL_FALSE;
+
+ AE_CONTEXT(ctx)->NewState = ~0;
+ return GL_TRUE;
+}
+
+
+void _ae_destroy_context( GLcontext *ctx )
+{
+ if ( AE_CONTEXT( ctx ) ) {
+ FREE( ctx->aelt_context );
+ ctx->aelt_context = 0;
+ }
+}
+
+
+/**
+ * Make a list of per-vertex functions to call for each glArrayElement call.
+ * These functions access the array data (i.e. glVertex, glColor, glNormal,
+ * etc).
+ * Note: this may be called during display list construction.
+ */
+static void _ae_update_state( GLcontext *ctx )
+{
+ AEcontext *actx = AE_CONTEXT(ctx);
+ AEarray *aa = actx->arrays;
+ AEattrib *at = actx->attribs;
+ GLuint i;
+
+ /* conventional vertex arrays */
+ if (ctx->Array.Index.Enabled) {
+ aa->array = &ctx->Array.Index;
+ aa->func = IndexFuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+ if (ctx->Array.EdgeFlag.Enabled) {
+ aa->array = &ctx->Array.EdgeFlag;
+ aa->func = (array_func) EdgeFlagv;
+ aa++;
+ }
+ if (ctx->Array.Normal.Enabled) {
+ aa->array = &ctx->Array.Normal;
+ aa->func = NormalFuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+ if (ctx->Array.Color.Enabled) {
+ aa->array = &ctx->Array.Color;
+ aa->func = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+ if (ctx->Array.SecondaryColor.Enabled) {
+ aa->array = &ctx->Array.SecondaryColor;
+ aa->func = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+ if (ctx->Array.FogCoord.Enabled) {
+ aa->array = &ctx->Array.FogCoord;
+ aa->func = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+ if (ctx->Array.TexCoord[i].Enabled) {
+ /* NOTE: we use generic glVertexAttrib functions here.
+ * If we ever de-alias conventional/generic vertex attribs this
+ * will have to change.
+ */
+ struct gl_client_array *attribArray = &ctx->Array.TexCoord[i];
+ at->array = attribArray;
+ at->func = AttribFuncs[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)];
+ at->index = VERT_ATTRIB_TEX0 + i;
+ at++;
+ }
+ }
+
+ /* generic vertex attribute arrays */
+ for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */
+ if (ctx->Array.VertexAttrib[i].Enabled) {
+ struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i];
+ at->array = attribArray;
+ /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
+ * function pointer here (for float arrays) since the pointer may
+ * change from one execution of _ae_loopback_array_elt() to
+ * the next. Doing so caused UT to break.
+ */
+ at->func = AttribFuncs[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)];
+ at->index = i;
+ at++;
+ }
+ }
+
+ /* finally, vertex position */
+ if (ctx->Array.VertexAttrib[0].Enabled) {
+ /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
+ * issued as the last (proviking) attribute).
+ */
+ aa->array = &ctx->Array.VertexAttrib[0];
+ assert(aa->array->Size >= 2); /* XXX fix someday? */
+ aa->func = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+ else if (ctx->Array.Vertex.Enabled) {
+ aa->array = &ctx->Array.Vertex;
+ aa->func = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX);
+ ASSERT(aa - actx->arrays < 32);
+ at->func = NULL; /* terminate the list */
+ aa->func = NULL; /* terminate the list */
+
+ actx->NewState = 0;
+}
+
+
+/**
+ * Called via glArrayElement() and glDrawArrays().
+ * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions
+ * for all enabled vertex arrays (for elt-th element).
+ * Note: this may be called during display list construction.
+ */
+void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const AEcontext *actx = AE_CONTEXT(ctx);
+ const AEarray *aa;
+ const AEattrib *at;
+
+ if (actx->NewState)
+ _ae_update_state( ctx );
+
+ /* generic attributes */
+ for (at = actx->attribs; at->func; at++) {
+ const GLubyte *src = at->array->BufferObj->Data
+ + (unsigned long) at->array->Ptr
+ + elt * at->array->StrideB;
+ at->func( at->index, src );
+ }
+
+ /* conventional arrays */
+ for (aa = actx->arrays; aa->func ; aa++) {
+ const GLubyte *src = aa->array->BufferObj->Data
+ + (unsigned long) aa->array->Ptr
+ + elt * aa->array->StrideB;
+ aa->func( src );
+ }
+}
+
+
+
+void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
+{
+ AE_CONTEXT(ctx)->NewState |= new_state;
+}
Index: xc/extras/Mesa/src/mesa/main/api_arrayelt.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_arrayelt.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_arrayelt.h Thu Apr 8 05:17:36 2004
@@ -0,0 +1,37 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef API_ARRAYELT_H
+#define API_ARRAYELT_H
+
+#include "mtypes.h"
+
+extern GLboolean _ae_create_context( GLcontext *ctx );
+extern void _ae_destroy_context( GLcontext *ctx );
+extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state );
+extern void GLAPIENTRY _ae_loopback_array_elt( GLint elt );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/api_eval.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_eval.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_eval.h Thu Apr 8 05:17:36 2004
@@ -0,0 +1,42 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef API_EVAL_H
+#define API_EVAL_H
+
+#include "mtypes.h"
+
+extern void _mesa_EvalPoint1( GLint i );
+extern void _mesa_EvalPoint2( GLint i, GLint j );
+extern void _mesa_EvalCoord1f( GLfloat u );
+extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v );
+extern void _mesa_EvalCoord1fv( const GLfloat *u );
+extern void _mesa_EvalCoord2fv( const GLfloat *u );
+
+#endif
+
+
+
Index: xc/extras/Mesa/src/mesa/main/api_loopback.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_loopback.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_loopback.c Fri Dec 10 10:32:26 2004
@@ -0,0 +1,1564 @@
+/**
+ * \file api_loopback.c
+ *
+ * \author Keith Whitwell
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "glapi.h"
+#include "glapitable.h"
+#include "macros.h"
+#include "colormac.h"
+#include "api_loopback.h"
+#include "glthread.h"
+
+/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc
+ * calls to a smaller set of driver-provided formats. Currently just
+ * go back to dispatch to find these (eg. call glNormal3f directly),
+ * hence 'loopback'.
+ *
+ * The driver must supply all of the remaining entry points, which are
+ * listed in dd.h. The easiest way for a driver to do this is to
+ * install the supplied software t&l module.
+ */
+#define COLORF(r,g,b,a) GL_CALL(Color4f)(r,g,b,a)
+#define VERTEX2(x,y) GL_CALL(Vertex2f)(x,y)
+#define VERTEX3(x,y,z) GL_CALL(Vertex3f)(x,y,z)
+#define VERTEX4(x,y,z,w) GL_CALL(Vertex4f)(x,y,z,w)
+#define NORMAL(x,y,z) GL_CALL(Normal3f)(x,y,z)
+#define TEXCOORD1(s) GL_CALL(TexCoord1f)(s)
+#define TEXCOORD2(s,t) GL_CALL(TexCoord2f)(s,t)
+#define TEXCOORD3(s,t,u) GL_CALL(TexCoord3f)(s,t,u)
+#define TEXCOORD4(s,t,u,v) GL_CALL(TexCoord4f)(s,t,u,v)
+#define INDEX(c) GL_CALL(Indexf)(c)
+#define MULTI_TEXCOORD1(z,s) GL_CALL(MultiTexCoord1fARB)(z,s)
+#define MULTI_TEXCOORD2(z,s,t) GL_CALL(MultiTexCoord2fARB)(z,s,t)
+#define MULTI_TEXCOORD3(z,s,t,u) GL_CALL(MultiTexCoord3fARB)(z,s,t,u)
+#define MULTI_TEXCOORD4(z,s,t,u,v) GL_CALL(MultiTexCoord4fARB)(z,s,t,u,v)
+#define EVALCOORD1(x) GL_CALL(EvalCoord1f)(x)
+#define EVALCOORD2(x,y) GL_CALL(EvalCoord2f)(x,y)
+#define MATERIALFV(a,b,c) GL_CALL(Materialfv)(a,b,c)
+#define RECTF(a,b,c,d) GL_CALL(Rectf)(a,b,c,d)
+
+/* Extension functions must be dereferenced through _glapi_Dispatch as
+ * not all libGL.so's will have all the uptodate entrypoints.
+ */
+#define ATTRIB1(index,x) GL_CALL(VertexAttrib1fNV)(index,x)
+#define ATTRIB2(index,x,y) GL_CALL(VertexAttrib2fNV)(index,x,y)
+#define ATTRIB3(index,x,y,z) GL_CALL(VertexAttrib3fNV)(index,x,y,z)
+#define ATTRIB4(index,x,y,z,w) GL_CALL(VertexAttrib4fNV)(index,x,y,z,w)
+#define FOGCOORDF(x) GL_CALL(FogCoordfEXT)(x)
+#define SECONDARYCOLORF(a,b,c) GL_CALL(SecondaryColor3fEXT)(a,b,c)
+
+static void GLAPIENTRY
+loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue )
+{
+ COLORF( BYTE_TO_FLOAT(red),
+ BYTE_TO_FLOAT(green),
+ BYTE_TO_FLOAT(blue),
+ 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue )
+{
+ COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3i_f( GLint red, GLint green, GLint blue )
+{
+ COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green),
+ INT_TO_FLOAT(blue), 1.0);
+}
+
+static void GLAPIENTRY
+loopback_Color3s_f( GLshort red, GLshort green, GLshort blue )
+{
+ COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green),
+ SHORT_TO_FLOAT(blue), 1.0);
+}
+
+static void GLAPIENTRY
+loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue )
+{
+ COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green),
+ UINT_TO_FLOAT(blue), 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3us_f( GLushort red, GLushort green, GLushort blue )
+{
+ COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green),
+ USHORT_TO_FLOAT(blue), 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue )
+{
+ COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue), 1.0 );
+}
+
+
+static void GLAPIENTRY
+loopback_Color3bv_f( const GLbyte *v )
+{
+ COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2]), 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3dv_f( const GLdouble *v )
+{
+ COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3iv_f( const GLint *v )
+{
+ COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) );
+}
+
+static void GLAPIENTRY
+loopback_Color3sv_f( const GLshort *v )
+{
+ COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2]), 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3uiv_f( const GLuint *v )
+{
+ COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2]), 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3usv_f( const GLushort *v )
+{
+ COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2]), 1.0 );
+}
+
+static void GLAPIENTRY
+loopback_Color3ubv_f( const GLubyte *v )
+{
+ COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]), 1.0 );
+}
+
+
+static void GLAPIENTRY
+loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue,
+ GLbyte alpha )
+{
+ COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green),
+ BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) );
+}
+
+static void GLAPIENTRY
+loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue,
+ GLdouble alpha )
+{
+ COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha );
+}
+
+static void GLAPIENTRY
+loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha )
+{
+ COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green),
+ INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) );
+}
+
+static void GLAPIENTRY
+loopback_Color4s_f( GLshort red, GLshort green, GLshort blue,
+ GLshort alpha )
+{
+ COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green),
+ SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) );
+}
+
+static void GLAPIENTRY
+loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha )
+{
+ COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green),
+ UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) );
+}
+
+static void GLAPIENTRY
+loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha )
+{
+ COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green),
+ USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) );
+}
+
+static void GLAPIENTRY
+loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
+{
+ COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) );
+}
+
+
+static void GLAPIENTRY
+loopback_Color4iv_f( const GLint *v )
+{
+ COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) );
+}
+
+
+static void GLAPIENTRY
+loopback_Color4bv_f( const GLbyte *v )
+{
+ COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) );
+}
+
+static void GLAPIENTRY
+loopback_Color4dv_f( const GLdouble *v )
+{
+ COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+static void GLAPIENTRY
+loopback_Color4sv_f( const GLshort *v)
+{
+ COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) );
+}
+
+
+static void GLAPIENTRY
+loopback_Color4uiv_f( const GLuint *v)
+{
+ COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) );
+}
+
+static void GLAPIENTRY
+loopback_Color4usv_f( const GLushort *v)
+{
+ COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) );
+}
+
+static void GLAPIENTRY
+loopback_Color4ubv_f( const GLubyte *v)
+{
+ COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) );
+}
+
+static void GLAPIENTRY
+loopback_FogCoorddEXT( GLdouble d )
+{
+ FOGCOORDF( (GLfloat) d );
+}
+
+static void GLAPIENTRY
+loopback_FogCoorddvEXT( const GLdouble *v )
+{
+ FOGCOORDF( (GLfloat) *v );
+}
+
+
+static void GLAPIENTRY
+loopback_Indexd( GLdouble c )
+{
+ INDEX( (GLfloat) c );
+}
+
+static void GLAPIENTRY
+loopback_Indexi( GLint c )
+{
+ INDEX( (GLfloat) c );
+}
+
+static void GLAPIENTRY
+loopback_Indexs( GLshort c )
+{
+ INDEX( (GLfloat) c );
+}
+
+static void GLAPIENTRY
+loopback_Indexub( GLubyte c )
+{
+ INDEX( (GLfloat) c );
+}
+
+static void GLAPIENTRY
+loopback_Indexdv( const GLdouble *c )
+{
+ INDEX( (GLfloat) *c );
+}
+
+static void GLAPIENTRY
+loopback_Indexiv( const GLint *c )
+{
+ INDEX( (GLfloat) *c );
+}
+
+static void GLAPIENTRY
+loopback_Indexsv( const GLshort *c )
+{
+ INDEX( (GLfloat) *c );
+}
+
+static void GLAPIENTRY
+loopback_Indexubv( const GLubyte *c )
+{
+ INDEX( (GLfloat) *c );
+}
+
+static void GLAPIENTRY
+loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz )
+{
+ NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) );
+}
+
+static void GLAPIENTRY
+loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz )
+{
+ NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz);
+}
+
+static void GLAPIENTRY
+loopback_Normal3i( GLint nx, GLint ny, GLint nz )
+{
+ NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) );
+}
+
+static void GLAPIENTRY
+loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz )
+{
+ NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) );
+}
+
+static void GLAPIENTRY
+loopback_Normal3bv( const GLbyte *v )
+{
+ NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) );
+}
+
+static void GLAPIENTRY
+loopback_Normal3dv( const GLdouble *v )
+{
+ NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+static void GLAPIENTRY
+loopback_Normal3iv( const GLint *v )
+{
+ NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) );
+}
+
+static void GLAPIENTRY
+loopback_Normal3sv( const GLshort *v )
+{
+ NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) );
+}
+
+static void GLAPIENTRY
+loopback_TexCoord1d( GLdouble s )
+{
+ TEXCOORD1((GLfloat) s);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord1i( GLint s )
+{
+ TEXCOORD1((GLfloat) s);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord1s( GLshort s )
+{
+ TEXCOORD1((GLfloat) s);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord2d( GLdouble s, GLdouble t )
+{
+ TEXCOORD2((GLfloat) s,(GLfloat) t);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord2s( GLshort s, GLshort t )
+{
+ TEXCOORD2((GLfloat) s,(GLfloat) t);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord2i( GLint s, GLint t )
+{
+ TEXCOORD2((GLfloat) s,(GLfloat) t);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r )
+{
+ TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord3i( GLint s, GLint t, GLint r )
+{
+ TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord3s( GLshort s, GLshort t, GLshort r )
+{
+ TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q )
+{
+ TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q )
+{
+ TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q )
+{
+ TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord1dv( const GLdouble *v )
+{
+ TEXCOORD1((GLfloat) v[0]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord1iv( const GLint *v )
+{
+ TEXCOORD1((GLfloat) v[0]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord1sv( const GLshort *v )
+{
+ TEXCOORD1((GLfloat) v[0]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord2dv( const GLdouble *v )
+{
+ TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord2iv( const GLint *v )
+{
+ TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord2sv( const GLshort *v )
+{
+ TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord3dv( const GLdouble *v )
+{
+ TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord3iv( const GLint *v )
+{
+ TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord3sv( const GLshort *v )
+{
+ TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord4dv( const GLdouble *v )
+{
+ TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord4iv( const GLint *v )
+{
+ TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_TexCoord4sv( const GLshort *v )
+{
+ TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_Vertex2d( GLdouble x, GLdouble y )
+{
+ VERTEX2( (GLfloat) x, (GLfloat) y );
+}
+
+static void GLAPIENTRY
+loopback_Vertex2i( GLint x, GLint y )
+{
+ VERTEX2( (GLfloat) x, (GLfloat) y );
+}
+
+static void GLAPIENTRY
+loopback_Vertex2s( GLshort x, GLshort y )
+{
+ VERTEX2( (GLfloat) x, (GLfloat) y );
+}
+
+static void GLAPIENTRY
+loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z )
+{
+ VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+static void GLAPIENTRY
+loopback_Vertex3i( GLint x, GLint y, GLint z )
+{
+ VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+static void GLAPIENTRY
+loopback_Vertex3s( GLshort x, GLshort y, GLshort z )
+{
+ VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+static void GLAPIENTRY
+loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w )
+{
+ VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w );
+}
+
+static void GLAPIENTRY
+loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w )
+{
+ VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w );
+}
+
+static void GLAPIENTRY
+loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w )
+{
+ VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w );
+}
+
+static void GLAPIENTRY
+loopback_Vertex2dv( const GLdouble *v )
+{
+ VERTEX2( (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex2iv( const GLint *v )
+{
+ VERTEX2( (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex2sv( const GLshort *v )
+{
+ VERTEX2( (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex3dv( const GLdouble *v )
+{
+ VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex3iv( const GLint *v )
+{
+ VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex3sv( const GLshort *v )
+{
+ VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex4dv( const GLdouble *v )
+{
+ VERTEX4( (GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex4iv( const GLint *v )
+{
+ VERTEX4( (GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+static void GLAPIENTRY
+loopback_Vertex4sv( const GLshort *v )
+{
+ VERTEX4( (GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord1dARB(GLenum target, GLdouble s)
+{
+ MULTI_TEXCOORD1( target, (GLfloat) s );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v)
+{
+ MULTI_TEXCOORD1( target, (GLfloat) v[0] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord1iARB(GLenum target, GLint s)
+{
+ MULTI_TEXCOORD1( target, (GLfloat) s );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v)
+{
+ MULTI_TEXCOORD1( target, (GLfloat) v[0] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord1sARB(GLenum target, GLshort s)
+{
+ MULTI_TEXCOORD1( target, (GLfloat) s );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v)
+{
+ MULTI_TEXCOORD1( target, (GLfloat) v[0] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t)
+{
+ MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v)
+{
+ MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t)
+{
+ MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v)
+{
+ MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t)
+{
+ MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v)
+{
+ MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r)
+{
+ MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v)
+{
+ MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r)
+{
+ MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v)
+{
+ MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r)
+{
+ MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v)
+{
+ MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+ MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t,
+ (GLfloat) r, (GLfloat) q );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v)
+{
+ MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q)
+{
+ MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t,
+ (GLfloat) r, (GLfloat) q );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v)
+{
+ MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
+{
+ MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t,
+ (GLfloat) r, (GLfloat) q );
+}
+
+static void GLAPIENTRY
+loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v)
+{
+ MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+static void GLAPIENTRY
+loopback_EvalCoord2dv( const GLdouble *u )
+{
+ EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] );
+}
+
+static void GLAPIENTRY
+loopback_EvalCoord2fv( const GLfloat *u )
+{
+ EVALCOORD2( u[0], u[1] );
+}
+
+static void GLAPIENTRY
+loopback_EvalCoord2d( GLdouble u, GLdouble v )
+{
+ EVALCOORD2( (GLfloat) u, (GLfloat) v );
+}
+
+static void GLAPIENTRY
+loopback_EvalCoord1dv( const GLdouble *u )
+{
+ EVALCOORD1( (GLfloat) *u );
+}
+
+static void GLAPIENTRY
+loopback_EvalCoord1fv( const GLfloat *u )
+{
+ EVALCOORD1( (GLfloat) *u );
+}
+
+static void GLAPIENTRY
+loopback_EvalCoord1d( GLdouble u )
+{
+ EVALCOORD1( (GLfloat) u );
+}
+
+static void GLAPIENTRY
+loopback_Materialf( GLenum face, GLenum pname, GLfloat param )
+{
+ GLfloat fparam[4];
+ fparam[0] = param;
+ MATERIALFV( face, pname, fparam );
+}
+
+static void GLAPIENTRY
+loopback_Materiali(GLenum face, GLenum pname, GLint param )
+{
+ GLfloat p = (GLfloat) param;
+ MATERIALFV(face, pname, &p);
+}
+
+static void GLAPIENTRY
+loopback_Materialiv(GLenum face, GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+ switch (pname) {
+ case GL_AMBIENT:
+ case GL_DIFFUSE:
+ case GL_SPECULAR:
+ case GL_EMISSION:
+ case GL_AMBIENT_AND_DIFFUSE:
+ fparam[0] = INT_TO_FLOAT( params[0] );
+ fparam[1] = INT_TO_FLOAT( params[1] );
+ fparam[2] = INT_TO_FLOAT( params[2] );
+ fparam[3] = INT_TO_FLOAT( params[3] );
+ break;
+ case GL_SHININESS:
+ fparam[0] = (GLfloat) params[0];
+ break;
+ case GL_COLOR_INDEXES:
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = (GLfloat) params[1];
+ fparam[2] = (GLfloat) params[2];
+ break;
+ default:
+ ;
+ }
+ MATERIALFV(face, pname, fparam);
+}
+
+
+static void GLAPIENTRY
+loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
+{
+ RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2);
+}
+
+static void GLAPIENTRY
+loopback_Rectdv(const GLdouble *v1, const GLdouble *v2)
+{
+ RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]);
+}
+
+static void GLAPIENTRY
+loopback_Rectfv(const GLfloat *v1, const GLfloat *v2)
+{
+ RECTF(v1[0], v1[1], v2[0], v2[1]);
+}
+
+static void GLAPIENTRY
+loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2)
+{
+ RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2);
+}
+
+static void GLAPIENTRY
+loopback_Rectiv(const GLint *v1, const GLint *v2)
+{
+ RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]);
+}
+
+static void GLAPIENTRY
+loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
+{
+ RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2);
+}
+
+static void GLAPIENTRY
+loopback_Rectsv(const GLshort *v1, const GLshort *v2)
+{
+ RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]);
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue )
+{
+ SECONDARYCOLORF( BYTE_TO_FLOAT(red),
+ BYTE_TO_FLOAT(green),
+ BYTE_TO_FLOAT(blue) );
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue )
+{
+ SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue );
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue )
+{
+ SECONDARYCOLORF( INT_TO_FLOAT(red),
+ INT_TO_FLOAT(green),
+ INT_TO_FLOAT(blue));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue )
+{
+ SECONDARYCOLORF(SHORT_TO_FLOAT(red),
+ SHORT_TO_FLOAT(green),
+ SHORT_TO_FLOAT(blue));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue )
+{
+ SECONDARYCOLORF(UINT_TO_FLOAT(red),
+ UINT_TO_FLOAT(green),
+ UINT_TO_FLOAT(blue));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue )
+{
+ SECONDARYCOLORF(USHORT_TO_FLOAT(red),
+ USHORT_TO_FLOAT(green),
+ USHORT_TO_FLOAT(blue));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue )
+{
+ SECONDARYCOLORF(UBYTE_TO_FLOAT(red),
+ UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3bvEXT_f( const GLbyte *v )
+{
+ SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]),
+ BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3dvEXT_f( const GLdouble *v )
+{
+ SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+static void GLAPIENTRY
+loopback_SecondaryColor3ivEXT_f( const GLint *v )
+{
+ SECONDARYCOLORF(INT_TO_FLOAT(v[0]),
+ INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3svEXT_f( const GLshort *v )
+{
+ SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]),
+ SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3uivEXT_f( const GLuint *v )
+{
+ SECONDARYCOLORF(UINT_TO_FLOAT(v[0]),
+ UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3usvEXT_f( const GLushort *v )
+{
+ SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]),
+ USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2]));
+}
+
+static void GLAPIENTRY
+loopback_SecondaryColor3ubvEXT_f( const GLubyte *v )
+{
+ SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]));
+}
+
+
+/*
+ * GL_NV_vertex_program
+ */
+
+static void GLAPIENTRY
+loopback_VertexAttrib1sNV(GLuint index, GLshort x)
+{
+ ATTRIB1(index, (GLfloat) x);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib1fNV(GLuint index, GLfloat x)
+{
+ ATTRIB1(index, x);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib1dNV(GLuint index, GLdouble x)
+{
+ ATTRIB1(index, (GLfloat) x);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y)
+{
+ ATTRIB2(index, (GLfloat) x, y);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
+{
+ ATTRIB2(index, (GLfloat) x, y);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y)
+{
+ ATTRIB2(index, (GLfloat) x, (GLfloat) y);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z)
+{
+ ATTRIB3(index, (GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ ATTRIB3(index, x, y, z);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+ ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
+{
+ ATTRIB4(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y),
+ UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w));
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib1svNV(GLuint index, const GLshort *v)
+{
+ ATTRIB1(index, (GLfloat) v[0]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib1fvNV(GLuint index, const GLfloat *v)
+{
+ ATTRIB1(index, v[0]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v)
+{
+ ATTRIB1(index, (GLfloat) v[0]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib2svNV(GLuint index, const GLshort *v)
+{
+ ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib2fvNV(GLuint index, const GLfloat *v)
+{
+ ATTRIB2(index, v[0], v[1]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v)
+{
+ ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib3svNV(GLuint index, const GLshort *v)
+{
+ ATTRIB3(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib3fvNV(GLuint index, const GLfloat *v)
+{
+ ATTRIB3(index, v[0], v[1], v[2]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v)
+{
+ ATTRIB3(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4svNV(GLuint index, const GLshort *v)
+{
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],
+ (GLfloat)v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4fvNV(GLuint index, const GLfloat *v)
+{
+ ATTRIB4(index, v[0], v[1], v[2], v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v)
+{
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
+{
+ ATTRIB4(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]));
+}
+
+
+static void GLAPIENTRY
+loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib1svNV(index + i, v + i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib1fvNV(index + i, v + i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib1dvNV(index + i, v + i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib2svNV(index + i, v + 2 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib2fvNV(index + i, v + 2 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib2dvNV(index + i, v + 2 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib3svNV(index + i, v + 3 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib3fvNV(index + i, v + 3 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib3dvNV(index + i, v + 3 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib4svNV(index + i, v + 4 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib4fvNV(index + i, v + 4 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib4dvNV(index + i, v + 4 * i);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
+{
+ GLint i;
+ for (i = n - 1; i >= 0; i--)
+ loopback_VertexAttrib4ubvNV(index + i, v + 4 * i);
+}
+
+
+/*
+ * GL_ARB_vertex_program
+ */
+
+static void GLAPIENTRY
+loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v)
+{
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4ivARB(GLuint index, const GLint * v)
+{
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v)
+{
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v)
+{
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v)
+{
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v)
+{
+ ATTRIB4(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v)
+{
+ ATTRIB4(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4NivARB(GLuint index, const GLint * v)
+{
+ ATTRIB4(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v)
+{
+ ATTRIB4(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]));
+}
+
+static void GLAPIENTRY
+loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v)
+{
+ ATTRIB4(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]));
+}
+
+
+
+
+/*
+ * This code never registers handlers for any of the entry points
+ * listed in vtxfmt.h.
+ */
+void
+_mesa_loopback_init_api_table( struct _glapi_table *dest )
+{
+ dest->Color3b = loopback_Color3b_f;
+ dest->Color3d = loopback_Color3d_f;
+ dest->Color3i = loopback_Color3i_f;
+ dest->Color3s = loopback_Color3s_f;
+ dest->Color3ui = loopback_Color3ui_f;
+ dest->Color3us = loopback_Color3us_f;
+ dest->Color3ub = loopback_Color3ub_f;
+ dest->Color4b = loopback_Color4b_f;
+ dest->Color4d = loopback_Color4d_f;
+ dest->Color4i = loopback_Color4i_f;
+ dest->Color4s = loopback_Color4s_f;
+ dest->Color4ui = loopback_Color4ui_f;
+ dest->Color4us = loopback_Color4us_f;
+ dest->Color4ub = loopback_Color4ub_f;
+ dest->Color3bv = loopback_Color3bv_f;
+ dest->Color3dv = loopback_Color3dv_f;
+ dest->Color3iv = loopback_Color3iv_f;
+ dest->Color3sv = loopback_Color3sv_f;
+ dest->Color3uiv = loopback_Color3uiv_f;
+ dest->Color3usv = loopback_Color3usv_f;
+ dest->Color3ubv = loopback_Color3ubv_f;
+ dest->Color4bv = loopback_Color4bv_f;
+ dest->Color4dv = loopback_Color4dv_f;
+ dest->Color4iv = loopback_Color4iv_f;
+ dest->Color4sv = loopback_Color4sv_f;
+ dest->Color4uiv = loopback_Color4uiv_f;
+ dest->Color4usv = loopback_Color4usv_f;
+ dest->Color4ubv = loopback_Color4ubv_f;
+
+ dest->SecondaryColor3bEXT = loopback_SecondaryColor3bEXT_f;
+ dest->SecondaryColor3dEXT = loopback_SecondaryColor3dEXT_f;
+ dest->SecondaryColor3iEXT = loopback_SecondaryColor3iEXT_f;
+ dest->SecondaryColor3sEXT = loopback_SecondaryColor3sEXT_f;
+ dest->SecondaryColor3uiEXT = loopback_SecondaryColor3uiEXT_f;
+ dest->SecondaryColor3usEXT = loopback_SecondaryColor3usEXT_f;
+ dest->SecondaryColor3ubEXT = loopback_SecondaryColor3ubEXT_f;
+ dest->SecondaryColor3bvEXT = loopback_SecondaryColor3bvEXT_f;
+ dest->SecondaryColor3dvEXT = loopback_SecondaryColor3dvEXT_f;
+ dest->SecondaryColor3ivEXT = loopback_SecondaryColor3ivEXT_f;
+ dest->SecondaryColor3svEXT = loopback_SecondaryColor3svEXT_f;
+ dest->SecondaryColor3uivEXT = loopback_SecondaryColor3uivEXT_f;
+ dest->SecondaryColor3usvEXT = loopback_SecondaryColor3usvEXT_f;
+ dest->SecondaryColor3ubvEXT = loopback_SecondaryColor3ubvEXT_f;
+
+ dest->Indexd = loopback_Indexd;
+ dest->Indexi = loopback_Indexi;
+ dest->Indexs = loopback_Indexs;
+ dest->Indexub = loopback_Indexub;
+ dest->Indexdv = loopback_Indexdv;
+ dest->Indexiv = loopback_Indexiv;
+ dest->Indexsv = loopback_Indexsv;
+ dest->Indexubv = loopback_Indexubv;
+ dest->Normal3b = loopback_Normal3b;
+ dest->Normal3d = loopback_Normal3d;
+ dest->Normal3i = loopback_Normal3i;
+ dest->Normal3s = loopback_Normal3s;
+ dest->Normal3bv = loopback_Normal3bv;
+ dest->Normal3dv = loopback_Normal3dv;
+ dest->Normal3iv = loopback_Normal3iv;
+ dest->Normal3sv = loopback_Normal3sv;
+ dest->TexCoord1d = loopback_TexCoord1d;
+ dest->TexCoord1i = loopback_TexCoord1i;
+ dest->TexCoord1s = loopback_TexCoord1s;
+ dest->TexCoord2d = loopback_TexCoord2d;
+ dest->TexCoord2s = loopback_TexCoord2s;
+ dest->TexCoord2i = loopback_TexCoord2i;
+ dest->TexCoord3d = loopback_TexCoord3d;
+ dest->TexCoord3i = loopback_TexCoord3i;
+ dest->TexCoord3s = loopback_TexCoord3s;
+ dest->TexCoord4d = loopback_TexCoord4d;
+ dest->TexCoord4i = loopback_TexCoord4i;
+ dest->TexCoord4s = loopback_TexCoord4s;
+ dest->TexCoord1dv = loopback_TexCoord1dv;
+ dest->TexCoord1iv = loopback_TexCoord1iv;
+ dest->TexCoord1sv = loopback_TexCoord1sv;
+ dest->TexCoord2dv = loopback_TexCoord2dv;
+ dest->TexCoord2iv = loopback_TexCoord2iv;
+ dest->TexCoord2sv = loopback_TexCoord2sv;
+ dest->TexCoord3dv = loopback_TexCoord3dv;
+ dest->TexCoord3iv = loopback_TexCoord3iv;
+ dest->TexCoord3sv = loopback_TexCoord3sv;
+ dest->TexCoord4dv = loopback_TexCoord4dv;
+ dest->TexCoord4iv = loopback_TexCoord4iv;
+ dest->TexCoord4sv = loopback_TexCoord4sv;
+ dest->Vertex2d = loopback_Vertex2d;
+ dest->Vertex2i = loopback_Vertex2i;
+ dest->Vertex2s = loopback_Vertex2s;
+ dest->Vertex3d = loopback_Vertex3d;
+ dest->Vertex3i = loopback_Vertex3i;
+ dest->Vertex3s = loopback_Vertex3s;
+ dest->Vertex4d = loopback_Vertex4d;
+ dest->Vertex4i = loopback_Vertex4i;
+ dest->Vertex4s = loopback_Vertex4s;
+ dest->Vertex2dv = loopback_Vertex2dv;
+ dest->Vertex2iv = loopback_Vertex2iv;
+ dest->Vertex2sv = loopback_Vertex2sv;
+ dest->Vertex3dv = loopback_Vertex3dv;
+ dest->Vertex3iv = loopback_Vertex3iv;
+ dest->Vertex3sv = loopback_Vertex3sv;
+ dest->Vertex4dv = loopback_Vertex4dv;
+ dest->Vertex4iv = loopback_Vertex4iv;
+ dest->Vertex4sv = loopback_Vertex4sv;
+ dest->MultiTexCoord1dARB = loopback_MultiTexCoord1dARB;
+ dest->MultiTexCoord1dvARB = loopback_MultiTexCoord1dvARB;
+ dest->MultiTexCoord1iARB = loopback_MultiTexCoord1iARB;
+ dest->MultiTexCoord1ivARB = loopback_MultiTexCoord1ivARB;
+ dest->MultiTexCoord1sARB = loopback_MultiTexCoord1sARB;
+ dest->MultiTexCoord1svARB = loopback_MultiTexCoord1svARB;
+ dest->MultiTexCoord2dARB = loopback_MultiTexCoord2dARB;
+ dest->MultiTexCoord2dvARB = loopback_MultiTexCoord2dvARB;
+ dest->MultiTexCoord2iARB = loopback_MultiTexCoord2iARB;
+ dest->MultiTexCoord2ivARB = loopback_MultiTexCoord2ivARB;
+ dest->MultiTexCoord2sARB = loopback_MultiTexCoord2sARB;
+ dest->MultiTexCoord2svARB = loopback_MultiTexCoord2svARB;
+ dest->MultiTexCoord3dARB = loopback_MultiTexCoord3dARB;
+ dest->MultiTexCoord3dvARB = loopback_MultiTexCoord3dvARB;
+ dest->MultiTexCoord3iARB = loopback_MultiTexCoord3iARB;
+ dest->MultiTexCoord3ivARB = loopback_MultiTexCoord3ivARB;
+ dest->MultiTexCoord3sARB = loopback_MultiTexCoord3sARB;
+ dest->MultiTexCoord3svARB = loopback_MultiTexCoord3svARB;
+ dest->MultiTexCoord4dARB = loopback_MultiTexCoord4dARB;
+ dest->MultiTexCoord4dvARB = loopback_MultiTexCoord4dvARB;
+ dest->MultiTexCoord4iARB = loopback_MultiTexCoord4iARB;
+ dest->MultiTexCoord4ivARB = loopback_MultiTexCoord4ivARB;
+ dest->MultiTexCoord4sARB = loopback_MultiTexCoord4sARB;
+ dest->MultiTexCoord4svARB = loopback_MultiTexCoord4svARB;
+ dest->EvalCoord2dv = loopback_EvalCoord2dv;
+ dest->EvalCoord2fv = loopback_EvalCoord2fv;
+ dest->EvalCoord2d = loopback_EvalCoord2d;
+ dest->EvalCoord1dv = loopback_EvalCoord1dv;
+ dest->EvalCoord1fv = loopback_EvalCoord1fv;
+ dest->EvalCoord1d = loopback_EvalCoord1d;
+ dest->Materialf = loopback_Materialf;
+ dest->Materiali = loopback_Materiali;
+ dest->Materialiv = loopback_Materialiv;
+ dest->Rectd = loopback_Rectd;
+ dest->Rectdv = loopback_Rectdv;
+ dest->Rectfv = loopback_Rectfv;
+ dest->Recti = loopback_Recti;
+ dest->Rectiv = loopback_Rectiv;
+ dest->Rects = loopback_Rects;
+ dest->Rectsv = loopback_Rectsv;
+ dest->FogCoorddEXT = loopback_FogCoorddEXT;
+ dest->FogCoorddvEXT = loopback_FogCoorddvEXT;
+
+ dest->VertexAttrib1sNV = loopback_VertexAttrib1sNV;
+ dest->VertexAttrib1fNV = loopback_VertexAttrib1fNV;
+ dest->VertexAttrib1dNV = loopback_VertexAttrib1dNV;
+ dest->VertexAttrib2sNV = loopback_VertexAttrib2sNV;
+ dest->VertexAttrib2fNV = loopback_VertexAttrib2fNV;
+ dest->VertexAttrib2dNV = loopback_VertexAttrib2dNV;
+ dest->VertexAttrib3sNV = loopback_VertexAttrib3sNV;
+ dest->VertexAttrib3fNV = loopback_VertexAttrib3fNV;
+ dest->VertexAttrib3dNV = loopback_VertexAttrib3dNV;
+ dest->VertexAttrib4sNV = loopback_VertexAttrib4sNV;
+ dest->VertexAttrib4dNV = loopback_VertexAttrib4dNV;
+ dest->VertexAttrib4ubNV = loopback_VertexAttrib4ubNV;
+
+ dest->VertexAttrib1svNV = loopback_VertexAttrib1svNV;
+ dest->VertexAttrib1fvNV = loopback_VertexAttrib1fvNV;
+ dest->VertexAttrib1dvNV = loopback_VertexAttrib1dvNV;
+ dest->VertexAttrib2svNV = loopback_VertexAttrib2svNV;
+ dest->VertexAttrib2fvNV = loopback_VertexAttrib2fvNV;
+ dest->VertexAttrib2dvNV = loopback_VertexAttrib2dvNV;
+ dest->VertexAttrib3svNV = loopback_VertexAttrib3svNV;
+ dest->VertexAttrib3fvNV = loopback_VertexAttrib3fvNV;
+ dest->VertexAttrib3dvNV = loopback_VertexAttrib3dvNV;
+ dest->VertexAttrib4svNV = loopback_VertexAttrib4svNV;
+ dest->VertexAttrib4fvNV = loopback_VertexAttrib4fvNV;
+ dest->VertexAttrib4dvNV = loopback_VertexAttrib4dvNV;
+ dest->VertexAttrib4ubvNV = loopback_VertexAttrib4ubvNV;
+
+ dest->VertexAttribs1svNV = loopback_VertexAttribs1svNV;
+ dest->VertexAttribs1fvNV = loopback_VertexAttribs1fvNV;
+ dest->VertexAttribs1dvNV = loopback_VertexAttribs1dvNV;
+ dest->VertexAttribs2svNV = loopback_VertexAttribs2svNV;
+ dest->VertexAttribs2fvNV = loopback_VertexAttribs2fvNV;
+ dest->VertexAttribs2dvNV = loopback_VertexAttribs2dvNV;
+ dest->VertexAttribs3svNV = loopback_VertexAttribs3svNV;
+ dest->VertexAttribs3fvNV = loopback_VertexAttribs3fvNV;
+ dest->VertexAttribs3dvNV = loopback_VertexAttribs3dvNV;
+ dest->VertexAttribs4svNV = loopback_VertexAttribs4svNV;
+ dest->VertexAttribs4fvNV = loopback_VertexAttribs4fvNV;
+ dest->VertexAttribs4dvNV = loopback_VertexAttribs4dvNV;
+ dest->VertexAttribs4ubvNV = loopback_VertexAttribs4ubvNV;
+
+ dest->VertexAttrib4bvARB = loopback_VertexAttrib4bvARB;
+ dest->VertexAttrib4ivARB = loopback_VertexAttrib4ivARB;
+ dest->VertexAttrib4ubvARB = loopback_VertexAttrib4ubvARB;
+ dest->VertexAttrib4usvARB = loopback_VertexAttrib4usvARB;
+ dest->VertexAttrib4uivARB = loopback_VertexAttrib4uivARB;
+ dest->VertexAttrib4NbvARB = loopback_VertexAttrib4NbvARB;
+ dest->VertexAttrib4NsvARB = loopback_VertexAttrib4NsvARB;
+ dest->VertexAttrib4NivARB = loopback_VertexAttrib4NivARB;
+ dest->VertexAttrib4NusvARB = loopback_VertexAttrib4NusvARB;
+ dest->VertexAttrib4NuivARB = loopback_VertexAttrib4NuivARB;
+}
Index: xc/extras/Mesa/src/mesa/main/api_loopback.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_loopback.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_loopback.h Thu Apr 8 05:17:36 2004
@@ -0,0 +1,37 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef API_LOOPBACK_H
+#define API_LOOPBACK_H
+
+#include "glheader.h"
+
+
+struct _glapi_table;
+
+extern void _mesa_loopback_init_api_table( struct _glapi_table *dest );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/api_noop.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_noop.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_noop.c Fri Dec 10 10:05:23 2004
@@ -0,0 +1,866 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "api_noop.h"
+#include "api_validate.h"
+#include "api_arrayelt.h"
+#include "context.h"
+#include "colormac.h"
+#include "light.h"
+#include "macros.h"
+#include "mtypes.h"
+#include "dlist.h"
+
+
+/* In states where certain vertex components are required for t&l or
+ * rasterization, we still need to keep track of the current values.
+ * These functions provide this service by keeping uptodate the
+ * 'ctx->Current' struct for all data elements not included in the
+ * currently enabled hardware vertex.
+ * I.e. these functions would typically be used when outside of glBegin/End.
+ */
+
+
+void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ctx->Current.EdgeFlag = b;
+}
+
+void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ctx->Current.EdgeFlag = *b;
+}
+
+void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ctx->Current.Index = f;
+}
+
+void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ctx->Current.Index = *v;
+}
+
+void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
+ dest[0] = a;
+ dest[1] = 0.0;
+ dest[2] = 0.0;
+ dest[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+ dest[0] = v[0];
+ dest[1] = 0.0;
+ dest[2] = 0.0;
+ dest[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
+ dest[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
+ color[0] = a;
+ color[1] = b;
+ color[2] = c;
+ color[3] = d;
+}
+
+void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
+ color[0] = v[0];
+ color[1] = v[1];
+ color[2] = v[2];
+ color[3] = v[3];
+}
+
+void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
+ color[0] = a;
+ color[1] = b;
+ color[2] = c;
+ color[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
+ color[0] = v[0];
+ color[1] = v[1];
+ color[2] = v[2];
+ color[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = a;
+ dest[1] = 0;
+ dest[2] = 0;
+ dest[3] = 1;
+ }
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = v[0];
+ dest[1] = 0;
+ dest[2] = 0;
+ dest[3] = 1;
+ }
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = 0;
+ dest[3] = 1;
+ }
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = 0;
+ dest[3] = 1;
+ }
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
+ dest[3] = 1;
+ }
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = 1;
+ }
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
+ GLfloat c, GLfloat d )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
+ dest[3] = d;
+ }
+}
+
+void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = target - GL_TEXTURE0_ARB;
+
+ /* unit is unsigned -- cannot be less than zero.
+ */
+ if (unit < MAX_TEXTURE_COORD_UNITS)
+ {
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = v[3];
+ }
+}
+
+void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
+ color[0] = a;
+ color[1] = b;
+ color[2] = c;
+ color[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
+ color[0] = v[0];
+ color[1] = v[1];
+ color[2] = v[2];
+ color[3] = 1.0;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = a;
+ dest[1] = 0;
+ dest[2] = 0;
+ dest[3] = 1;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = v[0];
+ dest[1] = 0;
+ dest[2] = 0;
+ dest[3] = 1;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = 0;
+ dest[3] = 1;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = 0;
+ dest[3] = 1;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
+ dest[3] = 1;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = 1;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
+ dest[3] = d;
+}
+
+void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = v[3];
+}
+
+
+
+void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1f" );
+}
+
+void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fv" );
+}
+
+void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2f" );
+}
+
+void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fv" );
+}
+
+void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3f" );
+}
+
+void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fv" );
+}
+
+void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z, GLfloat w )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4f" );
+}
+
+void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < VERT_ATTRIB_MAX) {
+ ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fv" );
+}
+
+/* Material
+ */
+void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i, nr;
+ struct gl_material *mat = &ctx->Light.Material;
+ GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0,
+ "_mesa_noop_Materialfv" );
+
+ if (ctx->Light.ColorMaterialEnabled)
+ bitmask &= ~ctx->Light.ColorMaterialBitmask;
+
+ if (bitmask == 0)
+ return;
+
+ switch (face) {
+ case GL_SHININESS: nr = 1; break;
+ case GL_COLOR_INDEXES: nr = 3; break;
+ default: nr = 4 ; break;
+ }
+
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (bitmask & (1<Attrib[i], nr, params );
+
+ _mesa_update_material( ctx, bitmask );
+}
+
+/* These really are noops outside begin/end:
+ */
+void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b )
+{
+ (void) a; (void) b;
+}
+
+void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c )
+{
+ (void) a; (void) b; (void) c;
+}
+
+void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+{
+ (void) a; (void) b; (void) c; (void) d;
+}
+
+/* Similarly, these have no effect outside begin/end:
+ */
+void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a )
+{
+ (void) a;
+}
+
+void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b )
+{
+ (void) a; (void) b;
+}
+
+void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a )
+{
+ (void) a;
+}
+
+void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
+{
+ (void) a; (void) b;
+}
+
+
+/* Begin -- call into driver, should result in the vtxfmt being
+ * swapped out:
+ */
+void GLAPIENTRY _mesa_noop_Begin( GLenum mode )
+{
+ (void) mode;
+}
+
+
+/* End -- just raise an error
+ */
+void GLAPIENTRY _mesa_noop_End( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
+}
+
+
+/* Execute a glRectf() function. This is not suitable for GL_COMPILE
+ * modes (as the test for outside begin/end is not compiled),
+ * but may be useful for drivers in circumstances which exclude
+ * display list interactions.
+ *
+ * (None of the functions in this file are suitable for GL_COMPILE
+ * modes).
+ */
+void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
+{
+ {
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ }
+
+ GL_CALL(Begin)( GL_QUADS );
+ GL_CALL(Vertex2f)( x1, y1 );
+ GL_CALL(Vertex2f)( x2, y1 );
+ GL_CALL(Vertex2f)( x2, y2 );
+ GL_CALL(Vertex2f)( x1, y2 );
+ GL_CALL(End)();
+}
+
+
+/* Some very basic support for arrays. Drivers without explicit array
+ * support can hook these in, but still need to supply an array-elt
+ * implementation.
+ */
+void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
+ return;
+
+ GL_CALL(Begin)(mode);
+ for (i = 0; i < count; i++)
+ GL_CALL(ArrayElement)(start + i);
+ GL_CALL(End)();
+}
+
+
+void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
+ return;
+
+ GL_CALL(Begin)(mode);
+
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ for (i = 0 ; i < count ; i++)
+ GL_CALL(ArrayElement)( ((GLubyte *)indices)[i] );
+ break;
+ case GL_UNSIGNED_SHORT:
+ for (i = 0 ; i < count ; i++)
+ GL_CALL(ArrayElement)( ((GLushort *)indices)[i] );
+ break;
+ case GL_UNSIGNED_INT:
+ for (i = 0 ; i < count ; i++)
+ GL_CALL(ArrayElement)( ((GLuint *)indices)[i] );
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
+ break;
+ }
+
+ GL_CALL(End)();
+}
+
+void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (_mesa_validate_DrawRangeElements( ctx, mode,
+ start, end,
+ count, type, indices ))
+ GL_CALL(DrawElements)( mode, count, type, indices );
+}
+
+/*
+ * Eval Mesh
+ */
+
+/* KW: If are compiling, we don't know whether eval will produce a
+ * vertex when it is run in the future. If this is pure immediate
+ * mode, eval is a noop if neither vertex map is enabled.
+ *
+ * Thus we need to have a check in the display list code or
+ * elsewhere for eval(1,2) vertices in the case where
+ * map(1,2)_vertex is disabled, and to purge those vertices from
+ * the vb.
+ */
+void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ GLfloat u, du;
+ GLenum prim;
+
+ switch (mode) {
+ case GL_POINT:
+ prim = GL_POINTS;
+ break;
+ case GL_LINE:
+ prim = GL_LINE_STRIP;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" );
+ return;
+ }
+
+ /* No effect if vertex maps disabled.
+ */
+ if (!ctx->Eval.Map1Vertex4 &&
+ !ctx->Eval.Map1Vertex3 &&
+ !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
+ return;
+
+ du = ctx->Eval.MapGrid1du;
+ u = ctx->Eval.MapGrid1u1 + i1 * du;
+
+ GL_CALL(Begin)( prim );
+ for (i=i1;i<=i2;i++,u+=du) {
+ GL_CALL(EvalCoord1f)( u );
+ }
+ GL_CALL(End)();
+}
+
+
+
+void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat u, du, v, dv, v1, u1;
+ GLint i, j;
+
+ switch (mode) {
+ case GL_POINT:
+ case GL_LINE:
+ case GL_FILL:
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
+ return;
+ }
+
+ /* No effect if vertex maps disabled.
+ */
+ if (!ctx->Eval.Map2Vertex4 &&
+ !ctx->Eval.Map2Vertex3 &&
+ !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
+ return;
+
+ du = ctx->Eval.MapGrid2du;
+ dv = ctx->Eval.MapGrid2dv;
+ v1 = ctx->Eval.MapGrid2v1 + j1 * dv;
+ u1 = ctx->Eval.MapGrid2u1 + i1 * du;
+
+ switch (mode) {
+ case GL_POINT:
+ GL_CALL(Begin)( GL_POINTS );
+ for (v=v1,j=j1;j<=j2;j++,v+=dv) {
+ for (u=u1,i=i1;i<=i2;i++,u+=du) {
+ GL_CALL(EvalCoord2f)(u, v );
+ }
+ }
+ GL_CALL(End)();
+ break;
+ case GL_LINE:
+ for (v=v1,j=j1;j<=j2;j++,v+=dv) {
+ GL_CALL(Begin)( GL_LINE_STRIP );
+ for (u=u1,i=i1;i<=i2;i++,u+=du) {
+ GL_CALL(EvalCoord2f)(u, v );
+ }
+ GL_CALL(End)();
+ }
+ for (u=u1,i=i1;i<=i2;i++,u+=du) {
+ GL_CALL(Begin)( GL_LINE_STRIP );
+ for (v=v1,j=j1;j<=j2;j++,v+=dv) {
+ GL_CALL(EvalCoord2f)(u, v );
+ }
+ GL_CALL(End)();
+ }
+ break;
+ case GL_FILL:
+ for (v=v1,j=j1;jArrayElement = _ae_loopback_array_elt; /* generic helper */
+ vfmt->Begin = _mesa_noop_Begin;
+ vfmt->CallList = _mesa_CallList;
+ vfmt->CallLists = _mesa_CallLists;
+ vfmt->Color3f = _mesa_noop_Color3f;
+ vfmt->Color3fv = _mesa_noop_Color3fv;
+ vfmt->Color4f = _mesa_noop_Color4f;
+ vfmt->Color4fv = _mesa_noop_Color4fv;
+ vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
+ vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
+ vfmt->End = _mesa_noop_End;
+ vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
+ vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
+ vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f;
+ vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv;
+ vfmt->EvalPoint1 = _mesa_noop_EvalPoint1;
+ vfmt->EvalPoint2 = _mesa_noop_EvalPoint2;
+ vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
+ vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
+ vfmt->Indexf = _mesa_noop_Indexf;
+ vfmt->Indexfv = _mesa_noop_Indexfv;
+ vfmt->Materialfv = _mesa_noop_Materialfv;
+ vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB;
+ vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB;
+ vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB;
+ vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB;
+ vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB;
+ vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB;
+ vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB;
+ vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB;
+ vfmt->Normal3f = _mesa_noop_Normal3f;
+ vfmt->Normal3fv = _mesa_noop_Normal3fv;
+ vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT;
+ vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT;
+ vfmt->TexCoord1f = _mesa_noop_TexCoord1f;
+ vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv;
+ vfmt->TexCoord2f = _mesa_noop_TexCoord2f;
+ vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv;
+ vfmt->TexCoord3f = _mesa_noop_TexCoord3f;
+ vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv;
+ vfmt->TexCoord4f = _mesa_noop_TexCoord4f;
+ vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv;
+ vfmt->Vertex2f = _mesa_noop_Vertex2f;
+ vfmt->Vertex2fv = _mesa_noop_Vertex2fv;
+ vfmt->Vertex3f = _mesa_noop_Vertex3f;
+ vfmt->Vertex3fv = _mesa_noop_Vertex3fv;
+ vfmt->Vertex4f = _mesa_noop_Vertex4f;
+ vfmt->Vertex4fv = _mesa_noop_Vertex4fv;
+ vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV;
+ vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV;
+ vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV;
+ vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV;
+ vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV;
+ vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
+ vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
+ vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
+
+ vfmt->Rectf = _mesa_noop_Rectf;
+
+ vfmt->DrawArrays = _mesa_noop_DrawArrays;
+ vfmt->DrawElements = _mesa_noop_DrawElements;
+ vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements;
+ vfmt->EvalMesh1 = _mesa_noop_EvalMesh1;
+ vfmt->EvalMesh2 = _mesa_noop_EvalMesh2;
+}
Index: xc/extras/Mesa/src/mesa/main/api_noop.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_noop.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_noop.h Thu Apr 8 05:17:36 2004
@@ -0,0 +1,180 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _API_NOOP_H
+#define _API_NOOP_H
+
+
+#include "glheader.h"
+#include "mtypes.h"
+#include "context.h"
+
+/* In states where certain vertex components are required for t&l or
+ * rasterization, we still need to keep track of the current values.
+ * These functions provide this service by keeping uptodate the
+ * 'ctx->Current' struct for all data elements not included in the
+ * currently enabled hardware vertex.
+ *
+ */
+extern void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b );
+
+extern void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b );
+
+extern void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a );
+
+extern void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_Indexf( GLfloat i );
+
+extern void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c );
+
+extern void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *param );
+
+extern void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d );
+
+extern void _mesa_noop_Color4ubv( const GLubyte *v );
+
+extern void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
+
+extern void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v );
+
+extern void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c );
+
+extern void _mesa_noop_Color3ubv( const GLubyte *v );
+
+extern void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c );
+
+extern void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a );
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a,
+ GLfloat b );
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a,
+ GLfloat b, GLfloat c);
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a,
+ GLfloat b, GLfloat c, GLfloat d );
+
+extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v );
+
+extern void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c );
+
+extern void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v );
+
+extern void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c );
+
+extern void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
+
+extern void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b );
+
+extern void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c );
+
+extern void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
+
+extern void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x );
+
+extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y );
+extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z );
+extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z, GLfloat w );
+
+extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v );
+
+extern void GLAPIENTRY _mesa_noop_End( void );
+extern void GLAPIENTRY _mesa_noop_Begin( GLenum mode );
+extern void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b );
+extern void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a );
+extern void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v );
+extern void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b );
+extern void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v );
+extern void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a );
+
+extern void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt );
+
+extern void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2,
+ GLint j1, GLint j2 );
+
+extern void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 );
+
+
+/* Not strictly a noop -- translate Rectf down to Begin/End and
+ * vertices. Closer to the loopback operations, but doesn't meet the
+ * criteria for inclusion there (cannot be used in the Save table).
+ */
+extern void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
+
+
+extern void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count);
+extern void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices);
+extern void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices);
+
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/api_validate.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_validate.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_validate.c Fri Dec 10 10:05:18 2004
@@ -0,0 +1,238 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "api_validate.h"
+#include "context.h"
+#include "imports.h"
+#include "mtypes.h"
+#include "state.h"
+
+
+GLboolean
+_mesa_validate_DrawElements(GLcontext *ctx,
+ GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices)
+{
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (count <= 0) {
+ if (count < 0)
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
+ return GL_FALSE;
+ }
+
+ if (mode > GL_POLYGON) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" );
+ return GL_FALSE;
+ }
+
+ if (type != GL_UNSIGNED_INT &&
+ type != GL_UNSIGNED_BYTE &&
+ type != GL_UNSIGNED_SHORT)
+ {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
+ return GL_FALSE;
+ }
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ /* Always need vertex positions */
+ if (!ctx->Array.Vertex.Enabled
+ && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
+ return GL_FALSE;
+
+ /* Vertex buffer object tests */
+ if (ctx->Array.ElementArrayBufferObj->Name) {
+ GLuint indexBytes;
+
+ /* use indices in the buffer object */
+ if (!ctx->Array.ElementArrayBufferObj->Data) {
+ _mesa_warning(ctx, "DrawElements with empty vertex elements buffer!");
+ return GL_FALSE;
+ }
+
+ /* make sure count doesn't go outside buffer bounds */
+ if (type == GL_UNSIGNED_INT) {
+ indexBytes = count * sizeof(GLuint);
+ }
+ else if (type == GL_UNSIGNED_BYTE) {
+ indexBytes = count * sizeof(GLubyte);
+ }
+ else {
+ ASSERT(type == GL_UNSIGNED_SHORT);
+ indexBytes = count * sizeof(GLushort);
+ }
+
+ if ((GLubyte *) indices + indexBytes >
+ ctx->Array.ElementArrayBufferObj->Data +
+ ctx->Array.ElementArrayBufferObj->Size) {
+ _mesa_warning(ctx, "glDrawElements index out of buffer bounds");
+ return GL_FALSE;
+ }
+
+ /* Actual address is the sum of pointers. Indices may be used below. */
+ if (ctx->Const.CheckArrayBounds) {
+ indices = (const GLvoid *)
+ ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data,
+ (const GLubyte *) indices);
+ }
+ }
+
+ if (ctx->Const.CheckArrayBounds) {
+ /* find max array index */
+ GLuint max = 0;
+ GLint i;
+ if (type == GL_UNSIGNED_INT) {
+ for (i = 0; i < count; i++)
+ if (((GLuint *) indices)[i] > max)
+ max = ((GLuint *) indices)[i];
+ }
+ else if (type == GL_UNSIGNED_SHORT) {
+ for (i = 0; i < count; i++)
+ if (((GLushort *) indices)[i] > max)
+ max = ((GLushort *) indices)[i];
+ }
+ else {
+ ASSERT(type == GL_UNSIGNED_BYTE);
+ for (i = 0; i < count; i++)
+ if (((GLubyte *) indices)[i] > max)
+ max = ((GLubyte *) indices)[i];
+ }
+ if (max >= ctx->Array._MaxElement) {
+ /* the max element is out of bounds of one or more enabled arrays */
+ return GL_FALSE;
+ }
+ }
+
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices)
+{
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (count <= 0) {
+ if (count < 0)
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
+ return GL_FALSE;
+ }
+
+ if (mode > GL_POLYGON) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" );
+ return GL_FALSE;
+ }
+
+ if (end < start) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(endNewState)
+ _mesa_update_state(ctx);
+
+ /* Always need vertex positions */
+ if (!ctx->Array.Vertex.Enabled
+ && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
+ return GL_FALSE;
+
+ if (ctx->Const.CheckArrayBounds) {
+ /* Find max array index.
+ * We don't trust the user's start and end values.
+ */
+ GLuint max = 0;
+ GLint i;
+ if (type == GL_UNSIGNED_INT) {
+ for (i = 0; i < count; i++)
+ if (((GLuint *) indices)[i] > max)
+ max = ((GLuint *) indices)[i];
+ }
+ else if (type == GL_UNSIGNED_SHORT) {
+ for (i = 0; i < count; i++)
+ if (((GLushort *) indices)[i] > max)
+ max = ((GLushort *) indices)[i];
+ }
+ else {
+ ASSERT(type == GL_UNSIGNED_BYTE);
+ for (i = 0; i < count; i++)
+ if (((GLubyte *) indices)[i] > max)
+ max = ((GLubyte *) indices)[i];
+ }
+ if (max >= ctx->Array._MaxElement) {
+ /* the max element is out of bounds of one or more enabled arrays */
+ return GL_FALSE;
+ }
+ }
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Called from the tnl module to error check the function parameters and
+ * verify that we really can draw something.
+ */
+GLboolean
+_mesa_validate_DrawArrays(GLcontext *ctx,
+ GLenum mode, GLint start, GLsizei count)
+{
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
+ return GL_FALSE;
+ }
+
+ if (mode > GL_POLYGON) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
+ return GL_FALSE;
+ }
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ /* Always need vertex positions */
+ if (!ctx->Array.Vertex.Enabled && !ctx->Array.VertexAttrib[0].Enabled)
+ return GL_FALSE;
+
+ if (ctx->Const.CheckArrayBounds) {
+ if (start + count > (GLint) ctx->Array._MaxElement)
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
Index: xc/extras/Mesa/src/mesa/main/api_validate.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/api_validate.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/api_validate.h Thu Apr 8 05:17:36 2004
@@ -0,0 +1,49 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef API_VALIDATE_H
+#define API_VALIDATE_H
+
+
+#include "mtypes.h"
+
+extern GLboolean
+_mesa_validate_DrawArrays(GLcontext *ctx,
+ GLenum mode, GLint start, GLsizei count);
+
+extern GLboolean
+_mesa_validate_DrawElements(GLcontext *ctx,
+ GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices);
+
+extern GLboolean
+_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices);
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/attrib.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/attrib.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/attrib.c Fri Dec 10 10:05:13 2004
@@ -0,0 +1,1302 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "accum.h"
+#include "attrib.h"
+#include "blend.h"
+#include "buffers.h"
+#include "bufferobj.h"
+#include "colormac.h"
+#include "colortab.h"
+#include "context.h"
+#include "depth.h"
+#include "enable.h"
+#include "enums.h"
+#include "fog.h"
+#include "hint.h"
+#include "light.h"
+#include "lines.h"
+#include "matrix.h"
+#include "points.h"
+#include "polygon.h"
+#include "simple_list.h"
+#include "stencil.h"
+#include "texobj.h"
+#include "texstate.h"
+#include "mtypes.h"
+#include "math/m_xform.h"
+
+
+/*
+ * Allocate a new attribute state node. These nodes have a
+ * "kind" value and a pointer to a struct of state data.
+ */
+static struct gl_attrib_node *
+new_attrib_node( GLbitfield kind )
+{
+ struct gl_attrib_node *an = MALLOC_STRUCT(gl_attrib_node);
+ if (an) {
+ an->kind = kind;
+ }
+ return an;
+}
+
+
+void GLAPIENTRY
+_mesa_PushAttrib(GLbitfield mask)
+{
+ struct gl_attrib_node *newnode;
+ struct gl_attrib_node *head;
+
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask);
+
+ if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) {
+ _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" );
+ return;
+ }
+
+ /* Build linked list of attribute nodes which save all attribute */
+ /* groups specified by the mask. */
+ head = NULL;
+
+ if (mask & GL_ACCUM_BUFFER_BIT) {
+ struct gl_accum_attrib *attr;
+ attr = MALLOC_STRUCT( gl_accum_attrib );
+ MEMCPY( attr, &ctx->Accum, sizeof(struct gl_accum_attrib) );
+ newnode = new_attrib_node( GL_ACCUM_BUFFER_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_COLOR_BUFFER_BIT) {
+ struct gl_colorbuffer_attrib *attr;
+ attr = MALLOC_STRUCT( gl_colorbuffer_attrib );
+ MEMCPY( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) );
+ newnode = new_attrib_node( GL_COLOR_BUFFER_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_CURRENT_BIT) {
+ struct gl_current_attrib *attr;
+ FLUSH_CURRENT( ctx, 0 );
+ attr = MALLOC_STRUCT( gl_current_attrib );
+ MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) );
+ newnode = new_attrib_node( GL_CURRENT_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_DEPTH_BUFFER_BIT) {
+ struct gl_depthbuffer_attrib *attr;
+ attr = MALLOC_STRUCT( gl_depthbuffer_attrib );
+ MEMCPY( attr, &ctx->Depth, sizeof(struct gl_depthbuffer_attrib) );
+ newnode = new_attrib_node( GL_DEPTH_BUFFER_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_ENABLE_BIT) {
+ struct gl_enable_attrib *attr;
+ GLuint i;
+ attr = MALLOC_STRUCT( gl_enable_attrib );
+ /* Copy enable flags from all other attributes into the enable struct. */
+ attr->AlphaTest = ctx->Color.AlphaEnabled;
+ attr->AutoNormal = ctx->Eval.AutoNormal;
+ attr->Blend = ctx->Color.BlendEnabled;
+ attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled;
+ attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
+ attr->ColorTable = ctx->Pixel.ColorTableEnabled;
+ attr->PostColorMatrixColorTable = ctx->Pixel.PostColorMatrixColorTableEnabled;
+ attr->PostConvolutionColorTable = ctx->Pixel.PostConvolutionColorTableEnabled;
+ attr->Convolution1D = ctx->Pixel.Convolution1DEnabled;
+ attr->Convolution2D = ctx->Pixel.Convolution2DEnabled;
+ attr->Separable2D = ctx->Pixel.Separable2DEnabled;
+ attr->CullFace = ctx->Polygon.CullFlag;
+ attr->DepthTest = ctx->Depth.Test;
+ attr->Dither = ctx->Color.DitherFlag;
+ attr->Fog = ctx->Fog.Enabled;
+ for (i=0;iLight[i] = ctx->Light.Light[i].Enabled;
+ }
+ attr->Lighting = ctx->Light.Enabled;
+ attr->LineSmooth = ctx->Line.SmoothFlag;
+ attr->LineStipple = ctx->Line.StippleFlag;
+ attr->Histogram = ctx->Pixel.HistogramEnabled;
+ attr->MinMax = ctx->Pixel.MinMaxEnabled;
+ attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled;
+ attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled;
+ attr->Map1Color4 = ctx->Eval.Map1Color4;
+ attr->Map1Index = ctx->Eval.Map1Index;
+ attr->Map1Normal = ctx->Eval.Map1Normal;
+ attr->Map1TextureCoord1 = ctx->Eval.Map1TextureCoord1;
+ attr->Map1TextureCoord2 = ctx->Eval.Map1TextureCoord2;
+ attr->Map1TextureCoord3 = ctx->Eval.Map1TextureCoord3;
+ attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4;
+ attr->Map1Vertex3 = ctx->Eval.Map1Vertex3;
+ attr->Map1Vertex4 = ctx->Eval.Map1Vertex4;
+ MEMCPY(attr->Map1Attrib, ctx->Eval.Map1Attrib, sizeof(ctx->Eval.Map1Attrib));
+ attr->Map2Color4 = ctx->Eval.Map2Color4;
+ attr->Map2Index = ctx->Eval.Map2Index;
+ attr->Map2Normal = ctx->Eval.Map2Normal;
+ attr->Map2TextureCoord1 = ctx->Eval.Map2TextureCoord1;
+ attr->Map2TextureCoord2 = ctx->Eval.Map2TextureCoord2;
+ attr->Map2TextureCoord3 = ctx->Eval.Map2TextureCoord3;
+ attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4;
+ attr->Map2Vertex3 = ctx->Eval.Map2Vertex3;
+ attr->Map2Vertex4 = ctx->Eval.Map2Vertex4;
+ MEMCPY(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib));
+ attr->Normalize = ctx->Transform.Normalize;
+ attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped;
+ attr->PixelTexture = ctx->Pixel.PixelTextureEnabled;
+ attr->PointSmooth = ctx->Point.SmoothFlag;
+ attr->PointSprite = ctx->Point.PointSprite;
+ attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint;
+ attr->PolygonOffsetLine = ctx->Polygon.OffsetLine;
+ attr->PolygonOffsetFill = ctx->Polygon.OffsetFill;
+ attr->PolygonSmooth = ctx->Polygon.SmoothFlag;
+ attr->PolygonStipple = ctx->Polygon.StippleFlag;
+ attr->RescaleNormals = ctx->Transform.RescaleNormals;
+ attr->Scissor = ctx->Scissor.Enabled;
+ attr->Stencil = ctx->Stencil.Enabled;
+ attr->MultisampleEnabled = ctx->Multisample.Enabled;
+ attr->SampleAlphaToCoverage = ctx->Multisample.SampleAlphaToCoverage;
+ attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne;
+ attr->SampleCoverage = ctx->Multisample.SampleCoverage;
+ attr->SampleCoverageInvert = ctx->Multisample.SampleCoverageInvert;
+ for (i=0; iTexture[i] = ctx->Texture.Unit[i].Enabled;
+ attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
+ attr->TextureColorTable[i] = ctx->Texture.Unit[i].ColorTableEnabled;
+ }
+ /* GL_NV_vertex_program */
+ attr->VertexProgram = ctx->VertexProgram.Enabled;
+ attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled;
+ attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled;
+ newnode = new_attrib_node( GL_ENABLE_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_EVAL_BIT) {
+ struct gl_eval_attrib *attr;
+ attr = MALLOC_STRUCT( gl_eval_attrib );
+ MEMCPY( attr, &ctx->Eval, sizeof(struct gl_eval_attrib) );
+ newnode = new_attrib_node( GL_EVAL_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_FOG_BIT) {
+ struct gl_fog_attrib *attr;
+ attr = MALLOC_STRUCT( gl_fog_attrib );
+ MEMCPY( attr, &ctx->Fog, sizeof(struct gl_fog_attrib) );
+ newnode = new_attrib_node( GL_FOG_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_HINT_BIT) {
+ struct gl_hint_attrib *attr;
+ attr = MALLOC_STRUCT( gl_hint_attrib );
+ MEMCPY( attr, &ctx->Hint, sizeof(struct gl_hint_attrib) );
+ newnode = new_attrib_node( GL_HINT_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_LIGHTING_BIT) {
+ struct gl_light_attrib *attr;
+ FLUSH_CURRENT(ctx, 0); /* flush material changes */
+ attr = MALLOC_STRUCT( gl_light_attrib );
+ MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) );
+ newnode = new_attrib_node( GL_LIGHTING_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_LINE_BIT) {
+ struct gl_line_attrib *attr;
+ attr = MALLOC_STRUCT( gl_line_attrib );
+ MEMCPY( attr, &ctx->Line, sizeof(struct gl_line_attrib) );
+ newnode = new_attrib_node( GL_LINE_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_LIST_BIT) {
+ struct gl_list_attrib *attr;
+ attr = MALLOC_STRUCT( gl_list_attrib );
+ MEMCPY( attr, &ctx->List, sizeof(struct gl_list_attrib) );
+ newnode = new_attrib_node( GL_LIST_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_PIXEL_MODE_BIT) {
+ struct gl_pixel_attrib *attr;
+ attr = MALLOC_STRUCT( gl_pixel_attrib );
+ MEMCPY( attr, &ctx->Pixel, sizeof(struct gl_pixel_attrib) );
+ newnode = new_attrib_node( GL_PIXEL_MODE_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_POINT_BIT) {
+ struct gl_point_attrib *attr;
+ attr = MALLOC_STRUCT( gl_point_attrib );
+ MEMCPY( attr, &ctx->Point, sizeof(struct gl_point_attrib) );
+ newnode = new_attrib_node( GL_POINT_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_POLYGON_BIT) {
+ struct gl_polygon_attrib *attr;
+ attr = MALLOC_STRUCT( gl_polygon_attrib );
+ MEMCPY( attr, &ctx->Polygon, sizeof(struct gl_polygon_attrib) );
+ newnode = new_attrib_node( GL_POLYGON_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_POLYGON_STIPPLE_BIT) {
+ GLuint *stipple;
+ stipple = (GLuint *) MALLOC( 32*sizeof(GLuint) );
+ MEMCPY( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) );
+ newnode = new_attrib_node( GL_POLYGON_STIPPLE_BIT );
+ newnode->data = stipple;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_SCISSOR_BIT) {
+ struct gl_scissor_attrib *attr;
+ attr = MALLOC_STRUCT( gl_scissor_attrib );
+ MEMCPY( attr, &ctx->Scissor, sizeof(struct gl_scissor_attrib) );
+ newnode = new_attrib_node( GL_SCISSOR_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_STENCIL_BUFFER_BIT) {
+ struct gl_stencil_attrib *attr;
+ attr = MALLOC_STRUCT( gl_stencil_attrib );
+ MEMCPY( attr, &ctx->Stencil, sizeof(struct gl_stencil_attrib) );
+ newnode = new_attrib_node( GL_STENCIL_BUFFER_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_TEXTURE_BIT) {
+ struct gl_texture_attrib *attr;
+ GLuint u;
+ /* Bump the texture object reference counts so that they don't
+ * inadvertantly get deleted.
+ */
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ ctx->Texture.Unit[u].Current1D->RefCount++;
+ ctx->Texture.Unit[u].Current2D->RefCount++;
+ ctx->Texture.Unit[u].Current3D->RefCount++;
+ ctx->Texture.Unit[u].CurrentCubeMap->RefCount++;
+ ctx->Texture.Unit[u].CurrentRect->RefCount++;
+ }
+ attr = MALLOC_STRUCT( gl_texture_attrib );
+ MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) );
+ /* copy state of the currently bound texture objects */
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ _mesa_copy_texture_object(&attr->Unit[u].Saved1D,
+ attr->Unit[u].Current1D);
+ _mesa_copy_texture_object(&attr->Unit[u].Saved2D,
+ attr->Unit[u].Current2D);
+ _mesa_copy_texture_object(&attr->Unit[u].Saved3D,
+ attr->Unit[u].Current3D);
+ _mesa_copy_texture_object(&attr->Unit[u].SavedCubeMap,
+ attr->Unit[u].CurrentCubeMap);
+ _mesa_copy_texture_object(&attr->Unit[u].SavedRect,
+ attr->Unit[u].CurrentRect);
+ }
+ newnode = new_attrib_node( GL_TEXTURE_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_TRANSFORM_BIT) {
+ struct gl_transform_attrib *attr;
+ attr = MALLOC_STRUCT( gl_transform_attrib );
+ MEMCPY( attr, &ctx->Transform, sizeof(struct gl_transform_attrib) );
+ newnode = new_attrib_node( GL_TRANSFORM_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ if (mask & GL_VIEWPORT_BIT) {
+ struct gl_viewport_attrib *attr;
+ attr = MALLOC_STRUCT( gl_viewport_attrib );
+ MEMCPY( attr, &ctx->Viewport, sizeof(struct gl_viewport_attrib) );
+ newnode = new_attrib_node( GL_VIEWPORT_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ /* GL_ARB_multisample */
+ if (mask & GL_MULTISAMPLE_BIT_ARB) {
+ struct gl_multisample_attrib *attr;
+ attr = MALLOC_STRUCT( gl_multisample_attrib );
+ MEMCPY( attr, &ctx->Multisample, sizeof(struct gl_multisample_attrib) );
+ newnode = new_attrib_node( GL_MULTISAMPLE_BIT_ARB );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
+ ctx->AttribStack[ctx->AttribStackDepth] = head;
+ ctx->AttribStackDepth++;
+}
+
+
+
+static void
+pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
+{
+ GLuint i;
+
+#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \
+ if ((VALUE) != (NEWVALUE)) { \
+ _mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \
+ }
+
+ TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
+ TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND);
+
+ for (i=0;iTransform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask))
+ _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i),
+ (GLboolean) ((enable->ClipPlanes & mask) ? GL_TRUE : GL_FALSE));
+ }
+
+ TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
+ GL_COLOR_MATERIAL);
+ TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled, enable->ColorTable,
+ GL_COLOR_TABLE);
+ TEST_AND_UPDATE(ctx->Pixel.PostColorMatrixColorTableEnabled,
+ enable->PostColorMatrixColorTable,
+ GL_POST_COLOR_MATRIX_COLOR_TABLE);
+ TEST_AND_UPDATE(ctx->Pixel.PostConvolutionColorTableEnabled,
+ enable->PostConvolutionColorTable,
+ GL_POST_CONVOLUTION_COLOR_TABLE);
+ TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
+ TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
+ TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
+ TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D,
+ GL_CONVOLUTION_1D);
+ TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D,
+ GL_CONVOLUTION_2D);
+ TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D,
+ GL_SEPARABLE_2D);
+ TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
+ TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING);
+ TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH);
+ TEST_AND_UPDATE(ctx->Line.StippleFlag, enable->LineStipple,
+ GL_LINE_STIPPLE);
+ TEST_AND_UPDATE(ctx->Color.IndexLogicOpEnabled, enable->IndexLogicOp,
+ GL_INDEX_LOGIC_OP);
+ TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp,
+ GL_COLOR_LOGIC_OP);
+
+ TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4);
+ TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX);
+ TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL);
+ TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord1, enable->Map1TextureCoord1,
+ GL_MAP1_TEXTURE_COORD_1);
+ TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord2, enable->Map1TextureCoord2,
+ GL_MAP1_TEXTURE_COORD_2);
+ TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord3, enable->Map1TextureCoord3,
+ GL_MAP1_TEXTURE_COORD_3);
+ TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord4, enable->Map1TextureCoord4,
+ GL_MAP1_TEXTURE_COORD_4);
+ TEST_AND_UPDATE(ctx->Eval.Map1Vertex3, enable->Map1Vertex3,
+ GL_MAP1_VERTEX_3);
+ TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4,
+ GL_MAP1_VERTEX_4);
+ for (i = 0; i < 16; i++) {
+ TEST_AND_UPDATE(ctx->Eval.Map1Attrib[i], enable->Map1Attrib[i],
+ GL_MAP1_VERTEX_ATTRIB0_4_NV + i);
+ }
+
+ TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4);
+ TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX);
+ TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL);
+ TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord1, enable->Map2TextureCoord1,
+ GL_MAP2_TEXTURE_COORD_1);
+ TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord2, enable->Map2TextureCoord2,
+ GL_MAP2_TEXTURE_COORD_2);
+ TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord3, enable->Map2TextureCoord3,
+ GL_MAP2_TEXTURE_COORD_3);
+ TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord4, enable->Map2TextureCoord4,
+ GL_MAP2_TEXTURE_COORD_4);
+ TEST_AND_UPDATE(ctx->Eval.Map2Vertex3, enable->Map2Vertex3,
+ GL_MAP2_VERTEX_3);
+ TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4,
+ GL_MAP2_VERTEX_4);
+ for (i = 0; i < 16; i++) {
+ TEST_AND_UPDATE(ctx->Eval.Map2Attrib[i], enable->Map2Attrib[i],
+ GL_MAP2_VERTEX_ATTRIB0_4_NV + i);
+ }
+
+ TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL);
+ TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE);
+ TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals,
+ GL_RESCALE_NORMAL_EXT);
+ TEST_AND_UPDATE(ctx->Transform.RasterPositionUnclipped,
+ enable->RasterPositionUnclipped,
+ GL_RASTER_POSITION_UNCLIPPED_IBM);
+ TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture,
+ GL_POINT_SMOOTH);
+ TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth,
+ GL_POINT_SMOOTH);
+ if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) {
+ TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite,
+ GL_POINT_SPRITE_NV);
+ }
+ TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint,
+ GL_POLYGON_OFFSET_POINT);
+ TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine,
+ GL_POLYGON_OFFSET_LINE);
+ TEST_AND_UPDATE(ctx->Polygon.OffsetFill, enable->PolygonOffsetFill,
+ GL_POLYGON_OFFSET_FILL);
+ TEST_AND_UPDATE(ctx->Polygon.SmoothFlag, enable->PolygonSmooth,
+ GL_POLYGON_SMOOTH);
+ TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple,
+ GL_POLYGON_STIPPLE);
+ TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST);
+ TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST);
+ /* XXX two-sided stencil */
+ TEST_AND_UPDATE(ctx->Multisample.Enabled, enable->MultisampleEnabled,
+ GL_MULTISAMPLE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage,
+ enable->SampleAlphaToCoverage,
+ GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
+ enable->SampleAlphaToOne,
+ GL_SAMPLE_ALPHA_TO_ONE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
+ enable->SampleCoverage,
+ GL_SAMPLE_COVERAGE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert,
+ enable->SampleCoverageInvert,
+ GL_SAMPLE_COVERAGE_INVERT_ARB);
+ /* GL_NV_vertex_program */
+ TEST_AND_UPDATE(ctx->VertexProgram.Enabled,
+ enable->VertexProgram,
+ GL_VERTEX_PROGRAM_NV);
+ TEST_AND_UPDATE(ctx->VertexProgram.PointSizeEnabled,
+ enable->VertexProgramPointSize,
+ GL_VERTEX_PROGRAM_POINT_SIZE_NV);
+ TEST_AND_UPDATE(ctx->VertexProgram.TwoSideEnabled,
+ enable->VertexProgramTwoSide,
+ GL_VERTEX_PROGRAM_TWO_SIDE_NV);
+
+#undef TEST_AND_UPDATE
+
+ /* texture unit enables */
+ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ if (ctx->Texture.Unit[i].Enabled != enable->Texture[i]) {
+ ctx->Texture.Unit[i].Enabled = enable->Texture[i];
+ if (ctx->Driver.Enable) {
+ if (ctx->Driver.ActiveTexture) {
+ (*ctx->Driver.ActiveTexture)(ctx, i);
+ }
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D,
+ (GLboolean) (enable->Texture[i] & TEXTURE_1D_BIT) );
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D,
+ (GLboolean) (enable->Texture[i] & TEXTURE_2D_BIT) );
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D,
+ (GLboolean) (enable->Texture[i] & TEXTURE_3D_BIT) );
+ if (ctx->Extensions.ARB_texture_cube_map)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB,
+ (GLboolean) (enable->Texture[i] & TEXTURE_CUBE_BIT) );
+ if (ctx->Extensions.NV_texture_rectangle)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV,
+ (GLboolean) (enable->Texture[i] & TEXTURE_RECT_BIT) );
+ }
+ }
+
+ if (ctx->Texture.Unit[i].TexGenEnabled != enable->TexGen[i]) {
+ ctx->Texture.Unit[i].TexGenEnabled = enable->TexGen[i];
+ if (ctx->Driver.Enable) {
+ if (ctx->Driver.ActiveTexture) {
+ (*ctx->Driver.ActiveTexture)(ctx, i);
+ }
+ if (enable->TexGen[i] & S_BIT)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_TRUE);
+ else
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_FALSE);
+ if (enable->TexGen[i] & T_BIT)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_TRUE);
+ else
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_FALSE);
+ if (enable->TexGen[i] & R_BIT)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_TRUE);
+ else
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_FALSE);
+ if (enable->TexGen[i] & Q_BIT)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_TRUE);
+ else
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
+ }
+ }
+
+ /* GL_SGI_texture_color_table */
+ ctx->Texture.Unit[i].ColorTableEnabled = enable->TextureColorTable[i];
+ }
+
+ if (ctx->Driver.ActiveTexture) {
+ (*ctx->Driver.ActiveTexture)(ctx, ctx->Texture.CurrentUnit);
+ }
+}
+
+
+static void
+pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
+{
+ GLuint u;
+
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ const struct gl_texture_unit *unit = &texAttrib->Unit[u];
+ GLuint i;
+
+ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u);
+ _mesa_set_enable(ctx, GL_TEXTURE_1D,
+ (GLboolean) (unit->Enabled & TEXTURE_1D_BIT ? GL_TRUE : GL_FALSE));
+ _mesa_set_enable(ctx, GL_TEXTURE_2D,
+ (GLboolean) (unit->Enabled & TEXTURE_2D_BIT ? GL_TRUE : GL_FALSE));
+ _mesa_set_enable(ctx, GL_TEXTURE_3D,
+ (GLboolean) (unit->Enabled & TEXTURE_3D_BIT ? GL_TRUE : GL_FALSE));
+ if (ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB,
+ (GLboolean) (unit->Enabled & TEXTURE_CUBE_BIT ? GL_TRUE : GL_FALSE));
+ }
+ if (ctx->Extensions.NV_texture_rectangle) {
+ _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV,
+ (GLboolean) (unit->Enabled & TEXTURE_RECT_BIT ? GL_TRUE : GL_FALSE));
+ }
+ if (ctx->Extensions.SGI_texture_color_table) {
+ _mesa_set_enable(ctx, GL_TEXTURE_COLOR_TABLE_SGI,
+ unit->ColorTableEnabled);
+ }
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode);
+ _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor);
+ _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS);
+ _mesa_TexGeni(GL_T, GL_TEXTURE_GEN_MODE, unit->GenModeT);
+ _mesa_TexGeni(GL_R, GL_TEXTURE_GEN_MODE, unit->GenModeR);
+ _mesa_TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, unit->GenModeQ);
+ _mesa_TexGenfv(GL_S, GL_OBJECT_PLANE, unit->ObjectPlaneS);
+ _mesa_TexGenfv(GL_T, GL_OBJECT_PLANE, unit->ObjectPlaneT);
+ _mesa_TexGenfv(GL_R, GL_OBJECT_PLANE, unit->ObjectPlaneR);
+ _mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->ObjectPlaneQ);
+ _mesa_TexGenfv(GL_S, GL_EYE_PLANE, unit->EyePlaneS);
+ _mesa_TexGenfv(GL_T, GL_EYE_PLANE, unit->EyePlaneT);
+ _mesa_TexGenfv(GL_R, GL_EYE_PLANE, unit->EyePlaneR);
+ _mesa_TexGenfv(GL_Q, GL_EYE_PLANE, unit->EyePlaneQ);
+ if (ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
+ GL_TEXTURE_LOD_BIAS_EXT, unit->LodBias);
+ }
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,
+ unit->Combine.ModeRGB);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
+ unit->Combine.ModeA);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB,
+ unit->Combine.SourceRGB[0]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB,
+ unit->Combine.SourceRGB[1]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB,
+ unit->Combine.SourceRGB[2]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA,
+ unit->Combine.SourceA[0]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA,
+ unit->Combine.SourceA[1]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA,
+ unit->Combine.SourceA[2]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB,
+ unit->Combine.OperandRGB[0]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB,
+ unit->Combine.OperandRGB[1]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB,
+ unit->Combine.OperandRGB[2]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA,
+ unit->Combine.OperandA[0]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA,
+ unit->Combine.OperandA[1]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA,
+ unit->Combine.OperandA[2]);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE,
+ 1 << unit->Combine.ScaleShiftRGB);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE,
+ 1 << unit->Combine.ScaleShiftA);
+ }
+
+ /* Restore texture object state */
+ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
+ GLenum target = 0;
+ const struct gl_texture_object *obj = NULL;
+ GLfloat bordColor[4];
+
+ switch (i) {
+ case 0:
+ target = GL_TEXTURE_1D;
+ obj = &unit->Saved1D;
+ break;
+ case 1:
+ target = GL_TEXTURE_2D;
+ obj = &unit->Saved2D;
+ break;
+ case 2:
+ target = GL_TEXTURE_3D;
+ obj = &unit->Saved3D;
+ break;
+ case 3:
+ if (!ctx->Extensions.ARB_texture_cube_map)
+ continue;
+ target = GL_TEXTURE_CUBE_MAP_ARB;
+ obj = &unit->SavedCubeMap;
+ break;
+ case 4:
+ if (!ctx->Extensions.NV_texture_rectangle)
+ continue;
+ target = GL_TEXTURE_RECTANGLE_NV;
+ obj = &unit->SavedRect;
+ break;
+ default:
+ ; /* silence warnings */
+ }
+
+ _mesa_BindTexture(target, obj->Name);
+
+ bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]);
+ bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]);
+ bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]);
+ bordColor[3] = CHAN_TO_FLOAT(obj->BorderColor[3]);
+
+ _mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority);
+ _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, bordColor);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, obj->WrapR);
+ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, obj->MinFilter);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter);
+ _mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod);
+ _mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod);
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel);
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT,
+ obj->MaxAnisotropy);
+ }
+ if (ctx->Extensions.SGIX_shadow) {
+ _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_SGIX,
+ obj->CompareFlag);
+ _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_OPERATOR_SGIX,
+ obj->CompareOperator);
+ }
+ if (ctx->Extensions.SGIX_shadow_ambient) {
+ _mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX,
+ obj->ShadowAmbient);
+ }
+
+ }
+ }
+ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB
+ + texAttrib->CurrentUnit);
+
+ /* "un-bump" the texture object reference counts. We did that so they
+ * wouldn't inadvertantly get deleted while they were still referenced
+ * inside the attribute state stack.
+ */
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ ctx->Texture.Unit[u].Current1D->RefCount--;
+ ctx->Texture.Unit[u].Current2D->RefCount--;
+ ctx->Texture.Unit[u].Current3D->RefCount--;
+ ctx->Texture.Unit[u].CurrentCubeMap->RefCount--;
+ ctx->Texture.Unit[u].CurrentRect->RefCount--;
+ }
+}
+
+
+/*
+ * This function is kind of long just because we have to call a lot
+ * of device driver functions to update device driver state.
+ *
+ * XXX As it is now, most of the pop-code calls immediate-mode Mesa functions
+ * in order to restore GL state. This isn't terribly efficient but it
+ * ensures that dirty flags and any derived state gets updated correctly.
+ * We could at least check if the value to restore equals the current value
+ * and then skip the Mesa call.
+ */
+void GLAPIENTRY
+_mesa_PopAttrib(void)
+{
+ struct gl_attrib_node *attr, *next;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->AttribStackDepth == 0) {
+ _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
+ return;
+ }
+
+ ctx->AttribStackDepth--;
+ attr = ctx->AttribStack[ctx->AttribStackDepth];
+
+ while (attr) {
+
+ if (MESA_VERBOSE & VERBOSE_API) {
+ _mesa_debug(ctx, "glPopAttrib %s\n",
+ _mesa_lookup_enum_by_nr(attr->kind));
+ }
+
+ switch (attr->kind) {
+ case GL_ACCUM_BUFFER_BIT:
+ {
+ const struct gl_accum_attrib *accum;
+ accum = (const struct gl_accum_attrib *) attr->data;
+ _mesa_ClearAccum(accum->ClearColor[0],
+ accum->ClearColor[1],
+ accum->ClearColor[2],
+ accum->ClearColor[3]);
+ }
+ break;
+ case GL_COLOR_BUFFER_BIT:
+ {
+ const struct gl_colorbuffer_attrib *color;
+ color = (const struct gl_colorbuffer_attrib *) attr->data;
+ _mesa_ClearIndex((GLfloat) color->ClearIndex);
+ _mesa_ClearColor(color->ClearColor[0],
+ color->ClearColor[1],
+ color->ClearColor[2],
+ color->ClearColor[3]);
+ _mesa_IndexMask(color->IndexMask);
+ _mesa_ColorMask((GLboolean) (color->ColorMask[0] != 0),
+ (GLboolean) (color->ColorMask[1] != 0),
+ (GLboolean) (color->ColorMask[2] != 0),
+ (GLboolean) (color->ColorMask[3] != 0));
+ _mesa_DrawBuffer(color->DrawBuffer);
+ _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled);
+ _mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef);
+ _mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled);
+ _mesa_BlendFuncSeparateEXT(color->BlendSrcRGB,
+ color->BlendDstRGB,
+ color->BlendSrcA,
+ color->BlendDstA);
+ /* This special case is because glBlendEquationSeparateEXT
+ * cannot take GL_LOGIC_OP as a parameter.
+ */
+ if ( color->BlendEquationRGB == color->BlendEquationA ) {
+ _mesa_BlendEquation(color->BlendEquationRGB);
+ }
+ else {
+ _mesa_BlendEquationSeparateEXT(color->BlendEquationRGB,
+ color->BlendEquationA);
+ }
+ _mesa_BlendColor(color->BlendColor[0],
+ color->BlendColor[1],
+ color->BlendColor[2],
+ color->BlendColor[3]);
+ _mesa_LogicOp(color->LogicOp);
+ _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP,
+ color->ColorLogicOpEnabled);
+ _mesa_set_enable(ctx, GL_INDEX_LOGIC_OP,
+ color->IndexLogicOpEnabled);
+ _mesa_set_enable(ctx, GL_DITHER, color->DitherFlag);
+ }
+ break;
+ case GL_CURRENT_BIT:
+ FLUSH_CURRENT( ctx, 0 );
+ MEMCPY( &ctx->Current, attr->data,
+ sizeof(struct gl_current_attrib) );
+ break;
+ case GL_DEPTH_BUFFER_BIT:
+ {
+ const struct gl_depthbuffer_attrib *depth;
+ depth = (const struct gl_depthbuffer_attrib *) attr->data;
+ _mesa_DepthFunc(depth->Func);
+ _mesa_ClearDepth(depth->Clear);
+ _mesa_set_enable(ctx, GL_DEPTH_TEST, depth->Test);
+ _mesa_DepthMask(depth->Mask);
+ if (ctx->Extensions.HP_occlusion_test)
+ _mesa_set_enable(ctx, GL_OCCLUSION_TEST_HP,
+ depth->OcclusionTest);
+ }
+ break;
+ case GL_ENABLE_BIT:
+ {
+ const struct gl_enable_attrib *enable;
+ enable = (const struct gl_enable_attrib *) attr->data;
+ pop_enable_group(ctx, enable);
+ ctx->NewState |= _NEW_ALL;
+ }
+ break;
+ case GL_EVAL_BIT:
+ MEMCPY( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) );
+ ctx->NewState |= _NEW_EVAL;
+ break;
+ case GL_FOG_BIT:
+ {
+ const struct gl_fog_attrib *fog;
+ fog = (const struct gl_fog_attrib *) attr->data;
+ _mesa_set_enable(ctx, GL_FOG, fog->Enabled);
+ _mesa_Fogfv(GL_FOG_COLOR, fog->Color);
+ _mesa_Fogf(GL_FOG_DENSITY, fog->Density);
+ _mesa_Fogf(GL_FOG_START, fog->Start);
+ _mesa_Fogf(GL_FOG_END, fog->End);
+ _mesa_Fogf(GL_FOG_INDEX, fog->Index);
+ _mesa_Fogi(GL_FOG_MODE, fog->Mode);
+ }
+ break;
+ case GL_HINT_BIT:
+ {
+ const struct gl_hint_attrib *hint;
+ hint = (const struct gl_hint_attrib *) attr->data;
+ _mesa_Hint(GL_PERSPECTIVE_CORRECTION_HINT,
+ hint->PerspectiveCorrection );
+ _mesa_Hint(GL_POINT_SMOOTH_HINT, hint->PointSmooth);
+ _mesa_Hint(GL_LINE_SMOOTH_HINT, hint->LineSmooth);
+ _mesa_Hint(GL_POLYGON_SMOOTH_HINT, hint->PolygonSmooth);
+ _mesa_Hint(GL_FOG_HINT, hint->Fog);
+ _mesa_Hint(GL_CLIP_VOLUME_CLIPPING_HINT_EXT,
+ hint->ClipVolumeClipping);
+ if (ctx->Extensions.ARB_texture_compression)
+ _mesa_Hint(GL_TEXTURE_COMPRESSION_HINT_ARB,
+ hint->TextureCompression);
+ }
+ break;
+ case GL_LIGHTING_BIT:
+ {
+ GLuint i;
+ const struct gl_light_attrib *light;
+ light = (const struct gl_light_attrib *) attr->data;
+ /* lighting enable */
+ _mesa_set_enable(ctx, GL_LIGHTING, light->Enabled);
+ /* per-light state */
+
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE)
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+
+ for (i = 0; i < MAX_LIGHTS; i++) {
+ GLenum lgt = (GLenum) (GL_LIGHT0 + i);
+ const struct gl_light *l = &light->Light[i];
+ GLfloat tmp[4];
+ _mesa_set_enable(ctx, lgt, l->Enabled);
+ _mesa_Lightfv( lgt, GL_AMBIENT, l->Ambient );
+ _mesa_Lightfv( lgt, GL_DIFFUSE, l->Diffuse );
+ _mesa_Lightfv( lgt, GL_SPECULAR, l->Specular );
+ TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->inv, l->EyePosition );
+ _mesa_Lightfv( lgt, GL_POSITION, tmp );
+ TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, l->EyeDirection );
+ _mesa_Lightfv( lgt, GL_SPOT_DIRECTION, tmp );
+ _mesa_Lightfv( lgt, GL_SPOT_EXPONENT, &l->SpotExponent );
+ _mesa_Lightfv( lgt, GL_SPOT_CUTOFF, &l->SpotCutoff );
+ _mesa_Lightfv( lgt, GL_CONSTANT_ATTENUATION,
+ &l->ConstantAttenuation );
+ _mesa_Lightfv( lgt, GL_LINEAR_ATTENUATION,
+ &l->LinearAttenuation );
+ _mesa_Lightfv( lgt, GL_QUADRATIC_ATTENUATION,
+ &l->QuadraticAttenuation );
+ }
+ /* light model */
+ _mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT,
+ light->Model.Ambient);
+ _mesa_LightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER,
+ (GLfloat) light->Model.LocalViewer);
+ _mesa_LightModelf(GL_LIGHT_MODEL_TWO_SIDE,
+ (GLfloat) light->Model.TwoSide);
+ _mesa_LightModelf(GL_LIGHT_MODEL_COLOR_CONTROL,
+ (GLfloat) light->Model.ColorControl);
+ /* materials */
+ MEMCPY(&ctx->Light.Material, &light->Material,
+ sizeof(struct gl_material));
+ /* shade model */
+ _mesa_ShadeModel(light->ShadeModel);
+ /* color material */
+ _mesa_ColorMaterial(light->ColorMaterialFace,
+ light->ColorMaterialMode);
+ _mesa_set_enable(ctx, GL_COLOR_MATERIAL,
+ light->ColorMaterialEnabled);
+ }
+ break;
+ case GL_LINE_BIT:
+ {
+ const struct gl_line_attrib *line;
+ line = (const struct gl_line_attrib *) attr->data;
+ _mesa_set_enable(ctx, GL_LINE_SMOOTH, line->SmoothFlag);
+ _mesa_set_enable(ctx, GL_LINE_STIPPLE, line->StippleFlag);
+ _mesa_LineStipple(line->StippleFactor, line->StipplePattern);
+ _mesa_LineWidth(line->Width);
+ }
+ break;
+ case GL_LIST_BIT:
+ MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) );
+ break;
+ case GL_PIXEL_MODE_BIT:
+ MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) );
+ ctx->NewState |= _NEW_PIXEL;
+ break;
+ case GL_POINT_BIT:
+ {
+ const struct gl_point_attrib *point;
+ point = (const struct gl_point_attrib *) attr->data;
+ _mesa_PointSize(point->Size);
+ _mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag);
+ if (ctx->Extensions.EXT_point_parameters) {
+ _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT,
+ point->Params);
+ _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT,
+ point->MinSize);
+ _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT,
+ point->MaxSize);
+ _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT,
+ point->Threshold);
+ }
+ if (ctx->Extensions.NV_point_sprite
+ || ctx->Extensions.ARB_point_sprite) {
+ GLuint u;
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ _mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV,
+ (GLint) point->CoordReplace[u]);
+ }
+ _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite);
+ _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV,
+ ctx->Point.SpriteRMode);
+ _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN,
+ (GLfloat)ctx->Point.SpriteOrigin);
+ }
+ }
+ break;
+ case GL_POLYGON_BIT:
+ {
+ const struct gl_polygon_attrib *polygon;
+ polygon = (const struct gl_polygon_attrib *) attr->data;
+ _mesa_CullFace(polygon->CullFaceMode);
+ _mesa_FrontFace(polygon->FrontFace);
+ _mesa_PolygonMode(GL_FRONT, polygon->FrontMode);
+ _mesa_PolygonMode(GL_BACK, polygon->BackMode);
+ _mesa_PolygonOffset(polygon->OffsetFactor,
+ polygon->OffsetUnits);
+ _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, polygon->SmoothFlag);
+ _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, polygon->StippleFlag);
+ _mesa_set_enable(ctx, GL_CULL_FACE, polygon->CullFlag);
+ _mesa_set_enable(ctx, GL_POLYGON_OFFSET_POINT,
+ polygon->OffsetPoint);
+ _mesa_set_enable(ctx, GL_POLYGON_OFFSET_LINE,
+ polygon->OffsetLine);
+ _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL,
+ polygon->OffsetFill);
+ }
+ break;
+ case GL_POLYGON_STIPPLE_BIT:
+ MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) );
+ ctx->NewState |= _NEW_POLYGONSTIPPLE;
+ if (ctx->Driver.PolygonStipple)
+ ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data );
+ break;
+ case GL_SCISSOR_BIT:
+ {
+ const struct gl_scissor_attrib *scissor;
+ scissor = (const struct gl_scissor_attrib *) attr->data;
+ _mesa_Scissor(scissor->X, scissor->Y,
+ scissor->Width, scissor->Height);
+ _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled);
+ }
+ break;
+ case GL_STENCIL_BUFFER_BIT:
+ {
+ const GLint face = 0; /* XXX stencil two side */
+ const struct gl_stencil_attrib *stencil;
+ stencil = (const struct gl_stencil_attrib *) attr->data;
+ _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled);
+ _mesa_ClearStencil(stencil->Clear);
+ _mesa_StencilFunc(stencil->Function[face], stencil->Ref[face],
+ stencil->ValueMask[face]);
+ _mesa_StencilMask(stencil->WriteMask[face]);
+ _mesa_StencilOp(stencil->FailFunc[face],
+ stencil->ZFailFunc[face],
+ stencil->ZPassFunc[face]);
+ }
+ break;
+ case GL_TRANSFORM_BIT:
+ {
+ GLuint i;
+ const struct gl_transform_attrib *xform;
+ xform = (const struct gl_transform_attrib *) attr->data;
+ _mesa_MatrixMode(xform->MatrixMode);
+
+ if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
+ _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
+
+ /* restore clip planes */
+ for (i = 0; i < MAX_CLIP_PLANES; i++) {
+ const GLuint mask = 1 << 1;
+ const GLfloat *eyePlane = xform->EyeUserPlane[i];
+ COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane);
+ if (xform->ClipPlanesEnabled & mask) {
+ _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE);
+ }
+ else {
+ _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE);
+ }
+ if (ctx->Driver.ClipPlane)
+ ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane );
+ }
+
+ /* normalize/rescale */
+ if (xform->Normalize != ctx->Transform.Normalize)
+ _mesa_set_enable(ctx, GL_NORMALIZE,ctx->Transform.Normalize);
+ if (xform->RescaleNormals != ctx->Transform.RescaleNormals)
+ _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT,
+ ctx->Transform.RescaleNormals);
+ }
+ break;
+ case GL_TEXTURE_BIT:
+ /* Take care of texture object reference counters */
+ {
+ const struct gl_texture_attrib *texture;
+ texture = (const struct gl_texture_attrib *) attr->data;
+ pop_texture_group(ctx, texture);
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ break;
+ case GL_VIEWPORT_BIT:
+ {
+ const struct gl_viewport_attrib *vp;
+ vp = (const struct gl_viewport_attrib *) attr->data;
+ _mesa_Viewport(vp->X, vp->Y, vp->Width, vp->Height);
+ _mesa_DepthRange(vp->Near, vp->Far);
+ }
+ break;
+ case GL_MULTISAMPLE_BIT_ARB:
+ {
+ const struct gl_multisample_attrib *ms;
+ ms = (const struct gl_multisample_attrib *) attr->data;
+ _mesa_SampleCoverageARB(ms->SampleCoverageValue,
+ ms->SampleCoverageInvert);
+ }
+ break;
+
+ default:
+ _mesa_problem( ctx, "Bad attrib flag in PopAttrib");
+ break;
+ }
+
+ next = attr->next;
+ FREE( attr->data );
+ FREE( attr );
+ attr = next;
+ }
+}
+
+
+/**
+ * Helper for incrementing/decrementing vertex buffer object reference
+ * counts when pushing/popping the GL_CLIENT_VERTEX_ARRAY_BIT attribute group.
+ */
+static void
+adjust_buffer_object_ref_counts(struct gl_array_attrib *array, GLint step)
+{
+ GLuint i;
+ array->Vertex.BufferObj->RefCount += step;
+ array->Normal.BufferObj->RefCount += step;
+ array->Color.BufferObj->RefCount += step;
+ array->SecondaryColor.BufferObj->RefCount += step;
+ array->FogCoord.BufferObj->RefCount += step;
+ array->Index.BufferObj->RefCount += step;
+ array->EdgeFlag.BufferObj->RefCount += step;
+ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
+ array->TexCoord[i].BufferObj->RefCount += step;
+ for (i = 0; i < VERT_ATTRIB_MAX; i++)
+ array->VertexAttrib[i].BufferObj->RefCount += step;
+
+ array->ArrayBufferObj->RefCount += step;
+ array->ElementArrayBufferObj->RefCount += step;
+}
+
+
+#define GL_CLIENT_PACK_BIT (1<<20)
+#define GL_CLIENT_UNPACK_BIT (1<<21)
+
+
+void GLAPIENTRY
+_mesa_PushClientAttrib(GLbitfield mask)
+{
+ struct gl_attrib_node *newnode;
+ struct gl_attrib_node *head;
+
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) {
+ _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" );
+ return;
+ }
+
+ /* Build linked list of attribute nodes which save all attribute */
+ /* groups specified by the mask. */
+ head = NULL;
+
+ if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
+ struct gl_pixelstore_attrib *attr;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Pack.BufferObj->RefCount++;
+ ctx->Unpack.BufferObj->RefCount++;
+#endif
+ /* packing attribs */
+ attr = MALLOC_STRUCT( gl_pixelstore_attrib );
+ MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) );
+ newnode = new_attrib_node( GL_CLIENT_PACK_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ /* unpacking attribs */
+ attr = MALLOC_STRUCT( gl_pixelstore_attrib );
+ MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) );
+ newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+ if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
+ struct gl_array_attrib *attr;
+ attr = MALLOC_STRUCT( gl_array_attrib );
+ MEMCPY( attr, &ctx->Array, sizeof(struct gl_array_attrib) );
+ newnode = new_attrib_node( GL_CLIENT_VERTEX_ARRAY_BIT );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ /* bump reference counts on buffer objects */
+ adjust_buffer_object_ref_counts(&ctx->Array, 1);
+ }
+
+ ctx->ClientAttribStack[ctx->ClientAttribStackDepth] = head;
+ ctx->ClientAttribStackDepth++;
+}
+
+
+
+
+void GLAPIENTRY
+_mesa_PopClientAttrib(void)
+{
+ struct gl_attrib_node *attr, *next;
+
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->ClientAttribStackDepth == 0) {
+ _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" );
+ return;
+ }
+
+ ctx->ClientAttribStackDepth--;
+ attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth];
+
+ while (attr) {
+ switch (attr->kind) {
+ case GL_CLIENT_PACK_BIT:
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Pack.BufferObj->RefCount--;
+ if (ctx->Pack.BufferObj->RefCount <= 0) {
+ _mesa_remove_buffer_object( ctx, ctx->Pack.BufferObj );
+ (*ctx->Driver.DeleteBuffer)( ctx, ctx->Pack.BufferObj );
+ }
+#endif
+ MEMCPY( &ctx->Pack, attr->data,
+ sizeof(struct gl_pixelstore_attrib) );
+ ctx->NewState |= _NEW_PACKUNPACK;
+ break;
+ case GL_CLIENT_UNPACK_BIT:
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Unpack.BufferObj->RefCount--;
+ if (ctx->Unpack.BufferObj->RefCount <= 0) {
+ _mesa_remove_buffer_object( ctx, ctx->Unpack.BufferObj );
+ (*ctx->Driver.DeleteBuffer)( ctx, ctx->Unpack.BufferObj );
+ }
+#endif
+ MEMCPY( &ctx->Unpack, attr->data,
+ sizeof(struct gl_pixelstore_attrib) );
+ ctx->NewState |= _NEW_PACKUNPACK;
+ break;
+ case GL_CLIENT_VERTEX_ARRAY_BIT:
+ adjust_buffer_object_ref_counts(&ctx->Array, -1);
+ MEMCPY( &ctx->Array, attr->data,
+ sizeof(struct gl_array_attrib) );
+ /* decrement reference counts on buffer objects */
+ ctx->NewState |= _NEW_ARRAY;
+ break;
+ default:
+ _mesa_problem( ctx, "Bad attrib flag in PopClientAttrib");
+ break;
+ }
+
+ next = attr->next;
+ FREE( attr->data );
+ FREE( attr );
+ attr = next;
+ }
+}
+
+
+void _mesa_init_attrib( GLcontext *ctx )
+{
+ /* Renderer and client attribute stacks */
+ ctx->AttribStackDepth = 0;
+ ctx->ClientAttribStackDepth = 0;
+}
Index: xc/extras/Mesa/src/mesa/main/attrib.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/attrib.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/attrib.h Thu Apr 8 05:17:39 2004
@@ -0,0 +1,68 @@
+/**
+ * \file attrib.h
+ * Attribute stacks.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef ATTRIB_H
+#define ATTRIB_H
+
+
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_PushAttrib( GLbitfield mask );
+
+extern void GLAPIENTRY
+_mesa_PopAttrib( void );
+
+extern void GLAPIENTRY
+_mesa_PushClientAttrib( GLbitfield mask );
+
+extern void GLAPIENTRY
+_mesa_PopClientAttrib( void );
+
+extern void
+_mesa_init_attrib( GLcontext *ctx );
+
+#else
+
+/** No-op */
+#define _mesa_init_attrib( c ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/blend.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/blend.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/blend.c Fri Dec 10 10:05:24 2004
@@ -0,0 +1,580 @@
+/**
+ * \file blend.c
+ * Blending operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#include "glheader.h"
+#include "blend.h"
+#include "colormac.h"
+#include "context.h"
+#include "enums.h"
+#include "macros.h"
+#include "mtypes.h"
+
+
+/**
+ * Specify the blending operation.
+ *
+ * \param sfactor source factor operator.
+ * \param dfactor destination factor operator.
+ *
+ * \sa glBlendFunc, glBlendFuncSeparateEXT
+ *
+ * Swizzles the inputs and calls \c glBlendFuncSeparateEXT. This is done
+ * using the \c CurrentDispatch table in the context, so this same function
+ * can be used while compiling display lists. Therefore, there is no need
+ * for the display list code to save and restore this function.
+ */
+void GLAPIENTRY
+_mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ (*ctx->CurrentDispatch->BlendFuncSeparateEXT)( sfactor, dfactor,
+ sfactor, dfactor );
+}
+
+
+/**
+ * Process GL_EXT_blend_func_separate().
+ *
+ * \param sfactorRGB RGB source factor operator.
+ * \param dfactorRGB RGB destination factor operator.
+ * \param sfactorA alpha source factor operator.
+ * \param dfactorA alpha destination factor operator.
+ *
+ * Verifies the parameters and updates gl_colorbuffer_attrib.
+ * On a change, flush the vertices and notify the driver via
+ * dd_function_table::BlendFuncSeparate.
+ */
+void GLAPIENTRY
+_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n",
+ _mesa_lookup_enum_by_nr(sfactorRGB),
+ _mesa_lookup_enum_by_nr(dfactorRGB),
+ _mesa_lookup_enum_by_nr(sfactorA),
+ _mesa_lookup_enum_by_nr(dfactorA));
+
+ switch (sfactorRGB) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ if (!ctx->Extensions.NV_blend_square) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorRGB)");
+ return;
+ }
+ /* fall-through */
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorRGB)");
+ return;
+ }
+
+ switch (dfactorRGB) {
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ if (!ctx->Extensions.NV_blend_square) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorRGB)");
+ return;
+ }
+ /* fall-through */
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorRGB)");
+ return;
+ }
+
+ switch (sfactorA) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ if (!ctx->Extensions.NV_blend_square) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorA)");
+ return;
+ }
+ /* fall-through */
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorA)");
+ return;
+ }
+
+ switch (dfactorA) {
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ if (!ctx->Extensions.NV_blend_square) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorA)");
+ return;
+ }
+ /* fall-through */
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorA)" );
+ return;
+ }
+
+ if (ctx->Color.BlendSrcRGB == sfactorRGB &&
+ ctx->Color.BlendDstRGB == dfactorRGB &&
+ ctx->Color.BlendSrcA == sfactorA &&
+ ctx->Color.BlendDstA == dfactorA)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+
+ ctx->Color.BlendSrcRGB = sfactorRGB;
+ ctx->Color.BlendDstRGB = dfactorRGB;
+ ctx->Color.BlendSrcA = sfactorA;
+ ctx->Color.BlendDstA = dfactorA;
+
+ if (ctx->Driver.BlendFuncSeparate) {
+ (*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB,
+ sfactorA, dfactorA );
+ }
+}
+
+
+#if _HAVE_FULL_GL
+
+static GLboolean
+_mesa_validate_blend_equation( GLcontext *ctx,
+ GLenum mode, GLboolean is_separate )
+{
+ switch (mode) {
+ case GL_FUNC_ADD:
+ break;
+ case GL_MIN:
+ case GL_MAX:
+ if (!ctx->Extensions.EXT_blend_minmax &&
+ !ctx->Extensions.ARB_imaging) {
+ return GL_FALSE;
+ }
+ break;
+ /* glBlendEquationSeparate cannot take GL_LOGIC_OP as a parameter.
+ */
+ case GL_LOGIC_OP:
+ if (!ctx->Extensions.EXT_blend_logic_op || is_separate) {
+ return GL_FALSE;
+ }
+ break;
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ if (!ctx->Extensions.EXT_blend_subtract &&
+ !ctx->Extensions.ARB_imaging) {
+ return GL_FALSE;
+ }
+ break;
+ default:
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+
+/* This is really an extension function! */
+void GLAPIENTRY
+_mesa_BlendEquation( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glBlendEquation %s\n",
+ _mesa_lookup_enum_by_nr(mode));
+
+ if ( ! _mesa_validate_blend_equation( ctx, mode, GL_FALSE ) ) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
+ return;
+ }
+
+ if ( (ctx->Color.BlendEquationRGB == mode) &&
+ (ctx->Color.BlendEquationA == mode) )
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.BlendEquationRGB = mode;
+ ctx->Color.BlendEquationA = mode;
+
+ /* This is needed to support 1.1's RGB logic ops AND
+ * 1.0's blending logicops.
+ */
+ ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled ||
+ (ctx->Color.BlendEnabled &&
+ mode == GL_LOGIC_OP));
+
+ if (ctx->Driver.BlendEquationSeparate)
+ (*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode );
+}
+
+void GLAPIENTRY
+_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glBlendEquationSeparateEXT %s %s\n",
+ _mesa_lookup_enum_by_nr(modeRGB),
+ _mesa_lookup_enum_by_nr(modeA));
+
+ if ( (modeRGB != modeA) && !ctx->Extensions.EXT_blend_equation_separate ) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlendEquationSeparateEXT not supported by driver");
+ return;
+ }
+
+ if ( ! _mesa_validate_blend_equation( ctx, modeRGB, GL_TRUE ) ) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeRGB)");
+ return;
+ }
+
+ if ( ! _mesa_validate_blend_equation( ctx, modeA, GL_TRUE ) ) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeA)");
+ return;
+ }
+
+
+ if ( (ctx->Color.BlendEquationRGB == modeRGB) &&
+ (ctx->Color.BlendEquationA == modeA) )
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.BlendEquationRGB = modeRGB;
+ ctx->Color.BlendEquationA = modeA;
+
+ /* This is needed to support 1.1's RGB logic ops AND
+ * 1.0's blending logicops. This test is simplified over glBlendEquation
+ * because modeRGB cannot be GL_LOGIC_OP.
+ */
+ ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled);
+
+ if (ctx->Driver.BlendEquationSeparate)
+ (*ctx->Driver.BlendEquationSeparate)( ctx, modeRGB, modeA );
+}
+#endif
+
+
+/**
+ * Set the blending color.
+ *
+ * \param red red color component.
+ * \param green green color component.
+ * \param blue blue color component.
+ * \param alpha alpha color component.
+ *
+ * \sa glBlendColor().
+ *
+ * Clamps the parameters and updates gl_colorbuffer_attrib::BlendColor. On a
+ * change, flushes the vertices and notifies the driver via
+ * dd_function_table::BlendColor callback.
+ */
+void GLAPIENTRY
+_mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+{
+ GLfloat tmp[4];
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ tmp[0] = CLAMP( red, 0.0F, 1.0F );
+ tmp[1] = CLAMP( green, 0.0F, 1.0F );
+ tmp[2] = CLAMP( blue, 0.0F, 1.0F );
+ tmp[3] = CLAMP( alpha, 0.0F, 1.0F );
+
+ if (TEST_EQ_4V(tmp, ctx->Color.BlendColor))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ COPY_4FV( ctx->Color.BlendColor, tmp );
+
+ if (ctx->Driver.BlendColor)
+ (*ctx->Driver.BlendColor)(ctx, tmp);
+}
+
+
+/**
+ * Specify the alpha test function.
+ *
+ * \param func alpha comparison function.
+ * \param ref reference value.
+ *
+ * Verifies the parameters and updates gl_colorbuffer_attrib.
+ * On a change, flushes the vertices and notifies the driver via
+ * dd_function_table::AlphaFunc callback.
+ */
+void GLAPIENTRY
+_mesa_AlphaFunc( GLenum func, GLclampf ref )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (func) {
+ case GL_NEVER:
+ case GL_LESS:
+ case GL_EQUAL:
+ case GL_LEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ case GL_GEQUAL:
+ case GL_ALWAYS:
+ ref = CLAMP(ref, 0.0F, 1.0F);
+
+ if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == ref)
+ return; /* no change */
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.AlphaFunc = func;
+ ctx->Color.AlphaRef = ref;
+
+ if (ctx->Driver.AlphaFunc)
+ ctx->Driver.AlphaFunc(ctx, func, ref);
+ return;
+
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glAlphaFunc(func)" );
+ return;
+ }
+}
+
+
+/**
+ * Specify a logic pixel operation for color index rendering.
+ *
+ * \param opcode operation.
+ *
+ * Verifies that \p opcode is a valid enum and updates
+gl_colorbuffer_attrib::LogicOp.
+ * On a change, flushes the vertices and notifies the driver via the
+ * dd_function_table::LogicOpcode callback.
+ */
+void GLAPIENTRY
+_mesa_LogicOp( GLenum opcode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (opcode) {
+ case GL_CLEAR:
+ case GL_SET:
+ case GL_COPY:
+ case GL_COPY_INVERTED:
+ case GL_NOOP:
+ case GL_INVERT:
+ case GL_AND:
+ case GL_NAND:
+ case GL_OR:
+ case GL_NOR:
+ case GL_XOR:
+ case GL_EQUIV:
+ case GL_AND_REVERSE:
+ case GL_AND_INVERTED:
+ case GL_OR_REVERSE:
+ case GL_OR_INVERTED:
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLogicOp" );
+ return;
+ }
+
+ if (ctx->Color.LogicOp == opcode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.LogicOp = opcode;
+
+ if (ctx->Driver.LogicOpcode)
+ ctx->Driver.LogicOpcode( ctx, opcode );
+}
+
+#if _HAVE_FULL_GL
+void GLAPIENTRY
+_mesa_IndexMask( GLuint mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Color.IndexMask == mask)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.IndexMask = mask;
+
+ if (ctx->Driver.IndexMask)
+ ctx->Driver.IndexMask( ctx, mask );
+}
+#endif
+
+
+/**
+ * Enable or disable writing of frame buffer color components.
+ *
+ * \param red whether to mask writing of the red color component.
+ * \param green whether to mask writing of the green color component.
+ * \param blue whether to mask writing of the blue color component.
+ * \param alpha whether to mask writing of the alpha color component.
+ *
+ * \sa glColorMask().
+ *
+ * Sets the appropriate value of gl_colorbuffer_attrib::ColorMask. On a
+ * change, flushes the vertices and notifies the driver via the
+ * dd_function_table::ColorMask callback.
+ */
+void GLAPIENTRY
+_mesa_ColorMask( GLboolean red, GLboolean green,
+ GLboolean blue, GLboolean alpha )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLubyte tmp[4];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glColorMask %d %d %d %d\n", red, green, blue, alpha);
+
+ /* Shouldn't have any information about channel depth in core mesa
+ * -- should probably store these as the native booleans:
+ */
+ tmp[RCOMP] = red ? 0xff : 0x0;
+ tmp[GCOMP] = green ? 0xff : 0x0;
+ tmp[BCOMP] = blue ? 0xff : 0x0;
+ tmp[ACOMP] = alpha ? 0xff : 0x0;
+
+ if (TEST_EQ_4UBV(tmp, ctx->Color.ColorMask))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ COPY_4UBV(ctx->Color.ColorMask, tmp);
+
+ if (ctx->Driver.ColorMask)
+ ctx->Driver.ColorMask( ctx, red, green, blue, alpha );
+}
+
+/**********************************************************************/
+/** \name Initialization */
+/*@{*/
+
+/**
+ * Initialization of the context's Color attribute group.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes the related fields in the context color attribute group,
+ * __GLcontextRec::Color.
+ */
+void _mesa_init_color( GLcontext * ctx )
+{
+ /* Color buffer group */
+ ctx->Color.IndexMask = 0xffffffff;
+ ctx->Color.ColorMask[0] = 0xff;
+ ctx->Color.ColorMask[1] = 0xff;
+ ctx->Color.ColorMask[2] = 0xff;
+ ctx->Color.ColorMask[3] = 0xff;
+ ctx->Color.ClearIndex = 0;
+ ASSIGN_4V( ctx->Color.ClearColor, 0, 0, 0, 0 );
+ ctx->Color.DrawBuffer = GL_FRONT;
+ ctx->Color.AlphaEnabled = GL_FALSE;
+ ctx->Color.AlphaFunc = GL_ALWAYS;
+ ctx->Color.AlphaRef = 0;
+ ctx->Color.BlendEnabled = GL_FALSE;
+ ctx->Color.BlendSrcRGB = GL_ONE;
+ ctx->Color.BlendDstRGB = GL_ZERO;
+ ctx->Color.BlendSrcA = GL_ONE;
+ ctx->Color.BlendDstA = GL_ZERO;
+ ctx->Color.BlendEquationRGB = GL_FUNC_ADD;
+ ctx->Color.BlendEquationA = GL_FUNC_ADD;
+ ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 );
+ ctx->Color.IndexLogicOpEnabled = GL_FALSE;
+ ctx->Color.ColorLogicOpEnabled = GL_FALSE;
+ ctx->Color._LogicOpEnabled = GL_FALSE;
+ ctx->Color.LogicOp = GL_COPY;
+ ctx->Color.DitherFlag = GL_TRUE;
+
+ if (ctx->Visual.doubleBufferMode) {
+ ctx->Color.DrawBuffer = GL_BACK;
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT;
+ }
+ else {
+ ctx->Color.DrawBuffer = GL_FRONT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
+ }
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/blend.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/blend.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/blend.h Thu Jun 10 10:23:43 2004
@@ -0,0 +1,78 @@
+/**
+ * \file blend.h
+ * Blending functions operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef BLEND_H
+#define BLEND_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_BlendFunc( GLenum sfactor, GLenum dfactor );
+
+
+extern void GLAPIENTRY
+_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA );
+
+
+extern void GLAPIENTRY
+_mesa_BlendEquation( GLenum mode );
+
+
+extern void GLAPIENTRY
+_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA );
+
+
+extern void GLAPIENTRY
+_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+
+
+extern void GLAPIENTRY
+_mesa_AlphaFunc( GLenum func, GLclampf ref );
+
+
+extern void GLAPIENTRY
+_mesa_LogicOp( GLenum opcode );
+
+
+extern void GLAPIENTRY
+_mesa_IndexMask( GLuint mask );
+
+extern void GLAPIENTRY
+_mesa_ColorMask( GLboolean red, GLboolean green,
+ GLboolean blue, GLboolean alpha );
+
+extern void
+_mesa_init_color( GLcontext * ctx );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/bufferobj.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/bufferobj.c:1.2
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/bufferobj.c Wed Dec 15 10:40:29 2004
@@ -0,0 +1,921 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/main/bufferobj.c,v 1.2 2004/12/15 15:40:29 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file bufferobj.c
+ * \brief Functions for the GL_ARB_vertex_buffer_object extension.
+ * \author Brian Paul, Ian Romanick
+ */
+
+
+#include "glheader.h"
+#include "hash.h"
+#include "imports.h"
+#include "image.h"
+#include "context.h"
+#include "bufferobj.h"
+
+
+/**
+ * Get the buffer object bound to the specified target in a GL context.
+ *
+ * \param ctx GL context
+ * \param target Buffer object target to be retrieved. Currently this must
+ * be either \c GL_ARRAY_BUFFER or \c GL_ELEMENT_ARRAY_BUFFER.
+ * \param str Name of caller for logging errors.
+ * \return A pointer to the buffer object bound to \c target in the
+ * specified context or \c NULL if \c target is invalid or no
+ * buffer object is bound.
+ */
+static INLINE struct gl_buffer_object *
+buffer_object_get_target( GLcontext *ctx, GLenum target, const char * str )
+{
+ struct gl_buffer_object * bufObj = NULL;
+
+ switch (target) {
+ case GL_ARRAY_BUFFER_ARB:
+ bufObj = ctx->Array.ArrayBufferObj;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_ARB:
+ bufObj = ctx->Array.ElementArrayBufferObj;
+ break;
+ case GL_PIXEL_PACK_BUFFER_EXT:
+ bufObj = ctx->Pack.BufferObj;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_EXT:
+ bufObj = ctx->Unpack.BufferObj;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(target)", str);
+ return NULL;
+ }
+
+ if (bufObj->Name == 0)
+ return NULL;
+
+ return bufObj;
+}
+
+
+/**
+ * Tests the subdata range parameters and sets the GL error code for
+ * \c glBufferSubDataARB and \c glGetBufferSubDataARB.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param offset Offset of the first byte of the subdata range.
+ * \param size Size, in bytes, of the subdata range.
+ * \param str Name of caller for logging errors.
+ * \return A pointer to the buffer object bound to \c target in the
+ * specified context or \c NULL if any of the parameter or state
+ * conditions for \c glBufferSubDataARB or \c glGetBufferSubDataARB
+ * are invalid.
+ *
+ * \sa glBufferSubDataARB, glGetBufferSubDataARB
+ */
+static struct gl_buffer_object *
+buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
+ GLintptrARB offset, GLsizeiptrARB size,
+ const char * str )
+{
+ struct gl_buffer_object *bufObj;
+
+ if (size < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", str);
+ return NULL;
+ }
+
+ if (offset < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", str);
+ return NULL;
+ }
+
+ bufObj = buffer_object_get_target( ctx, target, str );
+ if (!bufObj || bufObj->Name == 0) {
+ return NULL;
+ }
+
+ if ((GLuint) (offset + size) > bufObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(size + offset > buffer size)", str);
+ return NULL;
+ }
+
+ if (bufObj->Pointer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", str);
+ return NULL;
+ }
+
+ return bufObj;
+}
+
+
+/**
+ * Allocate and initialize a new buffer object.
+ *
+ * This function is intended to be called via
+ * \c dd_function_table::NewBufferObject.
+ */
+struct gl_buffer_object *
+_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
+{
+ struct gl_buffer_object *obj;
+
+ (void) ctx;
+
+ obj = MALLOC_STRUCT(gl_buffer_object);
+ _mesa_initialize_buffer_object(obj, name, target);
+ return obj;
+}
+
+
+/**
+ * Delete a buffer object.
+ *
+ * This function is intended to be called via
+ * \c dd_function_table::DeleteBuffer.
+ */
+void
+_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
+{
+ (void) ctx;
+
+ if (bufObj->Data)
+ _mesa_free(bufObj->Data);
+ _mesa_free(bufObj);
+}
+
+
+/**
+ * Initialize a buffer object to default values.
+ */
+void
+_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
+ GLuint name, GLenum target )
+{
+ (void) target;
+
+ _mesa_bzero(obj, sizeof(struct gl_buffer_object));
+ obj->RefCount = 1;
+ obj->Name = name;
+ obj->Usage = GL_STATIC_DRAW_ARB;
+ obj->Access = GL_READ_WRITE_ARB;
+}
+
+
+/**
+ * Add the given buffer object to the buffer object pool.
+ */
+void
+_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj )
+{
+ if (obj->Name > 0) {
+ /* insert into hash table */
+ _mesa_HashInsert(ctx->Shared->BufferObjects, obj->Name, obj);
+ }
+}
+
+
+/**
+ * Remove the given buffer object from the buffer object pool.
+ * Do not deallocate the buffer object though.
+ */
+void
+_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
+{
+ if (bufObj->Name > 0) {
+ /* remove from hash table */
+ _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name);
+ }
+}
+
+
+/**
+ * Allocate space for and store data in a buffer object. Any data that was
+ * previously stored in the buffer object is lost. If \c data is \c NULL,
+ * memory will be allocated, but no copy will occur.
+ *
+ * This function is intended to be called via
+ * \c dd_function_table::BufferData. This function need not set GL error
+ * codes. The input parameters will have been tested before calling.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param size Size, in bytes, of the new data store.
+ * \param data Pointer to the data to store in the buffer object. This
+ * pointer may be \c NULL.
+ * \param usage Hints about how the data will be used.
+ * \param bufObj Object to be used.
+ *
+ * \sa glBufferDataARB, dd_function_table::BufferData.
+ */
+void
+_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
+ const GLvoid * data, GLenum usage,
+ struct gl_buffer_object * bufObj )
+{
+ void * new_data;
+
+ (void) ctx; (void) target;
+
+ new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
+ if (new_data) {
+ bufObj->Data = (GLubyte *) new_data;
+ bufObj->Size = size;
+ bufObj->Usage = usage;
+
+ if (data) {
+ _mesa_memcpy( bufObj->Data, data, size );
+ }
+ }
+}
+
+
+/**
+ * Replace data in a subrange of buffer object. If the data range
+ * specified by \c size + \c offset extends beyond the end of the buffer or
+ * if \c data is \c NULL, no copy is performed.
+ *
+ * This function is intended to be called by
+ * \c dd_function_table::BufferSubData. This function need not set GL error
+ * codes. The input parameters will have been tested before calling.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param offset Offset of the first byte to be modified.
+ * \param size Size, in bytes, of the data range.
+ * \param data Pointer to the data to store in the buffer object.
+ * \param bufObj Object to be used.
+ *
+ * \sa glBufferSubDataARB, dd_function_table::BufferSubData.
+ */
+void
+_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, const GLvoid * data,
+ struct gl_buffer_object * bufObj )
+{
+ (void) ctx; (void) target;
+
+ if (bufObj->Data && ((GLuint) (size + offset) <= bufObj->Size)) {
+ _mesa_memcpy( (GLubyte *) bufObj->Data + offset, data, size );
+ }
+}
+
+
+/**
+ * Retrieve data from a subrange of buffer object. If the data range
+ * specified by \c size + \c offset extends beyond the end of the buffer or
+ * if \c data is \c NULL, no copy is performed.
+ *
+ * This function is intended to be called by
+ * \c dd_function_table::BufferGetSubData. This function need not set GL error
+ * codes. The input parameters will have been tested before calling.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param offset Offset of the first byte to be modified.
+ * \param size Size, in bytes, of the data range.
+ * \param data Pointer to the data to store in the buffer object.
+ * \param bufObj Object to be used.
+ *
+ * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
+ */
+void
+_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, GLvoid * data,
+ struct gl_buffer_object * bufObj )
+{
+ (void) ctx; (void) target;
+
+ if (bufObj->Data && ((GLuint) (size + offset) <= bufObj->Size)) {
+ _mesa_memcpy( data, (GLubyte *) bufObj->Data + offset, size );
+ }
+}
+
+
+/**
+ * Maps the private data buffer into the processor's address space.
+ *
+ * This function is intended to be called by \c dd_function_table::MapBuffer.
+ * This function need not set GL error codes. The input parameters will have
+ * been tested before calling.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param access Information about how the buffer will be accessed.
+ * \param bufObj Object to be used.
+ * \return A pointer to the object's internal data store that can be accessed
+ * by the processor
+ *
+ * \sa glMapBufferARB, dd_function_table::MapBuffer
+ */
+void *
+_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
+ struct gl_buffer_object * bufObj )
+{
+ (void) ctx; (void) target; (void) access;
+ return bufObj->Data;
+}
+
+
+/**
+ * Initialize the state associated with buffer objects
+ */
+void
+_mesa_init_buffer_objects( GLcontext *ctx )
+{
+ GLuint i;
+
+ /* Allocate the default buffer object and set refcount so high that
+ * it never gets deleted.
+ */
+ ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0);
+ if (ctx->Array.NullBufferObj)
+ ctx->Array.NullBufferObj->RefCount = 1000;
+
+ ctx->Array.ArrayBufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj;
+
+ /* Vertex array buffers */
+ ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj;
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+ ctx->Array.TexCoord[i].BufferObj = ctx->Array.NullBufferObj;
+ }
+ ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj;
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ ctx->Array.VertexAttrib[i].BufferObj = ctx->Array.NullBufferObj;
+ }
+}
+
+
+/**
+ * When we're about to read pixel data out of a PBO (via glDrawPixels,
+ * glTexImage, etc) or write data into a PBO (via glReadPixels,
+ * glGetTexImage, etc) we call this function to check that we're not
+ * going to read out of bounds.
+ *
+ * \param width width of image to read/write
+ * \param height height of image to read/write
+ * \param depth depth of image to read/write
+ * \param format format of image to read/write
+ * \param type datatype of image to read/write
+ * \param ptr the user-provided pointer/offset
+ * \return GL_TRUE if the PBO access is OK, GL_FALSE if the access would
+ * go out of bounds.
+ */
+GLboolean
+_mesa_validate_pbo_access(const struct gl_pixelstore_attrib *pack,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *ptr)
+{
+ GLvoid *start, *end;
+
+ ASSERT(pack->BufferObj->Name != 0);
+
+ if (pack->BufferObj->Size == 0)
+ /* no buffer! */
+ return GL_FALSE;
+
+ /* get address of first pixel we'll read */
+ start = _mesa_image_address(pack, ptr, width, height,
+ format, type, 0, 0, 0);
+
+ /* get address just past the last pixel we'll read */
+ end = _mesa_image_address(pack, ptr, width, height,
+ format, type, depth-1, height-1, width);
+
+
+ if ((const GLubyte *) start >
+ (const GLubyte *)(long) pack->BufferObj->Size) {
+ /* This will catch negative values / wrap-around */
+ return GL_FALSE;
+ }
+ if ((const GLubyte *) end >
+ (const GLubyte *)(long) pack->BufferObj->Size) {
+ /* Image read goes beyond end of buffer */
+ return GL_FALSE;
+ }
+
+ /* OK! */
+ return GL_TRUE;
+}
+
+
+
+
+/**********************************************************************/
+/* API Functions */
+/**********************************************************************/
+
+void GLAPIENTRY
+_mesa_BindBufferARB(GLenum target, GLuint buffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *oldBufObj;
+ struct gl_buffer_object *newBufObj = 0;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ oldBufObj = buffer_object_get_target( ctx, target, "BindBufferARB" );
+ if (oldBufObj && oldBufObj->Name == buffer)
+ return; /* rebinding the same buffer object- no change */
+
+ /*
+ * Get pointer to new buffer object (newBufObj)
+ */
+ if (buffer == 0) {
+ /* The spec says there's not a buffer object named 0, but we use
+ * one internally because it simplifies things.
+ */
+ newBufObj = ctx->Array.NullBufferObj;
+ }
+ else {
+ /* non-default buffer object */
+ const struct _mesa_HashTable *hash = ctx->Shared->BufferObjects;
+ newBufObj = (struct gl_buffer_object *) _mesa_HashLookup(hash, buffer);
+ if (!newBufObj) {
+ /* if this is a new buffer object id, allocate a buffer object now */
+ newBufObj = (*ctx->Driver.NewBufferObject)(ctx, buffer, target);
+ if (!newBufObj) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
+ return;
+ }
+ _mesa_save_buffer_object(ctx, newBufObj);
+ }
+ newBufObj->RefCount++;
+ }
+
+ switch (target) {
+ case GL_ARRAY_BUFFER_ARB:
+ ctx->Array.ArrayBufferObj = newBufObj;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_ARB:
+ ctx->Array.ElementArrayBufferObj = newBufObj;
+ break;
+ case GL_PIXEL_PACK_BUFFER_EXT:
+ ctx->Pack.BufferObj = newBufObj;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_EXT:
+ ctx->Unpack.BufferObj = newBufObj;
+ break;
+ default:
+ _mesa_problem(ctx, "Bad target in _mesa_BindBufferARB");
+ return;
+ }
+
+ /* Pass BindBuffer call to device driver */
+ if (ctx->Driver.BindBuffer && newBufObj)
+ (*ctx->Driver.BindBuffer)( ctx, target, newBufObj );
+
+ if (oldBufObj) {
+ oldBufObj->RefCount--;
+ assert(oldBufObj->RefCount >= 0);
+ if (oldBufObj->RefCount == 0) {
+ assert(oldBufObj->Name != 0);
+ _mesa_remove_buffer_object(ctx, oldBufObj);
+ ASSERT(ctx->Driver.DeleteBuffer);
+ (*ctx->Driver.DeleteBuffer)( ctx, oldBufObj );
+ }
+ }
+}
+
+
+/**
+ * Delete a set of buffer objects.
+ *
+ * \param n Number of buffer objects to delete.
+ * \param ids Array of \c n buffer object IDs.
+ */
+void GLAPIENTRY
+_mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLsizei i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)");
+ return;
+ }
+
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+
+ for (i = 0; i < n; i++) {
+ if (ids[i] != 0) {
+ struct gl_buffer_object *bufObj = (struct gl_buffer_object *)
+ _mesa_HashLookup(ctx->Shared->BufferObjects, ids[i]);
+ if (bufObj) {
+ /* unbind any vertex pointers bound to this buffer */
+ GLuint j;
+
+ ASSERT(bufObj->Name == ids[i]);
+
+ if (ctx->Array.Vertex.BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ if (ctx->Array.Normal.BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ if (ctx->Array.Color.BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ if (ctx->Array.SecondaryColor.BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ if (ctx->Array.FogCoord.BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ if (ctx->Array.Index.BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ if (ctx->Array.EdgeFlag.BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ for (j = 0; j < MAX_TEXTURE_UNITS; j++) {
+ if (ctx->Array.TexCoord[j].BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.TexCoord[j].BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ }
+ for (j = 0; j < VERT_ATTRIB_MAX; j++) {
+ if (ctx->Array.VertexAttrib[j].BufferObj == bufObj) {
+ bufObj->RefCount--;
+ ctx->Array.VertexAttrib[j].BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.NullBufferObj->RefCount++;
+ }
+ }
+
+ if (ctx->Array.ArrayBufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
+ }
+ if (ctx->Array.ElementArrayBufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
+ }
+
+ if (ctx->Pack.BufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 );
+ }
+ if (ctx->Unpack.BufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_PIXEL_UNPACK_BUFFER_EXT, 0 );
+ }
+
+ /* decrement refcount and delete if <= 0 */
+ if (!bufObj->DeletePending) {
+ bufObj->DeletePending = GL_TRUE;
+ bufObj->RefCount--;
+ }
+
+ if (bufObj->RefCount <= 0) {
+ /* buffer should not be bound anymore! */
+ ASSERT(ctx->Array.ArrayBufferObj != bufObj);
+ ASSERT(ctx->Array.ElementArrayBufferObj != bufObj);
+ ASSERT(ctx->Array.Vertex.BufferObj != bufObj);
+ _mesa_remove_buffer_object(ctx, bufObj);
+ ASSERT(ctx->Driver.DeleteBuffer);
+ (*ctx->Driver.DeleteBuffer)(ctx, bufObj);
+ }
+ }
+ }
+ }
+
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+}
+
+
+/**
+ * Generate a set of unique buffer object IDs and store them in \c buffer.
+ *
+ * \param n Number of IDs to generate.
+ * \param buffer Array of \c n locations to store the IDs.
+ */
+void GLAPIENTRY
+_mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint first;
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGenBuffersARB");
+ return;
+ }
+
+ if (!buffer) {
+ return;
+ }
+
+ /*
+ * This must be atomic (generation and allocation of buffer object IDs)
+ */
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+
+ first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
+
+ /* Allocate new, empty buffer objects and return identifiers */
+ for (i = 0; i < n; i++) {
+ struct gl_buffer_object *bufObj;
+ GLuint name = first + i;
+ GLenum target = 0;
+ bufObj = (*ctx->Driver.NewBufferObject)( ctx, name, target );
+ if (!bufObj) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB");
+ return;
+ }
+ _mesa_save_buffer_object(ctx, bufObj);
+ buffer[i] = first + i;
+ }
+
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+}
+
+
+/**
+ * Determine if ID is the name of a buffer object.
+ *
+ * \param id ID of the potential buffer object.
+ * \return \c GL_TRUE if \c id is the name of a buffer object,
+ * \c GL_FALSE otherwise.
+ */
+GLboolean GLAPIENTRY
+_mesa_IsBufferARB(GLuint id)
+{
+ struct gl_buffer_object * bufObj;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (id == 0)
+ return GL_FALSE;
+
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+ bufObj = (struct gl_buffer_object *) _mesa_HashLookup(ctx->Shared->BufferObjects, id);
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+
+ return bufObj && !bufObj->DeletePending;
+}
+
+
+void GLAPIENTRY
+_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
+ const GLvoid * data, GLenum usage)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (size < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size < 0)");
+ return;
+ }
+
+ switch (usage) {
+ case GL_STREAM_DRAW_ARB:
+ case GL_STREAM_READ_ARB:
+ case GL_STREAM_COPY_ARB:
+ case GL_STATIC_DRAW_ARB:
+ case GL_STATIC_READ_ARB:
+ case GL_STATIC_COPY_ARB:
+ case GL_DYNAMIC_DRAW_ARB:
+ case GL_DYNAMIC_READ_ARB:
+ case GL_DYNAMIC_COPY_ARB:
+ /* OK */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
+ return;
+ }
+
+ bufObj = buffer_object_get_target( ctx, target, "BufferDataARB" );
+ if (!bufObj || bufObj->Name ==0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB" );
+ return;
+ }
+
+ if (bufObj->Pointer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" );
+ return;
+ }
+
+ ASSERT(ctx->Driver.BufferData);
+
+ /* Give the buffer object to the driver! may be null! */
+ (*ctx->Driver.BufferData)( ctx, target, size, data, usage, bufObj );
+}
+
+
+void GLAPIENTRY
+_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, const GLvoid * data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
+ "BufferSubDataARB" );
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB" );
+ return;
+ }
+
+ if (bufObj->Pointer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB(buffer is mapped)" );
+ return;
+ }
+
+ ASSERT(ctx->Driver.BufferSubData);
+ (*ctx->Driver.BufferSubData)( ctx, target, offset, size, data, bufObj );
+}
+
+
+void GLAPIENTRY
+_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, void * data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
+ "GetBufferSubDataARB" );
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferSubDataARB" );
+ return;
+ }
+
+ if (bufObj->Pointer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferSubDataARB(buffer is mapped)" );
+ return;
+ }
+
+ ASSERT(ctx->Driver.GetBufferSubData);
+ (*ctx->Driver.GetBufferSubData)( ctx, target, offset, size, data, bufObj );
+}
+
+
+void * GLAPIENTRY
+_mesa_MapBufferARB(GLenum target, GLenum access)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object * bufObj;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
+
+ switch (access) {
+ case GL_READ_ONLY_ARB:
+ case GL_WRITE_ONLY_ARB:
+ case GL_READ_WRITE_ARB:
+ /* OK */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
+ return NULL;
+ }
+
+ bufObj = buffer_object_get_target( ctx, target, "MapBufferARB" );
+ if (!bufObj || bufObj->Name == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB" );
+ return NULL;
+ }
+
+ if (bufObj->Pointer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(already mapped)");
+ return NULL;
+ }
+
+ ASSERT(ctx->Driver.MapBuffer);
+ bufObj->Pointer = (*ctx->Driver.MapBuffer)( ctx, target, access, bufObj );
+ if (!bufObj->Pointer) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)");
+ }
+
+ bufObj->Access = access;
+
+ return bufObj->Pointer;
+}
+
+
+GLboolean GLAPIENTRY
+_mesa_UnmapBufferARB(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ GLboolean status = GL_TRUE;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" );
+ if (!bufObj || bufObj->Name == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" );
+ return GL_FALSE;
+ }
+
+ if (!bufObj->Pointer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB");
+ return GL_FALSE;
+ }
+
+ if (ctx->Driver.UnmapBuffer) {
+ status = (*ctx->Driver.UnmapBuffer)( ctx, target, bufObj );
+ }
+
+ bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */
+ bufObj->Pointer = NULL;
+
+ return status;
+}
+
+
+void GLAPIENTRY
+_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ bufObj = buffer_object_get_target( ctx, target, "GetBufferParameterivARB" );
+ if (!bufObj || bufObj->Name == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameterivARB" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_BUFFER_SIZE_ARB:
+ *params = bufObj->Size;
+ break;
+ case GL_BUFFER_USAGE_ARB:
+ *params = bufObj->Usage;
+ break;
+ case GL_BUFFER_ACCESS_ARB:
+ *params = bufObj->Access;
+ break;
+ case GL_BUFFER_MAPPED_ARB:
+ *params = (bufObj->Pointer != NULL);
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object * bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname != GL_BUFFER_MAP_POINTER_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
+ return;
+ }
+
+ bufObj = buffer_object_get_target( ctx, target, "GetBufferPointervARB" );
+ if (!bufObj || bufObj->Name == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferPointervARB" );
+ return;
+ }
+
+ *params = bufObj->Pointer;
+}
Index: xc/extras/Mesa/src/mesa/main/bufferobj.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/bufferobj.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/bufferobj.h Fri Dec 10 10:05:22 2004
@@ -0,0 +1,120 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef BUFFEROBJ_H
+#define BUFFEROBJ_H
+
+
+#include "context.h"
+
+
+/*
+ * Internal functions
+ */
+
+extern void
+_mesa_init_buffer_objects( GLcontext *ctx );
+
+extern struct gl_buffer_object *
+_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target );
+
+extern void
+_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj );
+
+extern void
+_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
+ GLuint name, GLenum target );
+
+extern void
+_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj );
+
+extern void
+_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj );
+
+extern void
+_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
+ const GLvoid * data, GLenum usage,
+ struct gl_buffer_object * bufObj );
+
+extern void
+_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, const GLvoid * data,
+ struct gl_buffer_object * bufObj );
+
+extern void
+_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, GLvoid * data,
+ struct gl_buffer_object * bufObj );
+
+extern void *
+_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
+ struct gl_buffer_object * bufObj );
+
+
+extern GLboolean
+_mesa_validate_pbo_access(const struct gl_pixelstore_attrib *pack,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *ptr);
+
+
+/*
+ * API functions
+ */
+
+extern void GLAPIENTRY
+_mesa_BindBufferARB(GLenum target, GLuint buffer);
+
+extern void GLAPIENTRY
+_mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer);
+
+extern void GLAPIENTRY
+_mesa_GenBuffersARB(GLsizei n, GLuint * buffer);
+
+extern GLboolean GLAPIENTRY
+_mesa_IsBufferARB(GLuint buffer);
+
+extern void GLAPIENTRY
+_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
+
+extern void GLAPIENTRY
+_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
+
+extern void GLAPIENTRY
+_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data);
+
+extern void * GLAPIENTRY
+_mesa_MapBufferARB(GLenum target, GLenum access);
+
+extern GLboolean GLAPIENTRY
+_mesa_UnmapBufferARB(GLenum target);
+
+extern void GLAPIENTRY
+_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params);
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/buffers.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/buffers.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/buffers.c Fri Dec 10 10:05:16 2004
@@ -0,0 +1,620 @@
+/**
+ * \file buffers.c
+ * Frame buffer management.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "buffers.h"
+#include "colormac.h"
+#include "context.h"
+#include "depth.h"
+#include "enums.h"
+#include "stencil.h"
+#include "state.h"
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+void GLAPIENTRY
+_mesa_ClearIndex( GLfloat c )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Color.ClearIndex == (GLuint) c)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.ClearIndex = (GLuint) c;
+
+ if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) {
+ /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
+ (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
+ }
+}
+#endif
+
+
+/**
+ * Specify the clear values for the color buffers.
+ *
+ * \param red red color component.
+ * \param green green color component.
+ * \param blue blue color component.
+ * \param alpha alpha component.
+ *
+ * \sa glClearColor().
+ *
+ * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a
+ * change, flushes the vertices and notifies the driver via the
+ * dd_function_table::ClearColor callback.
+ */
+void GLAPIENTRY
+_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+{
+ GLfloat tmp[4];
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ tmp[0] = CLAMP(red, 0.0F, 1.0F);
+ tmp[1] = CLAMP(green, 0.0F, 1.0F);
+ tmp[2] = CLAMP(blue, 0.0F, 1.0F);
+ tmp[3] = CLAMP(alpha, 0.0F, 1.0F);
+
+ if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
+ return; /* no change */
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ COPY_4V(ctx->Color.ClearColor, tmp);
+
+ if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) {
+ /* it's OK to call glClearColor in CI mode but it should be a NOP */
+ (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
+ }
+}
+
+
+/**
+ * Clear buffers.
+ *
+ * \param mask bit-mask indicating the buffers to be cleared.
+ *
+ * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState
+ * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin,
+ * etc. If the rasterization mode is set to GL_RENDER then requests the driver
+ * to clear the buffers, via the dd_function_table::Clear callback.
+ */
+void GLAPIENTRY
+_mesa_Clear( GLbitfield mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glClear 0x%x\n", mask);
+
+ if (mask & ~(GL_COLOR_BUFFER_BIT |
+ GL_DEPTH_BUFFER_BIT |
+ GL_STENCIL_BUFFER_BIT |
+ GL_ACCUM_BUFFER_BIT)) {
+ /* invalid bit set */
+ _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask);
+ return;
+ }
+
+ if (ctx->NewState) {
+ _mesa_update_state( ctx ); /* update _Xmin, etc */
+ }
+
+ if (ctx->RenderMode==GL_RENDER) {
+ const GLint x = ctx->DrawBuffer->_Xmin;
+ const GLint y = ctx->DrawBuffer->_Ymin;
+ const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+ const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+ GLbitfield ddMask;
+
+ /* don't clear depth buffer if depth writing disabled */
+ if (!ctx->Depth.Mask)
+ mask &= ~GL_DEPTH_BUFFER_BIT;
+
+ /* Build the bitmask to send to device driver's Clear function.
+ * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4
+ * of the FRONT/BACK_LEFT/RIGHT_BIT flags.
+ */
+ ddMask = 0;
+ if (mask & GL_COLOR_BUFFER_BIT)
+ ddMask |= ctx->Color._DrawDestMask;
+ if ((mask & GL_DEPTH_BUFFER_BIT) && ctx->Visual.depthBits > 0)
+ ddMask |= GL_DEPTH_BUFFER_BIT;
+ if ((mask & GL_STENCIL_BUFFER_BIT) && ctx->Visual.stencilBits > 0)
+ ddMask |= GL_STENCIL_BUFFER_BIT;
+ if ((mask & GL_ACCUM_BUFFER_BIT) && ctx->Visual.accumRedBits > 0)
+ ddMask |= GL_ACCUM_BUFFER_BIT;
+
+ ASSERT(ctx->Driver.Clear);
+ ctx->Driver.Clear( ctx, ddMask, (GLboolean) !ctx->Scissor.Enabled,
+ x, y, width, height );
+ }
+}
+
+
+/**
+ * Specify which color buffers to draw into.
+ *
+ * \param mode color buffer combination.
+ *
+ * \sa glDrawBuffer().
+ *
+ * Flushes the vertices and verifies the parameter and updates the
+ * gl_colorbuffer_attrib::_DrawDestMask bitfield. Marks new color state in
+ * __GLcontextRec::NewState and notifies the driver via the
+ * dd_function_table::DrawBuffer callback.
+ */
+void GLAPIENTRY
+_mesa_DrawBuffer( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
+
+ /*
+ * Do error checking and compute the _DrawDestMask bitfield.
+ */
+ switch (mode) {
+ case GL_FRONT:
+ /* never an error */
+ if (ctx->Visual.stereoMode)
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_FRONT_RIGHT_BIT;
+ else
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
+ break;
+ case GL_BACK:
+ if (!ctx->Visual.doubleBufferMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_BACK)");
+ return;
+ }
+ if (ctx->Visual.stereoMode)
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT | DD_BACK_RIGHT_BIT;
+ else
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT;
+ break;
+ case GL_NONE:
+ /* never an error */
+ ctx->Color._DrawDestMask = 0;
+ break;
+#if _HAVE_FULL_GL
+ case GL_RIGHT:
+ if (!ctx->Visual.stereoMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_RIGHT)");
+ return;}
+ if (ctx->Visual.doubleBufferMode)
+ ctx->Color._DrawDestMask = DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT;
+ else
+ ctx->Color._DrawDestMask = DD_FRONT_RIGHT_BIT;
+ break;
+ case GL_FRONT_RIGHT:
+ if (!ctx->Visual.stereoMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_FRONT_RIGHT)");
+ return;
+ }
+ ctx->Color._DrawDestMask = DD_FRONT_RIGHT_BIT;
+ break;
+ case GL_BACK_RIGHT:
+ if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_BACK_RIGHT)");
+ return;
+ }
+ ctx->Color._DrawDestMask = DD_BACK_RIGHT_BIT;
+ break;
+ case GL_BACK_LEFT:
+ if (!ctx->Visual.doubleBufferMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_BACK_LEFT)");
+ return;
+ }
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT;
+ break;
+ case GL_FRONT_AND_BACK:
+ if (!ctx->Visual.doubleBufferMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_FRONT_AND_BACK)");
+ return;
+ }
+ if (ctx->Visual.stereoMode)
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT
+ | DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT;
+ else
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT;
+ break;
+ case GL_LEFT:
+ /* never an error */
+ if (ctx->Visual.doubleBufferMode)
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT;
+ else
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
+ break;
+ case GL_FRONT_LEFT:
+ /* never an error */
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
+ break;
+ case GL_AUX0:
+ if (ctx->Visual.numAuxBuffers >= 1) {
+ ctx->Color._DrawDestMask = DD_AUX0_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX0)" );
+ return;
+ }
+ break;
+ case GL_AUX1:
+ if (ctx->Visual.numAuxBuffers >= 2) {
+ ctx->Color._DrawDestMask = DD_AUX1_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX1)" );
+ return;
+ }
+ break;
+ case GL_AUX2:
+ if (ctx->Visual.numAuxBuffers >= 3) {
+ ctx->Color._DrawDestMask = DD_AUX2_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX2)" );
+ return;
+ }
+ break;
+ case GL_AUX3:
+ if (ctx->Visual.numAuxBuffers >= 4) {
+ ctx->Color._DrawDestMask = DD_AUX3_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX3)" );
+ return;
+ }
+ break;
+#endif
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" );
+ return;
+ }
+
+ ctx->Color.DrawBuffer = mode;
+ ctx->NewState |= _NEW_COLOR;
+
+ /*
+ * Call device driver function.
+ */
+ if (ctx->Driver.DrawBuffer)
+ (*ctx->Driver.DrawBuffer)(ctx, mode);
+}
+
+
+/**
+ * Set the color buffer source for reading pixels.
+ *
+ * \param mode color buffer.
+ *
+ * \sa glReadBuffer().
+ *
+ * Verifies the parameter and updates gl_pixel_attrib::_ReadSrcMask. Marks
+ * new pixel state in __GLcontextRec::NewState and notifies the driver via
+ * dd_function_table::ReadBuffer.
+ */
+void GLAPIENTRY
+_mesa_ReadBuffer( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
+
+ /*
+ * Do error checking and compute ctx->Pixel._ReadSrcMask.
+ */
+ switch (mode) {
+ case GL_LEFT:
+ case GL_FRONT:
+ case GL_FRONT_LEFT:
+ /* Front-Left buffer, always exists */
+ ctx->Pixel._ReadSrcMask = DD_FRONT_LEFT_BIT;
+ break;
+ case GL_BACK:
+ case GL_BACK_LEFT:
+ /* Back-Left buffer, requires double buffering */
+ if (!ctx->Visual.doubleBufferMode) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
+ return;
+ }
+ ctx->Pixel._ReadSrcMask = DD_BACK_LEFT_BIT;
+ break;
+#if _HAVE_FULL_GL
+ case GL_FRONT_RIGHT:
+ case GL_RIGHT:
+ if (!ctx->Visual.stereoMode) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
+ return;
+ }
+ ctx->Pixel._ReadSrcMask = DD_FRONT_RIGHT_BIT;
+ break;
+ case GL_BACK_RIGHT:
+ if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
+ return;
+ }
+ ctx->Pixel._ReadSrcMask = DD_BACK_RIGHT_BIT;
+ break;
+ case GL_AUX0:
+ if (ctx->Visual.numAuxBuffers >= 1) {
+ ctx->Pixel._ReadSrcMask = DD_AUX0_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX0)" );
+ return;
+ }
+ break;
+ case GL_AUX1:
+ if (ctx->Visual.numAuxBuffers >= 2) {
+ ctx->Pixel._ReadSrcMask = DD_AUX1_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX1)" );
+ return;
+ }
+ break;
+ case GL_AUX2:
+ if (ctx->Visual.numAuxBuffers >= 3) {
+ ctx->Pixel._ReadSrcMask = DD_AUX2_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX2)" );
+ return;
+ }
+ break;
+ case GL_AUX3:
+ if (ctx->Visual.numAuxBuffers >= 4) {
+ ctx->Pixel._ReadSrcMask = DD_AUX3_BIT;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX3)" );
+ return;
+ }
+ break;
+#endif
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glReadBuffer" );
+ return;
+ }
+
+ ctx->Pixel.ReadBuffer = mode;
+ ctx->NewState |= _NEW_PIXEL;
+
+ /*
+ * Call device driver function.
+ */
+ if (ctx->Driver.ReadBuffer)
+ (*ctx->Driver.ReadBuffer)(ctx, mode);
+}
+
+#if _HAVE_FULL_GL
+
+/**
+ * GL_MESA_resize_buffers extension.
+ *
+ * When this function is called, we'll ask the window system how large
+ * the current window is. If it's a new size, we'll call the driver's
+ * ResizeBuffers function. The driver will then resize its color buffers
+ * as needed, and maybe call the swrast's routine for reallocating
+ * swrast-managed depth/stencil/accum/etc buffers.
+ * \note This function may be called from within Mesa or called by the
+ * user directly (see the GL_MESA_resize_buffers extension).
+ */
+void GLAPIENTRY
+_mesa_ResizeBuffersMESA( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glResizeBuffersMESA\n");
+
+ if (ctx) {
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+
+ if (ctx->DrawBuffer) {
+ GLuint buf_width, buf_height;
+ GLframebuffer *buffer = ctx->DrawBuffer;
+
+ /* ask device driver for size of output buffer */
+ (*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
+
+ /* see if size of device driver's color buffer (window) has changed */
+ if (buffer->Width == buf_width && buffer->Height == buf_height)
+ return; /* size is as expected */
+
+ buffer->Width = buf_width;
+ buffer->Height = buf_height;
+
+ ctx->Driver.ResizeBuffers( buffer );
+ }
+
+ if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer) {
+ GLuint buf_width, buf_height;
+ GLframebuffer *buffer = ctx->ReadBuffer;
+
+ /* ask device driver for size of read buffer */
+ (*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
+
+ /* see if size of device driver's color buffer (window) has changed */
+ if (buffer->Width == buf_width && buffer->Height == buf_height)
+ return; /* size is as expected */
+
+ buffer->Width = buf_width;
+ buffer->Height = buf_height;
+
+ ctx->Driver.ResizeBuffers( buffer );
+ }
+
+ ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
+ }
+}
+
+/*
+ * XXX move somewhere else someday?
+ */
+void GLAPIENTRY
+_mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB");
+ return;
+ }
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+ ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0);
+ ctx->Multisample.SampleCoverageInvert = invert;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+}
+
+#endif
+
+
+/**
+ * Define the scissor box.
+ *
+ * \param x, y coordinates of the scissor box lower-left corner.
+ * \param width width of the scissor box.
+ * \param height height of the scissor box.
+ *
+ * \sa glScissor().
+ *
+ * Verifies the parameters and updates __GLcontextRec::Scissor. On a
+ * change flushes the vertices and notifies the driver via
+ * the dd_function_table::Scissor callback.
+ */
+void GLAPIENTRY
+_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" );
+ return;
+ }
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
+
+ if (x == ctx->Scissor.X &&
+ y == ctx->Scissor.Y &&
+ width == ctx->Scissor.Width &&
+ height == ctx->Scissor.Height)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+ ctx->Scissor.X = x;
+ ctx->Scissor.Y = y;
+ ctx->Scissor.Width = width;
+ ctx->Scissor.Height = height;
+
+ if (ctx->Driver.Scissor)
+ ctx->Driver.Scissor( ctx, x, y, width, height );
+}
+
+/**********************************************************************/
+/** \name State management */
+/*@{*/
+
+/**
+ * Update screen bounds.
+ *
+ * \param ctx GL context.
+ *
+ * Update gl_frame_buffer::_Xmin, and etc.
+ */
+void _mesa_update_buffers( GLcontext *ctx )
+{
+ ctx->DrawBuffer->_Xmin = 0;
+ ctx->DrawBuffer->_Ymin = 0;
+ ctx->DrawBuffer->_Xmax = ctx->DrawBuffer->Width;
+ ctx->DrawBuffer->_Ymax = ctx->DrawBuffer->Height;
+ if (ctx->Scissor.Enabled) {
+ if (ctx->Scissor.X > ctx->DrawBuffer->_Xmin) {
+ ctx->DrawBuffer->_Xmin = ctx->Scissor.X;
+ }
+ if (ctx->Scissor.Y > ctx->DrawBuffer->_Ymin) {
+ ctx->DrawBuffer->_Ymin = ctx->Scissor.Y;
+ }
+ if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->_Xmax) {
+ ctx->DrawBuffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width;
+ }
+ if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->_Ymax) {
+ ctx->DrawBuffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
+ }
+ }
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Initialization */
+/*@{*/
+
+/**
+ * Initialize the context scissor data.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes the __GLcontextRec::Scissor and __GLcontextRec::Multisample
+ * attribute groups, and related constants in __GLcontextRec::Const.
+ */
+void _mesa_init_buffers( GLcontext * ctx )
+{
+ /* Scissor group */
+ ctx->Scissor.Enabled = GL_FALSE;
+ ctx->Scissor.X = 0;
+ ctx->Scissor.Y = 0;
+ ctx->Scissor.Width = 0;
+ ctx->Scissor.Height = 0;
+
+ /* Multisample */
+ ctx->Multisample.Enabled = GL_FALSE;
+ ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
+ ctx->Multisample.SampleAlphaToOne = GL_FALSE;
+ ctx->Multisample.SampleCoverage = GL_FALSE;
+ ctx->Multisample.SampleCoverageValue = 1.0;
+ ctx->Multisample.SampleCoverageInvert = GL_FALSE;
+
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/buffers.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/buffers.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/buffers.h Thu Apr 8 05:17:39 2004
@@ -0,0 +1,70 @@
+/**
+ * \file buffers.h
+ * Frame buffer management functions declarations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef BUFFERS_H
+#define BUFFERS_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_ClearIndex( GLfloat c );
+
+extern void GLAPIENTRY
+_mesa_ClearColor( GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha );
+
+extern void GLAPIENTRY
+_mesa_Clear( GLbitfield mask );
+
+extern void GLAPIENTRY
+_mesa_DrawBuffer( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_ReadBuffer( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_ResizeBuffersMESA( void );
+
+extern void GLAPIENTRY
+_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
+
+extern void GLAPIENTRY
+_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
+
+extern void
+_mesa_init_buffers( GLcontext * ctx );
+
+extern void
+_mesa_update_buffers( GLcontext *ctx );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/clip.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/clip.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/clip.c Fri Dec 10 10:05:21 2004
@@ -0,0 +1,161 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "clip.h"
+#include "context.h"
+#include "macros.h"
+#include "mtypes.h"
+
+#include "math/m_xform.h"
+#include "math/m_matrix.h"
+
+
+
+/**********************************************************************/
+/* Get/Set User clip-planes. */
+/**********************************************************************/
+
+
+
+void GLAPIENTRY
+_mesa_ClipPlane( GLenum plane, const GLdouble *eq )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint p;
+ GLfloat equation[4];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
+ if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" );
+ return;
+ }
+
+ equation[0] = (GLfloat) eq[0];
+ equation[1] = (GLfloat) eq[1];
+ equation[2] = (GLfloat) eq[2];
+ equation[3] = (GLfloat) eq[3];
+
+ /*
+ * The equation is transformed by the transpose of the inverse of the
+ * current modelview matrix and stored in the resulting eye coordinates.
+ *
+ * KW: Eqn is then transformed to the current clip space, where user
+ * clipping now takes place. The clip-space equations are recalculated
+ * whenever the projection matrix changes.
+ */
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY)
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+
+ _mesa_transform_vector( equation, equation,
+ ctx->ModelviewMatrixStack.Top->inv );
+
+ if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ COPY_4FV(ctx->Transform.EyeUserPlane[p], equation);
+
+ /* Update derived state. This state also depends on the projection
+ * matrix, and is recalculated on changes to the projection matrix by
+ * code in _mesa_update_state().
+ */
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
+ _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
+
+ _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
+ ctx->Transform.EyeUserPlane[p],
+ ctx->ProjectionMatrixStack.Top->inv );
+ }
+
+ if (ctx->Driver.ClipPlane)
+ ctx->Driver.ClipPlane( ctx, plane, equation );
+}
+
+
+void GLAPIENTRY
+_mesa_GetClipPlane( GLenum plane, GLdouble *equation )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint p;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ p = (GLint) (plane - GL_CLIP_PLANE0);
+ if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" );
+ return;
+ }
+
+ equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0];
+ equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1];
+ equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2];
+ equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3];
+}
+
+void GLAPIENTRY
+_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (cap) {
+ case GL_CULL_VERTEX_EYE_POSITION_EXT:
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ COPY_4FV(ctx->Transform.CullEyePos, v);
+
+ _mesa_transform_vector( ctx->Transform.CullObjPos,
+ ctx->Transform.CullEyePos,
+ ctx->ModelviewMatrixStack.Top->inv );
+ break;
+
+ case GL_CULL_VERTEX_OBJECT_POSITION_EXT:
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ COPY_4FV(ctx->Transform.CullObjPos, v);
+
+ _mesa_transform_vector( ctx->Transform.CullEyePos,
+ ctx->Transform.CullObjPos,
+ ctx->ModelviewMatrixStack.Top->m );
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCullParameterfvEXT" );
+ }
+}
+
+void GLAPIENTRY
+_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v)
+{
+ GLfloat f[4];
+
+ f[0] = (GLfloat)v[0];
+ f[1] = (GLfloat)v[1];
+ f[2] = (GLfloat)v[2];
+ f[3] = (GLfloat)v[3];
+
+ _mesa_CullParameterfvEXT(cap, f);
+}
+
Index: xc/extras/Mesa/src/mesa/main/clip.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/clip.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/clip.h Fri Dec 10 10:05:21 2004
@@ -0,0 +1,49 @@
+/**
+ * \file clip.h
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef CLIP_H
+#define CLIP_H
+
+#include "mtypes.h"
+
+extern void GLAPIENTRY
+_mesa_ClipPlane( GLenum plane, const GLdouble *equation );
+
+extern void GLAPIENTRY
+_mesa_GetClipPlane( GLenum plane, GLdouble *equation );
+
+extern void GLAPIENTRY
+_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v);
+
+extern void GLAPIENTRY
+_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v);
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/colormac.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/colormac.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/colormac.h Fri Dec 10 10:05:23 2004
@@ -0,0 +1,227 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file colormac.h
+ * Color-related macros
+ */
+
+
+#ifndef COLORMAC_H
+#define COLORMAC_H
+
+
+#include "imports.h"
+#include "config.h"
+#include "macros.h"
+
+
+/** \def BYTE_TO_CHAN
+ * Convert from GLbyte to GLchan */
+
+/** \def UBYTE_TO_CHAN
+ * Convert from GLubyte to GLchan */
+
+/** \def SHORT_TO_CHAN
+ * Convert from GLshort to GLchan */
+
+/** \def USHORT_TO_CHAN
+ * Convert from GLushort to GLchan */
+
+/** \def INT_TO_CHAN
+ * Convert from GLint to GLchan */
+
+/** \def UINT_TO_CHAN
+ * Convert from GLuint to GLchan */
+
+/** \def CHAN_TO_UBYTE
+ * Convert from GLchan to GLubyte */
+
+/** \def CHAN_TO_FLOAT
+ * Convert from GLchan to GLfloat */
+
+/** \def CLAMPED_FLOAT_TO_CHAN
+ * Convert from GLclampf to GLchan */
+
+/** \def UNCLAMPED_FLOAT_TO_CHAN
+ * Convert from GLfloat to GLchan */
+
+/** \def COPY_CHAN4
+ * Copy a GLchan[4] array */
+
+/** \def CHAN_PRODUCT
+ * Scaled product (usually approximated) between two GLchan arguments */
+
+#if CHAN_BITS == 8
+
+#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b))
+#define UBYTE_TO_CHAN(b) (b)
+#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) ((s) >> 7))
+#define USHORT_TO_CHAN(s) ((GLchan) ((s) >> 8))
+#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 23))
+#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 24))
+
+#define CHAN_TO_UBYTE(c) (c)
+#define CHAN_TO_FLOAT(c) UBYTE_TO_FLOAT(c)
+
+#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_UBYTE(c, f)
+#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_UBYTE(c, f)
+
+#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC)
+
+#define CHAN_PRODUCT(a, b) ((GLubyte) (((GLint)(a) * ((GLint)(b) + 1)) >> 8))
+
+#elif CHAN_BITS == 16
+
+#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516))
+#define UBYTE_TO_CHAN(b) ((((GLchan) (b)) << 8) | ((GLchan) (b)))
+#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) (s))
+#define USHORT_TO_CHAN(s) (s)
+#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15))
+#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16))
+
+#define CHAN_TO_UBYTE(c) ((c) >> 8)
+#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF)))
+
+#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f)
+#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f)
+
+#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
+
+#define CHAN_PRODUCT(a, b) ((GLchan) ((((GLuint) (a)) * ((GLuint) (b))) / 65535))
+
+#elif CHAN_BITS == 32
+
+/* XXX floating-point color channels not fully thought-out */
+#define BYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 127.0F)))
+#define UBYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 255.0F)))
+#define SHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 32767.0F)))
+#define USHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 65535.0F)))
+#define INT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 2147483647.0F)))
+#define UINT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 4294967295.0F)))
+
+#define CHAN_TO_UBYTE(c) FLOAT_TO_UBYTE(c)
+#define CHAN_TO_FLOAT(c) (c)
+
+#define CLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
+#define UNCLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
+
+#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
+
+#define CHAN_PRODUCT(a, b) ((a) * (b))
+
+#else
+
+#error unexpected CHAN_BITS size
+
+#endif
+
+
+/**
+ * Convert 3 channels at once.
+ *
+ * \param dst pointer to destination GLchan[3] array.
+ * \param f pointer to source GLfloat[3] array.
+ *
+ * \sa #UNCLAMPED_FLOAT_TO_CHAN.
+ */
+#define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \
+do { \
+ UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \
+ UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \
+ UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \
+} while (0)
+
+
+/**
+ * Convert 4 channels at once.
+ *
+ * \param dst pointer to destination GLchan[4] array.
+ * \param f pointer to source GLfloat[4] array.
+ *
+ * \sa #UNCLAMPED_FLOAT_TO_CHAN.
+ */
+#define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \
+do { \
+ UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \
+ UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \
+ UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \
+ UNCLAMPED_FLOAT_TO_CHAN(dst[3], f[3]); \
+} while (0)
+
+
+
+/**
+ * \name Generic color packing macros. All inputs should be GLubytes.
+ *
+ * \todo We may move these into texstore.h at some point.
+ */
+/*@{*/
+
+#define PACK_COLOR_8888( R, G, B, A ) \
+ (((R) << 24) | ((G) << 16) | ((B) << 8) | (A))
+
+#define PACK_COLOR_8888_REV( R, G, B, A ) \
+ (((A) << 24) | ((B) << 16) | ((G) << 8) | (R))
+
+#define PACK_COLOR_888( R, G, B ) \
+ (((R) << 16) | ((G) << 8) | (B))
+
+#define PACK_COLOR_565( R, G, B ) \
+ ((((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | (((B) & 0xf8) >> 3))
+
+#define PACK_COLOR_565_REV( R, G, B ) \
+ (((R) & 0xf8) | ((G) & 0xe0) >> 5 | (((G) & 0x1c) << 11) | (((B) & 0xf8) << 5))
+
+#define PACK_COLOR_1555( A, B, G, R ) \
+ ((((B) & 0xf8) << 7) | (((G) & 0xf8) << 2) | (((R) & 0xf8) >> 3) | \
+ ((A) ? 0x8000 : 0))
+
+#define PACK_COLOR_1555_REV( A, B, G, R ) \
+ ((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \
+ ((A) ? 0x80 : 0))
+
+#define PACK_COLOR_4444( R, G, B, A ) \
+ ((((R) & 0xf0) << 8) | (((G) & 0xf0) << 4) | ((B) & 0xf0) | ((A) >> 4))
+
+#define PACK_COLOR_4444_REV( R, G, B, A ) \
+ ((((B) & 0xf0) << 8) | (((A) & 0xf0) << 4) | ((R) & 0xf0) | ((G) >> 4))
+
+#define PACK_COLOR_88( L, A ) \
+ (((L) << 8) | (A))
+
+#define PACK_COLOR_88_REV( L, A ) \
+ (((A) << 8) | (L))
+
+#define PACK_COLOR_332( R, G, B ) \
+ (((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6))
+
+#define PACK_COLOR_233( B, G, R ) \
+ (((B) & 0xc0) | (((G) & 0xe0) >> 2) | (((R) & 0xe0) >> 5))
+
+/*@}*/
+
+
+#endif /* COLORMAC_H */
Index: xc/extras/Mesa/src/mesa/main/colortab.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/colortab.c:1.5
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/colortab.c Mon Dec 13 17:40:54 2004
@@ -0,0 +1,1383 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/* $XFree86: xc/extras/Mesa/src/mesa/main/colortab.c,v 1.5 2004/12/13 22:40:54 tsi Exp $ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "colortab.h"
+#include "context.h"
+#include "image.h"
+#include "macros.h"
+#include "state.h"
+
+
+/*
+ * Given an internalFormat token passed to glColorTable,
+ * return the corresponding base format.
+ * Return -1 if invalid token.
+ */
+static GLint
+base_colortab_format( GLenum format )
+{
+ switch (format) {
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return GL_ALPHA;
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ return GL_LUMINANCE;
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return GL_LUMINANCE_ALPHA;
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY8:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ return GL_INTENSITY;
+ case GL_RGB:
+ case GL_R3_G3_B2:
+ case GL_RGB4:
+ case GL_RGB5:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return GL_RGB;
+ case GL_RGBA:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return GL_RGBA;
+ default:
+ return -1; /* error */
+ }
+}
+
+
+
+/*
+ * Examine table's format and set the component sizes accordingly.
+ */
+static void
+set_component_sizes( struct gl_color_table *table )
+{
+ GLubyte sz;
+
+ switch (table->Type) {
+ case GL_UNSIGNED_BYTE:
+ sz = sizeof(GLubyte);
+ break;
+ case GL_UNSIGNED_SHORT:
+ sz = sizeof(GLushort);
+ break;
+ case GL_FLOAT:
+ sz = sizeof(GLfloat);
+ break;
+ default:
+ _mesa_problem(NULL, "bad color table type in set_component_sizes 0x%x", table->Type);
+ return;
+ }
+
+ switch (table->Format) {
+ case GL_ALPHA:
+ table->RedSize = 0;
+ table->GreenSize = 0;
+ table->BlueSize = 0;
+ table->AlphaSize = sz;
+ table->IntensitySize = 0;
+ table->LuminanceSize = 0;
+ break;
+ case GL_LUMINANCE:
+ table->RedSize = 0;
+ table->GreenSize = 0;
+ table->BlueSize = 0;
+ table->AlphaSize = 0;
+ table->IntensitySize = 0;
+ table->LuminanceSize = sz;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ table->RedSize = 0;
+ table->GreenSize = 0;
+ table->BlueSize = 0;
+ table->AlphaSize = sz;
+ table->IntensitySize = 0;
+ table->LuminanceSize = sz;
+ break;
+ case GL_INTENSITY:
+ table->RedSize = 0;
+ table->GreenSize = 0;
+ table->BlueSize = 0;
+ table->AlphaSize = 0;
+ table->IntensitySize = sz;
+ table->LuminanceSize = 0;
+ break;
+ case GL_RGB:
+ table->RedSize = sz;
+ table->GreenSize = sz;
+ table->BlueSize = sz;
+ table->AlphaSize = 0;
+ table->IntensitySize = 0;
+ table->LuminanceSize = 0;
+ break;
+ case GL_RGBA:
+ table->RedSize = sz;
+ table->GreenSize = sz;
+ table->BlueSize = sz;
+ table->AlphaSize = sz;
+ table->IntensitySize = 0;
+ table->LuminanceSize = 0;
+ break;
+ default:
+ _mesa_problem(NULL, "unexpected format in set_component_sizes");
+ }
+}
+
+
+
+/**
+ * Update/replace all or part of a color table. Helper function
+ * used by _mesa_ColorTable() and _mesa_ColorSubTable().
+ * The table->Table buffer should already be allocated.
+ * \param start first entry to update
+ * \param count number of entries to update
+ * \param format format of user-provided table data
+ * \param type datatype of user-provided table data
+ * \param data user-provided table data
+ * \param [rgba]Scale - RGBA scale factors
+ * \param [rgba]Bias - RGBA bias factors
+ */
+static void
+store_colortable_entries(GLcontext *ctx, struct gl_color_table *table,
+ GLsizei start, GLsizei count,
+ GLenum format, GLenum type, const GLvoid *data,
+ GLfloat rScale, GLfloat rBias,
+ GLfloat gScale, GLfloat gBias,
+ GLfloat bScale, GLfloat bBias,
+ GLfloat aScale, GLfloat aBias)
+{
+ if (table->Type == GL_FLOAT) {
+ /* convert user-provided data to GLfloat values */
+ GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4];
+ GLfloat *tableF;
+ GLint i;
+
+ _mesa_unpack_color_span_float(ctx,
+ count, /* number of pixels */
+ table->Format, /* dest format */
+ tempTab, /* dest address */
+ format, type, data, /* src data */
+ &ctx->Unpack,
+ IMAGE_CLAMP_BIT); /* transfer ops */
+
+ tableF = (GLfloat *) table->Table;
+
+ switch (table->Format) {
+ case GL_INTENSITY:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_LUMINANCE:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_ALPHA:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j] = CLAMP(tempTab[i] * aScale + aBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j*2+0] = CLAMP(tempTab[i*2+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[j*2+1] = CLAMP(tempTab[i*2+1] * aScale + aBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_RGB:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j*3+0] = CLAMP(tempTab[i*3+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[j*3+1] = CLAMP(tempTab[i*3+1] * gScale + gBias, 0.0F, 1.0F);
+ tableF[j*3+2] = CLAMP(tempTab[i*3+2] * bScale + bBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_RGBA:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j*4+0] = CLAMP(tempTab[i*4+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[j*4+1] = CLAMP(tempTab[i*4+1] * gScale + gBias, 0.0F, 1.0F);
+ tableF[j*4+2] = CLAMP(tempTab[i*4+2] * bScale + bBias, 0.0F, 1.0F);
+ tableF[j*4+3] = CLAMP(tempTab[i*4+3] * aScale + aBias, 0.0F, 1.0F);
+ }
+ break;
+ default:
+ _mesa_problem(ctx, "Bad format in store_colortable_entries");
+ return;
+ }
+ }
+ else {
+ /* non-float (GLchan) */
+ const GLint comps = _mesa_components_in_format(table->Format);
+ GLchan *dest = (GLchan *) table->Table + start * comps;
+ _mesa_unpack_color_span_chan(ctx, count, /* number of entries */
+ table->Format, /* dest format */
+ dest, /* dest address */
+ format, type, data, /* src data */
+ &ctx->Unpack,
+ 0); /* transfer ops */
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_ColorTable( GLenum target, GLenum internalFormat,
+ GLsizei width, GLenum format, GLenum type,
+ const GLvoid *data )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_object *texObj = NULL;
+ struct gl_color_table *table = NULL;
+ GLboolean proxy = GL_FALSE;
+ GLint baseFormat;
+ GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
+ GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
+ GLenum tableType = CHAN_TYPE;
+ GLint comps;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ texObj = texUnit->Current1D;
+ table = &texObj->Palette;
+ break;
+ case GL_TEXTURE_2D:
+ texObj = texUnit->Current2D;
+ table = &texObj->Palette;
+ break;
+ case GL_TEXTURE_3D:
+ texObj = texUnit->Current3D;
+ table = &texObj->Palette;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ texObj = texUnit->CurrentCubeMap;
+ table = &texObj->Palette;
+ break;
+ case GL_PROXY_TEXTURE_1D:
+ texObj = ctx->Texture.Proxy1D;
+ table = &texObj->Palette;
+ proxy = GL_TRUE;
+ break;
+ case GL_PROXY_TEXTURE_2D:
+ texObj = ctx->Texture.Proxy2D;
+ table = &texObj->Palette;
+ proxy = GL_TRUE;
+ break;
+ case GL_PROXY_TEXTURE_3D:
+ texObj = ctx->Texture.Proxy3D;
+ table = &texObj->Palette;
+ proxy = GL_TRUE;
+ break;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ texObj = ctx->Texture.ProxyCubeMap;
+ table = &texObj->Palette;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ table = &ctx->Texture.Palette;
+ break;
+ case GL_COLOR_TABLE:
+ table = &ctx->ColorTable;
+ tableType = GL_FLOAT;
+ rScale = ctx->Pixel.ColorTableScale[0];
+ gScale = ctx->Pixel.ColorTableScale[1];
+ bScale = ctx->Pixel.ColorTableScale[2];
+ aScale = ctx->Pixel.ColorTableScale[3];
+ rBias = ctx->Pixel.ColorTableBias[0];
+ gBias = ctx->Pixel.ColorTableBias[1];
+ bBias = ctx->Pixel.ColorTableBias[2];
+ aBias = ctx->Pixel.ColorTableBias[3];
+ break;
+ case GL_PROXY_COLOR_TABLE:
+ table = &ctx->ProxyColorTable;
+ proxy = GL_TRUE;
+ break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ table = &(texUnit->ColorTable);
+ tableType = GL_FLOAT;
+ rScale = ctx->Pixel.TextureColorTableScale[0];
+ gScale = ctx->Pixel.TextureColorTableScale[1];
+ bScale = ctx->Pixel.TextureColorTableScale[2];
+ aScale = ctx->Pixel.TextureColorTableScale[3];
+ rBias = ctx->Pixel.TextureColorTableBias[0];
+ gBias = ctx->Pixel.TextureColorTableBias[1];
+ bBias = ctx->Pixel.TextureColorTableBias[2];
+ aBias = ctx->Pixel.TextureColorTableBias[3];
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ table = &(texUnit->ProxyColorTable);
+ proxy = GL_TRUE;
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->PostConvolutionColorTable;
+ tableType = GL_FLOAT;
+ rScale = ctx->Pixel.PCCTscale[0];
+ gScale = ctx->Pixel.PCCTscale[1];
+ bScale = ctx->Pixel.PCCTscale[2];
+ aScale = ctx->Pixel.PCCTscale[3];
+ rBias = ctx->Pixel.PCCTbias[0];
+ gBias = ctx->Pixel.PCCTbias[1];
+ bBias = ctx->Pixel.PCCTbias[2];
+ aBias = ctx->Pixel.PCCTbias[3];
+ break;
+ case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->ProxyPostConvolutionColorTable;
+ proxy = GL_TRUE;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->PostColorMatrixColorTable;
+ tableType = GL_FLOAT;
+ rScale = ctx->Pixel.PCMCTscale[0];
+ gScale = ctx->Pixel.PCMCTscale[1];
+ bScale = ctx->Pixel.PCMCTscale[2];
+ aScale = ctx->Pixel.PCMCTscale[3];
+ rBias = ctx->Pixel.PCMCTbias[0];
+ gBias = ctx->Pixel.PCMCTbias[1];
+ bBias = ctx->Pixel.PCMCTbias[2];
+ aBias = ctx->Pixel.PCMCTbias[3];
+ break;
+ case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->ProxyPostColorMatrixColorTable;
+ proxy = GL_TRUE;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+
+ assert(table);
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type) ||
+ format == GL_INTENSITY) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glColorTable(format or type)");
+ return;
+ }
+
+ baseFormat = base_colortab_format(internalFormat);
+ if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)");
+ return;
+ }
+
+ if (width < 0 || (width != 0 && _mesa_bitcount(width) != 1)) {
+ /* error */
+ if (proxy) {
+ table->Size = 0;
+ table->IntFormat = (GLenum) 0;
+ table->Format = (GLenum) 0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glColorTable(width=%d)", width);
+ }
+ return;
+ }
+
+ if (width > (GLsizei) ctx->Const.MaxColorTableSize) {
+ if (proxy) {
+ table->Size = 0;
+ table->IntFormat = (GLenum) 0;
+ table->Format = (GLenum) 0;
+ }
+ else {
+ _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)");
+ }
+ return;
+ }
+
+ table->Size = width;
+ table->IntFormat = internalFormat;
+ table->Format = (GLenum) baseFormat;
+ set_component_sizes(table);
+
+ comps = _mesa_components_in_format(table->Format);
+ assert(comps > 0); /* error should have been caught sooner */
+
+ if (!proxy) {
+ /* free old table, if any */
+ if (table->Table) {
+ FREE(table->Table);
+ table->Table = NULL;
+ }
+
+ if (width > 0) {
+ if (tableType == GL_FLOAT) {
+ table->Type = GL_FLOAT;
+ table->Table = MALLOC(comps * width * sizeof(GLfloat));
+ }
+ else {
+ table->Type = CHAN_TYPE;
+ table->Table = MALLOC(comps * width * sizeof(GLchan));
+ }
+
+ if (!table->Table) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
+ return;
+ }
+
+ store_colortable_entries(ctx, table,
+ 0, width, /* start, count */
+ format, type, data,
+ rScale, rBias,
+ gScale, gBias,
+ bScale, bBias,
+ aScale, aBias);
+ }
+ } /* proxy */
+
+ if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) {
+ /* texture object palette, texObj==NULL means the shared palette */
+ if (ctx->Driver.UpdateTexturePalette) {
+ (*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
+ }
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+
+void GLAPIENTRY
+_mesa_ColorSubTable( GLenum target, GLsizei start,
+ GLsizei count, GLenum format, GLenum type,
+ const GLvoid *data )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_object *texObj = NULL;
+ struct gl_color_table *table = NULL;
+ GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
+ GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ texObj = texUnit->Current1D;
+ table = &texObj->Palette;
+ break;
+ case GL_TEXTURE_2D:
+ texObj = texUnit->Current2D;
+ table = &texObj->Palette;
+ break;
+ case GL_TEXTURE_3D:
+ texObj = texUnit->Current3D;
+ table = &texObj->Palette;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
+ return;
+ }
+ texObj = texUnit->CurrentCubeMap;
+ table = &texObj->Palette;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ table = &ctx->Texture.Palette;
+ break;
+ case GL_COLOR_TABLE:
+ table = &ctx->ColorTable;
+ rScale = ctx->Pixel.ColorTableScale[0];
+ gScale = ctx->Pixel.ColorTableScale[1];
+ bScale = ctx->Pixel.ColorTableScale[2];
+ aScale = ctx->Pixel.ColorTableScale[3];
+ rBias = ctx->Pixel.ColorTableBias[0];
+ gBias = ctx->Pixel.ColorTableBias[1];
+ bBias = ctx->Pixel.ColorTableBias[2];
+ aBias = ctx->Pixel.ColorTableBias[3];
+ break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
+ return;
+ }
+ table = &(texUnit->ColorTable);
+ rScale = ctx->Pixel.TextureColorTableScale[0];
+ gScale = ctx->Pixel.TextureColorTableScale[1];
+ bScale = ctx->Pixel.TextureColorTableScale[2];
+ aScale = ctx->Pixel.TextureColorTableScale[3];
+ rBias = ctx->Pixel.TextureColorTableBias[0];
+ gBias = ctx->Pixel.TextureColorTableBias[1];
+ bBias = ctx->Pixel.TextureColorTableBias[2];
+ aBias = ctx->Pixel.TextureColorTableBias[3];
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->PostConvolutionColorTable;
+ rScale = ctx->Pixel.PCCTscale[0];
+ gScale = ctx->Pixel.PCCTscale[1];
+ bScale = ctx->Pixel.PCCTscale[2];
+ aScale = ctx->Pixel.PCCTscale[3];
+ rBias = ctx->Pixel.PCCTbias[0];
+ gBias = ctx->Pixel.PCCTbias[1];
+ bBias = ctx->Pixel.PCCTbias[2];
+ aBias = ctx->Pixel.PCCTbias[3];
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->PostColorMatrixColorTable;
+ rScale = ctx->Pixel.PCMCTscale[0];
+ gScale = ctx->Pixel.PCMCTscale[1];
+ bScale = ctx->Pixel.PCMCTscale[2];
+ aScale = ctx->Pixel.PCMCTscale[3];
+ rBias = ctx->Pixel.PCMCTbias[0];
+ gBias = ctx->Pixel.PCMCTbias[1];
+ bBias = ctx->Pixel.PCMCTbias[2];
+ aBias = ctx->Pixel.PCMCTbias[3];
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
+ return;
+ }
+
+ assert(table);
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type) ||
+ format == GL_INTENSITY) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glColorSubTable(format or type)");
+ return;
+ }
+
+ if (count < 1) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)");
+ return;
+ }
+
+ /* error should have been caught sooner */
+ assert(_mesa_components_in_format(table->Format) > 0);
+
+ if (start + count > (GLint) table->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)");
+ return;
+ }
+
+ if (!table->Table) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorSubTable");
+ return;
+ }
+
+ store_colortable_entries(ctx, table, start, count,
+ format, type, data,
+ rScale, rBias,
+ gScale, gBias,
+ bScale, bBias,
+ aScale, aBias);
+
+ if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) {
+ /* per-texture object palette */
+ if (ctx->Driver.UpdateTexturePalette) {
+ (*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
+ }
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+
+/* XXX not tested */
+void GLAPIENTRY
+_mesa_CopyColorTable(GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* Select buffer to read from */
+ ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width );
+}
+
+
+
+/* XXX not tested */
+void GLAPIENTRY
+_mesa_CopyColorSubTable(GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width );
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetColorTable( GLenum target, GLenum format,
+ GLenum type, GLvoid *data )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_color_table *table = NULL;
+ GLchan rgba[MAX_COLOR_TABLE_SIZE][4];
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ table = &texUnit->Current1D->Palette;
+ break;
+ case GL_TEXTURE_2D:
+ table = &texUnit->Current2D->Palette;
+ break;
+ case GL_TEXTURE_3D:
+ table = &texUnit->Current3D->Palette;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
+ return;
+ }
+ table = &texUnit->CurrentCubeMap->Palette;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ table = &ctx->Texture.Palette;
+ break;
+ case GL_COLOR_TABLE:
+ table = &ctx->ColorTable;
+ break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
+ return;
+ }
+ table = &(texUnit->ColorTable);
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->PostConvolutionColorTable;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->PostColorMatrixColorTable;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
+ return;
+ }
+
+ ASSERT(table);
+
+ switch (table->Format) {
+ case GL_ALPHA:
+ if (table->Type == GL_FLOAT) {
+ const GLfloat *tableF = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = 0;
+ rgba[i][GCOMP] = 0;
+ rgba[i][BCOMP] = 0;
+ rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ }
+ }
+ else {
+ const GLchan *tableUB = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = 0;
+ rgba[i][GCOMP] = 0;
+ rgba[i][BCOMP] = 0;
+ rgba[i][ACOMP] = tableUB[i];
+ }
+ }
+ break;
+ case GL_LUMINANCE:
+ if (table->Type == GL_FLOAT) {
+ const GLfloat *tableF = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ rgba[i][ACOMP] = CHAN_MAX;
+ }
+ }
+ else {
+ const GLchan *tableUB = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = tableUB[i];
+ rgba[i][GCOMP] = tableUB[i];
+ rgba[i][BCOMP] = tableUB[i];
+ rgba[i][ACOMP] = CHAN_MAX;
+ }
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ if (table->Type == GL_FLOAT) {
+ const GLfloat *tableF = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
+ rgba[i][GCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
+ rgba[i][BCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
+ rgba[i][ACOMP] = IROUND_POS(tableF[i*2+1] * CHAN_MAXF);
+ }
+ }
+ else {
+ const GLchan *tableUB = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = tableUB[i*2+0];
+ rgba[i][GCOMP] = tableUB[i*2+0];
+ rgba[i][BCOMP] = tableUB[i*2+0];
+ rgba[i][ACOMP] = tableUB[i*2+1];
+ }
+ }
+ break;
+ case GL_INTENSITY:
+ if (table->Type == GL_FLOAT) {
+ const GLfloat *tableF = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+ }
+ }
+ else {
+ const GLchan *tableUB = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = tableUB[i];
+ rgba[i][GCOMP] = tableUB[i];
+ rgba[i][BCOMP] = tableUB[i];
+ rgba[i][ACOMP] = tableUB[i];
+ }
+ }
+ break;
+ case GL_RGB:
+ if (table->Type == GL_FLOAT) {
+ const GLfloat *tableF = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = IROUND_POS(tableF[i*3+0] * CHAN_MAXF);
+ rgba[i][GCOMP] = IROUND_POS(tableF[i*3+1] * CHAN_MAXF);
+ rgba[i][BCOMP] = IROUND_POS(tableF[i*3+2] * CHAN_MAXF);
+ rgba[i][ACOMP] = CHAN_MAX;
+ }
+ }
+ else {
+ const GLchan *tableUB = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = tableUB[i*3+0];
+ rgba[i][GCOMP] = tableUB[i*3+1];
+ rgba[i][BCOMP] = tableUB[i*3+2];
+ rgba[i][ACOMP] = CHAN_MAX;
+ }
+ }
+ break;
+ case GL_RGBA:
+ if (table->Type == GL_FLOAT) {
+ const GLfloat *tableF = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = IROUND_POS(tableF[i*4+0] * CHAN_MAXF);
+ rgba[i][GCOMP] = IROUND_POS(tableF[i*4+1] * CHAN_MAXF);
+ rgba[i][BCOMP] = IROUND_POS(tableF[i*4+2] * CHAN_MAXF);
+ rgba[i][ACOMP] = IROUND_POS(tableF[i*4+3] * CHAN_MAXF);
+ }
+ }
+ else {
+ const GLchan *tableUB = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < table->Size; i++) {
+ rgba[i][RCOMP] = tableUB[i*4+0];
+ rgba[i][GCOMP] = tableUB[i*4+1];
+ rgba[i][BCOMP] = tableUB[i*4+2];
+ rgba[i][ACOMP] = tableUB[i*4+3];
+ }
+ }
+ break;
+ default:
+ _mesa_problem(ctx, "bad table format in glGetColorTable");
+ return;
+ }
+
+ _mesa_pack_rgba_span_chan(ctx, table->Size, (const GLchan (*)[4]) rgba,
+ format, type, data, &ctx->Pack, GL_FALSE);
+}
+
+
+
+void GLAPIENTRY
+_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ switch (target) {
+ case GL_COLOR_TABLE_SGI:
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ ctx->Pixel.ColorTableScale[0] = params[0];
+ ctx->Pixel.ColorTableScale[1] = params[1];
+ ctx->Pixel.ColorTableScale[2] = params[2];
+ ctx->Pixel.ColorTableScale[3] = params[3];
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ ctx->Pixel.ColorTableBias[0] = params[0];
+ ctx->Pixel.ColorTableBias[1] = params[1];
+ ctx->Pixel.ColorTableBias[2] = params[2];
+ ctx->Pixel.ColorTableBias[3] = params[3];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)");
+ return;
+ }
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ ctx->Pixel.TextureColorTableScale[0] = params[0];
+ ctx->Pixel.TextureColorTableScale[1] = params[1];
+ ctx->Pixel.TextureColorTableScale[2] = params[2];
+ ctx->Pixel.TextureColorTableScale[3] = params[3];
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ ctx->Pixel.TextureColorTableBias[0] = params[0];
+ ctx->Pixel.TextureColorTableBias[1] = params[1];
+ ctx->Pixel.TextureColorTableBias[2] = params[2];
+ ctx->Pixel.TextureColorTableBias[3] = params[3];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
+ return;
+ }
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ ctx->Pixel.PCCTscale[0] = params[0];
+ ctx->Pixel.PCCTscale[1] = params[1];
+ ctx->Pixel.PCCTscale[2] = params[2];
+ ctx->Pixel.PCCTscale[3] = params[3];
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ ctx->Pixel.PCCTbias[0] = params[0];
+ ctx->Pixel.PCCTbias[1] = params[1];
+ ctx->Pixel.PCCTbias[2] = params[2];
+ ctx->Pixel.PCCTbias[3] = params[3];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
+ return;
+ }
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ ctx->Pixel.PCMCTscale[0] = params[0];
+ ctx->Pixel.PCMCTscale[1] = params[1];
+ ctx->Pixel.PCMCTscale[2] = params[2];
+ ctx->Pixel.PCMCTscale[3] = params[3];
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ ctx->Pixel.PCMCTbias[0] = params[0];
+ ctx->Pixel.PCMCTbias[1] = params[1];
+ ctx->Pixel.PCMCTbias[2] = params[2];
+ ctx->Pixel.PCMCTbias[3] = params[3];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)");
+ return;
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+
+void GLAPIENTRY
+_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+ GLfloat fparams[4];
+ if (pname == GL_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI ||
+ pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
+ pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {
+ /* four values */
+ fparams[0] = (GLfloat) params[0];
+ fparams[1] = (GLfloat) params[1];
+ fparams[2] = (GLfloat) params[2];
+ fparams[3] = (GLfloat) params[3];
+ }
+ else {
+ /* one values */
+ fparams[0] = (GLfloat) params[0];
+ }
+ _mesa_ColorTableParameterfv(target, pname, fparams);
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_color_table *table = NULL;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ table = &texUnit->Current1D->Palette;
+ break;
+ case GL_TEXTURE_2D:
+ table = &texUnit->Current2D->Palette;
+ break;
+ case GL_TEXTURE_3D:
+ table = &texUnit->Current3D->Palette;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetColorTableParameterfv(target)");
+ return;
+ }
+ table = &texUnit->CurrentCubeMap->Palette;
+ break;
+ case GL_PROXY_TEXTURE_1D:
+ table = &ctx->Texture.Proxy1D->Palette;
+ break;
+ case GL_PROXY_TEXTURE_2D:
+ table = &ctx->Texture.Proxy2D->Palette;
+ break;
+ case GL_PROXY_TEXTURE_3D:
+ table = &ctx->Texture.Proxy3D->Palette;
+ break;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetColorTableParameterfv(target)");
+ return;
+ }
+ table = &ctx->Texture.ProxyCubeMap->Palette;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ table = &ctx->Texture.Palette;
+ break;
+ case GL_COLOR_TABLE:
+ table = &ctx->ColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = ctx->Pixel.ColorTableScale[0];
+ params[1] = ctx->Pixel.ColorTableScale[1];
+ params[2] = ctx->Pixel.ColorTableScale[2];
+ params[3] = ctx->Pixel.ColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = ctx->Pixel.ColorTableBias[0];
+ params[1] = ctx->Pixel.ColorTableBias[1];
+ params[2] = ctx->Pixel.ColorTableBias[2];
+ params[3] = ctx->Pixel.ColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_COLOR_TABLE:
+ table = &ctx->ProxyColorTable;
+ break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &(texUnit->ColorTable);
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = ctx->Pixel.TextureColorTableScale[0];
+ params[1] = ctx->Pixel.TextureColorTableScale[1];
+ params[2] = ctx->Pixel.TextureColorTableScale[2];
+ params[3] = ctx->Pixel.TextureColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = ctx->Pixel.TextureColorTableBias[0];
+ params[1] = ctx->Pixel.TextureColorTableBias[1];
+ params[2] = ctx->Pixel.TextureColorTableBias[2];
+ params[3] = ctx->Pixel.TextureColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &(texUnit->ProxyColorTable);
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->PostConvolutionColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = ctx->Pixel.PCCTscale[0];
+ params[1] = ctx->Pixel.PCCTscale[1];
+ params[2] = ctx->Pixel.PCCTscale[2];
+ params[3] = ctx->Pixel.PCCTscale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = ctx->Pixel.PCCTbias[0];
+ params[1] = ctx->Pixel.PCCTbias[1];
+ params[2] = ctx->Pixel.PCCTbias[2];
+ params[3] = ctx->Pixel.PCCTbias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->ProxyPostConvolutionColorTable;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->PostColorMatrixColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = ctx->Pixel.PCMCTscale[0];
+ params[1] = ctx->Pixel.PCMCTscale[1];
+ params[2] = ctx->Pixel.PCMCTscale[2];
+ params[3] = ctx->Pixel.PCMCTscale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = ctx->Pixel.PCMCTbias[0];
+ params[1] = ctx->Pixel.PCMCTbias[1];
+ params[2] = ctx->Pixel.PCMCTbias[2];
+ params[3] = ctx->Pixel.PCMCTbias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->ProxyPostColorMatrixColorTable;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)");
+ return;
+ }
+
+ assert(table);
+
+ switch (pname) {
+ case GL_COLOR_TABLE_FORMAT:
+ *params = (GLfloat) table->IntFormat;
+ break;
+ case GL_COLOR_TABLE_WIDTH:
+ *params = (GLfloat) table->Size;
+ break;
+ case GL_COLOR_TABLE_RED_SIZE:
+ *params = (GLfloat) table->RedSize;
+ break;
+ case GL_COLOR_TABLE_GREEN_SIZE:
+ *params = (GLfloat) table->GreenSize;
+ break;
+ case GL_COLOR_TABLE_BLUE_SIZE:
+ *params = (GLfloat) table->BlueSize;
+ break;
+ case GL_COLOR_TABLE_ALPHA_SIZE:
+ *params = (GLfloat) table->AlphaSize;
+ break;
+ case GL_COLOR_TABLE_LUMINANCE_SIZE:
+ *params = (GLfloat) table->LuminanceSize;
+ break;
+ case GL_COLOR_TABLE_INTENSITY_SIZE:
+ *params = (GLfloat) table->IntensitySize;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" );
+ return;
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_color_table *table = NULL;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ table = &texUnit->Current1D->Palette;
+ break;
+ case GL_TEXTURE_2D:
+ table = &texUnit->Current2D->Palette;
+ break;
+ case GL_TEXTURE_3D:
+ table = &texUnit->Current3D->Palette;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetColorTableParameteriv(target)");
+ return;
+ }
+ table = &texUnit->CurrentCubeMap->Palette;
+ break;
+ case GL_PROXY_TEXTURE_1D:
+ table = &ctx->Texture.Proxy1D->Palette;
+ break;
+ case GL_PROXY_TEXTURE_2D:
+ table = &ctx->Texture.Proxy2D->Palette;
+ break;
+ case GL_PROXY_TEXTURE_3D:
+ table = &ctx->Texture.Proxy3D->Palette;
+ break;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetColorTableParameteriv(target)");
+ return;
+ }
+ table = &ctx->Texture.ProxyCubeMap->Palette;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ table = &ctx->Texture.Palette;
+ break;
+ case GL_COLOR_TABLE:
+ table = &ctx->ColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = (GLint) ctx->Pixel.ColorTableScale[0];
+ params[1] = (GLint) ctx->Pixel.ColorTableScale[1];
+ params[2] = (GLint) ctx->Pixel.ColorTableScale[2];
+ params[3] = (GLint) ctx->Pixel.ColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = (GLint) ctx->Pixel.ColorTableBias[0];
+ params[1] = (GLint) ctx->Pixel.ColorTableBias[1];
+ params[2] = (GLint) ctx->Pixel.ColorTableBias[2];
+ params[3] = (GLint) ctx->Pixel.ColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_COLOR_TABLE:
+ table = &ctx->ProxyColorTable;
+ break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &(texUnit->ColorTable);
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = (GLint) ctx->Pixel.TextureColorTableScale[0];
+ params[1] = (GLint) ctx->Pixel.TextureColorTableScale[1];
+ params[2] = (GLint) ctx->Pixel.TextureColorTableScale[2];
+ params[3] = (GLint) ctx->Pixel.TextureColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = (GLint) ctx->Pixel.TextureColorTableBias[0];
+ params[1] = (GLint) ctx->Pixel.TextureColorTableBias[1];
+ params[2] = (GLint) ctx->Pixel.TextureColorTableBias[2];
+ params[3] = (GLint) ctx->Pixel.TextureColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &(texUnit->ProxyColorTable);
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->PostConvolutionColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = (GLint) ctx->Pixel.PCCTscale[0];
+ params[1] = (GLint) ctx->Pixel.PCCTscale[1];
+ params[2] = (GLint) ctx->Pixel.PCCTscale[2];
+ params[3] = (GLint) ctx->Pixel.PCCTscale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = (GLint) ctx->Pixel.PCCTbias[0];
+ params[1] = (GLint) ctx->Pixel.PCCTbias[1];
+ params[2] = (GLint) ctx->Pixel.PCCTbias[2];
+ params[3] = (GLint) ctx->Pixel.PCCTbias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
+ table = &ctx->ProxyPostConvolutionColorTable;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->PostColorMatrixColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = (GLint) ctx->Pixel.PCMCTscale[0];
+ params[1] = (GLint) ctx->Pixel.PCMCTscale[1];
+ params[2] = (GLint) ctx->Pixel.PCMCTscale[2];
+ params[3] = (GLint) ctx->Pixel.PCMCTscale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = (GLint) ctx->Pixel.PCMCTbias[0];
+ params[1] = (GLint) ctx->Pixel.PCMCTbias[1];
+ params[2] = (GLint) ctx->Pixel.PCMCTbias[2];
+ params[3] = (GLint) ctx->Pixel.PCMCTbias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
+ table = &ctx->ProxyPostColorMatrixColorTable;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)");
+ return;
+ }
+
+ assert(table);
+
+ switch (pname) {
+ case GL_COLOR_TABLE_FORMAT:
+ *params = table->IntFormat;
+ break;
+ case GL_COLOR_TABLE_WIDTH:
+ *params = table->Size;
+ break;
+ case GL_COLOR_TABLE_RED_SIZE:
+ *params = table->RedSize;
+ break;
+ case GL_COLOR_TABLE_GREEN_SIZE:
+ *params = table->GreenSize;
+ break;
+ case GL_COLOR_TABLE_BLUE_SIZE:
+ *params = table->BlueSize;
+ break;
+ case GL_COLOR_TABLE_ALPHA_SIZE:
+ *params = table->AlphaSize;
+ break;
+ case GL_COLOR_TABLE_LUMINANCE_SIZE:
+ *params = table->LuminanceSize;
+ break;
+ case GL_COLOR_TABLE_INTENSITY_SIZE:
+ *params = table->IntensitySize;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" );
+ return;
+ }
+}
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+
+void
+_mesa_init_colortable( struct gl_color_table *p )
+{
+ p->Type = CHAN_TYPE;
+ p->Table = NULL;
+ p->Size = 0;
+ p->IntFormat = GL_RGBA;
+}
+
+
+
+void
+_mesa_free_colortable_data( struct gl_color_table *p )
+{
+ if (p->Table) {
+ FREE(p->Table);
+ p->Table = NULL;
+ }
+}
+
+
+/*
+ * Initialize all colortables for a context.
+ */
+void _mesa_init_colortables( GLcontext * ctx )
+{
+ /* Color tables */
+ _mesa_init_colortable(&ctx->ColorTable);
+ _mesa_init_colortable(&ctx->ProxyColorTable);
+ _mesa_init_colortable(&ctx->PostConvolutionColorTable);
+ _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable);
+ _mesa_init_colortable(&ctx->PostColorMatrixColorTable);
+ _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable);
+}
+
+
+/*
+ * Free all colortable data for a context
+ */
+void _mesa_free_colortables_data( GLcontext *ctx )
+{
+ _mesa_free_colortable_data(&ctx->ColorTable);
+ _mesa_free_colortable_data(&ctx->ProxyColorTable);
+ _mesa_free_colortable_data(&ctx->PostConvolutionColorTable);
+ _mesa_free_colortable_data(&ctx->ProxyPostConvolutionColorTable);
+ _mesa_free_colortable_data(&ctx->PostColorMatrixColorTable);
+ _mesa_free_colortable_data(&ctx->ProxyPostColorMatrixColorTable);
+}
Index: xc/extras/Mesa/src/mesa/main/colortab.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/colortab.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/colortab.h Thu Apr 8 05:17:39 2004
@@ -0,0 +1,110 @@
+/**
+ * \file colortab.h
+ * Color tables.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef COLORTAB_H
+#define COLORTAB_H
+
+
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_ColorTable( GLenum target, GLenum internalformat,
+ GLsizei width, GLenum format, GLenum type,
+ const GLvoid *table );
+
+extern void GLAPIENTRY
+_mesa_ColorSubTable( GLenum target, GLsizei start,
+ GLsizei count, GLenum format, GLenum type,
+ const GLvoid *table );
+
+extern void GLAPIENTRY
+_mesa_CopyColorSubTable(GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width);
+
+extern void GLAPIENTRY
+_mesa_CopyColorTable(GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width);
+
+extern void GLAPIENTRY
+_mesa_GetColorTable( GLenum target, GLenum format,
+ GLenum type, GLvoid *table );
+
+extern void GLAPIENTRY
+_mesa_ColorTableParameterfv(GLenum target, GLenum pname,
+ const GLfloat *params);
+
+extern void GLAPIENTRY
+_mesa_ColorTableParameteriv(GLenum target, GLenum pname,
+ const GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params );
+
+
+
+extern void
+_mesa_init_colortable( struct gl_color_table *table );
+
+extern void
+_mesa_free_colortable_data( struct gl_color_table *table );
+
+extern void
+_mesa_init_colortables( GLcontext *ctx );
+
+extern void
+_mesa_free_colortables_data( GLcontext *ctx );
+
+#else
+
+/** No-op */
+#define _mesa_init_colortable( p ) ((void) 0)
+
+/** No-op */
+#define _mesa_free_colortable_data( p ) ((void) 0)
+
+/** No-op */
+#define _mesa_init_colortables( p ) ((void)0)
+
+/** No-op */
+#define _mesa_free_colortables_data( p ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/config.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/config.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:25 2005
+++ xc/extras/Mesa/src/mesa/main/config.h Fri Dec 10 10:05:21 2004
@@ -0,0 +1,286 @@
+/**
+ * \file config.h
+ * Tunable configuration parameters.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#ifdef HAVE_CONFIG_H
+#include "conf.h"
+#endif
+
+
+/**
+ * \name OpenGL implementation limits
+ */
+/*@{*/
+
+/** Maximum modelview matrix stack depth */
+#define MAX_MODELVIEW_STACK_DEPTH 32
+
+/** Maximum projection matrix stack depth */
+#define MAX_PROJECTION_STACK_DEPTH 32
+
+/** Maximum texture matrix stack depth */
+#define MAX_TEXTURE_STACK_DEPTH 10
+
+/** Maximum color matrix stack depth */
+#define MAX_COLOR_STACK_DEPTH 4
+
+/** Maximum attribute stack depth */
+#define MAX_ATTRIB_STACK_DEPTH 16
+
+/** Maximum client attribute stack depth */
+#define MAX_CLIENT_ATTRIB_STACK_DEPTH 16
+
+/** Maximum recursion depth of display list calls */
+#define MAX_LIST_NESTING 64
+
+/** Maximum number of lights */
+#define MAX_LIGHTS 8
+
+/** Maximum user-defined clipping planes */
+#define MAX_CLIP_PLANES 6
+
+/** Maximum pixel map lookup table size */
+#define MAX_PIXEL_MAP_TABLE 256
+
+/** Maximum Number of auxillary color buffers */
+#define MAX_AUX_BUFFERS 4
+
+/** Maximum order (degree) of curves */
+#ifdef AMIGA
+# define MAX_EVAL_ORDER 12
+#else
+# define MAX_EVAL_ORDER 30
+#endif
+
+/** Maximum Name stack depth */
+#define MAX_NAME_STACK_DEPTH 64
+
+/** Minimum point size */
+#define MIN_POINT_SIZE 1.0
+/** Maximum point size */
+#define MAX_POINT_SIZE 20.0
+/** Point size granularity */
+#define POINT_SIZE_GRANULARITY 0.1
+
+/** Minimum line width */
+#define MIN_LINE_WIDTH 1.0
+/** Maximum line width */
+#define MAX_LINE_WIDTH 10.0
+/** Line width granularity */
+#define LINE_WIDTH_GRANULARITY 0.1
+
+/** Max texture palette / color table size */
+#define MAX_COLOR_TABLE_SIZE 256
+
+/** Number of 1D/2D texture mipmap levels */
+#define MAX_TEXTURE_LEVELS 12
+
+/** Number of 3D texture mipmap levels */
+#define MAX_3D_TEXTURE_LEVELS 9
+
+/** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
+#define MAX_CUBE_TEXTURE_LEVELS 12
+
+/** Maximum rectangular texture size - GL_NV_texture_rectangle */
+#define MAX_TEXTURE_RECT_SIZE 2048
+
+/** Number of texture units - GL_ARB_multitexture */
+#define MAX_TEXTURE_UNITS 8
+
+/*@}*/
+
+
+/**
+ * \name Separate numbers of texture coordinates and texture image units.
+ *
+ * These values will eventually replace most instances of MAX_TEXTURE_UNITS.
+ * We should always have MAX_TEXTURE_COORD_UNITS <= MAX_TEXTURE_IMAGE_UNITS.
+ * And, GL_MAX_TEXTURE_UNITS <= MAX_TEXTURE_COORD_UNITS.
+ */
+/*@{*/
+#define MAX_TEXTURE_COORD_UNITS 8
+#define MAX_TEXTURE_IMAGE_UNITS 8
+/*@}*/
+
+/**
+ * Maximum viewport/image width. Must accomodate all texture sizes too.
+ */
+#define MAX_WIDTH 4096
+/** Maximum viewport/image height */
+#define MAX_HEIGHT 4096
+
+/** Maxmimum size for CVA. May be overridden by the drivers. */
+#define MAX_ARRAY_LOCK_SIZE 3000
+
+/** Subpixel precision for antialiasing, window coordinate snapping */
+#define SUB_PIXEL_BITS 4
+
+/** Size of histogram tables */
+#define HISTOGRAM_TABLE_SIZE 256
+
+/** Max convolution filter width */
+#define MAX_CONVOLUTION_WIDTH 9
+/** Max convolution filter height */
+#define MAX_CONVOLUTION_HEIGHT 9
+
+/** For GL_ARB_texture_compression */
+#define MAX_COMPRESSED_TEXTURE_FORMATS 25
+
+/** For GL_EXT_texture_filter_anisotropic */
+#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
+
+/** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
+#define MAX_TEXTURE_LOD_BIAS 11.0
+
+/** For GL_NV_vertex_program */
+/*@{*/
+#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
+#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
+#define MAX_NV_VERTEX_PROGRAM_PARAMS 96
+#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
+#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
+/*@}*/
+
+/** For GL_NV_fragment_program */
+/*@{*/
+#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 128
+#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96
+#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64
+#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12
+#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3
+#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2
+/*@}*/
+
+/** For GL_ARB_vertex_program */
+/*@{*/
+#define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1
+#define MAX_VERTEX_PROGRAM_ATTRIBS 16
+/*@}*/
+
+/** For GL_ARB_fragment_program */
+/*@{*/
+#define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 1
+#define MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS 48
+#define MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS 24
+#define MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS 4
+/*@}*/
+
+/** For any program target/extension */
+/*@{*/
+#define MAX_PROGRAM_LOCAL_PARAMS 96
+#define MAX_PROGRAM_MATRICES 8
+#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
+/*@}*/
+
+
+/**
+ * \name Mesa-specific parameters
+ */
+/*@{*/
+
+
+/**
+ * If non-zero use GLdouble for walking triangle edges, for better accuracy.
+ */
+#define TRIANGLE_WALK_DOUBLE 0
+
+/**
+ * Bits per accumulation buffer color component: 8, 16 or 32
+ */
+#define ACCUM_BITS 16
+
+/**
+ * Bits per depth buffer value.
+ *
+ * Any reasonable value up to 31 will work. 32 doesn't work because of integer
+ * overflow problems in the rasterizer code.
+ */
+#ifndef DEFAULT_SOFTWARE_DEPTH_BITS
+#define DEFAULT_SOFTWARE_DEPTH_BITS 16
+#endif
+/** Depth buffer data type */
+#if DEFAULT_SOFTWARE_DEPTH_BITS <= 16
+#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort
+#else
+#define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint
+#endif
+
+
+/**
+ * Bits per stencil value: 8
+ */
+#define STENCIL_BITS 8
+
+
+/**
+ * Bits per color channel: 8, 16 or 32
+ */
+#ifndef CHAN_BITS
+#define CHAN_BITS 8
+#endif
+
+
+/*
+ * Color channel component order
+ *
+ * \note Changes will almost certainly cause problems at this time.
+ */
+#define RCOMP 0
+#define GCOMP 1
+#define BCOMP 2
+#define ACOMP 3
+
+
+/*
+ * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1.
+ */
+#ifndef _HAVE_FULL_GL
+#define _HAVE_FULL_GL 1
+#endif
+
+#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
+#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
+#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
+#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL
+#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL
+#define FEATURE_MESA_program_debug _HAVE_FULL_GL
+#define FEATURE_NV_fence _HAVE_FULL_GL
+#define FEATURE_NV_fragment_program _HAVE_FULL_GL
+#define FEATURE_NV_vertex_program _HAVE_FULL_GL
+#define FEATURE_userclip _HAVE_FULL_GL
+#define FEATURE_texgen _HAVE_FULL_GL
+#define FEATURE_windowpos _HAVE_FULL_GL
+
+/*@}*/
+
+
+#endif /* CONFIG_H */
Index: xc/extras/Mesa/src/mesa/main/context.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/context.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/context.c Fri Dec 10 10:05:20 2004
@@ -0,0 +1,2001 @@
+/**
+ * \file context.c
+ * Mesa context/visual/framebuffer management functions.
+ * \author Brian Paul
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \mainpage Mesa Main Module
+ *
+ * \section MainIntroduction Introduction
+ *
+ * The Mesa Main module consists of all the files in the main/ directory.
+ * Among the features of this module are:
+ *
+ * - Structures to represent most GL state
+ * - State set/get functions
+ * - Display lists
+ * - Texture unit, object and image handling
+ * - Matrix and attribute stacks
+ *
+ *
+ * Other modules are responsible for API dispatch, vertex transformation,
+ * point/line/triangle setup, rasterization, vertex array caching,
+ * vertex/fragment programs/shaders, etc.
+ *
+ *
+ * \section AboutDoxygen About Doxygen
+ *
+ * If you're viewing this information as Doxygen-generated HTML you'll
+ * see the documentation index at the top of this page.
+ *
+ * The first line lists the Mesa source code modules.
+ * The second line lists the indexes available for viewing the documentation
+ * for each module.
+ *
+ * Selecting the Main page link will display a summary of the module
+ * (this page).
+ *
+ * Selecting Data Structures will list all C structures.
+ *
+ * Selecting the File List link will list all the source files in
+ * the module.
+ * Selecting a filename will show a list of all functions defined in that file.
+ *
+ * Selecting the Data Fields link will display a list of all
+ * documented structure members.
+ *
+ * Selecting the Globals link will display a list
+ * of all functions, structures, global variables and macros in the module.
+ *
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "accum.h"
+#include "attrib.h"
+#include "blend.h"
+#include "buffers.h"
+#include "bufferobj.h"
+#include "colortab.h"
+#include "context.h"
+#include "debug.h"
+#include "depth.h"
+#include "dlist.h"
+#include "eval.h"
+#include "enums.h"
+#include "extensions.h"
+#include "feedback.h"
+#include "fog.h"
+#include "get.h"
+#include "glthread.h"
+#include "glapioffsets.h"
+#include "histogram.h"
+#include "hint.h"
+#include "hash.h"
+#include "light.h"
+#include "lines.h"
+#include "macros.h"
+#include "matrix.h"
+#include "occlude.h"
+#include "pixel.h"
+#include "points.h"
+#include "polygon.h"
+#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
+#include "program.h"
+#endif
+#include "rastpos.h"
+#include "simple_list.h"
+#include "state.h"
+#include "stencil.h"
+#include "texcompress.h"
+#include "teximage.h"
+#include "texobj.h"
+#include "texstate.h"
+#include "mtypes.h"
+#include "varray.h"
+#include "vtxfmt.h"
+#if _HAVE_FULL_GL
+#include "math/m_translate.h"
+#include "math/m_matrix.h"
+#include "math/m_xform.h"
+#include "math/mathmod.h"
+#endif
+
+#ifdef USE_SPARC_ASM
+#include "sparc/sparc.h"
+#endif
+
+#ifndef MESA_VERBOSE
+int MESA_VERBOSE = 0;
+#endif
+
+#ifndef MESA_DEBUG_FLAGS
+int MESA_DEBUG_FLAGS = 0;
+#endif
+
+
+/* ubyte -> float conversion */
+GLfloat _mesa_ubyte_to_float_color_tab[256];
+
+static void
+free_shared_state( GLcontext *ctx, struct gl_shared_state *ss );
+
+
+/**********************************************************************/
+/** \name OpenGL SI-style interface (new in Mesa 3.5)
+ *
+ * \if subset
+ * \note Most of these functions are never called in the Mesa subset.
+ * \endif
+ */
+/*@{*/
+
+/**
+ * Destroy context callback.
+ *
+ * \param gc context.
+ * \return GL_TRUE on success, or GL_FALSE on failure.
+ *
+ * \ifnot subset
+ * Called by window system/device driver (via __GLexports::destroyCurrent) when
+ * the rendering context is to be destroyed.
+ * \endif
+ *
+ * Frees the context data and the context structure.
+ */
+GLboolean
+_mesa_destroyContext(__GLcontext *gc)
+{
+ if (gc) {
+ _mesa_free_context_data(gc);
+ _mesa_free(gc);
+ }
+ return GL_TRUE;
+}
+
+/**
+ * Unbind context callback.
+ *
+ * \param gc context.
+ * \return GL_TRUE on success, or GL_FALSE on failure.
+ *
+ * \ifnot subset
+ * Called by window system/device driver (via __GLexports::loseCurrent)
+ * when the rendering context is made non-current.
+ * \endif
+ *
+ * No-op
+ */
+GLboolean
+_mesa_loseCurrent(__GLcontext *gc)
+{
+ /* XXX unbind context from thread */
+ (void) gc;
+ return GL_TRUE;
+}
+
+/**
+ * Bind context callback.
+ *
+ * \param gc context.
+ * \return GL_TRUE on success, or GL_FALSE on failure.
+ *
+ * \ifnot subset
+ * Called by window system/device driver (via __GLexports::makeCurrent)
+ * when the rendering context is made current.
+ * \endif
+ *
+ * No-op
+ */
+GLboolean
+_mesa_makeCurrent(__GLcontext *gc)
+{
+ /* XXX bind context to thread */
+ (void) gc;
+ return GL_TRUE;
+}
+
+/**
+ * Share context callback.
+ *
+ * \param gc context.
+ * \param gcShare shared context.
+ * \return GL_TRUE on success, or GL_FALSE on failure.
+ *
+ * \ifnot subset
+ * Called by window system/device driver (via __GLexports::shareContext)
+ * \endif
+ *
+ * Update the shared context reference count, gl_shared_state::RefCount.
+ */
+GLboolean
+_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare)
+{
+ if (gc && gcShare && gc->Shared && gcShare->Shared) {
+ gc->Shared->RefCount--;
+ if (gc->Shared->RefCount == 0) {
+ free_shared_state(gc, gc->Shared);
+ }
+ gc->Shared = gcShare->Shared;
+ gc->Shared->RefCount++;
+ return GL_TRUE;
+ }
+ else {
+ return GL_FALSE;
+ }
+}
+
+
+#if _HAVE_FULL_GL
+/**
+ * Copy context callback.
+ */
+GLboolean
+_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask)
+{
+ if (dst && src) {
+ _mesa_copy_context( src, dst, mask );
+ return GL_TRUE;
+ }
+ else {
+ return GL_FALSE;
+ }
+}
+#endif
+
+/** No-op */
+GLboolean
+_mesa_forceCurrent(__GLcontext *gc)
+{
+ (void) gc;
+ return GL_TRUE;
+}
+
+/**
+ * Windows/buffer resizing notification callback.
+ *
+ * \param gc GL context.
+ * \return GL_TRUE on success, or GL_FALSE on failure.
+ */
+GLboolean
+_mesa_notifyResize(__GLcontext *gc)
+{
+ GLint x, y;
+ GLuint width, height;
+ __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc);
+ if (!d || !d->getDrawableSize)
+ return GL_FALSE;
+ d->getDrawableSize( d, &x, &y, &width, &height );
+ /* update viewport, resize software buffers, etc. */
+ return GL_TRUE;
+}
+
+/**
+ * Window/buffer destruction notification callback.
+ *
+ * \param gc GL context.
+ *
+ * Called when the context's window/buffer is going to be destroyed.
+ *
+ * No-op
+ */
+void
+_mesa_notifyDestroy(__GLcontext *gc)
+{
+ /* Unbind from it. */
+ (void) gc;
+}
+
+/**
+ * Swap buffers notification callback.
+ *
+ * \param gc GL context.
+ *
+ * Called by window system just before swapping buffers.
+ * We have to finish any pending rendering.
+ */
+void
+_mesa_notifySwapBuffers(__GLcontext *gc)
+{
+ FLUSH_VERTICES( gc, 0 );
+}
+
+/** No-op */
+struct __GLdispatchStateRec *
+_mesa_dispatchExec(__GLcontext *gc)
+{
+ (void) gc;
+ return NULL;
+}
+
+/** No-op */
+void
+_mesa_beginDispatchOverride(__GLcontext *gc)
+{
+ (void) gc;
+}
+
+/** No-op */
+void
+_mesa_endDispatchOverride(__GLcontext *gc)
+{
+ (void) gc;
+}
+
+/**
+ * \ifnot subset
+ * Setup the exports.
+ *
+ * The window system will call these functions when it needs Mesa to do
+ * something.
+ *
+ * \note Device drivers should override these functions! For example,
+ * the Xlib driver should plug in the XMesa*-style functions into this
+ * structure. The XMesa-style functions should then call the _mesa_*
+ * version of these functions. This is an approximation to OO design
+ * (inheritance and virtual functions).
+ * \endif
+ *
+ * \if subset
+ * No-op.
+ *
+ * \endif
+ */
+static void
+_mesa_init_default_exports(__GLexports *exports)
+{
+#if _HAVE_FULL_GL
+ exports->destroyContext = _mesa_destroyContext;
+ exports->loseCurrent = _mesa_loseCurrent;
+ exports->makeCurrent = _mesa_makeCurrent;
+ exports->shareContext = _mesa_shareContext;
+ exports->copyContext = _mesa_copyContext;
+ exports->forceCurrent = _mesa_forceCurrent;
+ exports->notifyResize = _mesa_notifyResize;
+ exports->notifyDestroy = _mesa_notifyDestroy;
+ exports->notifySwapBuffers = _mesa_notifySwapBuffers;
+ exports->dispatchExec = _mesa_dispatchExec;
+ exports->beginDispatchOverride = _mesa_beginDispatchOverride;
+ exports->endDispatchOverride = _mesa_endDispatchOverride;
+#else
+ (void) exports;
+#endif
+}
+
+/**
+ * Exported OpenGL SI interface.
+ */
+__GLcontext *
+__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes)
+{
+ GLcontext *ctx;
+
+ ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext));
+ if (ctx == NULL) {
+ return NULL;
+ }
+
+ /* XXX doesn't work at this time */
+ _mesa_initialize_context(ctx, modes, NULL, NULL, NULL);
+ ctx->imports = *imports;
+
+ return ctx;
+}
+
+/**
+ * Exported OpenGL SI interface.
+ */
+void
+__glCoreNopDispatch(void)
+{
+#if 0
+ /* SI */
+ __gl_dispatch = __glNopDispatchState;
+#else
+ /* Mesa */
+ _glapi_set_dispatch(NULL);
+#endif
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name GL Visual allocation/destruction */
+/**********************************************************************/
+/*@{*/
+
+/**
+ * Allocates a GLvisual structure and initializes it via
+ * _mesa_initialize_visual().
+ *
+ * \param rgbFlag GL_TRUE for RGB(A) mode, GL_FALSE for Color Index mode.
+ * \param dbFlag double buffering
+ * \param stereoFlag stereo buffer
+ * \param depthBits requested bits per depth buffer value. Any value in [0, 32]
+ * is acceptable but the actual depth type will be GLushort or GLuint as
+ * needed.
+ * \param stencilBits requested minimum bits per stencil buffer value
+ * \param accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits number of bits per color component in accum buffer.
+ * \param indexBits number of bits per pixel if \p rgbFlag is GL_FALSE
+ * \param redBits number of bits per color component in frame buffer for RGB(A)
+ * mode. We always use 8 in core Mesa though.
+ * \param greenBits same as above.
+ * \param blueBits same as above.
+ * \param alphaBits same as above.
+ * \param numSamples not really used.
+ *
+ * \return pointer to new GLvisual or NULL if requested parameters can't be
+ * met.
+ *
+ * \note Need to add params for level and numAuxBuffers (at least)
+ */
+GLvisual *
+_mesa_create_visual( GLboolean rgbFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits,
+ GLint indexBits,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumRedBits,
+ GLint accumGreenBits,
+ GLint accumBlueBits,
+ GLint accumAlphaBits,
+ GLint numSamples )
+{
+ GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) );
+ if (vis) {
+ if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag,
+ redBits, greenBits, blueBits, alphaBits,
+ indexBits, depthBits, stencilBits,
+ accumRedBits, accumGreenBits,
+ accumBlueBits, accumAlphaBits,
+ numSamples)) {
+ FREE(vis);
+ return NULL;
+ }
+ }
+ return vis;
+}
+
+/**
+ * Makes some sanity checks and fills in the fields of the
+ * GLvisual structure with the given parameters.
+ *
+ * \return GL_TRUE on success, or GL_FALSE on failure.
+ *
+ * \sa _mesa_create_visual() above for the parameter description.
+ *
+ * \note Need to add params for level and numAuxBuffers (at least)
+ */
+GLboolean
+_mesa_initialize_visual( GLvisual *vis,
+ GLboolean rgbFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits,
+ GLint indexBits,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumRedBits,
+ GLint accumGreenBits,
+ GLint accumBlueBits,
+ GLint accumAlphaBits,
+ GLint numSamples )
+{
+ assert(vis);
+
+ /* This is to catch bad values from device drivers not updated for
+ * Mesa 3.3. Some device drivers just passed 1. That's a REALLY
+ * bad value now (a 1-bit depth buffer!?!).
+ */
+ assert(depthBits == 0 || depthBits > 1);
+
+ if (depthBits < 0 || depthBits > 32) {
+ return GL_FALSE;
+ }
+ if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) {
+ return GL_FALSE;
+ }
+ if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) {
+ return GL_FALSE;
+ }
+ if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) {
+ return GL_FALSE;
+ }
+ if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) {
+ return GL_FALSE;
+ }
+ if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) {
+ return GL_FALSE;
+ }
+
+ vis->rgbMode = rgbFlag;
+ vis->doubleBufferMode = dbFlag;
+ vis->stereoMode = stereoFlag;
+
+ vis->redBits = redBits;
+ vis->greenBits = greenBits;
+ vis->blueBits = blueBits;
+ vis->alphaBits = alphaBits;
+
+ vis->indexBits = indexBits;
+ vis->depthBits = depthBits;
+ vis->accumRedBits = (accumRedBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->accumGreenBits = (accumGreenBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->accumBlueBits = (accumBlueBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->accumAlphaBits = (accumAlphaBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->stencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0;
+
+ vis->haveAccumBuffer = accumRedBits > 0;
+ vis->haveDepthBuffer = depthBits > 0;
+ vis->haveStencilBuffer = stencilBits > 0;
+
+ vis->numAuxBuffers = 0;
+ vis->level = 0;
+ vis->pixmapMode = 0;
+ vis->samples = numSamples;
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Destroy a visual and free its memory.
+ *
+ * \param vis visual.
+ *
+ * Frees the visual structure.
+ */
+void
+_mesa_destroy_visual( GLvisual *vis )
+{
+ FREE(vis);
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name GL Framebuffer allocation/destruction */
+/**********************************************************************/
+/*@{*/
+
+/**
+ * Allocate a GLframebuffer structure and initializes it via
+ * _mesa_initialize_framebuffer().
+ *
+ * A GLframebuffer is a structure which encapsulates the depth, stencil and
+ * accum buffers and related parameters.
+ *
+ * Note that the actual depth/stencil/accum/etc buffers are not allocated
+ * at this time. It's up to the device driver and/or swrast module to
+ * allocate them as needed.
+ *
+ * \param visual a GLvisual pointer (we copy the struct contents)
+ * \param softwareDepth create/use a software depth buffer?
+ * \param softwareStencil create/use a software stencil buffer?
+ * \param softwareAccum create/use a software accum buffer?
+ * \param softwareAlpha create/use a software alpha buffer?
+ *
+ * \return pointer to new GLframebuffer struct or NULL if error.
+ *
+ * \note Need to add softwareAuxBuffers parameter.
+ */
+GLframebuffer *
+_mesa_create_framebuffer( const GLvisual *visual,
+ GLboolean softwareDepth,
+ GLboolean softwareStencil,
+ GLboolean softwareAccum,
+ GLboolean softwareAlpha )
+{
+ GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer);
+ assert(visual);
+ if (buffer) {
+ _mesa_initialize_framebuffer(buffer, visual,
+ softwareDepth, softwareStencil,
+ softwareAccum, softwareAlpha );
+ }
+ return buffer;
+}
+
+
+/**
+ * Makes some sanity checks and fills in the fields of the
+ * GLframebuffer structure with the given parameters.
+ *
+ * \sa _mesa_create_framebuffer() above for the parameter description.
+ */
+void
+_mesa_initialize_framebuffer( GLframebuffer *buffer,
+ const GLvisual *visual,
+ GLboolean softwareDepth,
+ GLboolean softwareStencil,
+ GLboolean softwareAccum,
+ GLboolean softwareAlpha )
+{
+ GLboolean softwareAux = GL_FALSE;
+ assert(buffer);
+ assert(visual);
+
+ _mesa_bzero(buffer, sizeof(GLframebuffer));
+
+ /* sanity checks */
+ if (softwareDepth ) {
+ assert(visual->depthBits > 0);
+ }
+ if (softwareStencil) {
+ assert(visual->stencilBits > 0);
+ }
+ if (softwareAccum) {
+ assert(visual->rgbMode);
+ assert(visual->accumRedBits > 0);
+ assert(visual->accumGreenBits > 0);
+ assert(visual->accumBlueBits > 0);
+ }
+ if (softwareAlpha) {
+ assert(visual->rgbMode);
+ assert(visual->alphaBits > 0);
+ }
+
+ buffer->Visual = *visual;
+ buffer->UseSoftwareDepthBuffer = softwareDepth;
+ buffer->UseSoftwareStencilBuffer = softwareStencil;
+ buffer->UseSoftwareAccumBuffer = softwareAccum;
+ buffer->UseSoftwareAlphaBuffers = softwareAlpha;
+ buffer->UseSoftwareAuxBuffers = softwareAux;
+}
+
+
+/**
+ * Free a framebuffer struct and its buffers.
+ *
+ * Calls _mesa_free_framebuffer_data() and frees the structure.
+ */
+void
+_mesa_destroy_framebuffer( GLframebuffer *buffer )
+{
+ if (buffer) {
+ _mesa_free_framebuffer_data(buffer);
+ FREE(buffer);
+ }
+}
+
+
+/**
+ * Free the data hanging off of \p buffer, but not \p buffer itself.
+ *
+ * \param buffer framebuffer.
+ *
+ * Frees all the buffers associated with the structure.
+ */
+void
+_mesa_free_framebuffer_data( GLframebuffer *buffer )
+{
+ if (!buffer)
+ return;
+
+ if (buffer->UseSoftwareDepthBuffer && buffer->DepthBuffer) {
+ MESA_PBUFFER_FREE( buffer->DepthBuffer );
+ buffer->DepthBuffer = NULL;
+ }
+ if (buffer->UseSoftwareAccumBuffer && buffer->Accum) {
+ MESA_PBUFFER_FREE( buffer->Accum );
+ buffer->Accum = NULL;
+ }
+ if (buffer->UseSoftwareStencilBuffer && buffer->Stencil) {
+ MESA_PBUFFER_FREE( buffer->Stencil );
+ buffer->Stencil = NULL;
+ }
+ if (buffer->UseSoftwareAlphaBuffers){
+ if (buffer->FrontLeftAlpha) {
+ MESA_PBUFFER_FREE( buffer->FrontLeftAlpha );
+ buffer->FrontLeftAlpha = NULL;
+ }
+ if (buffer->BackLeftAlpha) {
+ MESA_PBUFFER_FREE( buffer->BackLeftAlpha );
+ buffer->BackLeftAlpha = NULL;
+ }
+ if (buffer->FrontRightAlpha) {
+ MESA_PBUFFER_FREE( buffer->FrontRightAlpha );
+ buffer->FrontRightAlpha = NULL;
+ }
+ if (buffer->BackRightAlpha) {
+ MESA_PBUFFER_FREE( buffer->BackRightAlpha );
+ buffer->BackRightAlpha = NULL;
+ }
+ }
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Context allocation, initialization, destroying
+ *
+ * The purpose of the most initialization functions here is to provide the
+ * default state values according to the OpenGL specification.
+ */
+/**********************************************************************/
+/*@{*/
+
+/**
+ * One-time initialization mutex lock.
+ *
+ * \sa Used by one_time_init().
+ */
+_glthread_DECLARE_STATIC_MUTEX(OneTimeLock);
+
+/**
+ * Calls all the various one-time-init functions in Mesa.
+ *
+ * While holding a global mutex lock, calls several initialization functions,
+ * and sets the glapi callbacks if the \c MESA_DEBUG environment variable is
+ * defined.
+ *
+ * \sa _mesa_init_lists(), _math_init().
+ */
+static void
+one_time_init( GLcontext *ctx )
+{
+ static GLboolean alreadyCalled = GL_FALSE;
+ (void) ctx;
+ _glthread_LOCK_MUTEX(OneTimeLock);
+ if (!alreadyCalled) {
+ GLuint i;
+
+ /* do some implementation tests */
+ assert( sizeof(GLbyte) == 1 );
+ assert( sizeof(GLubyte) == 1 );
+ assert( sizeof(GLshort) == 2 );
+ assert( sizeof(GLushort) == 2 );
+ assert( sizeof(GLint) == 4 );
+ assert( sizeof(GLuint) == 4 );
+
+ _mesa_init_lists();
+
+#if _HAVE_FULL_GL
+ _math_init();
+
+ for (i = 0; i < 256; i++) {
+ _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+ }
+#endif
+
+#ifdef USE_SPARC_ASM
+ _mesa_init_sparc_glapi_relocs();
+#endif
+ if (_mesa_getenv("MESA_DEBUG")) {
+ _glapi_noop_enable_warnings(GL_TRUE);
+#ifndef GLX_DIRECT_RENDERING
+ /* libGL from before 2002/06/28 don't have this function. Someday,
+ * when newer libGL libs are common, remove the #ifdef test. This
+ * only serves to print warnings when calling undefined GL functions.
+ */
+ _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning );
+#endif
+ }
+ else {
+ _glapi_noop_enable_warnings(GL_FALSE);
+ }
+
+#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
+ _mesa_debug(ctx, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__);
+#endif
+
+ alreadyCalled = GL_TRUE;
+ }
+ _glthread_UNLOCK_MUTEX(OneTimeLock);
+}
+
+
+/**
+ * Allocate and initialize a shared context state structure.
+ * Initializes the display list, texture objects and vertex programs hash
+ * tables, allocates the texture objects. If it runs out of memory, frees
+ * everything already allocated before returning NULL.
+ *
+ * \return pointer to a gl_shared_state structure on success, or NULL on
+ * failure.
+ */
+static GLboolean
+alloc_shared_state( GLcontext *ctx )
+{
+ struct gl_shared_state *ss = CALLOC_STRUCT(gl_shared_state);
+ if (!ss)
+ return GL_FALSE;
+
+ ctx->Shared = ss;
+
+ _glthread_INIT_MUTEX(ss->Mutex);
+
+ ss->DisplayList = _mesa_NewHashTable();
+ ss->TexObjects = _mesa_NewHashTable();
+#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
+ ss->Programs = _mesa_NewHashTable();
+#endif
+
+#if FEATURE_ARB_vertex_program
+ ss->DefaultVertexProgram = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
+ if (!ss->DefaultVertexProgram)
+ goto cleanup;
+#endif
+#if FEATURE_ARB_fragment_program
+ ss->DefaultFragmentProgram = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
+ if (!ss->DefaultFragmentProgram)
+ goto cleanup;
+#endif
+
+ ss->BufferObjects = _mesa_NewHashTable();
+
+ ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D);
+ if (!ss->Default1D)
+ goto cleanup;
+
+ ss->Default2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D);
+ if (!ss->Default2D)
+ goto cleanup;
+
+ ss->Default3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D);
+ if (!ss->Default3D)
+ goto cleanup;
+
+ ss->DefaultCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB);
+ if (!ss->DefaultCubeMap)
+ goto cleanup;
+
+ ss->DefaultRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV);
+ if (!ss->DefaultRect)
+ goto cleanup;
+
+ /* Effectively bind the default textures to all texture units */
+ ss->Default1D->RefCount += MAX_TEXTURE_IMAGE_UNITS;
+ ss->Default2D->RefCount += MAX_TEXTURE_IMAGE_UNITS;
+ ss->Default3D->RefCount += MAX_TEXTURE_IMAGE_UNITS;
+ ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS;
+ ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS;
+
+ return GL_TRUE;
+
+ cleanup:
+ /* Ran out of memory at some point. Free everything and return NULL */
+ if (ss->DisplayList)
+ _mesa_DeleteHashTable(ss->DisplayList);
+ if (ss->TexObjects)
+ _mesa_DeleteHashTable(ss->TexObjects);
+#if FEATURE_NV_vertex_program
+ if (ss->Programs)
+ _mesa_DeleteHashTable(ss->Programs);
+#endif
+#if FEATURE_ARB_vertex_program
+ if (ss->DefaultVertexProgram)
+ ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram);
+#endif
+#if FEATURE_ARB_fragment_program
+ if (ss->DefaultFragmentProgram)
+ ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram);
+#endif
+#if FEATURE_ARB_vertex_buffer_object
+ if (ss->BufferObjects)
+ _mesa_DeleteHashTable(ss->BufferObjects);
+#endif
+
+ if (ss->Default1D)
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D);
+ if (ss->Default2D)
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D);
+ if (ss->Default3D)
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D);
+ if (ss->DefaultCubeMap)
+ (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap);
+ if (ss->DefaultRect)
+ (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect);
+ if (ss)
+ _mesa_free(ss);
+ return GL_FALSE;
+}
+
+/**
+ * Deallocate a shared state context and all children structures.
+ *
+ * \param ctx GL context.
+ * \param ss shared state pointer.
+ *
+ * Frees the display lists, the texture objects (calling the driver texture
+ * deletion callback to free its private data) and the vertex programs, as well
+ * as their hash tables.
+ *
+ * \sa alloc_shared_state().
+ */
+static void
+free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
+{
+ /* Free display lists */
+ while (1) {
+ GLuint list = _mesa_HashFirstEntry(ss->DisplayList);
+ if (list) {
+ _mesa_destroy_list(ctx, list);
+ }
+ else {
+ break;
+ }
+ }
+ _mesa_DeleteHashTable(ss->DisplayList);
+
+ /* Free texture objects */
+ ASSERT(ctx->Driver.DeleteTexture);
+ /* the default textures */
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect);
+ /* all other textures */
+ while (1) {
+ GLuint texName = _mesa_HashFirstEntry(ss->TexObjects);
+ if (texName) {
+ struct gl_texture_object *texObj = (struct gl_texture_object *)
+ _mesa_HashLookup(ss->TexObjects, texName);
+ ASSERT(texObj);
+ (*ctx->Driver.DeleteTexture)(ctx, texObj);
+ _mesa_HashRemove(ss->TexObjects, texName);
+ }
+ else {
+ break;
+ }
+ }
+ _mesa_DeleteHashTable(ss->TexObjects);
+
+#if FEATURE_NV_vertex_program
+ /* Free vertex programs */
+ while (1) {
+ GLuint prog = _mesa_HashFirstEntry(ss->Programs);
+ if (prog) {
+ struct program *p = (struct program *) _mesa_HashLookup(ss->Programs,
+ prog);
+ ASSERT(p);
+ ctx->Driver.DeleteProgram(ctx, p);
+ _mesa_HashRemove(ss->Programs, prog);
+ }
+ else {
+ break;
+ }
+ }
+ _mesa_DeleteHashTable(ss->Programs);
+#endif
+#if FEATURE_ARB_vertex_program
+ _mesa_delete_program(ctx, ss->DefaultVertexProgram);
+#endif
+#if FEATURE_ARB_fragment_program
+ _mesa_delete_program(ctx, ss->DefaultFragmentProgram);
+#endif
+
+#if FEATURE_ARB_vertex_buffer_object
+ _mesa_DeleteHashTable(ss->BufferObjects);
+#endif
+ _glthread_DESTROY_MUTEX(ss->Mutex);
+
+ FREE(ss);
+}
+
+
+/**
+ * Initialize fields of gl_current_attrib (aka ctx->Current.*)
+ */
+static void
+_mesa_init_current( GLcontext *ctx )
+{
+ GLuint i;
+
+ /* Current group */
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 );
+ }
+ /* special cases: */
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 );
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 );
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 );
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 );
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 );
+
+ ctx->Current.Index = 1;
+ ctx->Current.EdgeFlag = GL_TRUE;
+}
+
+
+/**
+ * Initialize fields of gl_constants (aka ctx->Const.*).
+ * Use defaults from config.h. The device drivers will often override
+ * some of these values (such as number of texture units).
+ */
+static void
+_mesa_init_constants( GLcontext *ctx )
+{
+ assert(ctx);
+
+ assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
+ assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
+
+ /* Constants, may be overriden by device drivers */
+ ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
+ ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
+ ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
+ ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
+ ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS;
+ ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS;
+ ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
+ ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS;
+ ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;
+ ctx->Const.SubPixelBits = SUB_PIXEL_BITS;
+ ctx->Const.MinPointSize = MIN_POINT_SIZE;
+ ctx->Const.MaxPointSize = MAX_POINT_SIZE;
+ ctx->Const.MinPointSizeAA = MIN_POINT_SIZE;
+ ctx->Const.MaxPointSizeAA = MAX_POINT_SIZE;
+ ctx->Const.PointSizeGranularity = (GLfloat) POINT_SIZE_GRANULARITY;
+ ctx->Const.MinLineWidth = MIN_LINE_WIDTH;
+ ctx->Const.MaxLineWidth = MAX_LINE_WIDTH;
+ ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH;
+ ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH;
+ ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY;
+ ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE;
+ ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH;
+ ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT;
+ ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES;
+ ctx->Const.MaxLights = MAX_LIGHTS;
+ ctx->Const.MaxSpotExponent = 128.0;
+ ctx->Const.MaxShininess = 128.0;
+#if FEATURE_ARB_vertex_program
+ ctx->Const.MaxVertexProgramInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS;
+ ctx->Const.MaxVertexProgramAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
+ ctx->Const.MaxVertexProgramTemps = MAX_NV_VERTEX_PROGRAM_TEMPS;
+ ctx->Const.MaxVertexProgramLocalParams = MAX_NV_VERTEX_PROGRAM_PARAMS;
+ ctx->Const.MaxVertexProgramEnvParams = MAX_NV_VERTEX_PROGRAM_PARAMS;/*XXX*/
+ ctx->Const.MaxVertexProgramAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
+#endif
+#if FEATURE_ARB_fragment_program
+ ctx->Const.MaxFragmentProgramInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS;
+ ctx->Const.MaxFragmentProgramAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS;
+ ctx->Const.MaxFragmentProgramTemps = MAX_NV_FRAGMENT_PROGRAM_TEMPS;
+ ctx->Const.MaxFragmentProgramLocalParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
+ ctx->Const.MaxFragmentProgramEnvParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;/*XXX*/
+ ctx->Const.MaxFragmentProgramAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
+ ctx->Const.MaxFragmentProgramAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS;
+ ctx->Const.MaxFragmentProgramTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS;
+ ctx->Const.MaxFragmentProgramTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS;
+#endif
+ ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
+ ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
+
+ /* If we're running in the X server, do bounds checking to prevent
+ * segfaults and server crashes!
+ */
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ ctx->Const.CheckArrayBounds = GL_TRUE;
+#else
+ ctx->Const.CheckArrayBounds = GL_FALSE;
+#endif
+
+ ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
+}
+
+
+/**
+ * Initialize the attribute groups in a GL context.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes all the attributes, calling the respective init*
+ * functions for the more complex data structures.
+ */
+static GLboolean
+init_attrib_groups( GLcontext *ctx )
+{
+ assert(ctx);
+
+ /* Constants */
+ _mesa_init_constants( ctx );
+
+ /* Extensions */
+ _mesa_init_extensions( ctx );
+
+ /* Attribute Groups */
+ _mesa_init_accum( ctx );
+ _mesa_init_attrib( ctx );
+ _mesa_init_buffers( ctx );
+ _mesa_init_buffer_objects( ctx );
+ _mesa_init_color( ctx );
+ _mesa_init_colortables( ctx );
+ _mesa_init_current( ctx );
+ _mesa_init_depth( ctx );
+ _mesa_init_debug( ctx );
+ _mesa_init_display_list( ctx );
+ _mesa_init_eval( ctx );
+ _mesa_init_feedback( ctx );
+ _mesa_init_fog( ctx );
+ _mesa_init_histogram( ctx );
+ _mesa_init_hint( ctx );
+ _mesa_init_line( ctx );
+ _mesa_init_lighting( ctx );
+ _mesa_init_matrix( ctx );
+ _mesa_init_occlude( ctx );
+ _mesa_init_pixel( ctx );
+ _mesa_init_point( ctx );
+ _mesa_init_polygon( ctx );
+ _mesa_init_program( ctx );
+ _mesa_init_rastpos( ctx );
+ _mesa_init_stencil( ctx );
+ _mesa_init_transform( ctx );
+ _mesa_init_varray( ctx );
+ _mesa_init_viewport( ctx );
+
+ if (!_mesa_init_texture( ctx ))
+ return GL_FALSE;
+
+ _mesa_init_texture_s3tc( ctx );
+ _mesa_init_texture_fxt1( ctx );
+
+ /* Miscellaneous */
+ ctx->NewState = _NEW_ALL;
+ ctx->ErrorValue = (GLenum) GL_NO_ERROR;
+ ctx->_Facing = 0;
+#if CHAN_TYPE == GL_FLOAT
+ ctx->ClampFragmentColors = GL_FALSE; /* XXX temporary */
+#else
+ ctx->ClampFragmentColors = GL_TRUE;
+#endif
+ ctx->ClampVertexColors = GL_TRUE;
+
+ return GL_TRUE;
+}
+
+
+/**
+ * If the DRI libGL.so library is old, it may not have the entrypoints for
+ * some recent OpenGL extensions. Dynamically add them now.
+ * If we're building stand-alone Mesa where libGL.so has both the dispatcher
+ * and driver code, this won't be an issue (and calling this function won't
+ * do any harm).
+ */
+static void
+add_newer_entrypoints(void)
+{
+ unsigned i;
+ static const struct {
+ const char * const name;
+ unsigned offset;
+ }
+ newer_entrypoints[] = {
+ /* GL_ARB_window_pos aliases with GL_MESA_window_pos */
+ { "glWindowPos2dARB", 513 },
+ { "glWindowPos2dvARB", 514 },
+ { "glWindowPos2fARB", 515 },
+ { "glWindowPos2fvARB", 516 },
+ { "glWindowPos2iARB", 517 },
+ { "glWindowPos2ivARB", 518 },
+ { "glWindowPos2sARB", 519 },
+ { "glWindowPos2svARB", 520 },
+ { "glWindowPos3dARB", 521 },
+ { "glWindowPos3dvARB", 522 },
+ { "glWindowPos3fARB", 523 },
+ { "glWindowPos3fvARB", 524 },
+ { "glWindowPos3iARB", 525 },
+ { "glWindowPos3ivARB", 526 },
+ { "glWindowPos3sARB", 527 },
+ { "glWindowPos3svARB", 528 },
+#if FEATURE_NV_vertex_program
+ { "glAreProgramsResidentNV", 578 },
+ { "glBindProgramNV", 579 },
+ { "glDeleteProgramsNV", 580 },
+ { "glExecuteProgramNV", 581 },
+ { "glGenProgramsNV", 582 },
+ { "glGetProgramParameterdvNV", 583 },
+ { "glGetProgramParameterfvNV", 584 },
+ { "glGetProgramivNV", 585 },
+ { "glGetProgramStringNV", 586 },
+ { "glGetTrackMatrixivNV", 587 },
+ { "glGetVertexAttribdvNV", 588 },
+ { "glGetVertexAttribfvNV", 589 },
+ { "glGetVertexAttribivNV", 590 },
+ { "glGetVertexAttribPointervNV", 591 },
+ { "glIsProgramNV", 592 },
+ { "glLoadProgramNV", 593 },
+ { "glProgramParameter4dNV", 594 },
+ { "glProgramParameter4dvNV", 595 },
+ { "glProgramParameter4fNV", 596 },
+ { "glProgramParameter4fvNV", 597 },
+ { "glProgramParameters4dvNV", 598 },
+ { "glProgramParameters4fvNV", 599 },
+ { "glRequestResidentProgramsNV", 600 },
+ { "glTrackMatrixNV", 601 },
+ { "glVertexAttribPointerNV", 602 },
+ { "glVertexAttrib1dNV", 603 },
+ { "glVertexAttrib1dvNV", 604 },
+ { "glVertexAttrib1fNV", 605 },
+ { "glVertexAttrib1fvNV", 606 },
+ { "glVertexAttrib1sNV", 607 },
+ { "glVertexAttrib1svNV", 608 },
+ { "glVertexAttrib2dNV", 609 },
+ { "glVertexAttrib2dvNV", 610 },
+ { "glVertexAttrib2fNV", 611 },
+ { "glVertexAttrib2fvNV", 612 },
+ { "glVertexAttrib2sNV", 613 },
+ { "glVertexAttrib2svNV", 614 },
+ { "glVertexAttrib3dNV", 615 },
+ { "glVertexAttrib3dvNV", 616 },
+ { "glVertexAttrib3fNV", 617 },
+ { "glVertexAttrib3fvNV", 618 },
+ { "glVertexAttrib3sNV", 619 },
+ { "glVertexAttrib3svNV", 620 },
+ { "glVertexAttrib4dNV", 621 },
+ { "glVertexAttrib4dvNV", 622 },
+ { "glVertexAttrib4fNV", 623 },
+ { "glVertexAttrib4fvNV", 624 },
+ { "glVertexAttrib4sNV", 625 },
+ { "glVertexAttrib4svNV", 626 },
+ { "glVertexAttrib4ubNV", 627 },
+ { "glVertexAttrib4ubvNV", 628 },
+ { "glVertexAttribs1dvNV", 629 },
+ { "glVertexAttribs1fvNV", 630 },
+ { "glVertexAttribs1svNV", 631 },
+ { "glVertexAttribs2dvNV", 632 },
+ { "glVertexAttribs2fvNV", 633 },
+ { "glVertexAttribs2svNV", 634 },
+ { "glVertexAttribs3dvNV", 635 },
+ { "glVertexAttribs3fvNV", 636 },
+ { "glVertexAttribs3svNV", 637 },
+ { "glVertexAttribs4dvNV", 638 },
+ { "glVertexAttribs4fvNV", 639 },
+ { "glVertexAttribs4svNV", 640 },
+ { "glVertexAttribs4ubvNV", 641 },
+#endif
+ { "glPointParameteriNV", 642 },
+ { "glPointParameterivNV", 643 },
+ { "glMultiDrawArraysEXT", 644 },
+ { "glMultiDrawElementsEXT", 645 },
+ { "glMultiDrawArraysSUN", _gloffset_MultiDrawArraysEXT },
+ { "glMultiDrawElementsSUN", _gloffset_MultiDrawElementsEXT },
+ { "glActiveStencilFaceEXT", 646 },
+#if FEATURE_NV_fence
+ { "glDeleteFencesNV", 647 },
+ { "glGenFencesNV", 648 },
+ { "glIsFenceNV", 649 },
+ { "glTestFenceNV", 650 },
+ { "glGetFenceivNV", 651 },
+ { "glFinishFenceNV", 652 },
+ { "glSetFenceNV", 653 },
+#endif
+#if FEATURE_NV_fragment_program
+ { "glProgramNamedParameter4fNV", 682 },
+ { "glProgramNamedParameter4dNV", 683 },
+ { "glProgramNamedParameter4fvNV", 683 },
+ { "glProgramNamedParameter4dvNV", 684 },
+ { "glGetProgramNamedParameterfvNV", 685 },
+ { "glGetProgramNamedParameterdvNV", 686 },
+#endif
+#if FEATURE_ARB_vertex_program
+ { "glVertexAttrib1sARB", _gloffset_VertexAttrib1sNV },
+ { "glVertexAttrib1fARB", _gloffset_VertexAttrib1fNV },
+ { "glVertexAttrib1dARB", _gloffset_VertexAttrib1dNV },
+ { "glVertexAttrib2sARB", _gloffset_VertexAttrib2sNV },
+ { "glVertexAttrib2fARB", _gloffset_VertexAttrib2fNV },
+ { "glVertexAttrib2dARB", _gloffset_VertexAttrib2dNV },
+ { "glVertexAttrib3sARB", _gloffset_VertexAttrib3sNV },
+ { "glVertexAttrib3fARB", _gloffset_VertexAttrib3fNV },
+ { "glVertexAttrib3dARB", _gloffset_VertexAttrib3dNV },
+ { "glVertexAttrib4sARB", _gloffset_VertexAttrib4sNV },
+ { "glVertexAttrib4fARB", _gloffset_VertexAttrib4fNV },
+ { "glVertexAttrib4dARB", _gloffset_VertexAttrib4dNV },
+ { "glVertexAttrib4NubARB", _gloffset_VertexAttrib4ubNV },
+ { "glVertexAttrib1svARB", _gloffset_VertexAttrib1svNV },
+ { "glVertexAttrib1fvARB", _gloffset_VertexAttrib1fvNV },
+ { "glVertexAttrib1dvARB", _gloffset_VertexAttrib1dvNV },
+ { "glVertexAttrib2svARB", _gloffset_VertexAttrib2svNV },
+ { "glVertexAttrib2fvARB", _gloffset_VertexAttrib2fvNV },
+ { "glVertexAttrib2dvARB", _gloffset_VertexAttrib2dvNV },
+ { "glVertexAttrib3svARB", _gloffset_VertexAttrib3svNV },
+ { "glVertexAttrib3fvARB", _gloffset_VertexAttrib3fvNV },
+ { "glVertexAttrib3dvARB", _gloffset_VertexAttrib3dvNV },
+ { "glVertexAttrib4bvARB", _gloffset_VertexAttrib4bvARB },
+ { "glVertexAttrib4svARB", _gloffset_VertexAttrib4svNV },
+ { "glVertexAttrib4ivARB", _gloffset_VertexAttrib4ivARB },
+ { "glVertexAttrib4ubvARB", _gloffset_VertexAttrib4ubvARB },
+ { "glVertexAttrib4usvARB", _gloffset_VertexAttrib4usvARB },
+ { "glVertexAttrib4uivARB", _gloffset_VertexAttrib4uivARB },
+ { "glVertexAttrib4fvARB", _gloffset_VertexAttrib4fvNV },
+ { "glVertexAttrib4dvARB", _gloffset_VertexAttrib4dvNV },
+ { "glVertexAttrib4NbvARB", _gloffset_VertexAttrib4NbvARB },
+ { "glVertexAttrib4NsvARB", _gloffset_VertexAttrib4NsvARB },
+ { "glVertexAttrib4NivARB", _gloffset_VertexAttrib4NivARB },
+ { "glVertexAttrib4NubvARB", _gloffset_VertexAttrib4ubvNV },
+ { "glVertexAttrib4NusvARB", _gloffset_VertexAttrib4NusvARB },
+ { "glVertexAttrib4NuivARB", _gloffset_VertexAttrib4NuivARB },
+ { "glVertexAttribPointerARB", _gloffset_VertexAttribPointerARB },
+ { "glEnableVertexAttribArrayARB", _gloffset_EnableVertexAttribArrayARB },
+ { "glDisableVertexAttribArrayARB", _gloffset_DisableVertexAttribArrayARB },
+ { "glProgramStringARB", _gloffset_ProgramStringARB },
+ { "glBindProgramARB", _gloffset_BindProgramNV },
+ { "glDeleteProgramsARB", _gloffset_DeleteProgramsNV },
+ { "glGenProgramsARB", _gloffset_GenProgramsNV },
+ { "glIsProgramARB", _gloffset_IsProgramNV },
+ { "glProgramEnvParameter4dARB", _gloffset_ProgramEnvParameter4dARB },
+ { "glProgramEnvParameter4dvARB", _gloffset_ProgramEnvParameter4dvARB },
+ { "glProgramEnvParameter4fARB", _gloffset_ProgramEnvParameter4fARB },
+ { "glProgramEnvParameter4fvARB", _gloffset_ProgramEnvParameter4fvARB },
+ { "glProgramLocalParameter4dARB", _gloffset_ProgramLocalParameter4dARB },
+ { "glProgramLocalParameter4dvARB", _gloffset_ProgramLocalParameter4dvARB },
+ { "glProgramLocalParameter4fARB", _gloffset_ProgramLocalParameter4fARB },
+ { "glProgramLocalParameter4fvARB", _gloffset_ProgramLocalParameter4fvARB },
+ { "glGetProgramEnvParameterdvARB", _gloffset_GetProgramEnvParameterdvARB },
+ { "glGetProgramEnvParameterfvARB", _gloffset_GetProgramEnvParameterfvARB },
+ { "glGetProgramLocalParameterdvARB", _gloffset_GetProgramLocalParameterdvARB },
+ { "glGetProgramLocalParameterfvARB", _gloffset_GetProgramLocalParameterfvARB },
+ { "glGetProgramivARB", _gloffset_GetProgramivARB },
+ { "glGetProgramStringARB", _gloffset_GetProgramStringARB },
+ { "glGetVertexAttribdvARB", _gloffset_GetVertexAttribdvNV },
+ { "glGetVertexAttribfvARB", _gloffset_GetVertexAttribfvNV },
+ { "glGetVertexAttribivARB", _gloffset_GetVertexAttribivNV },
+ { "glGetVertexAttribPointervARB", _gloffset_GetVertexAttribPointervNV },
+#endif
+ { "glMultiModeDrawArraysIBM", _gloffset_MultiModeDrawArraysIBM },
+ { "glMultiModeDrawElementsIBM", _gloffset_MultiModeDrawElementsIBM },
+ };
+
+ for ( i = 0 ; i < Elements(newer_entrypoints) ; i++ ) {
+ _glapi_add_entrypoint( newer_entrypoints[i].name,
+ newer_entrypoints[i].offset );
+ }
+}
+
+
+/**
+ * Initialize a GLcontext struct (rendering context).
+ *
+ * This includes allocating all the other structs and arrays which hang off of
+ * the context by pointers.
+ * Note that the driver needs to pass in its dd_function_table here since
+ * we need to at least call driverFunctions->NewTextureObject to create the
+ * default texture objects.
+ *
+ * Called by _mesa_create_context().
+ *
+ * Performs the imports and exports callback tables initialization, and
+ * miscellaneous one-time initializations. If no shared context is supplied one
+ * is allocated, and increase its reference count. Setups the GL API dispatch
+ * tables. Initialize the TNL module. Sets the maximum Z buffer depth.
+ * Finally queries the \c MESA_DEBUG and \c MESA_VERBOSE environment variables
+ * for debug flags.
+ *
+ * \param ctx the context to initialize
+ * \param visual describes the visual attributes for this context
+ * \param share_list points to context to share textures, display lists,
+ * etc with, or NULL
+ * \param driverFunctions table of device driver functions for this context
+ * to use
+ * \param driverContext pointer to driver-specific context data
+ */
+GLboolean
+_mesa_initialize_context( GLcontext *ctx,
+ const GLvisual *visual,
+ GLcontext *share_list,
+ const struct dd_function_table *driverFunctions,
+ void *driverContext )
+{
+ GLuint dispatchSize;
+
+ ASSERT(driverContext);
+ assert(driverFunctions->NewTextureObject);
+
+ /* If the driver wants core Mesa to use special imports, it'll have to
+ * override these defaults.
+ */
+ _mesa_init_default_imports( &(ctx->imports), driverContext );
+
+ /* initialize the exports (Mesa functions called by the window system) */
+ _mesa_init_default_exports( &(ctx->exports) );
+
+ /* misc one-time initializations */
+ one_time_init(ctx);
+
+ ctx->Visual = *visual;
+ ctx->DrawBuffer = NULL;
+ ctx->ReadBuffer = NULL;
+
+ /* Plug in driver functions and context pointer here.
+ * This is important because when we call alloc_shared_state() below
+ * we'll call ctx->Driver.NewTextureObject() to create the default
+ * textures.
+ */
+ ctx->Driver = *driverFunctions;
+ ctx->DriverCtx = driverContext;
+
+ if (share_list) {
+ /* share state with another context */
+ ctx->Shared = share_list->Shared;
+ }
+ else {
+ /* allocate new, unshared state */
+ if (!alloc_shared_state( ctx )) {
+ return GL_FALSE;
+ }
+ }
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+ ctx->Shared->RefCount++;
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+
+ if (!init_attrib_groups( ctx )) {
+ free_shared_state(ctx, ctx->Shared);
+ return GL_FALSE;
+ }
+
+ /* libGL ABI coordination */
+ add_newer_entrypoints();
+
+ /* Find the larger of Mesa's dispatch table and libGL's dispatch table.
+ * In practice, this'll be the same for stand-alone Mesa. But for DRI
+ * Mesa we do this to accomodate different versions of libGL and various
+ * DRI drivers.
+ */
+ dispatchSize = MAX2(_glapi_get_dispatch_table_size(),
+ sizeof(struct _glapi_table) / sizeof(void *));
+
+ /* setup API dispatch tables */
+ ctx->Exec = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*));
+ ctx->Save = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*));
+ if (!ctx->Exec || !ctx->Save) {
+ free_shared_state(ctx, ctx->Shared);
+ if (ctx->Exec)
+ FREE( ctx->Exec );
+ }
+ _mesa_init_exec_table(ctx->Exec, dispatchSize);
+ ctx->CurrentDispatch = ctx->Exec;
+
+#if _HAVE_FULL_GL
+ _mesa_init_dlist_table(ctx->Save, dispatchSize);
+ _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
+
+
+ /* Neutral tnl module stuff */
+ _mesa_init_exec_vtxfmt( ctx );
+ ctx->TnlModule.Current = NULL;
+ ctx->TnlModule.SwapCount = 0;
+#endif
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Allocate and initialize a GLcontext structure.
+ * Note that the driver needs to pass in its dd_function_table here since
+ * we need to at least call driverFunctions->NewTextureObject to initialize
+ * the rendering context.
+ *
+ * \param visual a GLvisual pointer (we copy the struct contents)
+ * \param share_list another context to share display lists with or NULL
+ * \param driverFunctions points to the dd_function_table into which the
+ * driver has plugged in all its special functions.
+ * \param driverCtx points to the device driver's private context state
+ *
+ * \return pointer to a new __GLcontextRec or NULL if error.
+ */
+GLcontext *
+_mesa_create_context( const GLvisual *visual,
+ GLcontext *share_list,
+ const struct dd_function_table *driverFunctions,
+ void *driverContext )
+
+{
+ GLcontext *ctx;
+
+ ASSERT(visual);
+ ASSERT(driverContext);
+
+ ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext));
+ if (!ctx)
+ return NULL;
+
+ if (_mesa_initialize_context(ctx, visual, share_list,
+ driverFunctions, driverContext)) {
+ return ctx;
+ }
+ else {
+ _mesa_free(ctx);
+ return NULL;
+ }
+}
+
+
+/**
+ * Free the data associated with the given context.
+ *
+ * But doesn't free the GLcontext struct itself.
+ *
+ * \sa _mesa_initialize_context() and init_attrib_groups().
+ */
+void
+_mesa_free_context_data( GLcontext *ctx )
+{
+ /* if we're destroying the current context, unbind it first */
+ if (ctx == _mesa_get_current_context()) {
+ _mesa_make_current(NULL, NULL);
+ }
+
+ _mesa_free_lighting_data( ctx );
+ _mesa_free_eval_data( ctx );
+ _mesa_free_texture_data( ctx );
+ _mesa_free_matrix_data( ctx );
+ _mesa_free_viewport_data( ctx );
+ _mesa_free_colortables_data( ctx );
+ _mesa_free_program_data(ctx);
+ _mesa_free_occlude_data(ctx);
+
+#if FEATURE_ARB_vertex_buffer_object
+ _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj);
+#endif
+
+ /* Shared context state (display lists, textures, etc) */
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+ ctx->Shared->RefCount--;
+ assert(ctx->Shared->RefCount >= 0);
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+ if (ctx->Shared->RefCount == 0) {
+ /* free shared state */
+ free_shared_state( ctx, ctx->Shared );
+ }
+
+ if (ctx->Extensions.String)
+ FREE((void *) ctx->Extensions.String);
+
+ FREE(ctx->Exec);
+ FREE(ctx->Save);
+}
+
+
+/**
+ * Destroy a GLcontext structure.
+ *
+ * \param ctx GL context.
+ *
+ * Calls _mesa_free_context_data() and frees the GLcontext structure itself.
+ */
+void
+_mesa_destroy_context( GLcontext *ctx )
+{
+ if (ctx) {
+ _mesa_free_context_data(ctx);
+ FREE( (void *) ctx );
+ }
+}
+
+
+#if _HAVE_FULL_GL
+/**
+ * Copy attribute groups from one context to another.
+ *
+ * \param src source context
+ * \param dst destination context
+ * \param mask bitwise OR of GL_*_BIT flags
+ *
+ * According to the bits specified in \p mask, copies the corresponding
+ * attributes from \p src into \p dst. For many of the attributes a simple \c
+ * memcpy is not enough due to the existence of internal pointers in their data
+ * structures.
+ */
+void
+_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
+{
+ if (mask & GL_ACCUM_BUFFER_BIT) {
+ /* OK to memcpy */
+ dst->Accum = src->Accum;
+ }
+ if (mask & GL_COLOR_BUFFER_BIT) {
+ /* OK to memcpy */
+ dst->Color = src->Color;
+ }
+ if (mask & GL_CURRENT_BIT) {
+ /* OK to memcpy */
+ dst->Current = src->Current;
+ }
+ if (mask & GL_DEPTH_BUFFER_BIT) {
+ /* OK to memcpy */
+ dst->Depth = src->Depth;
+ }
+ if (mask & GL_ENABLE_BIT) {
+ /* no op */
+ }
+ if (mask & GL_EVAL_BIT) {
+ /* OK to memcpy */
+ dst->Eval = src->Eval;
+ }
+ if (mask & GL_FOG_BIT) {
+ /* OK to memcpy */
+ dst->Fog = src->Fog;
+ }
+ if (mask & GL_HINT_BIT) {
+ /* OK to memcpy */
+ dst->Hint = src->Hint;
+ }
+ if (mask & GL_LIGHTING_BIT) {
+ GLuint i;
+ /* begin with memcpy */
+ MEMCPY( &dst->Light, &src->Light, sizeof(struct gl_light) );
+ /* fixup linked lists to prevent pointer insanity */
+ make_empty_list( &(dst->Light.EnabledList) );
+ for (i = 0; i < MAX_LIGHTS; i++) {
+ if (dst->Light.Light[i].Enabled) {
+ insert_at_tail(&(dst->Light.EnabledList), &(dst->Light.Light[i]));
+ }
+ }
+ }
+ if (mask & GL_LINE_BIT) {
+ /* OK to memcpy */
+ dst->Line = src->Line;
+ }
+ if (mask & GL_LIST_BIT) {
+ /* OK to memcpy */
+ dst->List = src->List;
+ }
+ if (mask & GL_PIXEL_MODE_BIT) {
+ /* OK to memcpy */
+ dst->Pixel = src->Pixel;
+ }
+ if (mask & GL_POINT_BIT) {
+ /* OK to memcpy */
+ dst->Point = src->Point;
+ }
+ if (mask & GL_POLYGON_BIT) {
+ /* OK to memcpy */
+ dst->Polygon = src->Polygon;
+ }
+ if (mask & GL_POLYGON_STIPPLE_BIT) {
+ /* Use loop instead of MEMCPY due to problem with Portland Group's
+ * C compiler. Reported by John Stone.
+ */
+ GLuint i;
+ for (i = 0; i < 32; i++) {
+ dst->PolygonStipple[i] = src->PolygonStipple[i];
+ }
+ }
+ if (mask & GL_SCISSOR_BIT) {
+ /* OK to memcpy */
+ dst->Scissor = src->Scissor;
+ }
+ if (mask & GL_STENCIL_BUFFER_BIT) {
+ /* OK to memcpy */
+ dst->Stencil = src->Stencil;
+ }
+ if (mask & GL_TEXTURE_BIT) {
+ /* Cannot memcpy because of pointers */
+ _mesa_copy_texture_state(src, dst);
+ }
+ if (mask & GL_TRANSFORM_BIT) {
+ /* OK to memcpy */
+ dst->Transform = src->Transform;
+ }
+ if (mask & GL_VIEWPORT_BIT) {
+ /* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */
+ dst->Viewport.X = src->Viewport.X;
+ dst->Viewport.Y = src->Viewport.Y;
+ dst->Viewport.Width = src->Viewport.Width;
+ dst->Viewport.Height = src->Viewport.Height;
+ dst->Viewport.Near = src->Viewport.Near;
+ dst->Viewport.Far = src->Viewport.Far;
+ _math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap);
+ }
+
+ /* XXX FIXME: Call callbacks?
+ */
+ dst->NewState = _NEW_ALL;
+}
+#endif
+
+
+/**
+ * Check if the given context can render into the given framebuffer
+ * by checking visual attributes.
+ * \return GL_TRUE if compatible, GL_FALSE otherwise.
+ */
+static GLboolean
+check_compatible(const GLcontext *ctx, const GLframebuffer *buffer)
+{
+ const GLvisual *ctxvis = &ctx->Visual;
+ const GLvisual *bufvis = &buffer->Visual;
+
+ if (ctxvis == bufvis)
+ return GL_TRUE;
+
+ if (ctxvis->rgbMode != bufvis->rgbMode)
+ return GL_FALSE;
+ if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode)
+ return GL_FALSE;
+ if (ctxvis->stereoMode && !bufvis->stereoMode)
+ return GL_FALSE;
+ if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer)
+ return GL_FALSE;
+ if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer)
+ return GL_FALSE;
+ if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer)
+ return GL_FALSE;
+ if (ctxvis->redMask && ctxvis->redMask != bufvis->redMask)
+ return GL_FALSE;
+ if (ctxvis->greenMask && ctxvis->greenMask != bufvis->greenMask)
+ return GL_FALSE;
+ if (ctxvis->blueMask && ctxvis->blueMask != bufvis->blueMask)
+ return GL_FALSE;
+ if (ctxvis->depthBits && ctxvis->depthBits != bufvis->depthBits)
+ return GL_FALSE;
+ if (ctxvis->stencilBits && ctxvis->stencilBits != bufvis->stencilBits)
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Set the current context, binding the given frame buffer to the context.
+ *
+ * \param newCtx new GL context.
+ * \param buffer framebuffer.
+ *
+ * Calls _mesa_make_current2() with \p buffer as read and write framebuffer.
+ */
+void
+_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer )
+{
+ _mesa_make_current2( newCtx, buffer, buffer );
+}
+
+/**
+ * Bind the given context to the given draw-buffer and read-buffer and
+ * make it the current context for this thread.
+ *
+ * \param newCtx new GL context. If NULL then there will be no current GL
+ * context.
+ * \param drawBuffer draw framebuffer.
+ * \param readBuffer read framebuffer.
+ *
+ * Check that the context's and framebuffer's visuals are compatible, returning
+ * immediately otherwise. Sets the glapi current context via
+ * _glapi_set_context(). If \p newCtx is not NULL, associates \p drawBuffer and
+ * \p readBuffer with it and calls dd_function_table::ResizeBuffers if the buffers size has changed.
+ * Calls dd_function_table::MakeCurrent callback if defined.
+ *
+ * When a context is bound by the first time and the \c MESA_INFO environment
+ * variable is set it calls print_info() as an aid for remote user
+ * troubleshooting.
+ */
+void
+_mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer,
+ GLframebuffer *readBuffer )
+{
+ if (MESA_VERBOSE)
+ _mesa_debug(newCtx, "_mesa_make_current2()\n");
+
+ /* Check that the context's and framebuffer's visuals are compatible.
+ */
+ if (newCtx && drawBuffer && newCtx->DrawBuffer != drawBuffer) {
+ if (!check_compatible(newCtx, drawBuffer))
+ return;
+ }
+ if (newCtx && readBuffer && newCtx->ReadBuffer != readBuffer) {
+ if (!check_compatible(newCtx, readBuffer))
+ return;
+ }
+
+ /* We call this function periodically (just here for now) in
+ * order to detect when multithreading has begun.
+ */
+ _glapi_check_multithread();
+
+ _glapi_set_context((void *) newCtx);
+ ASSERT(_mesa_get_current_context() == newCtx);
+
+
+ if (!newCtx) {
+ _glapi_set_dispatch(NULL); /* none current */
+ }
+ else {
+ _glapi_set_dispatch(newCtx->CurrentDispatch);
+
+ if (drawBuffer && readBuffer) {
+ /* TODO: check if newCtx and buffer's visual match??? */
+ newCtx->DrawBuffer = drawBuffer;
+ newCtx->ReadBuffer = readBuffer;
+ newCtx->NewState |= _NEW_BUFFERS;
+
+#if _HAVE_FULL_GL
+ if (drawBuffer->Width == 0 && drawBuffer->Height == 0) {
+ /* get initial window size */
+ GLuint bufWidth, bufHeight;
+
+ /* ask device driver for size of output buffer */
+ (*newCtx->Driver.GetBufferSize)( drawBuffer, &bufWidth, &bufHeight );
+
+ if (drawBuffer->Width != bufWidth ||
+ drawBuffer->Height != bufHeight) {
+
+ drawBuffer->Width = bufWidth;
+ drawBuffer->Height = bufHeight;
+
+ newCtx->Driver.ResizeBuffers( drawBuffer );
+ }
+ }
+
+ if (readBuffer != drawBuffer &&
+ readBuffer->Width == 0 && readBuffer->Height == 0) {
+ /* get initial window size */
+ GLuint bufWidth, bufHeight;
+
+ /* ask device driver for size of output buffer */
+ (*newCtx->Driver.GetBufferSize)( readBuffer, &bufWidth, &bufHeight );
+
+ if (readBuffer->Width != bufWidth ||
+ readBuffer->Height != bufHeight) {
+
+ readBuffer->Width = bufWidth;
+ readBuffer->Height = bufHeight;
+
+ newCtx->Driver.ResizeBuffers( readBuffer );
+ }
+ }
+#endif
+ }
+
+ /* Alert the driver - usually passed on to the sw t&l module,
+ * but also used to detect threaded cases in the radeon codegen
+ * hw t&l module.
+ */
+ if (newCtx->Driver.MakeCurrent)
+ newCtx->Driver.MakeCurrent( newCtx, drawBuffer, readBuffer );
+
+ /* We can use this to help debug user's problems. Tell them to set
+ * the MESA_INFO env variable before running their app. Then the
+ * first time each context is made current we'll print some useful
+ * information.
+ */
+ if (newCtx->FirstTimeCurrent) {
+ if (_mesa_getenv("MESA_INFO")) {
+ _mesa_print_info();
+ }
+ newCtx->FirstTimeCurrent = GL_FALSE;
+ }
+ }
+}
+
+/**
+ * Get current context for the calling thread.
+ *
+ * \return pointer to the current GL context.
+ *
+ * Calls _glapi_get_context(). This isn't the fastest way to get the current
+ * context. If you need speed, see the #GET_CURRENT_CONTEXT macro in context.h.
+ */
+GLcontext *
+_mesa_get_current_context( void )
+{
+ return (GLcontext *) _glapi_get_context();
+}
+
+/**
+ * Get context's current API dispatch table.
+ *
+ * It'll either be the immediate-mode execute dispatcher or the display list
+ * compile dispatcher.
+ *
+ * \param ctx GL context.
+ *
+ * \return pointer to dispatch_table.
+ *
+ * Simply returns __GLcontextRec::CurrentDispatch.
+ */
+struct _glapi_table *
+_mesa_get_dispatch(GLcontext *ctx)
+{
+ return ctx->CurrentDispatch;
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Miscellaneous functions */
+/**********************************************************************/
+/*@{*/
+
+/**
+ * Record an error.
+ *
+ * \param ctx GL context.
+ * \param error error code.
+ *
+ * Records the given error code and call the driver's dd_function_table::Error
+ * function if defined.
+ *
+ * \sa
+ * This is called via _mesa_error().
+ */
+void
+_mesa_record_error( GLcontext *ctx, GLenum error )
+{
+ if (!ctx)
+ return;
+
+ if (ctx->ErrorValue == GL_NO_ERROR) {
+ ctx->ErrorValue = error;
+ }
+
+ /* Call device driver's error handler, if any. This is used on the Mac. */
+ if (ctx->Driver.Error) {
+ (*ctx->Driver.Error)( ctx );
+ }
+}
+
+/**
+ * Execute glFinish().
+ *
+ * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the
+ * dd_function_table::Finish driver callback, if not NULL.
+ */
+void GLAPIENTRY
+_mesa_Finish( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ if (ctx->Driver.Finish) {
+ (*ctx->Driver.Finish)( ctx );
+ }
+}
+
+/**
+ * Execute glFlush().
+ *
+ * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the
+ * dd_function_table::Flush driver callback, if not NULL.
+ */
+void GLAPIENTRY
+_mesa_Flush( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ if (ctx->Driver.Flush) {
+ (*ctx->Driver.Flush)( ctx );
+ }
+}
+
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/context.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/context.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/context.h Fri Dec 10 10:05:20 2004
@@ -0,0 +1,395 @@
+/**
+ * \file context.h
+ * Mesa context/visual/framebuffer management functions.
+ *
+ * There are three Mesa data types which are meant to be used by device
+ * drivers:
+ * - GLcontext: this contains the Mesa rendering state
+ * - GLvisual: this describes the color buffer (RGB vs. ci), whether or not
+ * there's a depth buffer, stencil buffer, etc.
+ * - GLframebuffer: contains pointers to the depth buffer, stencil buffer,
+ * accum buffer and alpha buffers.
+ *
+ * These types should be encapsulated by corresponding device driver
+ * data types. See xmesa.h and xmesaP.h for an example.
+ *
+ * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes
+ * which the device driver must derive from.
+ *
+ * The following functions create and destroy these data types.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef CONTEXT_H
+#define CONTEXT_H
+
+
+#include "glapi.h"
+#include "imports.h"
+#include "mtypes.h"
+
+
+/**********************************************************************/
+/** \name Create/destroy a GLvisual. */
+/*@{*/
+
+extern GLvisual *
+_mesa_create_visual( GLboolean rgbFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits,
+ GLint indexBits,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumRedBits,
+ GLint accumGreenBits,
+ GLint accumBlueBits,
+ GLint accumAlphaBits,
+ GLint numSamples );
+
+extern GLboolean
+_mesa_initialize_visual( GLvisual *v,
+ GLboolean rgbFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits,
+ GLint indexBits,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumRedBits,
+ GLint accumGreenBits,
+ GLint accumBlueBits,
+ GLint accumAlphaBits,
+ GLint numSamples );
+
+extern void
+_mesa_destroy_visual( GLvisual *vis );
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Create/destroy a GLframebuffer. */
+/*@{*/
+
+extern GLframebuffer *
+_mesa_create_framebuffer( const GLvisual *visual,
+ GLboolean softwareDepth,
+ GLboolean softwareStencil,
+ GLboolean softwareAccum,
+ GLboolean softwareAlpha );
+
+extern void
+_mesa_initialize_framebuffer( GLframebuffer *fb,
+ const GLvisual *visual,
+ GLboolean softwareDepth,
+ GLboolean softwareStencil,
+ GLboolean softwareAccum,
+ GLboolean softwareAlpha );
+
+extern void
+_mesa_free_framebuffer_data( GLframebuffer *buffer );
+
+extern void
+_mesa_destroy_framebuffer( GLframebuffer *buffer );
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Create/destroy a GLcontext. */
+/*@{*/
+
+extern GLcontext *
+_mesa_create_context( const GLvisual *visual,
+ GLcontext *share_list,
+ const struct dd_function_table *driverFunctions,
+ void *driverContext );
+
+extern GLboolean
+_mesa_initialize_context( GLcontext *ctx,
+ const GLvisual *visual,
+ GLcontext *share_list,
+ const struct dd_function_table *driverFunctions,
+ void *driverContext );
+
+extern void
+_mesa_free_context_data( GLcontext *ctx );
+
+extern void
+_mesa_destroy_context( GLcontext *ctx );
+
+
+extern void
+_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
+
+
+extern void
+_mesa_make_current( GLcontext *ctx, GLframebuffer *buffer );
+
+
+extern void
+_mesa_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
+ GLframebuffer *readBuffer );
+
+
+extern GLcontext *
+_mesa_get_current_context(void);
+
+/*@}*/
+
+
+/**
+ * Macro for declaration and fetching the current context.
+ *
+ * \param C local variable which will hold the current context.
+ *
+ * It should be used in the variable declaration area of a function:
+ * \code
+ * ...
+ * {
+ * GET_CURRENT_CONTEXT(ctx);
+ * ...
+ * \endcode
+ */
+#ifdef THREADS
+
+#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())
+
+#else
+
+#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
+
+#endif
+
+
+
+/**********************************************************************/
+/** \name OpenGL SI-style export functions. */
+/*@{*/
+
+extern GLboolean
+_mesa_destroyContext(__GLcontext *gc);
+
+extern GLboolean
+_mesa_loseCurrent(__GLcontext *gc);
+
+extern GLboolean
+_mesa_makeCurrent(__GLcontext *gc);
+
+extern GLboolean
+_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare);
+
+extern GLboolean
+_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask);
+
+extern GLboolean
+_mesa_forceCurrent(__GLcontext *gc);
+
+extern GLboolean
+_mesa_notifyResize(__GLcontext *gc);
+
+extern void
+_mesa_notifyDestroy(__GLcontext *gc);
+
+extern void
+_mesa_notifySwapBuffers(__GLcontext *gc);
+
+extern struct __GLdispatchStateRec *
+_mesa_dispatchExec(__GLcontext *gc);
+
+extern void
+_mesa_beginDispatchOverride(__GLcontext *gc);
+
+extern void
+_mesa_endDispatchOverride(__GLcontext *gc);
+
+/*@}*/
+
+
+extern struct _glapi_table *
+_mesa_get_dispatch(GLcontext *ctx);
+
+
+
+/**********************************************************************/
+/** \name Miscellaneous */
+/*@{*/
+
+extern void
+_mesa_record_error( GLcontext *ctx, GLenum error );
+
+
+extern void GLAPIENTRY
+_mesa_Finish( void );
+
+extern void GLAPIENTRY
+_mesa_Flush( void );
+
+/*@}*/
+
+
+
+/**********************************************************************/
+/** \name Macros for contexts/flushing. */
+/*@{*/
+
+
+/**
+ * Flush vertices.
+ *
+ * \param ctx GL context.
+ * \param newstate new state.
+ *
+ * Checks if dd_function_table::NeedFlush is marked to flush stored vertices,
+ * and calls dd_function_table::FlushVertices if so. Marks
+ * __GLcontextRec::NewState with \p newstate.
+ */
+#define FLUSH_VERTICES(ctx, newstate) \
+do { \
+ if (MESA_VERBOSE & VERBOSE_STATE) \
+ _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
+ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
+ ctx->NewState |= newstate; \
+} while (0)
+
+/**
+ * Flush current state.
+ *
+ * \param ctx GL context.
+ * \param newstate new state.
+ *
+ * Checks if dd_function_table::NeedFlush is marked to flush current state,
+ * and calls dd_function_table::FlushVertices if so. Marks
+ * __GLcontextRec::NewState with \p newstate.
+ */
+#define FLUSH_CURRENT(ctx, newstate) \
+do { \
+ if (MESA_VERBOSE & VERBOSE_STATE) \
+ _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \
+ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
+ ctx->NewState |= newstate; \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair, with return value.
+ *
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
+do { \
+ if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
+ _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ return retval; \
+ } \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair.
+ *
+ * \param ctx GL context.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
+do { \
+ if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
+ _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ return; \
+ } \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices.
+ *
+ * \param ctx GL context.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
+do { \
+ ASSERT_OUTSIDE_BEGIN_END(ctx); \
+ FLUSH_VERTICES(ctx, 0); \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices, with return value.
+ *
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
+do { \
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
+ FLUSH_VERTICES(ctx, 0); \
+} while (0)
+
+
+/*@}*/
+
+
+
+/**
+ * Macros to help evaluate current state conditions
+ */
+
+/*@{*/
+
+/**
+ * Is the secondary color needed?
+ */
+#define NEED_SECONDARY_COLOR(CTX) \
+ (((CTX)->Light.Enabled && \
+ (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
+ || (CTX)->Fog.ColorSumEnabled \
+ || ((CTX)->VertexProgram._Enabled && \
+ ((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \
+ || ((CTX)->FragmentProgram._Enabled && \
+ ((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \
+ )
+
+
+/**
+ * Is two-sided lighting in effect?
+ */
+#define NEED_TWO_SIDED_LIGHTING(CTX) \
+ (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+
+
+/*@}*/
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/convolve.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/convolve.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/convolve.c Fri Dec 10 10:32:28 2004
@@ -0,0 +1,1412 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Image convolution functions.
+ *
+ * Notes: filter kernel elements are indexed by and as in
+ * the GL spec.
+ */
+
+
+#include "glheader.h"
+#include "colormac.h"
+#include "convolve.h"
+#include "context.h"
+#include "image.h"
+#include "mtypes.h"
+#include "state.h"
+
+
+/*
+ * Given an internalFormat token passed to glConvolutionFilter
+ * or glSeparableFilter, return the corresponding base format.
+ * Return -1 if invalid token.
+ */
+static GLint
+base_filter_format( GLenum format )
+{
+ switch (format) {
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return GL_ALPHA;
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ return GL_LUMINANCE;
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return GL_LUMINANCE_ALPHA;
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY8:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ return GL_INTENSITY;
+ case GL_RGB:
+ case GL_R3_G3_B2:
+ case GL_RGB4:
+ case GL_RGB5:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return GL_RGB;
+ case 4:
+ case GL_RGBA:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return GL_RGBA;
+ default:
+ return -1; /* error */
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
+{
+ GLint baseFormat;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target != GL_CONVOLUTION_1D) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)");
+ return;
+ }
+
+ baseFormat = base_filter_format(internalFormat);
+ if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)");
+ return;
+ }
+
+ if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)");
+ return;
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)");
+ return;
+ }
+
+ if (format == GL_COLOR_INDEX ||
+ format == GL_STENCIL_INDEX ||
+ format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
+ type == GL_BITMAP) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)");
+ return;
+ }
+
+ ctx->Convolution1D.Format = format;
+ ctx->Convolution1D.InternalFormat = internalFormat;
+ ctx->Convolution1D.Width = width;
+ ctx->Convolution1D.Height = 1;
+
+ /* unpack filter image */
+ _mesa_unpack_color_span_float(ctx, width, GL_RGBA,
+ ctx->Convolution1D.Filter,
+ format, type, image, &ctx->Unpack,
+ 0); /* transferOps */
+
+ /* apply scale and bias */
+ {
+ const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[0];
+ const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[0];
+ GLint i;
+ for (i = 0; i < width; i++) {
+ GLfloat r = ctx->Convolution1D.Filter[i * 4 + 0];
+ GLfloat g = ctx->Convolution1D.Filter[i * 4 + 1];
+ GLfloat b = ctx->Convolution1D.Filter[i * 4 + 2];
+ GLfloat a = ctx->Convolution1D.Filter[i * 4 + 3];
+ r = r * scale[0] + bias[0];
+ g = g * scale[1] + bias[1];
+ b = b * scale[2] + bias[2];
+ a = a * scale[3] + bias[3];
+ ctx->Convolution1D.Filter[i * 4 + 0] = r;
+ ctx->Convolution1D.Filter[i * 4 + 1] = g;
+ ctx->Convolution1D.Filter[i * 4 + 2] = b;
+ ctx->Convolution1D.Filter[i * 4 + 3] = a;
+ }
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
+{
+ GLint baseFormat;
+ GLint i;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target != GL_CONVOLUTION_2D) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)");
+ return;
+ }
+
+ baseFormat = base_filter_format(internalFormat);
+ if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)");
+ return;
+ }
+
+ if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)");
+ return;
+ }
+ if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)");
+ return;
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)");
+ return;
+ }
+ if (format == GL_COLOR_INDEX ||
+ format == GL_STENCIL_INDEX ||
+ format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
+ type == GL_BITMAP) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)");
+ return;
+ }
+
+ /* this should have been caught earlier */
+ assert(_mesa_components_in_format(format));
+
+ ctx->Convolution2D.Format = format;
+ ctx->Convolution2D.InternalFormat = internalFormat;
+ ctx->Convolution2D.Width = width;
+ ctx->Convolution2D.Height = height;
+
+ /* Unpack filter image. We always store filters in RGBA format. */
+ for (i = 0; i < height; i++) {
+ const GLvoid *src = _mesa_image_address(&ctx->Unpack, image, width,
+ height, format, type, 0, i, 0);
+ GLfloat *dst = ctx->Convolution2D.Filter + i * width * 4;
+ _mesa_unpack_color_span_float(ctx, width, GL_RGBA, dst,
+ format, type, src, &ctx->Unpack,
+ 0); /* transferOps */
+ }
+
+ /* apply scale and bias */
+ {
+ const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[1];
+ const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[1];
+ for (i = 0; i < width * height; i++) {
+ GLfloat r = ctx->Convolution2D.Filter[i * 4 + 0];
+ GLfloat g = ctx->Convolution2D.Filter[i * 4 + 1];
+ GLfloat b = ctx->Convolution2D.Filter[i * 4 + 2];
+ GLfloat a = ctx->Convolution2D.Filter[i * 4 + 3];
+ r = r * scale[0] + bias[0];
+ g = g * scale[1] + bias[1];
+ b = b * scale[2] + bias[2];
+ a = a * scale[3] + bias[3];
+ ctx->Convolution2D.Filter[i * 4 + 0] = r;
+ ctx->Convolution2D.Filter[i * 4 + 1] = g;
+ ctx->Convolution2D.Filter[i * 4 + 2] = b;
+ ctx->Convolution2D.Filter[i * 4 + 3] = a;
+ }
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint c;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ switch (target) {
+ case GL_CONVOLUTION_1D:
+ c = 0;
+ break;
+ case GL_CONVOLUTION_2D:
+ c = 1;
+ break;
+ case GL_SEPARABLE_2D:
+ c = 2;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_MODE:
+ if (param == (GLfloat) GL_REDUCE ||
+ param == (GLfloat) GL_CONSTANT_BORDER ||
+ param == (GLfloat) GL_REPLICATE_BORDER) {
+ ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)");
+ return;
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint c;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ switch (target) {
+ case GL_CONVOLUTION_1D:
+ c = 0;
+ break;
+ case GL_CONVOLUTION_2D:
+ c = 1;
+ break;
+ case GL_SEPARABLE_2D:
+ c = 2;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_COLOR:
+ COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params);
+ break;
+ case GL_CONVOLUTION_BORDER_MODE:
+ if (params[0] == (GLfloat) GL_REDUCE ||
+ params[0] == (GLfloat) GL_CONSTANT_BORDER ||
+ params[0] == (GLfloat) GL_REPLICATE_BORDER) {
+ ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)");
+ return;
+ }
+ break;
+ case GL_CONVOLUTION_FILTER_SCALE:
+ COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params);
+ break;
+ case GL_CONVOLUTION_FILTER_BIAS:
+ COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params);
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)");
+ return;
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint c;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ switch (target) {
+ case GL_CONVOLUTION_1D:
+ c = 0;
+ break;
+ case GL_CONVOLUTION_2D:
+ c = 1;
+ break;
+ case GL_SEPARABLE_2D:
+ c = 2;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_MODE:
+ if (param == (GLint) GL_REDUCE ||
+ param == (GLint) GL_CONSTANT_BORDER ||
+ param == (GLint) GL_REPLICATE_BORDER) {
+ ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)");
+ return;
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint c;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ switch (target) {
+ case GL_CONVOLUTION_1D:
+ c = 0;
+ break;
+ case GL_CONVOLUTION_2D:
+ c = 1;
+ break;
+ case GL_SEPARABLE_2D:
+ c = 2;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_COLOR:
+ ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]);
+ ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]);
+ ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]);
+ ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]);
+ break;
+ case GL_CONVOLUTION_BORDER_MODE:
+ if (params[0] == (GLint) GL_REDUCE ||
+ params[0] == (GLint) GL_CONSTANT_BORDER ||
+ params[0] == (GLint) GL_REPLICATE_BORDER) {
+ ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)");
+ return;
+ }
+ break;
+ case GL_CONVOLUTION_FILTER_SCALE:
+ /* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */
+ /* need cast to prevent compiler warnings */
+ ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0];
+ ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1];
+ ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2];
+ ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3];
+ break;
+ case GL_CONVOLUTION_FILTER_BIAS:
+ /* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */
+ /* need cast to prevent compiler warnings */
+ ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0];
+ ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1];
+ ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2];
+ ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3];
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)");
+ return;
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
+{
+ GLint baseFormat;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target != GL_CONVOLUTION_1D) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)");
+ return;
+ }
+
+ baseFormat = base_filter_format(internalFormat);
+ if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)");
+ return;
+ }
+
+ if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)");
+ return;
+ }
+
+ ctx->Driver.CopyConvolutionFilter1D( ctx, target,
+ internalFormat, x, y, width);
+}
+
+
+void GLAPIENTRY
+_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ GLint baseFormat;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target != GL_CONVOLUTION_2D) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)");
+ return;
+ }
+
+ baseFormat = base_filter_format(internalFormat);
+ if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)");
+ return;
+ }
+
+ if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)");
+ return;
+ }
+ if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)");
+ return;
+ }
+
+ ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y,
+ width, height );
+
+}
+
+
+void GLAPIENTRY
+_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
+{
+ const struct gl_convolution_attrib *filter;
+ GLuint row;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)");
+ return;
+ }
+
+ if (format == GL_COLOR_INDEX ||
+ format == GL_STENCIL_INDEX ||
+ format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
+ type == GL_BITMAP) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)");
+ return;
+ }
+
+ switch (target) {
+ case GL_CONVOLUTION_1D:
+ filter = &(ctx->Convolution1D);
+ break;
+ case GL_CONVOLUTION_2D:
+ filter = &(ctx->Convolution2D);
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)");
+ return;
+ }
+
+ for (row = 0; row < filter->Height; row++) {
+ GLvoid *dst = _mesa_image_address( &ctx->Pack, image, filter->Width,
+ filter->Height, format, type,
+ 0, row, 0);
+ const GLfloat *src = filter->Filter + row * filter->Width * 4;
+ _mesa_pack_rgba_span_float(ctx, filter->Width,
+ (const GLfloat (*)[4]) src,
+ format, type, dst, &ctx->Pack, 0);
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_convolution_attrib *conv;
+ GLuint c;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (target) {
+ case GL_CONVOLUTION_1D:
+ c = 0;
+ conv = &ctx->Convolution1D;
+ break;
+ case GL_CONVOLUTION_2D:
+ c = 1;
+ conv = &ctx->Convolution2D;
+ break;
+ case GL_SEPARABLE_2D:
+ c = 2;
+ conv = &ctx->Separable2D;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_COLOR:
+ COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]);
+ break;
+ case GL_CONVOLUTION_BORDER_MODE:
+ *params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c];
+ break;
+ case GL_CONVOLUTION_FILTER_SCALE:
+ COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]);
+ break;
+ case GL_CONVOLUTION_FILTER_BIAS:
+ COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]);
+ break;
+ case GL_CONVOLUTION_FORMAT:
+ *params = (GLfloat) conv->Format;
+ break;
+ case GL_CONVOLUTION_WIDTH:
+ *params = (GLfloat) conv->Width;
+ break;
+ case GL_CONVOLUTION_HEIGHT:
+ *params = (GLfloat) conv->Height;
+ break;
+ case GL_MAX_CONVOLUTION_WIDTH:
+ *params = (GLfloat) ctx->Const.MaxConvolutionWidth;
+ break;
+ case GL_MAX_CONVOLUTION_HEIGHT:
+ *params = (GLfloat) ctx->Const.MaxConvolutionHeight;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_convolution_attrib *conv;
+ GLuint c;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (target) {
+ case GL_CONVOLUTION_1D:
+ c = 0;
+ conv = &ctx->Convolution1D;
+ break;
+ case GL_CONVOLUTION_2D:
+ c = 1;
+ conv = &ctx->Convolution2D;
+ break;
+ case GL_SEPARABLE_2D:
+ c = 2;
+ conv = &ctx->Separable2D;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_COLOR:
+ params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]);
+ params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]);
+ params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]);
+ params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]);
+ break;
+ case GL_CONVOLUTION_BORDER_MODE:
+ *params = (GLint) ctx->Pixel.ConvolutionBorderMode[c];
+ break;
+ case GL_CONVOLUTION_FILTER_SCALE:
+ params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0];
+ params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1];
+ params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2];
+ params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3];
+ break;
+ case GL_CONVOLUTION_FILTER_BIAS:
+ params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0];
+ params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1];
+ params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2];
+ params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3];
+ break;
+ case GL_CONVOLUTION_FORMAT:
+ *params = (GLint) conv->Format;
+ break;
+ case GL_CONVOLUTION_WIDTH:
+ *params = (GLint) conv->Width;
+ break;
+ case GL_CONVOLUTION_HEIGHT:
+ *params = (GLint) conv->Height;
+ break;
+ case GL_MAX_CONVOLUTION_WIDTH:
+ *params = (GLint) ctx->Const.MaxConvolutionWidth;
+ break;
+ case GL_MAX_CONVOLUTION_HEIGHT:
+ *params = (GLint) ctx->Const.MaxConvolutionHeight;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
+{
+ const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
+ const struct gl_convolution_attrib *filter;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ if (target != GL_SEPARABLE_2D) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)");
+ return;
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)");
+ return;
+ }
+
+ if (format == GL_COLOR_INDEX ||
+ format == GL_STENCIL_INDEX ||
+ format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
+ type == GL_BITMAP) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)");
+ return;
+ }
+
+ filter = &ctx->Separable2D;
+
+ /* Row filter */
+ {
+ GLvoid *dst = _mesa_image_address( &ctx->Pack, row, filter->Width,
+ filter->Height, format, type,
+ 0, 0, 0);
+ _mesa_pack_rgba_span_float(ctx, filter->Width,
+ (const GLfloat (*)[4]) filter->Filter,
+ format, type, dst, &ctx->Pack, 0);
+ }
+
+ /* Column filter */
+ {
+ GLvoid *dst = _mesa_image_address( &ctx->Pack, column, filter->Width,
+ 1, format, type,
+ 0, 0, 0);
+ const GLfloat *src = filter->Filter + colStart;
+ _mesa_pack_rgba_span_float(ctx, filter->Height,
+ (const GLfloat (*)[4]) src,
+ format, type, dst, &ctx->Pack, 0);
+ }
+
+ (void) span; /* unused at this time */
+}
+
+
+void GLAPIENTRY
+_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
+{
+ const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
+ GLint baseFormat;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target != GL_SEPARABLE_2D) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)");
+ return;
+ }
+
+ baseFormat = base_filter_format(internalFormat);
+ if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)");
+ return;
+ }
+
+ if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)");
+ return;
+ }
+ if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)");
+ return;
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)");
+ return;
+ }
+
+ if (format == GL_COLOR_INDEX ||
+ format == GL_STENCIL_INDEX ||
+ format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
+ type == GL_BITMAP) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)");
+ return;
+ }
+
+ ctx->Separable2D.Format = format;
+ ctx->Separable2D.InternalFormat = internalFormat;
+ ctx->Separable2D.Width = width;
+ ctx->Separable2D.Height = height;
+
+ /* unpack row filter */
+ _mesa_unpack_color_span_float(ctx, width, GL_RGBA,
+ ctx->Separable2D.Filter,
+ format, type, row, &ctx->Unpack,
+ 0); /* transferOps */
+
+ /* apply scale and bias */
+ {
+ const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2];
+ const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2];
+ GLint i;
+ for (i = 0; i < width; i++) {
+ GLfloat r = ctx->Separable2D.Filter[i * 4 + 0];
+ GLfloat g = ctx->Separable2D.Filter[i * 4 + 1];
+ GLfloat b = ctx->Separable2D.Filter[i * 4 + 2];
+ GLfloat a = ctx->Separable2D.Filter[i * 4 + 3];
+ r = r * scale[0] + bias[0];
+ g = g * scale[1] + bias[1];
+ b = b * scale[2] + bias[2];
+ a = a * scale[3] + bias[3];
+ ctx->Separable2D.Filter[i * 4 + 0] = r;
+ ctx->Separable2D.Filter[i * 4 + 1] = g;
+ ctx->Separable2D.Filter[i * 4 + 2] = b;
+ ctx->Separable2D.Filter[i * 4 + 3] = a;
+ }
+ }
+
+ /* unpack column filter */
+ _mesa_unpack_color_span_float(ctx, height, GL_RGBA,
+ &ctx->Separable2D.Filter[colStart],
+ format, type, column, &ctx->Unpack,
+ 0); /* transferOps */
+
+ /* apply scale and bias */
+ {
+ const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2];
+ const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2];
+ GLint i;
+ for (i = 0; i < height; i++) {
+ GLfloat r = ctx->Separable2D.Filter[i * 4 + 0 + colStart];
+ GLfloat g = ctx->Separable2D.Filter[i * 4 + 1 + colStart];
+ GLfloat b = ctx->Separable2D.Filter[i * 4 + 2 + colStart];
+ GLfloat a = ctx->Separable2D.Filter[i * 4 + 3 + colStart];
+ r = r * scale[0] + bias[0];
+ g = g * scale[1] + bias[1];
+ b = b * scale[2] + bias[2];
+ a = a * scale[3] + bias[3];
+ ctx->Separable2D.Filter[i * 4 + 0 + colStart] = r;
+ ctx->Separable2D.Filter[i * 4 + 1 + colStart] = g;
+ ctx->Separable2D.Filter[i * 4 + 2 + colStart] = b;
+ ctx->Separable2D.Filter[i * 4 + 3 + colStart] = a;
+ }
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+/**********************************************************************/
+/*** image convolution functions ***/
+/**********************************************************************/
+
+static void
+convolve_1d_reduce(GLint srcWidth, const GLfloat src[][4],
+ GLint filterWidth, const GLfloat filter[][4],
+ GLfloat dest[][4])
+{
+ GLint dstWidth;
+ GLint i, n;
+
+ if (filterWidth >= 1)
+ dstWidth = srcWidth - (filterWidth - 1);
+ else
+ dstWidth = srcWidth;
+
+ if (dstWidth <= 0)
+ return; /* null result */
+
+ for (i = 0; i < dstWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (n = 0; n < filterWidth; n++) {
+ sumR += src[i + n][RCOMP] * filter[n][RCOMP];
+ sumG += src[i + n][GCOMP] * filter[n][GCOMP];
+ sumB += src[i + n][BCOMP] * filter[n][BCOMP];
+ sumA += src[i + n][ACOMP] * filter[n][ACOMP];
+ }
+ dest[i][RCOMP] = sumR;
+ dest[i][GCOMP] = sumG;
+ dest[i][BCOMP] = sumB;
+ dest[i][ACOMP] = sumA;
+ }
+}
+
+
+static void
+convolve_1d_constant(GLint srcWidth, const GLfloat src[][4],
+ GLint filterWidth, const GLfloat filter[][4],
+ GLfloat dest[][4],
+ const GLfloat borderColor[4])
+{
+ const GLint halfFilterWidth = filterWidth / 2;
+ GLint i, n;
+
+ for (i = 0; i < srcWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (n = 0; n < filterWidth; n++) {
+ if (i + n < halfFilterWidth || i + n - halfFilterWidth >= srcWidth) {
+ sumR += borderColor[RCOMP] * filter[n][RCOMP];
+ sumG += borderColor[GCOMP] * filter[n][GCOMP];
+ sumB += borderColor[BCOMP] * filter[n][BCOMP];
+ sumA += borderColor[ACOMP] * filter[n][ACOMP];
+ }
+ else {
+ sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP];
+ sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP];
+ sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP];
+ sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP];
+ }
+ }
+ dest[i][RCOMP] = sumR;
+ dest[i][GCOMP] = sumG;
+ dest[i][BCOMP] = sumB;
+ dest[i][ACOMP] = sumA;
+ }
+}
+
+
+static void
+convolve_1d_replicate(GLint srcWidth, const GLfloat src[][4],
+ GLint filterWidth, const GLfloat filter[][4],
+ GLfloat dest[][4])
+{
+ const GLint halfFilterWidth = filterWidth / 2;
+ GLint i, n;
+
+ for (i = 0; i < srcWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (n = 0; n < filterWidth; n++) {
+ if (i + n < halfFilterWidth) {
+ sumR += src[0][RCOMP] * filter[n][RCOMP];
+ sumG += src[0][GCOMP] * filter[n][GCOMP];
+ sumB += src[0][BCOMP] * filter[n][BCOMP];
+ sumA += src[0][ACOMP] * filter[n][ACOMP];
+ }
+ else if (i + n - halfFilterWidth >= srcWidth) {
+ sumR += src[srcWidth - 1][RCOMP] * filter[n][RCOMP];
+ sumG += src[srcWidth - 1][GCOMP] * filter[n][GCOMP];
+ sumB += src[srcWidth - 1][BCOMP] * filter[n][BCOMP];
+ sumA += src[srcWidth - 1][ACOMP] * filter[n][ACOMP];
+ }
+ else {
+ sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP];
+ sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP];
+ sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP];
+ sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP];
+ }
+ }
+ dest[i][RCOMP] = sumR;
+ dest[i][GCOMP] = sumG;
+ dest[i][BCOMP] = sumB;
+ dest[i][ACOMP] = sumA;
+ }
+}
+
+
+static void
+convolve_2d_reduce(GLint srcWidth, GLint srcHeight,
+ const GLfloat src[][4],
+ GLint filterWidth, GLint filterHeight,
+ const GLfloat filter[][4],
+ GLfloat dest[][4])
+{
+ GLint dstWidth, dstHeight;
+ GLint i, j, n, m;
+
+ if (filterWidth >= 1)
+ dstWidth = srcWidth - (filterWidth - 1);
+ else
+ dstWidth = srcWidth;
+
+ if (filterHeight >= 1)
+ dstHeight = srcHeight - (filterHeight - 1);
+ else
+ dstHeight = srcHeight;
+
+ if (dstWidth <= 0 || dstHeight <= 0)
+ return;
+
+ for (j = 0; j < dstHeight; j++) {
+ for (i = 0; i < dstWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (m = 0; m < filterHeight; m++) {
+ for (n = 0; n < filterWidth; n++) {
+ const GLint k = (j + m) * srcWidth + i + n;
+ const GLint f = m * filterWidth + n;
+ sumR += src[k][RCOMP] * filter[f][RCOMP];
+ sumG += src[k][GCOMP] * filter[f][GCOMP];
+ sumB += src[k][BCOMP] * filter[f][BCOMP];
+ sumA += src[k][ACOMP] * filter[f][ACOMP];
+ }
+ }
+ dest[j * dstWidth + i][RCOMP] = sumR;
+ dest[j * dstWidth + i][GCOMP] = sumG;
+ dest[j * dstWidth + i][BCOMP] = sumB;
+ dest[j * dstWidth + i][ACOMP] = sumA;
+ }
+ }
+}
+
+
+static void
+convolve_2d_constant(GLint srcWidth, GLint srcHeight,
+ const GLfloat src[][4],
+ GLint filterWidth, GLint filterHeight,
+ const GLfloat filter[][4],
+ GLfloat dest[][4],
+ const GLfloat borderColor[4])
+{
+ const GLint halfFilterWidth = filterWidth / 2;
+ const GLint halfFilterHeight = filterHeight / 2;
+ GLint i, j, n, m;
+
+ for (j = 0; j < srcHeight; j++) {
+ for (i = 0; i < srcWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (m = 0; m < filterHeight; m++) {
+ for (n = 0; n < filterWidth; n++) {
+ const GLint f = m * filterWidth + n;
+ const GLint is = i + n - halfFilterWidth;
+ const GLint js = j + m - halfFilterHeight;
+ if (is < 0 || is >= srcWidth ||
+ js < 0 || js >= srcHeight) {
+ sumR += borderColor[RCOMP] * filter[f][RCOMP];
+ sumG += borderColor[GCOMP] * filter[f][GCOMP];
+ sumB += borderColor[BCOMP] * filter[f][BCOMP];
+ sumA += borderColor[ACOMP] * filter[f][ACOMP];
+ }
+ else {
+ const GLint k = js * srcWidth + is;
+ sumR += src[k][RCOMP] * filter[f][RCOMP];
+ sumG += src[k][GCOMP] * filter[f][GCOMP];
+ sumB += src[k][BCOMP] * filter[f][BCOMP];
+ sumA += src[k][ACOMP] * filter[f][ACOMP];
+ }
+ }
+ }
+ dest[j * srcWidth + i][RCOMP] = sumR;
+ dest[j * srcWidth + i][GCOMP] = sumG;
+ dest[j * srcWidth + i][BCOMP] = sumB;
+ dest[j * srcWidth + i][ACOMP] = sumA;
+ }
+ }
+}
+
+
+static void
+convolve_2d_replicate(GLint srcWidth, GLint srcHeight,
+ const GLfloat src[][4],
+ GLint filterWidth, GLint filterHeight,
+ const GLfloat filter[][4],
+ GLfloat dest[][4])
+{
+ const GLint halfFilterWidth = filterWidth / 2;
+ const GLint halfFilterHeight = filterHeight / 2;
+ GLint i, j, n, m;
+
+ for (j = 0; j < srcHeight; j++) {
+ for (i = 0; i < srcWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (m = 0; m < filterHeight; m++) {
+ for (n = 0; n < filterWidth; n++) {
+ const GLint f = m * filterWidth + n;
+ GLint is = i + n - halfFilterWidth;
+ GLint js = j + m - halfFilterHeight;
+ GLint k;
+ if (is < 0)
+ is = 0;
+ else if (is >= srcWidth)
+ is = srcWidth - 1;
+ if (js < 0)
+ js = 0;
+ else if (js >= srcHeight)
+ js = srcHeight - 1;
+ k = js * srcWidth + is;
+ sumR += src[k][RCOMP] * filter[f][RCOMP];
+ sumG += src[k][GCOMP] * filter[f][GCOMP];
+ sumB += src[k][BCOMP] * filter[f][BCOMP];
+ sumA += src[k][ACOMP] * filter[f][ACOMP];
+ }
+ }
+ dest[j * srcWidth + i][RCOMP] = sumR;
+ dest[j * srcWidth + i][GCOMP] = sumG;
+ dest[j * srcWidth + i][BCOMP] = sumB;
+ dest[j * srcWidth + i][ACOMP] = sumA;
+ }
+ }
+}
+
+
+static void
+convolve_sep_reduce(GLint srcWidth, GLint srcHeight,
+ const GLfloat src[][4],
+ GLint filterWidth, GLint filterHeight,
+ const GLfloat rowFilt[][4],
+ const GLfloat colFilt[][4],
+ GLfloat dest[][4])
+{
+ GLint dstWidth, dstHeight;
+ GLint i, j, n, m;
+
+ if (filterWidth >= 1)
+ dstWidth = srcWidth - (filterWidth - 1);
+ else
+ dstWidth = srcWidth;
+
+ if (filterHeight >= 1)
+ dstHeight = srcHeight - (filterHeight - 1);
+ else
+ dstHeight = srcHeight;
+
+ if (dstWidth <= 0 || dstHeight <= 0)
+ return;
+
+ for (j = 0; j < dstHeight; j++) {
+ for (i = 0; i < dstWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (m = 0; m < filterHeight; m++) {
+ for (n = 0; n < filterWidth; n++) {
+ GLint k = (j + m) * srcWidth + i + n;
+ sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
+ sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
+ sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
+ sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
+ }
+ }
+ dest[j * dstWidth + i][RCOMP] = sumR;
+ dest[j * dstWidth + i][GCOMP] = sumG;
+ dest[j * dstWidth + i][BCOMP] = sumB;
+ dest[j * dstWidth + i][ACOMP] = sumA;
+ }
+ }
+}
+
+
+static void
+convolve_sep_constant(GLint srcWidth, GLint srcHeight,
+ const GLfloat src[][4],
+ GLint filterWidth, GLint filterHeight,
+ const GLfloat rowFilt[][4],
+ const GLfloat colFilt[][4],
+ GLfloat dest[][4],
+ const GLfloat borderColor[4])
+{
+ const GLint halfFilterWidth = filterWidth / 2;
+ const GLint halfFilterHeight = filterHeight / 2;
+ GLint i, j, n, m;
+
+ for (j = 0; j < srcHeight; j++) {
+ for (i = 0; i < srcWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (m = 0; m < filterHeight; m++) {
+ for (n = 0; n < filterWidth; n++) {
+ const GLint is = i + n - halfFilterWidth;
+ const GLint js = j + m - halfFilterHeight;
+ if (is < 0 || is >= srcWidth ||
+ js < 0 || js >= srcHeight) {
+ sumR += borderColor[RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
+ sumG += borderColor[GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
+ sumB += borderColor[BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
+ sumA += borderColor[ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
+ }
+ else {
+ GLint k = js * srcWidth + is;
+ sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
+ sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
+ sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
+ sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
+ }
+
+ }
+ }
+ dest[j * srcWidth + i][RCOMP] = sumR;
+ dest[j * srcWidth + i][GCOMP] = sumG;
+ dest[j * srcWidth + i][BCOMP] = sumB;
+ dest[j * srcWidth + i][ACOMP] = sumA;
+ }
+ }
+}
+
+
+static void
+convolve_sep_replicate(GLint srcWidth, GLint srcHeight,
+ const GLfloat src[][4],
+ GLint filterWidth, GLint filterHeight,
+ const GLfloat rowFilt[][4],
+ const GLfloat colFilt[][4],
+ GLfloat dest[][4])
+{
+ const GLint halfFilterWidth = filterWidth / 2;
+ const GLint halfFilterHeight = filterHeight / 2;
+ GLint i, j, n, m;
+
+ for (j = 0; j < srcHeight; j++) {
+ for (i = 0; i < srcWidth; i++) {
+ GLfloat sumR = 0.0;
+ GLfloat sumG = 0.0;
+ GLfloat sumB = 0.0;
+ GLfloat sumA = 0.0;
+ for (m = 0; m < filterHeight; m++) {
+ for (n = 0; n < filterWidth; n++) {
+ GLint is = i + n - halfFilterWidth;
+ GLint js = j + m - halfFilterHeight;
+ GLint k;
+ if (is < 0)
+ is = 0;
+ else if (is >= srcWidth)
+ is = srcWidth - 1;
+ if (js < 0)
+ js = 0;
+ else if (js >= srcHeight)
+ js = srcHeight - 1;
+ k = js * srcWidth + is;
+ sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
+ sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
+ sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
+ sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
+ }
+ }
+ dest[j * srcWidth + i][RCOMP] = sumR;
+ dest[j * srcWidth + i][GCOMP] = sumG;
+ dest[j * srcWidth + i][BCOMP] = sumB;
+ dest[j * srcWidth + i][ACOMP] = sumA;
+ }
+ }
+}
+
+
+
+void
+_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
+ const GLfloat *srcImage, GLfloat *dstImage)
+{
+ switch (ctx->Pixel.ConvolutionBorderMode[0]) {
+ case GL_REDUCE:
+ convolve_1d_reduce(*width, (const GLfloat (*)[4]) srcImage,
+ ctx->Convolution1D.Width,
+ (const GLfloat (*)[4]) ctx->Convolution1D.Filter,
+ (GLfloat (*)[4]) dstImage);
+ *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1);
+ break;
+ case GL_CONSTANT_BORDER:
+ convolve_1d_constant(*width, (const GLfloat (*)[4]) srcImage,
+ ctx->Convolution1D.Width,
+ (const GLfloat (*)[4]) ctx->Convolution1D.Filter,
+ (GLfloat (*)[4]) dstImage,
+ ctx->Pixel.ConvolutionBorderColor[0]);
+ break;
+ case GL_REPLICATE_BORDER:
+ convolve_1d_replicate(*width, (const GLfloat (*)[4]) srcImage,
+ ctx->Convolution1D.Width,
+ (const GLfloat (*)[4]) ctx->Convolution1D.Filter,
+ (GLfloat (*)[4]) dstImage);
+ break;
+ default:
+ ;
+ }
+}
+
+
+void
+_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
+ const GLfloat *srcImage, GLfloat *dstImage)
+{
+ switch (ctx->Pixel.ConvolutionBorderMode[1]) {
+ case GL_REDUCE:
+ convolve_2d_reduce(*width, *height,
+ (const GLfloat (*)[4]) srcImage,
+ ctx->Convolution2D.Width,
+ ctx->Convolution2D.Height,
+ (const GLfloat (*)[4]) ctx->Convolution2D.Filter,
+ (GLfloat (*)[4]) dstImage);
+ *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1);
+ *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1);
+ break;
+ case GL_CONSTANT_BORDER:
+ convolve_2d_constant(*width, *height,
+ (const GLfloat (*)[4]) srcImage,
+ ctx->Convolution2D.Width,
+ ctx->Convolution2D.Height,
+ (const GLfloat (*)[4]) ctx->Convolution2D.Filter,
+ (GLfloat (*)[4]) dstImage,
+ ctx->Pixel.ConvolutionBorderColor[1]);
+ break;
+ case GL_REPLICATE_BORDER:
+ convolve_2d_replicate(*width, *height,
+ (const GLfloat (*)[4]) srcImage,
+ ctx->Convolution2D.Width,
+ ctx->Convolution2D.Height,
+ (const GLfloat (*)[4])ctx->Convolution2D.Filter,
+ (GLfloat (*)[4]) dstImage);
+ break;
+ default:
+ ;
+ }
+}
+
+
+void
+_mesa_convolve_sep_image(const GLcontext *ctx,
+ GLsizei *width, GLsizei *height,
+ const GLfloat *srcImage, GLfloat *dstImage)
+{
+ const GLfloat *rowFilter = ctx->Separable2D.Filter;
+ const GLfloat *colFilter = rowFilter + 4 * MAX_CONVOLUTION_WIDTH;
+
+ switch (ctx->Pixel.ConvolutionBorderMode[2]) {
+ case GL_REDUCE:
+ convolve_sep_reduce(*width, *height,
+ (const GLfloat (*)[4]) srcImage,
+ ctx->Separable2D.Width,
+ ctx->Separable2D.Height,
+ (const GLfloat (*)[4]) rowFilter,
+ (const GLfloat (*)[4]) colFilter,
+ (GLfloat (*)[4]) dstImage);
+ *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1);
+ *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1);
+ break;
+ case GL_CONSTANT_BORDER:
+ convolve_sep_constant(*width, *height,
+ (const GLfloat (*)[4]) srcImage,
+ ctx->Separable2D.Width,
+ ctx->Separable2D.Height,
+ (const GLfloat (*)[4]) rowFilter,
+ (const GLfloat (*)[4]) colFilter,
+ (GLfloat (*)[4]) dstImage,
+ ctx->Pixel.ConvolutionBorderColor[2]);
+ break;
+ case GL_REPLICATE_BORDER:
+ convolve_sep_replicate(*width, *height,
+ (const GLfloat (*)[4]) srcImage,
+ ctx->Separable2D.Width,
+ ctx->Separable2D.Height,
+ (const GLfloat (*)[4]) rowFilter,
+ (const GLfloat (*)[4]) colFilter,
+ (GLfloat (*)[4]) dstImage);
+ break;
+ default:
+ ;
+ }
+}
+
+
+
+/*
+ * This function computes an image's size after convolution.
+ * If the convolution border mode is GL_REDUCE, the post-convolution
+ * image will be smaller than the original.
+ */
+void
+_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
+ GLsizei *width, GLsizei *height)
+{
+ if (ctx->Pixel.Convolution1DEnabled
+ && dimensions == 1
+ && ctx->Pixel.ConvolutionBorderMode[0] == GL_REDUCE) {
+ *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1);
+ }
+ else if (ctx->Pixel.Convolution2DEnabled
+ && dimensions > 1
+ && ctx->Pixel.ConvolutionBorderMode[1] == GL_REDUCE) {
+ *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1);
+ *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1);
+ }
+ else if (ctx->Pixel.Separable2DEnabled
+ && dimensions > 1
+ && ctx->Pixel.ConvolutionBorderMode[2] == GL_REDUCE) {
+ *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1);
+ *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1);
+ }
+}
Index: xc/extras/Mesa/src/mesa/main/convolve.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/convolve.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/convolve.h Thu Apr 8 05:17:40 2004
@@ -0,0 +1,114 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef CONVOLVE_H
+#define CONVOLVE_H
+
+
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+extern void GLAPIENTRY
+_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
+ GLenum format, GLenum type, const GLvoid *image);
+
+extern void GLAPIENTRY
+_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width,
+ GLsizei height, GLenum format, GLenum type,
+ const GLvoid *image);
+
+extern void GLAPIENTRY
+_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
+
+extern void GLAPIENTRY
+_mesa_ConvolutionParameterfv(GLenum target, GLenum pname,
+ const GLfloat *params);
+
+extern void GLAPIENTRY
+_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params);
+
+extern void GLAPIENTRY
+_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
+
+extern void GLAPIENTRY
+_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width);
+
+extern void GLAPIENTRY
+_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+extern void GLAPIENTRY
+_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
+ GLvoid *image);
+
+extern void GLAPIENTRY
+_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
+
+extern void GLAPIENTRY
+_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
+ GLvoid *row, GLvoid *column, GLvoid *span);
+
+extern void GLAPIENTRY
+_mesa_SeparableFilter2D(GLenum target, GLenum internalformat,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *row, const GLvoid *column);
+
+
+
+extern void
+_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
+ const GLfloat *srcImage, GLfloat *dstImage);
+
+
+extern void
+_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
+ const GLfloat *srcImage, GLfloat *dstImage);
+
+
+extern void
+_mesa_convolve_sep_image(const GLcontext *ctx,
+ GLsizei *width, GLsizei *height,
+ const GLfloat *srcImage, GLfloat *dstImage);
+
+
+extern void
+_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
+ GLsizei *width, GLsizei *height);
+
+#else
+#define _mesa_adjust_image_for_convolution(c, d, w, h) ((void)0)
+#define _mesa_convolve_1d_image(c,w,s,d) ((void)0)
+#define _mesa_convolve_2d_image(c,w,h,s,d) ((void)0)
+#define _mesa_convolve_sep_image(c,w,h,s,d) ((void)0)
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/dd.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/dd.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/dd.h Fri Dec 10 10:05:12 2004
@@ -0,0 +1,993 @@
+/**
+ * \file dd.h
+ * Device driver interfaces.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef DD_INCLUDED
+#define DD_INCLUDED
+
+/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
+
+struct gl_pixelstore_attrib;
+
+/**
+ * Device driver function table.
+ * Core Mesa uses these function pointers to call into device drivers.
+ * Most of these functions directly correspond to OpenGL state commands.
+ * Core Mesa will call these functions after error checking has been done
+ * so that the drivers don't have to worry about error testing.
+ *
+ * Vertex transformation/clipping/lighting is patched into the T&L module.
+ * Rasterization functions are patched into the swrast module.
+ *
+ * Note: when new functions are added here, the drivers/common/driverfuncs.c
+ * file should be updated too!!!
+ */
+struct dd_function_table {
+ /**
+ * Return a string as needed by glGetString().
+ *
+ * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
+ * returned.
+ */
+ const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
+
+ /**
+ * Notify the driver after Mesa has made some internal state changes.
+ *
+ * This is in addition to any state change callbacks Mesa may already have
+ * made.
+ */
+ void (*UpdateState)( GLcontext *ctx, GLuint new_state );
+
+ /**
+ * Get the width and height of the named buffer/window.
+ *
+ * Mesa uses this to determine when the driver's window size has changed.
+ */
+ void (*GetBufferSize)( GLframebuffer *buffer,
+ GLuint *width, GLuint *height );
+
+ /**
+ * Resize the driver's depth/stencil/accum/back buffers to match the
+ * size given in the GLframebuffer struct.
+ *
+ * This is typically called when Mesa detects that a window size has changed.
+ */
+ void (*ResizeBuffers)( GLframebuffer *buffer );
+
+ /**
+ * Called whenever an error is generated.
+ *
+ * __GLcontextRec::ErrorValue contains the error value.
+ */
+ void (*Error)( GLcontext *ctx );
+
+ /**
+ * This is called whenever glFinish() is called.
+ */
+ void (*Finish)( GLcontext *ctx );
+
+ /**
+ * This is called whenever glFlush() is called.
+ */
+ void (*Flush)( GLcontext *ctx );
+
+ /**
+ * Clear the color/depth/stencil/accum buffer(s).
+ *
+ * \param mask a bitmask of the DD_*_BIT values defined above that indicates
+ * which buffers need to be cleared.
+ * \param all if true then clear the whole buffer, else clear only the
+ * region defined by (x, y, width, height).
+ *
+ * This function must obey the glColorMask(), glIndexMask() and
+ * glStencilMask() settings!
+ * Software Mesa can do masked clears if the device driver can't.
+ */
+ void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
+ GLint x, GLint y, GLint width, GLint height );
+
+
+ /**
+ * \name For hardware accumulation buffer
+ */
+ /*@{*/
+ /**
+ * Execute glAccum command within the given scissor region.
+ */
+ void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
+ GLint xpos, GLint ypos, GLint width, GLint height );
+ /*@}*/
+
+
+ /**
+ * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
+ */
+ /*@{*/
+
+ /**
+ * This is called by glDrawPixels().
+ *
+ * \p unpack describes how to unpack the source image data.
+ */
+ void (*DrawPixels)( GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLvoid *pixels );
+
+ /**
+ * Called by glReadPixels().
+ */
+ void (*ReadPixels)( GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ GLvoid *dest );
+
+ /**
+ * Do a glCopyPixels().
+ *
+ * This function must respect all rasterization state, glPixelTransfer(),
+ * glPixelZoom(), etc.
+ */
+ void (*CopyPixels)( GLcontext *ctx,
+ GLint srcx, GLint srcy,
+ GLsizei width, GLsizei height,
+ GLint dstx, GLint dsty, GLenum type );
+
+ /**
+ * This is called by glBitmap().
+ *
+ * Works the same as dd_function_table::DrawPixels, above.
+ */
+ void (*Bitmap)( GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLubyte *bitmap );
+ /*@}*/
+
+
+ /**
+ * \name Texture image functions
+ */
+ /*@{*/
+
+ /**
+ * Choose texture format.
+ *
+ * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
+ * functions. The driver should examine \p internalFormat and return a
+ * pointer to an appropriate gl_texture_format.
+ */
+ const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx,
+ GLint internalFormat, GLenum srcFormat, GLenum srcType );
+
+ /**
+ * Called by glTexImage1D().
+ *
+ * \param target user specified.
+ * \param format user specified.
+ * \param type user specified.
+ * \param pixels user specified.
+ * \param packing indicates the image packing of pixels.
+ * \param texObj is the target texture object.
+ * \param texImage is the target texture image. It will have the texture \p
+ * width, \p height, \p depth, \p border and \p internalFormat information.
+ *
+ * \p retainInternalCopy is returned by this function and indicates whether
+ * core Mesa should keep an internal copy of the texture image.
+ *
+ * Drivers should call a fallback routine from texstore.c if needed.
+ */
+ void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+
+ /**
+ * Called by glTexImage2D().
+ *
+ * \sa dd_function_table::TexImage1D.
+ */
+ void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+
+ /**
+ * Called by glTexImage3D().
+ *
+ * \sa dd_function_table::TexImage1D.
+ */
+ void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint depth, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+
+ /**
+ * Called by glTexSubImage1D().
+ *
+ * \param target user specified.
+ * \param level user specified.
+ * \param xoffset user specified.
+ * \param yoffset user specified.
+ * \param zoffset user specified.
+ * \param width user specified.
+ * \param height user specified.
+ * \param depth user specified.
+ * \param format user specified.
+ * \param type user specified.
+ * \param pixels user specified.
+ * \param packing indicates the image packing of pixels.
+ * \param texObj is the target texture object.
+ * \param texImage is the target texture image. It will have the texture \p
+ * width, \p height, \p border and \p internalFormat information.
+ *
+ * The driver should use a fallback routine from texstore.c if needed.
+ */
+ void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLsizei width,
+ GLenum format, GLenum type,
+ const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+
+ /**
+ * Called by glTexSubImage2D().
+ *
+ * \sa dd_function_table::TexSubImage1D.
+ */
+ void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+
+ /**
+ * Called by glTexSubImage3D().
+ *
+ * \sa dd_function_table::TexSubImage1D.
+ */
+ void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLint depth,
+ GLenum format, GLenum type,
+ const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+
+ /**
+ * Called by glCopyTexImage1D().
+ *
+ * Drivers should use a fallback routine from texstore.c if needed.
+ */
+ void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLint border );
+
+ /**
+ * Called by glCopyTexImage2D().
+ *
+ * Drivers should use a fallback routine from texstore.c if needed.
+ */
+ void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLsizei height, GLint border );
+
+ /**
+ * Called by glCopyTexSubImage1D().
+ *
+ * Drivers should use a fallback routine from texstore.c if needed.
+ */
+ void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset,
+ GLint x, GLint y, GLsizei width );
+ /**
+ * Called by glCopyTexSubImage2D().
+ *
+ * Drivers should use a fallback routine from texstore.c if needed.
+ */
+ void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+ /**
+ * Called by glCopyTexSubImage3D().
+ *
+ * Drivers should use a fallback routine from texstore.c if needed.
+ */
+ void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+ /**
+ * Called by glTexImage[123]D when user specifies a proxy texture
+ * target.
+ *
+ * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
+ */
+ GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
+ GLint level, GLint internalFormat,
+ GLenum format, GLenum type,
+ GLint width, GLint height,
+ GLint depth, GLint border);
+ /*@}*/
+
+
+ /**
+ * \name Compressed texture functions
+ */
+ /*@{*/
+
+ /**
+ * Called by glCompressedTexImage1D().
+ *
+ * \param target user specified.
+ * \param format user specified.
+ * \param type user specified.
+ * \param pixels user specified.
+ * \param packing indicates the image packing of pixels.
+ * \param texObj is the target texture object.
+ * \param texImage is the target texture image. It will have the texture \p
+ * width, \p height, \p depth, \p border and \p internalFormat information.
+ *
+ * \a retainInternalCopy is returned by this function and indicates whether
+ * core Mesa should keep an internal copy of the texture image.
+ */
+ void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
+ GLint level, GLint internalFormat,
+ GLsizei width, GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+ /**
+ * Called by glCompressedTexImage2D().
+ *
+ * \sa dd_function_table::CompressedTexImage1D.
+ */
+ void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
+ GLint level, GLint internalFormat,
+ GLsizei width, GLsizei height, GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+ /**
+ * Called by glCompressedTexImage3D().
+ *
+ * \sa dd_function_table::CompressedTexImage3D.
+ */
+ void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
+ GLint level, GLint internalFormat,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage );
+
+ /**
+ * Called by glCompressedTexSubImage1D().
+ *
+ * \param target user specified.
+ * \param level user specified.
+ * \param xoffset user specified.
+ * \param yoffset user specified.
+ * \param zoffset user specified.
+ * \param width user specified.
+ * \param height user specified.
+ * \param depth user specified.
+ * \param imageSize user specified.
+ * \param data user specified.
+ * \param texObj is the target texture object.
+ * \param texImage is the target texture image. It will have the texture \p
+ * width, \p height, \p depth, \p border and \p internalFormat information.
+ */
+ void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLsizei width,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+ /**
+ * Called by glCompressedTexSubImage2D().
+ *
+ * \sa dd_function_table::CompressedTexImage3D.
+ */
+ void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLint height,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+ /**
+ * Called by glCompressedTexSubImage3D().
+ *
+ * \sa dd_function_table::CompressedTexImage3D.
+ */
+ void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLint height, GLint depth,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+ /**
+ * Called to query number of bytes of storage needed to store the
+ * specified compressed texture.
+ */
+ GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLenum format );
+ /*@}*/
+
+ /**
+ * \name Texture object functions
+ */
+ /*@{*/
+
+ /**
+ * Called by glBindTexture().
+ */
+ void (*BindTexture)( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj );
+
+ /**
+ * Called to allocate a new texture object.
+ * A new gl_texture_object should be returned. The driver should
+ * attach to it any device-specific info it needs.
+ */
+ struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name,
+ GLenum target );
+ /**
+ * Called when a texture object is about to be deallocated.
+ *
+ * Driver should delete the gl_texture_object object and anything
+ * hanging off of it.
+ */
+ void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+
+ /**
+ * Called to allocate a new texture image object.
+ */
+ struct gl_texture_image * (*NewTextureImage)( GLcontext *ctx );
+
+ /**
+ * Called by glAreTextureResident().
+ */
+ GLboolean (*IsTextureResident)( GLcontext *ctx,
+ struct gl_texture_object *t );
+
+ /**
+ * Called by glPrioritizeTextures().
+ */
+ void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
+ GLclampf priority );
+
+ /**
+ * Called by glActiveTextureARB() to set current texture unit.
+ */
+ void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
+
+ /**
+ * Called when the texture's color lookup table is changed.
+ *
+ * If \p tObj is NULL then the shared texture palette
+ * gl_texture_object::Palette is to be updated.
+ */
+ void (*UpdateTexturePalette)( GLcontext *ctx,
+ struct gl_texture_object *tObj );
+ /*@}*/
+
+
+ /**
+ * \name Imaging functionality
+ */
+ /*@{*/
+ void (*CopyColorTable)( GLcontext *ctx,
+ GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyColorSubTable)( GLcontext *ctx,
+ GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+ /*@}*/
+
+
+ /**
+ * \name Vertex/fragment program functions
+ */
+ /*@{*/
+ /** Bind a vertex/fragment program */
+ void (*BindProgram)(GLcontext *ctx, GLenum target, struct program *prog);
+ /** Allocate a new program */
+ struct program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id);
+ /** Delete a program */
+ void (*DeleteProgram)(GLcontext *ctx, struct program *prog);
+ /** Notify driver that a program string has been specified. */
+ void (*ProgramStringNotify)(GLcontext *ctx, GLenum target,
+ struct program *prog);
+
+
+
+ /** Query if program can be loaded onto hardware */
+ GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target,
+ struct program *prog);
+
+ /*@}*/
+
+
+ /**
+ * \name State-changing functions.
+ *
+ * \note drawing functions are above.
+ *
+ * These functions are called by their corresponding OpenGL API functions.
+ * They are \e also called by the gl_PopAttrib() function!!!
+ * May add more functions like these to the device driver in the future.
+ */
+ /*@{*/
+ /** Specify the alpha test function */
+ void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref);
+ /** Set the blend color */
+ void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
+ /** Set the blend equation */
+ void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA);
+ /** Specify pixel arithmetic */
+ void (*BlendFuncSeparate)(GLcontext *ctx,
+ GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA);
+ /** Specify clear values for the color buffers */
+ void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]);
+ /** Specify the clear value for the depth buffer */
+ void (*ClearDepth)(GLcontext *ctx, GLclampd d);
+ /** Specify the clear value for the color index buffers */
+ void (*ClearIndex)(GLcontext *ctx, GLuint index);
+ /** Specify the clear value for the stencil buffer */
+ void (*ClearStencil)(GLcontext *ctx, GLint s);
+ /** Specify a plane against which all geometry is clipped */
+ void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
+ /** Enable and disable writing of frame buffer color components */
+ void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
+ GLboolean bmask, GLboolean amask );
+ /** Cause a material color to track the current color */
+ void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
+ /** Specify whether front- or back-facing facets can be culled */
+ void (*CullFace)(GLcontext *ctx, GLenum mode);
+ /** Define front- and back-facing polygons */
+ void (*FrontFace)(GLcontext *ctx, GLenum mode);
+ /** Specify the value used for depth buffer comparisons */
+ void (*DepthFunc)(GLcontext *ctx, GLenum func);
+ /** Enable or disable writing into the depth buffer */
+ void (*DepthMask)(GLcontext *ctx, GLboolean flag);
+ /** Specify mapping of depth values from NDC to window coordinates */
+ void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
+ /** Specify the current buffer for writing */
+ void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
+ /** Enable or disable server-side gl capabilities */
+ void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state);
+ /** Specify fog parameters */
+ void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
+ /** Specify implementation-specific hints */
+ void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
+ /** Control the writing of individual bits in the color index buffers */
+ void (*IndexMask)(GLcontext *ctx, GLuint mask);
+ /** Set light source parameters */
+ void (*Lightfv)(GLcontext *ctx, GLenum light,
+ GLenum pname, const GLfloat *params );
+ /** Set the lighting model parameters */
+ void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
+ /** Specify the line stipple pattern */
+ void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
+ /** Specify the width of rasterized lines */
+ void (*LineWidth)(GLcontext *ctx, GLfloat width);
+ /** Specify a logical pixel operation for color index rendering */
+ void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
+ void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
+ const GLfloat *params);
+ /** Specify the diameter of rasterized points */
+ void (*PointSize)(GLcontext *ctx, GLfloat size);
+ /** Select a polygon rasterization mode */
+ void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
+ /** Set the scale and units used to calculate depth values */
+ void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
+ /** Set the polygon stippling pattern */
+ void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
+ /* Specifies the current buffer for reading */
+ void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
+ /** Set rasterization mode */
+ void (*RenderMode)(GLcontext *ctx, GLenum mode );
+ /** Define the scissor box */
+ void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+ /** Select flat or smooth shading */
+ void (*ShadeModel)(GLcontext *ctx, GLenum mode);
+ /** Set function and reference value for stencil testing */
+ void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
+ /** Control the writing of individual bits in the stencil planes */
+ void (*StencilMask)(GLcontext *ctx, GLuint mask);
+ /** Set stencil test actions */
+ void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
+ void (*ActiveStencilFace)(GLcontext *ctx, GLuint face);
+ /** Control the generation of texture coordinates */
+ void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
+ const GLfloat *params);
+ /** Set texture environment parameters */
+ void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
+ const GLfloat *param);
+ /** Set texture parameters */
+ void (*TexParameter)(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ GLenum pname, const GLfloat *params);
+ void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
+ /** Set the viewport */
+ void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+ /*@}*/
+
+
+ /**
+ * \name Vertex array functions
+ *
+ * Called by the corresponding OpenGL functions.
+ */
+ /*@{*/
+ void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+ void (*NormalPointer)(GLcontext *ctx, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+ void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+ void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+ void (*IndexPointer)(GLcontext *ctx, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+ void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+ void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+ void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
+ void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size,
+ GLenum type, GLsizei stride, const GLvoid *ptr);
+ void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
+ void (*UnlockArraysEXT)( GLcontext *ctx );
+ /*@}*/
+
+
+ /**
+ * \name State-query functions
+ *
+ * Return GL_TRUE if query was completed, GL_FALSE otherwise.
+ */
+ /*@{*/
+ /** Return the value or values of a selected parameter */
+ GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
+ /** Return the value or values of a selected parameter */
+ GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
+ /** Return the value or values of a selected parameter */
+ GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
+ /** Return the value or values of a selected parameter */
+ GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
+ /** Return the value or values of a selected parameter */
+ GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
+ /*@}*/
+
+
+ /**
+ * \name Vertex buffer object functions
+ */
+#if FEATURE_ARB_vertex_buffer_object
+ /*@{*/
+ void (*BindBuffer)( GLcontext *ctx, GLenum target,
+ struct gl_buffer_object *obj );
+
+ struct gl_buffer_object * (*NewBufferObject)( GLcontext *ctx, GLuint buffer,
+ GLenum target );
+
+ void (*DeleteBuffer)( GLcontext *ctx, struct gl_buffer_object *obj );
+
+ void (*BufferData)( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
+ const GLvoid *data, GLenum usage,
+ struct gl_buffer_object *obj );
+
+ void (*BufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, const GLvoid *data,
+ struct gl_buffer_object *obj );
+
+ void (*GetBufferSubData)( GLcontext *ctx, GLenum target,
+ GLintptrARB offset, GLsizeiptrARB size,
+ GLvoid *data, struct gl_buffer_object *obj );
+
+ void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access,
+ struct gl_buffer_object *obj );
+
+ GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target,
+ struct gl_buffer_object *obj );
+ /*@}*/
+#endif
+
+ /**
+ * \name Support for multiple T&L engines
+ */
+ /*@{*/
+
+ /**
+ * Bitmask of state changes that require the current T&L module to be
+ * validated, using ValidateTnlModule() below.
+ */
+ GLuint NeedValidate;
+
+ /**
+ * Validate the current T&L module.
+ *
+ * This is called directly after UpdateState() when a state change that has
+ * occurred matches the dd_function_table::NeedValidate bitmask above. This
+ * ensures all computed values are up to date, thus allowing the driver to
+ * decide if the current T&L module needs to be swapped out.
+ *
+ * This must be non-NULL if a driver installs a custom T&L module and sets
+ * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
+ */
+ void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
+
+
+#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
+#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
+#define PRIM_UNKNOWN GL_POLYGON+3
+
+ /**
+ * Set by the driver-supplied T&L engine.
+ *
+ * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
+ */
+ GLuint CurrentExecPrimitive;
+
+ /**
+ * Current state of an in-progress compilation.
+ *
+ * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
+ * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
+ */
+ GLuint CurrentSavePrimitive;
+
+
+#define FLUSH_STORED_VERTICES 0x1
+#define FLUSH_UPDATE_CURRENT 0x2
+ /**
+ * Set by the driver-supplied T&L engine whenever vertices are buffered
+ * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
+ * updated.
+ *
+ * The dd_function_table::FlushVertices call below may be used to resolve
+ * these conditions.
+ */
+ GLuint NeedFlush;
+ GLuint SaveNeedFlush;
+
+ /**
+ * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
+ * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
+ * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
+ * __GLcontextRec::Current and gl_light_attrib::Material
+ *
+ * Note that the default T&L engine never clears the
+ * FLUSH_UPDATE_CURRENT bit, even after performing the update.
+ */
+ void (*FlushVertices)( GLcontext *ctx, GLuint flags );
+ void (*SaveFlushVertices)( GLcontext *ctx );
+
+ /**
+ * Give the driver the opportunity to hook in its own vtxfmt for
+ * compiling optimized display lists. This is called on each valid
+ * glBegin() during list compilation.
+ */
+ GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode );
+
+ /**
+ * Notify driver that the special derived value _NeedEyeCoords has
+ * changed.
+ */
+ void (*LightingSpaceChange)( GLcontext *ctx );
+
+ /**
+ * Let the T&L component know when the context becomes current.
+ */
+ void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
+ GLframebuffer *readBuffer );
+
+ /**
+ * Called by glNewList().
+ *
+ * Let the T&L component know what is going on with display lists
+ * in time to make changes to dispatch tables, etc.
+ */
+ void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
+ /**
+ * Called by glEndList().
+ *
+ * \sa dd_function_table::NewList.
+ */
+ void (*EndList)( GLcontext *ctx );
+
+ /**
+ * Called by glCallList(s), but not recursively.
+ *
+ * Notify the T&L component before and after calling a display list.
+ * Called by glCallList(s), but not recursively.
+ */
+ void (*BeginCallList)( GLcontext *ctx, GLuint list );
+ /**
+ * Called by glEndCallList().
+ *
+ * \sa dd_function_table::BeginCallList.
+ */
+ void (*EndCallList)( GLcontext *ctx );
+
+};
+
+
+/**
+ * Transform/Clip/Lighting interface
+ *
+ * Drivers present a reduced set of the functions possible in
+ * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
+ * remaining functions to map down to these entry points.
+ *
+ * These are the initial values to be installed into dispatch by
+ * mesa. If the T&L driver wants to modify the dispatch table
+ * while installed, it must do so itself. It would be possible for
+ * the vertexformat to install it's own initial values for these
+ * functions, but this way there is an obvious list of what is
+ * expected of the driver.
+ *
+ * If the driver wants to hook in entry points other than those
+ * listed, it must restore them to their original values in
+ * the disable() callback, below.
+ */
+typedef struct {
+ /**
+ * \name Vertex
+ */
+ /*@{*/
+ void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */
+ void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP Color3fv)( const GLfloat * );
+ void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP Color4fv)( const GLfloat * );
+ void (GLAPIENTRYP EdgeFlag)( GLboolean );
+ void (GLAPIENTRYP EdgeFlagv)( const GLboolean * );
+ void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */
+ void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */
+ void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
+ void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); /* NOTE */
+ void (GLAPIENTRYP EvalPoint1)( GLint ); /* NOTE */
+ void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */
+ void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
+ void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
+ void (GLAPIENTRYP Indexf)( GLfloat );
+ void (GLAPIENTRYP Indexfv)( const GLfloat * );
+ void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
+ void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
+ void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
+ void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
+ void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
+ void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
+ void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
+ void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP Normal3fv)( const GLfloat * );
+ void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
+ void (GLAPIENTRYP TexCoord1f)( GLfloat );
+ void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
+ void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
+ void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
+ void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
+ void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
+ void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
+ void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
+ void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
+ void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
+ void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
+ void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */
+ void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */
+ void (GLAPIENTRYP Begin)( GLenum );
+ void (GLAPIENTRYP End)( void );
+ void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
+ void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
+ void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
+ void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
+ void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
+ void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
+ void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+ void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
+ /*@}*/
+
+ /*
+ */
+ void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
+
+ /**
+ * \name Array
+ */
+ /*@{*/
+ void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
+ void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices );
+ void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start,
+ GLuint end, GLsizei count,
+ GLenum type, const GLvoid *indices );
+ /*@}*/
+
+ /**
+ * \name Eval
+ *
+ * If you don't support eval, fallback to the default vertex format
+ * on receiving an eval call and use the pipeline mechanism to
+ * provide partial T&L acceleration.
+ *
+ * Mesa will provide a set of helper functions to do eval within
+ * accelerated vertex formats, eventually...
+ */
+ /*@{*/
+ void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
+ void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
+ /*@}*/
+
+} GLvertexformat;
+
+
+#endif /* DD_INCLUDED */
Index: xc/extras/Mesa/src/mesa/main/debug.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/debug.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/debug.c Fri Dec 10 10:05:12 2004
@@ -0,0 +1,214 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "mtypes.h"
+#include "context.h"
+#include "imports.h"
+#include "debug.h"
+#include "get.h"
+
+/**
+ * Primitive names
+ */
+const char *_mesa_prim_name[GL_POLYGON+4] = {
+ "GL_POINTS",
+ "GL_LINES",
+ "GL_LINE_LOOP",
+ "GL_LINE_STRIP",
+ "GL_TRIANGLES",
+ "GL_TRIANGLE_STRIP",
+ "GL_TRIANGLE_FAN",
+ "GL_QUADS",
+ "GL_QUAD_STRIP",
+ "GL_POLYGON",
+ "outside begin/end",
+ "inside unkown primitive",
+ "unknown state"
+};
+
+void
+_mesa_print_state( const char *msg, GLuint state )
+{
+ _mesa_debug(NULL,
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ msg,
+ state,
+ (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
+ (state & _NEW_PROJECTION) ? "ctx->Projection, " : "",
+ (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "",
+ (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "",
+ (state & _NEW_ACCUM) ? "ctx->Accum, " : "",
+ (state & _NEW_COLOR) ? "ctx->Color, " : "",
+ (state & _NEW_DEPTH) ? "ctx->Depth, " : "",
+ (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "",
+ (state & _NEW_FOG) ? "ctx->Fog, " : "",
+ (state & _NEW_HINT) ? "ctx->Hint, " : "",
+ (state & _NEW_LIGHT) ? "ctx->Light, " : "",
+ (state & _NEW_LINE) ? "ctx->Line, " : "",
+ (state & _NEW_PIXEL) ? "ctx->Pixel, " : "",
+ (state & _NEW_POINT) ? "ctx->Point, " : "",
+ (state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
+ (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "",
+ (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "",
+ (state & _NEW_TEXTURE) ? "ctx->Texture, " : "",
+ (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "",
+ (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "",
+ (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "",
+ (state & _NEW_ARRAY) ? "ctx->Array, " : "",
+ (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "",
+ (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
+}
+
+
+
+void
+_mesa_print_tri_caps( const char *name, GLuint flags )
+{
+ _mesa_debug(NULL,
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ name,
+ flags,
+ (flags & DD_FLATSHADE) ? "flat-shade, " : "",
+ (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "",
+ (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "",
+ (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "",
+ (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
+ (flags & DD_TRI_OFFSET) ? "tri-offset, " : "",
+ (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "",
+ (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "",
+ (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "",
+ (flags & DD_LINE_WIDTH) ? "line-wide, " : "",
+ (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "",
+ (flags & DD_POINT_SIZE) ? "point-size, " : "",
+ (flags & DD_POINT_ATTEN) ? "point-atten, " : "",
+ (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : ""
+ );
+}
+
+
+/**
+ * Print information about this Mesa version and build options.
+ */
+void _mesa_print_info( void )
+{
+ _mesa_debug(NULL, "Mesa GL_VERSION = %s\n",
+ (char *) _mesa_GetString(GL_VERSION));
+ _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n",
+ (char *) _mesa_GetString(GL_RENDERER));
+ _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n",
+ (char *) _mesa_GetString(GL_VENDOR));
+ _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n",
+ (char *) _mesa_GetString(GL_EXTENSIONS));
+#if defined(THREADS)
+ _mesa_debug(NULL, "Mesa thread-safe: YES\n");
+#else
+ _mesa_debug(NULL, "Mesa thread-safe: NO\n");
+#endif
+#if defined(USE_X86_ASM)
+ _mesa_debug(NULL, "Mesa x86-optimized: YES\n");
+#else
+ _mesa_debug(NULL, "Mesa x86-optimized: NO\n");
+#endif
+#if defined(USE_SPARC_ASM)
+ _mesa_debug(NULL, "Mesa sparc-optimized: YES\n");
+#else
+ _mesa_debug(NULL, "Mesa sparc-optimized: NO\n");
+#endif
+}
+
+
+/**
+ * Set the debugging flags.
+ *
+ * \param debug debug string
+ *
+ * If compiled with debugging support then search for keywords in \p debug and
+ * enables the verbose debug output of the respective feature.
+ */
+static void add_debug_flags( const char *debug )
+{
+#ifdef MESA_DEBUG
+ if (_mesa_strstr(debug, "varray"))
+ MESA_VERBOSE |= VERBOSE_VARRAY;
+
+ if (_mesa_strstr(debug, "tex"))
+ MESA_VERBOSE |= VERBOSE_TEXTURE;
+
+ if (_mesa_strstr(debug, "imm"))
+ MESA_VERBOSE |= VERBOSE_IMMEDIATE;
+
+ if (_mesa_strstr(debug, "pipe"))
+ MESA_VERBOSE |= VERBOSE_PIPELINE;
+
+ if (_mesa_strstr(debug, "driver"))
+ MESA_VERBOSE |= VERBOSE_DRIVER;
+
+ if (_mesa_strstr(debug, "state"))
+ MESA_VERBOSE |= VERBOSE_STATE;
+
+ if (_mesa_strstr(debug, "api"))
+ MESA_VERBOSE |= VERBOSE_API;
+
+ if (_mesa_strstr(debug, "list"))
+ MESA_VERBOSE |= VERBOSE_DISPLAY_LIST;
+
+ if (_mesa_strstr(debug, "lighting"))
+ MESA_VERBOSE |= VERBOSE_LIGHTING;
+
+ /* Debug flag:
+ */
+ if (_mesa_strstr(debug, "flush"))
+ MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH;
+#else
+ (void) debug;
+#endif
+}
+
+
+void
+_mesa_init_debug( GLcontext *ctx )
+{
+ char *c;
+
+ /* For debug/development only */
+ ctx->FirstTimeCurrent = GL_TRUE;
+
+ /* Dither disable */
+ ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
+ if (ctx->NoDither) {
+ if (_mesa_getenv("MESA_DEBUG")) {
+ _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n");
+ }
+ ctx->Color.DitherFlag = GL_FALSE;
+ }
+
+ c = _mesa_getenv("MESA_DEBUG");
+ if (c)
+ add_debug_flags(c);
+
+ c = _mesa_getenv("MESA_VERBOSE");
+ if (c)
+ add_debug_flags(c);
+}
+
Index: xc/extras/Mesa/src/mesa/main/debug.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/debug.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/debug.h Thu Jun 10 10:23:45 2004
@@ -0,0 +1,60 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file debug.h
+ * Debugging functions.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+#if _HAVE_FULL_GL
+
+extern void _mesa_print_tri_caps( const char *name, GLuint flags );
+extern void _mesa_print_enable_flags( const char *msg, GLuint flags );
+extern void _mesa_print_state( const char *msg, GLuint state );
+extern void _mesa_print_info( void );
+extern void _mesa_init_debug( GLcontext *ctx );
+
+#else
+
+/** No-op */
+#define _mesa_print_state( m, s ) ((void)0)
+
+/** No-op */
+#define _mesa_print_info() ((void)0)
+
+/** No-op */
+#define _mesa_init_debug( c ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/depth.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/depth.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/depth.c Fri Dec 10 10:05:12 2004
@@ -0,0 +1,180 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "depth.h"
+#include "enums.h"
+#include "hash.h"
+#include "macros.h"
+#include "mtypes.h"
+
+
+/**********************************************************************/
+/***** API Functions *****/
+/**********************************************************************/
+
+
+
+void GLAPIENTRY
+_mesa_ClearDepth( GLclampd depth )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ depth = CLAMP( depth, 0.0, 1.0 );
+
+ if (ctx->Depth.Clear == depth)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Clear = depth;
+ if (ctx->Driver.ClearDepth)
+ (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear );
+}
+
+
+
+void GLAPIENTRY
+_mesa_DepthFunc( GLenum func )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func));
+
+ switch (func) {
+ case GL_LESS: /* (default) pass if incoming z < stored z */
+ case GL_GEQUAL:
+ case GL_LEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ case GL_EQUAL:
+ case GL_ALWAYS:
+ case GL_NEVER:
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glDepth.Func" );
+ return;
+ }
+
+ if (ctx->Depth.Func == func)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Func = func;
+
+ if (ctx->Driver.DepthFunc)
+ ctx->Driver.DepthFunc( ctx, func );
+}
+
+
+
+void GLAPIENTRY
+_mesa_DepthMask( GLboolean flag )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glDepthMask %d\n", flag);
+
+ /*
+ * GL_TRUE indicates depth buffer writing is enabled (default)
+ * GL_FALSE indicates depth buffer writing is disabled
+ */
+ if (ctx->Depth.Mask == flag)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Mask = flag;
+
+ if (ctx->Driver.DepthMask)
+ ctx->Driver.DepthMask( ctx, flag );
+}
+
+
+
+/* GL_EXT_depth_bounds_test */
+void GLAPIENTRY
+_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (zmin > zmax) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > zmax)");
+ return;
+ }
+
+ zmin = CLAMP(zmin, 0.0, 1.0);
+ zmax = CLAMP(zmax, 0.0, 1.0);
+
+ if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.BoundsMin = (GLfloat) zmin;
+ ctx->Depth.BoundsMax = (GLfloat) zmax;
+}
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+void _mesa_init_depth( GLcontext * ctx )
+{
+ /* Depth buffer group */
+ ctx->Depth.Test = GL_FALSE;
+ ctx->Depth.Clear = 1.0;
+ ctx->Depth.Func = GL_LESS;
+ ctx->Depth.Mask = GL_TRUE;
+ ctx->Depth.OcclusionTest = GL_FALSE;
+
+ /* Z buffer stuff */
+ if (ctx->Visual.depthBits == 0) {
+ /* Special case. Even if we don't have a depth buffer we need
+ * good values for DepthMax for Z vertex transformation purposes
+ * and for per-fragment fog computation.
+ */
+ ctx->DepthMax = 1 << 16;
+ ctx->DepthMaxF = (GLfloat) ctx->DepthMax;
+ }
+ else if (ctx->Visual.depthBits < 32) {
+ ctx->DepthMax = (1 << ctx->Visual.depthBits) - 1;
+ ctx->DepthMaxF = (GLfloat) ctx->DepthMax;
+ }
+ else {
+ /* Special case since shift values greater than or equal to the
+ * number of bits in the left hand expression's type are undefined.
+ */
+ ctx->DepthMax = 0xffffffff;
+ ctx->DepthMaxF = (GLfloat) ctx->DepthMax;
+ }
+ ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */
+}
Index: xc/extras/Mesa/src/mesa/main/depth.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/depth.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/depth.h Thu Apr 8 05:17:41 2004
@@ -0,0 +1,62 @@
+/**
+ * \file depth.h
+ * Depth buffer operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef DEPTH_H
+#define DEPTH_H
+
+
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_ClearDepth( GLclampd depth );
+
+extern void GLAPIENTRY
+_mesa_DepthFunc( GLenum func );
+
+extern void GLAPIENTRY
+_mesa_DepthMask( GLboolean flag );
+
+extern void
+_mesa_init_depth( GLcontext * ctx );
+
+extern void GLAPIENTRY
+_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax );
+
+#else
+
+/** No-op */
+#define _mesa_init_depth( c ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/dispatch.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/dispatch.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/dispatch.c Fri Dec 10 10:05:24 2004
@@ -0,0 +1,89 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * This file generates all the gl* function entyrpoints.
+ * But if we're using X86-optimized dispatch (X86/glapi_x86.S) then
+ * we don't use this code.
+ *
+ * NOTE: This file should _not_ be used when compiling Mesa for a DRI-
+ * based device driver.
+ *
+ */
+
+
+#include "glheader.h"
+#include "glapi.h"
+#include "glapitable.h"
+#include "glthread.h"
+
+
+#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
+
+#if defined(WIN32)
+#define KEYWORD1 GLAPI
+#else
+#define KEYWORD1
+#endif
+
+#define KEYWORD2 GLAPIENTRY
+
+#if defined(USE_MGL_NAMESPACE)
+#define NAME(func) mgl##func
+#else
+#define NAME(func) gl##func
+#endif
+
+#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */
+
+#define F stdout
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
+ fprintf MESSAGE; \
+ GL_CALL(FUNC) ARGS;
+
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
+ fprintf MESSAGE; \
+ return GL_CALL(FUNC) ARGS;
+
+#else
+
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
+ GL_CALL(FUNC) ARGS;
+
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
+ return GL_CALL(FUNC) ARGS;
+
+#endif /* logging */
+
+
+#ifndef GLAPIENTRY
+#define GLAPIENTRY
+#endif
+
+#include "glapitemp.h"
+
+
+#endif /* USE_X86_ASM */
Index: xc/extras/Mesa/src/mesa/main/dlist.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/dlist.c:1.4
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/dlist.c Fri Dec 10 10:41:02 2004
@@ -0,0 +1,8016 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/* $XFree86: xc/extras/Mesa/src/mesa/main/dlist.c,v 1.4 2004/12/10 15:41:02 alanh Exp $ */
+
+
+/**
+ * \file dlist.c
+ * Display lists management functions.
+ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "api_arrayelt.h"
+#include "api_loopback.h"
+#include "config.h"
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+#include "arbprogram.h"
+#include "program.h"
+#endif
+#include "attrib.h"
+#include "blend.h"
+#include "buffers.h"
+#if FEATURE_ARB_vertex_buffer_object
+#include "bufferobj.h"
+#endif
+#include "clip.h"
+#include "colormac.h"
+#include "colortab.h"
+#include "context.h"
+#include "convolve.h"
+#include "depth.h"
+#include "dlist.h"
+#include "enable.h"
+#include "enums.h"
+#include "eval.h"
+#include "extensions.h"
+#include "feedback.h"
+#include "get.h"
+#include "glapi.h"
+#include "hash.h"
+#include "histogram.h"
+#include "image.h"
+#include "light.h"
+#include "lines.h"
+#include "dlist.h"
+#include "macros.h"
+#include "matrix.h"
+#include "occlude.h"
+#include "pixel.h"
+#include "points.h"
+#include "polygon.h"
+#include "state.h"
+#include "texobj.h"
+#include "teximage.h"
+#include "texstate.h"
+#include "mtypes.h"
+#include "varray.h"
+#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
+#include "nvprogram.h"
+#include "program.h"
+#endif
+
+#include "math/m_matrix.h"
+#include "math/m_xform.h"
+
+
+/**
+ * Flush vertices.
+ *
+ * \param ctx GL context.
+ *
+ * Checks if dd_function_table::SaveNeedFlush is marked to flush
+ * stored (save) vertices, and calls
+ * dd_function_table::SaveFlushVertices if so.
+ */
+#define SAVE_FLUSH_VERTICES(ctx) \
+do { \
+ if (ctx->Driver.SaveNeedFlush) \
+ ctx->Driver.SaveFlushVertices(ctx); \
+} while (0)
+
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair, with return value.
+ *
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
+ */
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
+do { \
+ if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
+ ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
+ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ return retval; \
+ } \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair.
+ *
+ * \param ctx GL context.
+ */
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
+do { \
+ if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
+ ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
+ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ return; \
+ } \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices.
+ *
+ * \param ctx GL context.
+ */
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
+do { \
+ ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
+ SAVE_FLUSH_VERTICES(ctx); \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices, with return value.
+ *
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
+ */
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
+do { \
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
+ SAVE_FLUSH_VERTICES(ctx); \
+} while (0)
+
+
+
+/**
+ * Display list opcodes.
+ *
+ * The fact that these identifiers are assigned consecutive
+ * integer values starting at 0 is very important, see InstSize array usage)
+ */
+typedef enum {
+ OPCODE_INVALID = -1, /* Force signed enum */
+ OPCODE_ACCUM,
+ OPCODE_ALPHA_FUNC,
+ OPCODE_BIND_TEXTURE,
+ OPCODE_BITMAP,
+ OPCODE_BLEND_COLOR,
+ OPCODE_BLEND_EQUATION,
+ OPCODE_BLEND_EQUATION_SEPARATE,
+ OPCODE_BLEND_FUNC_SEPARATE,
+ OPCODE_CALL_LIST,
+ OPCODE_CALL_LIST_OFFSET,
+ OPCODE_CLEAR,
+ OPCODE_CLEAR_ACCUM,
+ OPCODE_CLEAR_COLOR,
+ OPCODE_CLEAR_DEPTH,
+ OPCODE_CLEAR_INDEX,
+ OPCODE_CLEAR_STENCIL,
+ OPCODE_CLIP_PLANE,
+ OPCODE_COLOR_MASK,
+ OPCODE_COLOR_MATERIAL,
+ OPCODE_COLOR_TABLE,
+ OPCODE_COLOR_TABLE_PARAMETER_FV,
+ OPCODE_COLOR_TABLE_PARAMETER_IV,
+ OPCODE_COLOR_SUB_TABLE,
+ OPCODE_CONVOLUTION_FILTER_1D,
+ OPCODE_CONVOLUTION_FILTER_2D,
+ OPCODE_CONVOLUTION_PARAMETER_I,
+ OPCODE_CONVOLUTION_PARAMETER_IV,
+ OPCODE_CONVOLUTION_PARAMETER_F,
+ OPCODE_CONVOLUTION_PARAMETER_FV,
+ OPCODE_COPY_COLOR_SUB_TABLE,
+ OPCODE_COPY_COLOR_TABLE,
+ OPCODE_COPY_PIXELS,
+ OPCODE_COPY_TEX_IMAGE1D,
+ OPCODE_COPY_TEX_IMAGE2D,
+ OPCODE_COPY_TEX_SUB_IMAGE1D,
+ OPCODE_COPY_TEX_SUB_IMAGE2D,
+ OPCODE_COPY_TEX_SUB_IMAGE3D,
+ OPCODE_CULL_FACE,
+ OPCODE_DEPTH_FUNC,
+ OPCODE_DEPTH_MASK,
+ OPCODE_DEPTH_RANGE,
+ OPCODE_DISABLE,
+ OPCODE_DRAW_BUFFER,
+ OPCODE_DRAW_PIXELS,
+ OPCODE_ENABLE,
+ OPCODE_EVALMESH1,
+ OPCODE_EVALMESH2,
+ OPCODE_FOG,
+ OPCODE_FRONT_FACE,
+ OPCODE_FRUSTUM,
+ OPCODE_HINT,
+ OPCODE_HISTOGRAM,
+ OPCODE_INDEX_MASK,
+ OPCODE_INIT_NAMES,
+ OPCODE_LIGHT,
+ OPCODE_LIGHT_MODEL,
+ OPCODE_LINE_STIPPLE,
+ OPCODE_LINE_WIDTH,
+ OPCODE_LIST_BASE,
+ OPCODE_LOAD_IDENTITY,
+ OPCODE_LOAD_MATRIX,
+ OPCODE_LOAD_NAME,
+ OPCODE_LOGIC_OP,
+ OPCODE_MAP1,
+ OPCODE_MAP2,
+ OPCODE_MAPGRID1,
+ OPCODE_MAPGRID2,
+ OPCODE_MATRIX_MODE,
+ OPCODE_MIN_MAX,
+ OPCODE_MULT_MATRIX,
+ OPCODE_ORTHO,
+ OPCODE_PASSTHROUGH,
+ OPCODE_PIXEL_MAP,
+ OPCODE_PIXEL_TRANSFER,
+ OPCODE_PIXEL_ZOOM,
+ OPCODE_POINT_SIZE,
+ OPCODE_POINT_PARAMETERS,
+ OPCODE_POLYGON_MODE,
+ OPCODE_POLYGON_STIPPLE,
+ OPCODE_POLYGON_OFFSET,
+ OPCODE_POP_ATTRIB,
+ OPCODE_POP_MATRIX,
+ OPCODE_POP_NAME,
+ OPCODE_PRIORITIZE_TEXTURE,
+ OPCODE_PUSH_ATTRIB,
+ OPCODE_PUSH_MATRIX,
+ OPCODE_PUSH_NAME,
+ OPCODE_RASTER_POS,
+ OPCODE_READ_BUFFER,
+ OPCODE_RESET_HISTOGRAM,
+ OPCODE_RESET_MIN_MAX,
+ OPCODE_ROTATE,
+ OPCODE_SCALE,
+ OPCODE_SCISSOR,
+ OPCODE_SELECT_TEXTURE_SGIS,
+ OPCODE_SELECT_TEXTURE_COORD_SET,
+ OPCODE_SHADE_MODEL,
+ OPCODE_STENCIL_FUNC,
+ OPCODE_STENCIL_MASK,
+ OPCODE_STENCIL_OP,
+ OPCODE_TEXENV,
+ OPCODE_TEXGEN,
+ OPCODE_TEXPARAMETER,
+ OPCODE_TEX_IMAGE1D,
+ OPCODE_TEX_IMAGE2D,
+ OPCODE_TEX_IMAGE3D,
+ OPCODE_TEX_SUB_IMAGE1D,
+ OPCODE_TEX_SUB_IMAGE2D,
+ OPCODE_TEX_SUB_IMAGE3D,
+ OPCODE_TRANSLATE,
+ OPCODE_VIEWPORT,
+ OPCODE_WINDOW_POS,
+ /* GL_ARB_multitexture */
+ OPCODE_ACTIVE_TEXTURE,
+ /* GL_SGIX/SGIS_pixel_texture */
+ OPCODE_PIXEL_TEXGEN_SGIX,
+ OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS,
+ /* GL_ARB_texture_compression */
+ OPCODE_COMPRESSED_TEX_IMAGE_1D,
+ OPCODE_COMPRESSED_TEX_IMAGE_2D,
+ OPCODE_COMPRESSED_TEX_IMAGE_3D,
+ OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
+ OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
+ OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
+ /* GL_ARB_multisample */
+ OPCODE_SAMPLE_COVERAGE,
+ /* GL_ARB_window_pos */
+ OPCODE_WINDOW_POS_ARB,
+ /* GL_NV_vertex_program */
+ OPCODE_BIND_PROGRAM_NV,
+ OPCODE_EXECUTE_PROGRAM_NV,
+ OPCODE_REQUEST_RESIDENT_PROGRAMS_NV,
+ OPCODE_LOAD_PROGRAM_NV,
+ OPCODE_PROGRAM_PARAMETER4F_NV,
+ OPCODE_TRACK_MATRIX_NV,
+ /* GL_NV_fragment_program */
+ OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
+ OPCODE_PROGRAM_NAMED_PARAMETER_NV,
+ /* GL_EXT_stencil_two_side */
+ OPCODE_ACTIVE_STENCIL_FACE_EXT,
+ /* GL_EXT_depth_bounds_test */
+ OPCODE_DEPTH_BOUNDS_EXT,
+ /* GL_ARB_vertex/fragment_program */
+ OPCODE_PROGRAM_STRING_ARB,
+ OPCODE_PROGRAM_ENV_PARAMETER_ARB,
+ /* GL_ARB_occlusion_query */
+ OPCODE_BEGIN_QUERY_ARB,
+ OPCODE_END_QUERY_ARB,
+
+ /* Vertex attributes -- fallback for when optimized display
+ * list build isn't active.
+ */
+ OPCODE_ATTR_1F,
+ OPCODE_ATTR_2F,
+ OPCODE_ATTR_3F,
+ OPCODE_ATTR_4F,
+ OPCODE_MATERIAL,
+ OPCODE_INDEX,
+ OPCODE_EDGEFLAG,
+ OPCODE_BEGIN,
+ OPCODE_END,
+ OPCODE_RECTF,
+ OPCODE_EVAL_C1,
+ OPCODE_EVAL_C2,
+ OPCODE_EVAL_P1,
+ OPCODE_EVAL_P2,
+
+
+ /* The following three are meta instructions */
+ OPCODE_ERROR, /* raise compiled-in error */
+ OPCODE_CONTINUE,
+ OPCODE_END_OF_LIST,
+ OPCODE_EXT_0
+} OpCode;
+
+
+
+/**
+ * Display list node.
+ *
+ * Display list instructions are stored as sequences of "nodes". Nodes
+ * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
+ * are linked together with a pointer.
+ *
+ * Each instruction in the display list is stored as a sequence of
+ * contiguous nodes in memory.
+ * Each node is the union of a variety of data types.
+ */
+union node {
+ OpCode opcode;
+ GLboolean b;
+ GLbitfield bf;
+ GLubyte ub;
+ GLshort s;
+ GLushort us;
+ GLint i;
+ GLuint ui;
+ GLenum e;
+ GLfloat f;
+ GLvoid *data;
+ void *next; /* If prev node's opcode==OPCODE_CONTINUE */
+};
+
+
+/**
+ * How many nodes to allocate at a time.
+ *
+ * \note Reduced now that we hold vertices etc. elsewhere.
+ */
+#define BLOCK_SIZE 256
+
+
+
+/**
+ * Number of nodes of storage needed for each instruction.
+ * Sizes for dynamically allocated opcodes are stored in the context struct.
+ */
+static GLuint InstSize[ OPCODE_END_OF_LIST+1 ];
+
+void mesa_print_display_list( GLuint list );
+
+
+/**********************************************************************/
+/***** Private *****/
+/**********************************************************************/
+
+/*
+ * Make an empty display list. This is used by glGenLists() to
+ * reserver display list IDs.
+ */
+static Node *make_empty_list( void )
+{
+ Node *n = (Node *) MALLOC( sizeof(Node) );
+ n[0].opcode = OPCODE_END_OF_LIST;
+ return n;
+}
+
+
+
+/*
+ * Destroy all nodes in a display list.
+ * \param list - display list number
+ */
+void _mesa_destroy_list( GLcontext *ctx, GLuint list )
+{
+ Node *n, *block;
+ GLboolean done;
+
+ if (list==0)
+ return;
+
+ block = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+ n = block;
+
+ done = block ? GL_FALSE : GL_TRUE;
+ while (!done) {
+
+ /* check for extension opcodes first */
+
+ GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
+ if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
+ ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]);
+ n += ctx->ListExt.Opcode[i].Size;
+ }
+ else {
+ switch (n[0].opcode) {
+ /* for some commands, we need to free malloc'd memory */
+ case OPCODE_MAP1:
+ FREE(n[6].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_MAP2:
+ FREE(n[10].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_DRAW_PIXELS:
+ FREE( n[5].data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_BITMAP:
+ FREE( n[7].data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COLOR_TABLE:
+ FREE( n[6].data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COLOR_SUB_TABLE:
+ FREE( n[6].data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_CONVOLUTION_FILTER_1D:
+ FREE( n[6].data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_CONVOLUTION_FILTER_2D:
+ FREE( n[7].data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_POLYGON_STIPPLE:
+ FREE( n[1].data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_TEX_IMAGE1D:
+ FREE(n[8].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_TEX_IMAGE2D:
+ FREE( n[9]. data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_TEX_IMAGE3D:
+ FREE( n[10]. data );
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_TEX_SUB_IMAGE1D:
+ FREE(n[7].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_TEX_SUB_IMAGE2D:
+ FREE(n[9].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_TEX_SUB_IMAGE3D:
+ FREE(n[11].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COMPRESSED_TEX_IMAGE_1D:
+ FREE(n[7].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COMPRESSED_TEX_IMAGE_2D:
+ FREE(n[8].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COMPRESSED_TEX_IMAGE_3D:
+ FREE(n[9].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
+ FREE(n[7].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
+ FREE(n[9].data);
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
+ FREE(n[11].data);
+ n += InstSize[n[0].opcode];
+ break;
+#if FEATURE_NV_vertex_program
+ case OPCODE_LOAD_PROGRAM_NV:
+ FREE(n[4].data); /* program string */
+ n += InstSize[n[0].opcode];
+ break;
+ case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
+ FREE(n[2].data); /* array of program ids */
+ n += InstSize[n[0].opcode];
+ break;
+#endif
+#if FEATURE_NV_fragment_program
+ case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
+ FREE(n[3].data); /* parameter name */
+ n += InstSize[n[0].opcode];
+ break;
+#endif
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ case OPCODE_PROGRAM_STRING_ARB:
+ FREE(n[4].data); /* program string */
+ n += InstSize[n[0].opcode];
+ break;
+#endif
+ case OPCODE_CONTINUE:
+ n = (Node *) n[1].next;
+ FREE( block );
+ block = n;
+ break;
+ case OPCODE_END_OF_LIST:
+ FREE( block );
+ done = GL_TRUE;
+ break;
+ default:
+ /* Most frequent case */
+ n += InstSize[n[0].opcode];
+ break;
+ }
+ }
+ }
+
+ _mesa_HashRemove(ctx->Shared->DisplayList, list);
+}
+
+
+
+/*
+ * Translate the nth element of list from type to GLuint.
+ */
+static GLuint translate_id( GLsizei n, GLenum type, const GLvoid *list )
+{
+ GLbyte *bptr;
+ GLubyte *ubptr;
+ GLshort *sptr;
+ GLushort *usptr;
+ GLint *iptr;
+ GLuint *uiptr;
+ GLfloat *fptr;
+
+ switch (type) {
+ case GL_BYTE:
+ bptr = (GLbyte *) list;
+ return (GLuint) *(bptr+n);
+ case GL_UNSIGNED_BYTE:
+ ubptr = (GLubyte *) list;
+ return (GLuint) *(ubptr+n);
+ case GL_SHORT:
+ sptr = (GLshort *) list;
+ return (GLuint) *(sptr+n);
+ case GL_UNSIGNED_SHORT:
+ usptr = (GLushort *) list;
+ return (GLuint) *(usptr+n);
+ case GL_INT:
+ iptr = (GLint *) list;
+ return (GLuint) *(iptr+n);
+ case GL_UNSIGNED_INT:
+ uiptr = (GLuint *) list;
+ return (GLuint) *(uiptr+n);
+ case GL_FLOAT:
+ fptr = (GLfloat *) list;
+ return (GLuint) *(fptr+n);
+ case GL_2_BYTES:
+ ubptr = ((GLubyte *) list) + 2*n;
+ return (GLuint) *ubptr * 256 + (GLuint) *(ubptr+1);
+ case GL_3_BYTES:
+ ubptr = ((GLubyte *) list) + 3*n;
+ return (GLuint) *ubptr * 65536
+ + (GLuint) *(ubptr+1) * 256
+ + (GLuint) *(ubptr+2);
+ case GL_4_BYTES:
+ ubptr = ((GLubyte *) list) + 4*n;
+ return (GLuint) *ubptr * 16777216
+ + (GLuint) *(ubptr+1) * 65536
+ + (GLuint) *(ubptr+2) * 256
+ + (GLuint) *(ubptr+3);
+ default:
+ return 0;
+ }
+}
+
+
+
+
+/**********************************************************************/
+/***** Public *****/
+/**********************************************************************/
+
+/**
+ * Do one-time initialiazations for display lists.
+ */
+void
+_mesa_init_lists( void )
+{
+ static int init_flag = 0;
+
+ if (init_flag==0) {
+ InstSize[OPCODE_ACCUM] = 3;
+ InstSize[OPCODE_ALPHA_FUNC] = 3;
+ InstSize[OPCODE_BIND_TEXTURE] = 3;
+ InstSize[OPCODE_BITMAP] = 8;
+ InstSize[OPCODE_BLEND_COLOR] = 5;
+ InstSize[OPCODE_BLEND_EQUATION] = 2;
+ InstSize[OPCODE_BLEND_EQUATION_SEPARATE] = 3;
+ InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5;
+ InstSize[OPCODE_CALL_LIST] = 2;
+ InstSize[OPCODE_CALL_LIST_OFFSET] = 3;
+ InstSize[OPCODE_CLEAR] = 2;
+ InstSize[OPCODE_CLEAR_ACCUM] = 5;
+ InstSize[OPCODE_CLEAR_COLOR] = 5;
+ InstSize[OPCODE_CLEAR_DEPTH] = 2;
+ InstSize[OPCODE_CLEAR_INDEX] = 2;
+ InstSize[OPCODE_CLEAR_STENCIL] = 2;
+ InstSize[OPCODE_CLIP_PLANE] = 6;
+ InstSize[OPCODE_COLOR_MASK] = 5;
+ InstSize[OPCODE_COLOR_MATERIAL] = 3;
+ InstSize[OPCODE_COLOR_TABLE] = 7;
+ InstSize[OPCODE_COLOR_TABLE_PARAMETER_FV] = 7;
+ InstSize[OPCODE_COLOR_TABLE_PARAMETER_IV] = 7;
+ InstSize[OPCODE_COLOR_SUB_TABLE] = 7;
+ InstSize[OPCODE_CONVOLUTION_FILTER_1D] = 7;
+ InstSize[OPCODE_CONVOLUTION_FILTER_2D] = 8;
+ InstSize[OPCODE_CONVOLUTION_PARAMETER_I] = 4;
+ InstSize[OPCODE_CONVOLUTION_PARAMETER_IV] = 7;
+ InstSize[OPCODE_CONVOLUTION_PARAMETER_F] = 4;
+ InstSize[OPCODE_CONVOLUTION_PARAMETER_FV] = 7;
+ InstSize[OPCODE_COPY_PIXELS] = 6;
+ InstSize[OPCODE_COPY_COLOR_SUB_TABLE] = 6;
+ InstSize[OPCODE_COPY_COLOR_TABLE] = 6;
+ InstSize[OPCODE_COPY_TEX_IMAGE1D] = 8;
+ InstSize[OPCODE_COPY_TEX_IMAGE2D] = 9;
+ InstSize[OPCODE_COPY_TEX_SUB_IMAGE1D] = 7;
+ InstSize[OPCODE_COPY_TEX_SUB_IMAGE2D] = 9;
+ InstSize[OPCODE_COPY_TEX_SUB_IMAGE3D] = 10;
+ InstSize[OPCODE_CULL_FACE] = 2;
+ InstSize[OPCODE_DEPTH_FUNC] = 2;
+ InstSize[OPCODE_DEPTH_MASK] = 2;
+ InstSize[OPCODE_DEPTH_RANGE] = 3;
+ InstSize[OPCODE_DISABLE] = 2;
+ InstSize[OPCODE_DRAW_BUFFER] = 2;
+ InstSize[OPCODE_DRAW_PIXELS] = 6;
+ InstSize[OPCODE_ENABLE] = 2;
+ InstSize[OPCODE_EVALMESH1] = 4;
+ InstSize[OPCODE_EVALMESH2] = 6;
+ InstSize[OPCODE_FOG] = 6;
+ InstSize[OPCODE_FRONT_FACE] = 2;
+ InstSize[OPCODE_FRUSTUM] = 7;
+ InstSize[OPCODE_HINT] = 3;
+ InstSize[OPCODE_HISTOGRAM] = 5;
+ InstSize[OPCODE_INDEX_MASK] = 2;
+ InstSize[OPCODE_INIT_NAMES] = 1;
+ InstSize[OPCODE_LIGHT] = 7;
+ InstSize[OPCODE_LIGHT_MODEL] = 6;
+ InstSize[OPCODE_LINE_STIPPLE] = 3;
+ InstSize[OPCODE_LINE_WIDTH] = 2;
+ InstSize[OPCODE_LIST_BASE] = 2;
+ InstSize[OPCODE_LOAD_IDENTITY] = 1;
+ InstSize[OPCODE_LOAD_MATRIX] = 17;
+ InstSize[OPCODE_LOAD_NAME] = 2;
+ InstSize[OPCODE_LOGIC_OP] = 2;
+ InstSize[OPCODE_MAP1] = 7;
+ InstSize[OPCODE_MAP2] = 11;
+ InstSize[OPCODE_MAPGRID1] = 4;
+ InstSize[OPCODE_MAPGRID2] = 7;
+ InstSize[OPCODE_MATRIX_MODE] = 2;
+ InstSize[OPCODE_MIN_MAX] = 4;
+ InstSize[OPCODE_MULT_MATRIX] = 17;
+ InstSize[OPCODE_ORTHO] = 7;
+ InstSize[OPCODE_PASSTHROUGH] = 2;
+ InstSize[OPCODE_PIXEL_MAP] = 4;
+ InstSize[OPCODE_PIXEL_TRANSFER] = 3;
+ InstSize[OPCODE_PIXEL_ZOOM] = 3;
+ InstSize[OPCODE_POINT_SIZE] = 2;
+ InstSize[OPCODE_POINT_PARAMETERS] = 5;
+ InstSize[OPCODE_POLYGON_MODE] = 3;
+ InstSize[OPCODE_POLYGON_STIPPLE] = 2;
+ InstSize[OPCODE_POLYGON_OFFSET] = 3;
+ InstSize[OPCODE_POP_ATTRIB] = 1;
+ InstSize[OPCODE_POP_MATRIX] = 1;
+ InstSize[OPCODE_POP_NAME] = 1;
+ InstSize[OPCODE_PRIORITIZE_TEXTURE] = 3;
+ InstSize[OPCODE_PUSH_ATTRIB] = 2;
+ InstSize[OPCODE_PUSH_MATRIX] = 1;
+ InstSize[OPCODE_PUSH_NAME] = 2;
+ InstSize[OPCODE_RASTER_POS] = 5;
+ InstSize[OPCODE_READ_BUFFER] = 2;
+ InstSize[OPCODE_RESET_HISTOGRAM] = 2;
+ InstSize[OPCODE_RESET_MIN_MAX] = 2;
+ InstSize[OPCODE_ROTATE] = 5;
+ InstSize[OPCODE_SCALE] = 4;
+ InstSize[OPCODE_SCISSOR] = 5;
+ InstSize[OPCODE_STENCIL_FUNC] = 4;
+ InstSize[OPCODE_STENCIL_MASK] = 2;
+ InstSize[OPCODE_STENCIL_OP] = 4;
+ InstSize[OPCODE_SHADE_MODEL] = 2;
+ InstSize[OPCODE_TEXENV] = 7;
+ InstSize[OPCODE_TEXGEN] = 7;
+ InstSize[OPCODE_TEXPARAMETER] = 7;
+ InstSize[OPCODE_TEX_IMAGE1D] = 9;
+ InstSize[OPCODE_TEX_IMAGE2D] = 10;
+ InstSize[OPCODE_TEX_IMAGE3D] = 11;
+ InstSize[OPCODE_TEX_SUB_IMAGE1D] = 8;
+ InstSize[OPCODE_TEX_SUB_IMAGE2D] = 10;
+ InstSize[OPCODE_TEX_SUB_IMAGE3D] = 12;
+ InstSize[OPCODE_TRANSLATE] = 4;
+ InstSize[OPCODE_VIEWPORT] = 5;
+ InstSize[OPCODE_WINDOW_POS] = 5;
+ InstSize[OPCODE_CONTINUE] = 2;
+ InstSize[OPCODE_ERROR] = 3;
+ InstSize[OPCODE_END_OF_LIST] = 1;
+ /* GL_SGIX/SGIS_pixel_texture */
+ InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2;
+ InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3;
+ /* GL_ARB_texture_compression */
+ InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8;
+ InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9;
+ InstSize[OPCODE_COMPRESSED_TEX_IMAGE_3D] = 10;
+ InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D] = 8;
+ InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D] = 10;
+ InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D] = 12;
+ /* GL_ARB_multisample */
+ InstSize[OPCODE_SAMPLE_COVERAGE] = 3;
+ /* GL_ARB_multitexture */
+ InstSize[OPCODE_ACTIVE_TEXTURE] = 2;
+ /* GL_ARB_window_pos */
+ InstSize[OPCODE_WINDOW_POS_ARB] = 4;
+ /* GL_NV_vertex_program */
+ InstSize[OPCODE_BIND_PROGRAM_NV] = 3;
+ InstSize[OPCODE_EXECUTE_PROGRAM_NV] = 7;
+ InstSize[OPCODE_REQUEST_RESIDENT_PROGRAMS_NV] = 2;
+ InstSize[OPCODE_LOAD_PROGRAM_NV] = 5;
+ InstSize[OPCODE_PROGRAM_PARAMETER4F_NV] = 7;
+ InstSize[OPCODE_TRACK_MATRIX_NV] = 5;
+ /* GL_NV_fragment_program */
+ InstSize[OPCODE_PROGRAM_LOCAL_PARAMETER_ARB] = 7;
+ InstSize[OPCODE_PROGRAM_NAMED_PARAMETER_NV] = 8;
+ /* GL_EXT_stencil_two_side */
+ InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2;
+ /* GL_EXT_depth_bounds_test */
+ InstSize[OPCODE_DEPTH_BOUNDS_EXT] = 3;
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ InstSize[OPCODE_PROGRAM_STRING_ARB] = 5;
+ InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7;
+#endif
+#if FEATURE_ARB_occlusion_query
+ InstSize[OPCODE_BEGIN_QUERY_ARB] = 3;
+ InstSize[OPCODE_END_QUERY_ARB] = 2;
+#endif
+ InstSize[OPCODE_ATTR_1F] = 3;
+ InstSize[OPCODE_ATTR_2F] = 4;
+ InstSize[OPCODE_ATTR_3F] = 5;
+ InstSize[OPCODE_ATTR_4F] = 6;
+ InstSize[OPCODE_MATERIAL] = 7;
+ InstSize[OPCODE_INDEX] = 2;
+ InstSize[OPCODE_EDGEFLAG] = 2;
+ InstSize[OPCODE_BEGIN] = 2;
+ InstSize[OPCODE_END] = 1;
+ InstSize[OPCODE_RECTF] = 5;
+ InstSize[OPCODE_EVAL_C1] = 2;
+ InstSize[OPCODE_EVAL_C2] = 3;
+ InstSize[OPCODE_EVAL_P1] = 2;
+ InstSize[OPCODE_EVAL_P2] = 3;
+ }
+ init_flag = 1;
+}
+
+
+
+/**
+ * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
+ * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
+ */
+static GLvoid *
+unpack_image( GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *unpack )
+{
+ if (unpack->BufferObj->Name == 0) {
+ /* no PBO */
+ return _mesa_unpack_image(width, height, depth, format, type,
+ pixels, unpack);
+ }
+ else if (_mesa_validate_pbo_access(unpack, width, height, depth, format,
+ type, pixels)) {
+ const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels);
+ return _mesa_unpack_image(width, height, depth, format, type,
+ src, unpack);
+ }
+ /* bad access! */
+ return NULL;
+}
+
+
+/*
+ * Allocate space for a display list instruction.
+ * \param opcode - type of instruction
+ * argcount - size in bytes of data required.
+ * \return pointer to the usable data area (not including the internal
+ * opcode).
+ */
+void *
+_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz )
+{
+ Node *n, *newblock;
+ GLuint count = 1 + (sz + sizeof(Node) - 1) / sizeof(Node);
+
+#ifdef DEBUG
+ if (opcode < (int) OPCODE_EXT_0) {
+ assert( count == InstSize[opcode] );
+ }
+#endif
+
+ if (ctx->ListState.CurrentPos + count + 2 > BLOCK_SIZE) {
+ /* This block is full. Allocate a new block and chain to it */
+ n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
+ n[0].opcode = OPCODE_CONTINUE;
+ newblock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE );
+ if (!newblock) {
+ _mesa_error( ctx, GL_OUT_OF_MEMORY, "Building display list" );
+ return NULL;
+ }
+ n[1].next = (Node *) newblock;
+ ctx->ListState.CurrentBlock = newblock;
+ ctx->ListState.CurrentPos = 0;
+ }
+
+ n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
+ ctx->ListState.CurrentPos += count;
+
+ n[0].opcode = (OpCode) opcode;
+
+ return (void *)&n[1];
+}
+
+
+/**
+ * This function allows modules and drivers to get their own opcodes
+ * for extending display list functionality.
+ * \param ctx the rendering context
+ * \param size number of bytes for storing the new display list command
+ * \param execute function to execute the new display list command
+ * \param destroy function to destroy the new display list command
+ * \param print function to print the new display list command
+ * \return the new opcode number or -1 if error
+ */
+GLint
+_mesa_alloc_opcode( GLcontext *ctx,
+ GLuint size,
+ void (*execute)( GLcontext *, void * ),
+ void (*destroy)( GLcontext *, void * ),
+ void (*print)( GLcontext *, void * ) )
+{
+ if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) {
+ const GLuint i = ctx->ListExt.NumOpcodes++;
+ ctx->ListExt.Opcode[i].Size = 1 + (size + sizeof(Node) - 1)/sizeof(Node);
+ ctx->ListExt.Opcode[i].Execute = execute;
+ ctx->ListExt.Opcode[i].Destroy = destroy;
+ ctx->ListExt.Opcode[i].Print = print;
+ return i + OPCODE_EXT_0;
+ }
+ return -1;
+}
+
+
+
+/* Mimic the old behaviour of alloc_instruction:
+ * - sz is in units of sizeof(Node)
+ * - return value a pointer to sizeof(Node) before the actual
+ * usable data area.
+ */
+#define ALLOC_INSTRUCTION(ctx, opcode, sz) \
+ ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
+
+
+
+/*
+ * Display List compilation functions
+ */
+static void GLAPIENTRY save_Accum( GLenum op, GLfloat value )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ACCUM, 2 );
+ if (n) {
+ n[1].e = op;
+ n[2].f = value;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Accum)( op, value );
+ }
+}
+
+
+static void GLAPIENTRY save_AlphaFunc( GLenum func, GLclampf ref )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ALPHA_FUNC, 2 );
+ if (n) {
+ n[1].e = func;
+ n[2].f = (GLfloat) ref;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->AlphaFunc)( func, ref );
+ }
+}
+
+
+static void GLAPIENTRY save_BindTexture( GLenum target, GLuint texture )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_TEXTURE, 2 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = texture;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BindTexture)( target, texture );
+ }
+}
+
+
+static void GLAPIENTRY save_Bitmap( GLsizei width, GLsizei height,
+ GLfloat xorig, GLfloat yorig,
+ GLfloat xmove, GLfloat ymove,
+ const GLubyte *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLvoid *image = _mesa_unpack_bitmap( width, height, pixels, &ctx->Unpack );
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BITMAP, 7 );
+ if (n) {
+ n[1].i = (GLint) width;
+ n[2].i = (GLint) height;
+ n[3].f = xorig;
+ n[4].f = yorig;
+ n[5].f = xmove;
+ n[6].f = ymove;
+ n[7].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Bitmap)( width, height,
+ xorig, yorig, xmove, ymove, pixels );
+ }
+}
+
+
+static void GLAPIENTRY save_BlendEquation( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BlendEquation)( mode );
+ }
+}
+
+
+static void GLAPIENTRY save_BlendEquationSeparateEXT( GLenum modeRGB,
+ GLenum modeA )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2 );
+ if (n) {
+ n[1].e = modeRGB;
+ n[2].e = modeA;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BlendEquationSeparateEXT)( modeRGB, modeA );
+ }
+}
+
+
+static void GLAPIENTRY save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC_SEPARATE, 4 );
+ if (n) {
+ n[1].e = sfactorRGB;
+ n[2].e = dfactorRGB;
+ n[3].e = sfactorA;
+ n[4].e = dfactorA;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BlendFuncSeparateEXT)( sfactorRGB, dfactorRGB,
+ sfactorA, dfactorA);
+ }
+}
+
+
+static void GLAPIENTRY save_BlendColor( GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_COLOR, 4 );
+ if (n) {
+ n[1].f = red;
+ n[2].f = green;
+ n[3].f = blue;
+ n[4].f = alpha;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BlendColor)( red, green, blue, alpha );
+ }
+}
+
+
+void GLAPIENTRY _mesa_save_CallList( GLuint list )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES(ctx);
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST, 1 );
+ if (n) {
+ n[1].ui = list;
+ }
+
+ /* After this, we don't know what begin/end state we're in:
+ */
+ ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CallList)( list );
+ }
+}
+
+
+void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ GLboolean typeErrorFlag;
+
+ SAVE_FLUSH_VERTICES(ctx);
+
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ typeErrorFlag = GL_FALSE;
+ break;
+ default:
+ typeErrorFlag = GL_TRUE;
+ }
+
+ for (i=0;iDriver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CallLists)( n, type, lists );
+ }
+}
+
+
+static void GLAPIENTRY save_Clear( GLbitfield mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR, 1 );
+ if (n) {
+ n[1].bf = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Clear)( mask );
+ }
+}
+
+
+static void GLAPIENTRY save_ClearAccum( GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_ACCUM, 4 );
+ if (n) {
+ n[1].f = red;
+ n[2].f = green;
+ n[3].f = blue;
+ n[4].f = alpha;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ClearAccum)( red, green, blue, alpha );
+ }
+}
+
+
+static void GLAPIENTRY save_ClearColor( GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_COLOR, 4 );
+ if (n) {
+ n[1].f = red;
+ n[2].f = green;
+ n[3].f = blue;
+ n[4].f = alpha;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ClearColor)( red, green, blue, alpha );
+ }
+}
+
+
+static void GLAPIENTRY save_ClearDepth( GLclampd depth )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_DEPTH, 1 );
+ if (n) {
+ n[1].f = (GLfloat) depth;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ClearDepth)( depth );
+ }
+}
+
+
+static void GLAPIENTRY save_ClearIndex( GLfloat c )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_INDEX, 1 );
+ if (n) {
+ n[1].f = c;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ClearIndex)( c );
+ }
+}
+
+
+static void GLAPIENTRY save_ClearStencil( GLint s )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_STENCIL, 1 );
+ if (n) {
+ n[1].i = s;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ClearStencil)( s );
+ }
+}
+
+
+static void GLAPIENTRY save_ClipPlane( GLenum plane, const GLdouble *equ )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CLIP_PLANE, 5 );
+ if (n) {
+ n[1].e = plane;
+ n[2].f = (GLfloat) equ[0];
+ n[3].f = (GLfloat) equ[1];
+ n[4].f = (GLfloat) equ[2];
+ n[5].f = (GLfloat) equ[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ClipPlane)( plane, equ );
+ }
+}
+
+
+
+static void GLAPIENTRY save_ColorMask( GLboolean red, GLboolean green,
+ GLboolean blue, GLboolean alpha )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MASK, 4 );
+ if (n) {
+ n[1].b = red;
+ n[2].b = green;
+ n[3].b = blue;
+ n[4].b = alpha;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ColorMask)( red, green, blue, alpha );
+ }
+}
+
+
+static void GLAPIENTRY save_ColorMaterial( GLenum face, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MATERIAL, 2 );
+ if (n) {
+ n[1].e = face;
+ n[2].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ColorMaterial)( face, mode );
+ }
+}
+
+
+static void GLAPIENTRY save_ColorTable( GLenum target, GLenum internalFormat,
+ GLsizei width, GLenum format, GLenum type,
+ const GLvoid *table )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_1D ||
+ target == GL_PROXY_TEXTURE_2D ||
+ target == GL_PROXY_TEXTURE_3D ||
+ target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+ /* execute immediately */
+ (*ctx->Exec->ColorTable)( target, internalFormat, width,
+ format, type, table );
+ }
+ else {
+ GLvoid *image = unpack_image(width, 1, 1, format, type, table,
+ &ctx->Unpack);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = internalFormat;
+ n[3].i = width;
+ n[4].e = format;
+ n[5].e = type;
+ n[6].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ColorTable)( target, internalFormat, width,
+ format, type, table );
+ }
+ }
+}
+
+
+
+static void GLAPIENTRY
+save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ n[3].f = params[0];
+ if (pname == GL_COLOR_TABLE_SGI ||
+ pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
+ pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI) {
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ColorTableParameterfv)( target, pname, params );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ n[3].i = params[0];
+ if (pname == GL_COLOR_TABLE_SGI ||
+ pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
+ pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI) {
+ n[4].i = params[1];
+ n[5].i = params[2];
+ n[6].i = params[3];
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ColorTableParameteriv)( target, pname, params );
+ }
+}
+
+
+
+static void GLAPIENTRY save_ColorSubTable( GLenum target, GLsizei start, GLsizei count,
+ GLenum format, GLenum type,
+ const GLvoid *table)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLvoid *image = unpack_image(count, 1, 1, format, type, table,
+ &ctx->Unpack);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_SUB_TABLE, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = start;
+ n[3].i = count;
+ n[4].e = format;
+ n[5].e = type;
+ n[6].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ColorSubTable)(target, start, count, format, type, table);
+ }
+}
+
+
+static void GLAPIENTRY
+save_CopyColorSubTable(GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = start;
+ n[3].i = x;
+ n[4].i = y;
+ n[5].i = width;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyColorSubTable)(target, start, x, y, width);
+ }
+}
+
+
+static void GLAPIENTRY
+save_CopyColorTable(GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_TABLE, 5 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = internalformat;
+ n[3].i = x;
+ n[4].i = y;
+ n[5].i = width;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyColorTable)(target, internalformat, x, y, width);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
+ GLenum format, GLenum type, const GLvoid *filter)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLvoid *image = unpack_image(width, 1, 1, format, type, filter,
+ &ctx->Unpack);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = internalFormat;
+ n[3].i = width;
+ n[4].e = format;
+ n[5].e = type;
+ n[6].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ConvolutionFilter1D)( target, internalFormat, width,
+ format, type, filter );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
+ GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *filter)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLvoid *image = unpack_image(width, height, 1, format, type, filter,
+ &ctx->Unpack);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = internalFormat;
+ n[3].i = width;
+ n[4].i = height;
+ n[5].e = format;
+ n[6].e = type;
+ n[7].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ConvolutionFilter2D)( target, internalFormat, width, height,
+ format, type, filter );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ n[3].i = param;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ConvolutionParameteri)( target, pname, param );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ n[3].i = params[0];
+ if (pname == GL_CONVOLUTION_BORDER_COLOR ||
+ pname == GL_CONVOLUTION_FILTER_SCALE ||
+ pname == GL_CONVOLUTION_FILTER_BIAS) {
+ n[4].i = params[1];
+ n[5].i = params[2];
+ n[6].i = params[3];
+ }
+ else {
+ n[4].i = n[5].i = n[6].i = 0;
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ConvolutionParameteriv)( target, pname, params );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ n[3].f = param;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ConvolutionParameterf)( target, pname, param );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ n[3].f = params[0];
+ if (pname == GL_CONVOLUTION_BORDER_COLOR ||
+ pname == GL_CONVOLUTION_FILTER_SCALE ||
+ pname == GL_CONVOLUTION_FILTER_BIAS) {
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ else {
+ n[4].f = n[5].f = n[6].f = 0.0F;
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ConvolutionParameterfv)( target, pname, params );
+ }
+}
+
+
+static void GLAPIENTRY
+save_CopyPixels( GLint x, GLint y,
+ GLsizei width, GLsizei height, GLenum type )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_PIXELS, 5 );
+ if (n) {
+ n[1].i = x;
+ n[2].i = y;
+ n[3].i = (GLint) width;
+ n[4].i = (GLint) height;
+ n[5].e = type;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyPixels)( x, y, width, height, type );
+ }
+}
+
+
+
+static void GLAPIENTRY
+save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
+ GLint x, GLint y, GLsizei width, GLint border )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE1D, 7 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].e = internalformat;
+ n[4].i = x;
+ n[5].i = y;
+ n[6].i = width;
+ n[7].i = border;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyTexImage1D)( target, level, internalformat,
+ x, y, width, border );
+ }
+}
+
+
+static void GLAPIENTRY
+save_CopyTexImage2D( GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y, GLsizei width,
+ GLsizei height, GLint border )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE2D, 8 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].e = internalformat;
+ n[4].i = x;
+ n[5].i = y;
+ n[6].i = width;
+ n[7].i = height;
+ n[8].i = border;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyTexImage2D)( target, level, internalformat,
+ x, y, width, height, border );
+ }
+}
+
+
+
+static void GLAPIENTRY
+save_CopyTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y,
+ GLsizei width )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = x;
+ n[5].i = y;
+ n[6].i = width;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyTexSubImage1D)( target, level, xoffset, x, y, width );
+ }
+}
+
+
+static void GLAPIENTRY
+save_CopyTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLint height )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = yoffset;
+ n[5].i = x;
+ n[6].i = y;
+ n[7].i = width;
+ n[8].i = height;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyTexSubImage2D)( target, level, xoffset, yoffset,
+ x, y, width, height );
+ }
+}
+
+
+static void GLAPIENTRY
+save_CopyTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y,
+ GLsizei width, GLint height )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = yoffset;
+ n[5].i = zoffset;
+ n[6].i = x;
+ n[7].i = y;
+ n[8].i = width;
+ n[9].i = height;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CopyTexSubImage3D)( target, level,
+ xoffset, yoffset, zoffset,
+ x, y, width, height );
+ }
+}
+
+
+static void GLAPIENTRY save_CullFace( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_CULL_FACE, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CullFace)( mode );
+ }
+}
+
+
+static void GLAPIENTRY save_DepthFunc( GLenum func )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_FUNC, 1 );
+ if (n) {
+ n[1].e = func;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DepthFunc)( func );
+ }
+}
+
+
+static void GLAPIENTRY save_DepthMask( GLboolean mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_MASK, 1 );
+ if (n) {
+ n[1].b = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DepthMask)( mask );
+ }
+}
+
+
+static void GLAPIENTRY save_DepthRange( GLclampd nearval, GLclampd farval )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_RANGE, 2 );
+ if (n) {
+ n[1].f = (GLfloat) nearval;
+ n[2].f = (GLfloat) farval;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DepthRange)( nearval, farval );
+ }
+}
+
+
+static void GLAPIENTRY save_Disable( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DISABLE, 1 );
+ if (n) {
+ n[1].e = cap;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Disable)( cap );
+ }
+}
+
+
+static void GLAPIENTRY save_DrawBuffer( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFER, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DrawBuffer)( mode );
+ }
+}
+
+
+static void GLAPIENTRY save_DrawPixels( GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLvoid *image = unpack_image(width, height, 1, format, type,
+ pixels, &ctx->Unpack);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_PIXELS, 5 );
+ if (n) {
+ n[1].i = width;
+ n[2].i = height;
+ n[3].e = format;
+ n[4].e = type;
+ n[5].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DrawPixels)( width, height, format, type, pixels );
+ }
+}
+
+
+
+static void GLAPIENTRY save_Enable( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ENABLE, 1 );
+ if (n) {
+ n[1].e = cap;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Enable)( cap );
+ }
+}
+
+
+
+void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH1, 3 );
+ if (n) {
+ n[1].e = mode;
+ n[2].i = i1;
+ n[3].i = i2;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalMesh1)( mode, i1, i2 );
+ }
+}
+
+
+void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH2, 5 );
+ if (n) {
+ n[1].e = mode;
+ n[2].i = i1;
+ n[3].i = i2;
+ n[4].i = j1;
+ n[5].i = j2;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalMesh2)( mode, i1, i2, j1, j2 );
+ }
+}
+
+
+
+
+static void GLAPIENTRY save_Fogfv( GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_FOG, 5 );
+ if (n) {
+ n[1].e = pname;
+ n[2].f = params[0];
+ n[3].f = params[1];
+ n[4].f = params[2];
+ n[5].f = params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Fogfv)( pname, params );
+ }
+}
+
+
+static void GLAPIENTRY save_Fogf( GLenum pname, GLfloat param )
+{
+ save_Fogfv(pname, ¶m);
+}
+
+
+static void GLAPIENTRY save_Fogiv(GLenum pname, const GLint *params )
+{
+ GLfloat p[4];
+ switch (pname) {
+ case GL_FOG_MODE:
+ case GL_FOG_DENSITY:
+ case GL_FOG_START:
+ case GL_FOG_END:
+ case GL_FOG_INDEX:
+ p[0] = (GLfloat) *params;
+ break;
+ case GL_FOG_COLOR:
+ p[0] = INT_TO_FLOAT( params[0] );
+ p[1] = INT_TO_FLOAT( params[1] );
+ p[2] = INT_TO_FLOAT( params[2] );
+ p[3] = INT_TO_FLOAT( params[3] );
+ break;
+ default:
+ /* Error will be caught later in gl_Fogfv */
+ ;
+ }
+ save_Fogfv(pname, p);
+}
+
+
+static void GLAPIENTRY save_Fogi(GLenum pname, GLint param )
+{
+ save_Fogiv(pname, ¶m);
+}
+
+
+static void GLAPIENTRY save_FrontFace( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_FRONT_FACE, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->FrontFace)( mode );
+ }
+}
+
+
+static void GLAPIENTRY save_Frustum( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble nearval, GLdouble farval )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_FRUSTUM, 6 );
+ if (n) {
+ n[1].f = (GLfloat) left;
+ n[2].f = (GLfloat) right;
+ n[3].f = (GLfloat) bottom;
+ n[4].f = (GLfloat) top;
+ n[5].f = (GLfloat) nearval;
+ n[6].f = (GLfloat) farval;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Frustum)( left, right, bottom, top, nearval, farval );
+ }
+}
+
+
+static void GLAPIENTRY save_Hint( GLenum target, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_HINT, 2 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Hint)( target, mode );
+ }
+}
+
+
+static void GLAPIENTRY
+save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_HISTOGRAM, 4 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = width;
+ n[3].e = internalFormat;
+ n[4].b = sink;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Histogram)( target, width, internalFormat, sink );
+ }
+}
+
+
+static void GLAPIENTRY save_IndexMask( GLuint mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX_MASK, 1 );
+ if (n) {
+ n[1].ui = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->IndexMask)( mask );
+ }
+}
+
+
+static void GLAPIENTRY save_InitNames( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_INIT_NAMES, 0 );
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->InitNames)();
+ }
+}
+
+
+static void GLAPIENTRY save_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT, 6 );
+ if (OPCODE_LIGHT) {
+ GLint i, nParams;
+ n[1].e = light;
+ n[2].e = pname;
+ switch (pname) {
+ case GL_AMBIENT:
+ nParams = 4;
+ break;
+ case GL_DIFFUSE:
+ nParams = 4;
+ break;
+ case GL_SPECULAR:
+ nParams = 4;
+ break;
+ case GL_POSITION:
+ nParams = 4;
+ break;
+ case GL_SPOT_DIRECTION:
+ nParams = 3;
+ break;
+ case GL_SPOT_EXPONENT:
+ nParams = 1;
+ break;
+ case GL_SPOT_CUTOFF:
+ nParams = 1;
+ break;
+ case GL_CONSTANT_ATTENUATION:
+ nParams = 1;
+ break;
+ case GL_LINEAR_ATTENUATION:
+ nParams = 1;
+ break;
+ case GL_QUADRATIC_ATTENUATION:
+ nParams = 1;
+ break;
+ default:
+ nParams = 0;
+ }
+ for (i = 0; i < nParams; i++) {
+ n[3+i].f = params[i];
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Lightfv)( light, pname, params );
+ }
+}
+
+
+static void GLAPIENTRY save_Lightf( GLenum light, GLenum pname, GLfloat params )
+{
+ save_Lightfv(light, pname, ¶ms);
+}
+
+
+static void GLAPIENTRY save_Lightiv( GLenum light, GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+ switch (pname) {
+ case GL_AMBIENT:
+ case GL_DIFFUSE:
+ case GL_SPECULAR:
+ fparam[0] = INT_TO_FLOAT( params[0] );
+ fparam[1] = INT_TO_FLOAT( params[1] );
+ fparam[2] = INT_TO_FLOAT( params[2] );
+ fparam[3] = INT_TO_FLOAT( params[3] );
+ break;
+ case GL_POSITION:
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = (GLfloat) params[1];
+ fparam[2] = (GLfloat) params[2];
+ fparam[3] = (GLfloat) params[3];
+ break;
+ case GL_SPOT_DIRECTION:
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = (GLfloat) params[1];
+ fparam[2] = (GLfloat) params[2];
+ break;
+ case GL_SPOT_EXPONENT:
+ case GL_SPOT_CUTOFF:
+ case GL_CONSTANT_ATTENUATION:
+ case GL_LINEAR_ATTENUATION:
+ case GL_QUADRATIC_ATTENUATION:
+ fparam[0] = (GLfloat) params[0];
+ break;
+ default:
+ /* error will be caught later in gl_Lightfv */
+ ;
+ }
+ save_Lightfv( light, pname, fparam );
+}
+
+
+static void GLAPIENTRY save_Lighti( GLenum light, GLenum pname, GLint param )
+{
+ save_Lightiv( light, pname, ¶m );
+}
+
+
+static void GLAPIENTRY save_LightModelfv( GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT_MODEL, 5 );
+ if (n) {
+ n[1].e = pname;
+ n[2].f = params[0];
+ n[3].f = params[1];
+ n[4].f = params[2];
+ n[5].f = params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LightModelfv)( pname, params );
+ }
+}
+
+
+static void GLAPIENTRY save_LightModelf( GLenum pname, GLfloat param )
+{
+ save_LightModelfv(pname, ¶m);
+}
+
+
+static void GLAPIENTRY save_LightModeliv( GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+ switch (pname) {
+ case GL_LIGHT_MODEL_AMBIENT:
+ fparam[0] = INT_TO_FLOAT( params[0] );
+ fparam[1] = INT_TO_FLOAT( params[1] );
+ fparam[2] = INT_TO_FLOAT( params[2] );
+ fparam[3] = INT_TO_FLOAT( params[3] );
+ break;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ fparam[0] = (GLfloat) params[0];
+ break;
+ default:
+ /* Error will be caught later in gl_LightModelfv */
+ ;
+ }
+ save_LightModelfv(pname, fparam);
+}
+
+
+static void GLAPIENTRY save_LightModeli( GLenum pname, GLint param )
+{
+ save_LightModeliv(pname, ¶m);
+}
+
+
+static void GLAPIENTRY save_LineStipple( GLint factor, GLushort pattern )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_STIPPLE, 2 );
+ if (n) {
+ n[1].i = factor;
+ n[2].us = pattern;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LineStipple)( factor, pattern );
+ }
+}
+
+
+static void GLAPIENTRY save_LineWidth( GLfloat width )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_WIDTH, 1 );
+ if (n) {
+ n[1].f = width;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LineWidth)( width );
+ }
+}
+
+
+static void GLAPIENTRY save_ListBase( GLuint base )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LIST_BASE, 1 );
+ if (n) {
+ n[1].ui = base;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ListBase)( base );
+ }
+}
+
+
+static void GLAPIENTRY save_LoadIdentity( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_IDENTITY, 0 );
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LoadIdentity)();
+ }
+}
+
+
+static void GLAPIENTRY save_LoadMatrixf( const GLfloat *m )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_MATRIX, 16 );
+ if (n) {
+ GLuint i;
+ for (i=0;i<16;i++) {
+ n[1+i].f = m[i];
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LoadMatrixf)( m );
+ }
+}
+
+
+static void GLAPIENTRY save_LoadMatrixd( const GLdouble *m )
+{
+ GLfloat f[16];
+ GLint i;
+ for (i = 0; i < 16; i++) {
+ f[i] = (GLfloat) m[i];
+ }
+ save_LoadMatrixf(f);
+}
+
+
+static void GLAPIENTRY save_LoadName( GLuint name )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_NAME, 1 );
+ if (n) {
+ n[1].ui = name;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LoadName)( name );
+ }
+}
+
+
+static void GLAPIENTRY save_LogicOp( GLenum opcode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LOGIC_OP, 1 );
+ if (n) {
+ n[1].e = opcode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LogicOp)( opcode );
+ }
+}
+
+
+static void GLAPIENTRY save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+ GLint order, const GLdouble *points)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 );
+ if (n) {
+ GLfloat *pnts = _mesa_copy_map_points1d( target, stride, order, points );
+ n[1].e = target;
+ n[2].f = (GLfloat) u1;
+ n[3].f = (GLfloat) u2;
+ n[4].i = _mesa_evaluator_components(target); /* stride */
+ n[5].i = order;
+ n[6].data = (void *) pnts;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Map1d)( target, u1, u2, stride, order, points );
+ }
+}
+
+static void GLAPIENTRY save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+ GLint order, const GLfloat *points)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 );
+ if (n) {
+ GLfloat *pnts = _mesa_copy_map_points1f( target, stride, order, points );
+ n[1].e = target;
+ n[2].f = u1;
+ n[3].f = u2;
+ n[4].i = _mesa_evaluator_components(target); /* stride */
+ n[5].i = order;
+ n[6].data = (void *) pnts;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Map1f)( target, u1, u2, stride, order, points );
+ }
+}
+
+
+static void GLAPIENTRY save_Map2d( GLenum target,
+ GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+ GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+ const GLdouble *points )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 );
+ if (n) {
+ GLfloat *pnts = _mesa_copy_map_points2d( target, ustride, uorder,
+ vstride, vorder, points );
+ n[1].e = target;
+ n[2].f = (GLfloat) u1;
+ n[3].f = (GLfloat) u2;
+ n[4].f = (GLfloat) v1;
+ n[5].f = (GLfloat) v2;
+ /* XXX verify these strides are correct */
+ n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride*/
+ n[7].i = _mesa_evaluator_components(target); /*vstride*/
+ n[8].i = uorder;
+ n[9].i = vorder;
+ n[10].data = (void *) pnts;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Map2d)( target,
+ u1, u2, ustride, uorder,
+ v1, v2, vstride, vorder, points );
+ }
+}
+
+
+static void GLAPIENTRY save_Map2f( GLenum target,
+ GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+ GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+ const GLfloat *points )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 );
+ if (n) {
+ GLfloat *pnts = _mesa_copy_map_points2f( target, ustride, uorder,
+ vstride, vorder, points );
+ n[1].e = target;
+ n[2].f = u1;
+ n[3].f = u2;
+ n[4].f = v1;
+ n[5].f = v2;
+ /* XXX verify these strides are correct */
+ n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride*/
+ n[7].i = _mesa_evaluator_components(target); /*vstride*/
+ n[8].i = uorder;
+ n[9].i = vorder;
+ n[10].data = (void *) pnts;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Map2f)( target, u1, u2, ustride, uorder,
+ v1, v2, vstride, vorder, points );
+ }
+}
+
+
+static void GLAPIENTRY save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID1, 3 );
+ if (n) {
+ n[1].i = un;
+ n[2].f = u1;
+ n[3].f = u2;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->MapGrid1f)( un, u1, u2 );
+ }
+}
+
+
+static void GLAPIENTRY save_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
+{
+ save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
+}
+
+
+static void GLAPIENTRY save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+ GLint vn, GLfloat v1, GLfloat v2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID2, 6 );
+ if (n) {
+ n[1].i = un;
+ n[2].f = u1;
+ n[3].f = u2;
+ n[4].i = vn;
+ n[5].f = v1;
+ n[6].f = v2;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->MapGrid2f)( un, u1, u2, vn, v1, v2 );
+ }
+}
+
+
+
+static void GLAPIENTRY save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+ GLint vn, GLdouble v1, GLdouble v2 )
+{
+ save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
+ vn, (GLfloat) v1, (GLfloat) v2);
+}
+
+
+static void GLAPIENTRY save_MatrixMode( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MATRIX_MODE, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->MatrixMode)( mode );
+ }
+}
+
+
+static void GLAPIENTRY
+save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MIN_MAX, 3 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = internalFormat;
+ n[3].b = sink;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Minmax)( target, internalFormat, sink );
+ }
+}
+
+
+static void GLAPIENTRY save_MultMatrixf( const GLfloat *m )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MULT_MATRIX, 16 );
+ if (n) {
+ GLuint i;
+ for (i=0;i<16;i++) {
+ n[1+i].f = m[i];
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->MultMatrixf)( m );
+ }
+}
+
+
+static void GLAPIENTRY save_MultMatrixd( const GLdouble *m )
+{
+ GLfloat f[16];
+ GLint i;
+ for (i = 0; i < 16; i++) {
+ f[i] = (GLfloat) m[i];
+ }
+ save_MultMatrixf(f);
+}
+
+
+static void GLAPIENTRY save_NewList( GLuint list, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ /* It's an error to call this function while building a display list */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" );
+ (void) list;
+ (void) mode;
+}
+
+
+
+static void GLAPIENTRY save_Ortho( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble nearval, GLdouble farval )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ORTHO, 6 );
+ if (n) {
+ n[1].f = (GLfloat) left;
+ n[2].f = (GLfloat) right;
+ n[3].f = (GLfloat) bottom;
+ n[4].f = (GLfloat) top;
+ n[5].f = (GLfloat) nearval;
+ n[6].f = (GLfloat) farval;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Ortho)( left, right, bottom, top, nearval, farval );
+ }
+}
+
+
+static void GLAPIENTRY
+save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_MAP, 3 );
+ if (n) {
+ n[1].e = map;
+ n[2].i = mapsize;
+ n[3].data = (void *) MALLOC( mapsize * sizeof(GLfloat) );
+ MEMCPY( n[3].data, (void *) values, mapsize * sizeof(GLfloat) );
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PixelMapfv)( map, mapsize, values );
+ }
+}
+
+
+static void GLAPIENTRY
+save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values )
+{
+ GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
+ GLint i;
+ if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
+ for (i=0;iExecuteFlag) {
+ (*ctx->Exec->PixelTransferf)( pname, param );
+ }
+}
+
+
+static void GLAPIENTRY
+save_PixelTransferi( GLenum pname, GLint param )
+{
+ save_PixelTransferf( pname, (GLfloat) param );
+}
+
+
+static void GLAPIENTRY
+save_PixelZoom( GLfloat xfactor, GLfloat yfactor )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_ZOOM, 2 );
+ if (n) {
+ n[1].f = xfactor;
+ n[2].f = yfactor;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PixelZoom)( xfactor, yfactor );
+ }
+}
+
+
+static void GLAPIENTRY
+save_PointParameterfvEXT( GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_PARAMETERS, 4 );
+ if (n) {
+ n[1].e = pname;
+ n[2].f = params[0];
+ n[3].f = params[1];
+ n[4].f = params[2];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PointParameterfvEXT)( pname, params );
+ }
+}
+
+
+static void GLAPIENTRY save_PointParameterfEXT( GLenum pname, GLfloat param )
+{
+ save_PointParameterfvEXT(pname, ¶m);
+}
+
+static void GLAPIENTRY save_PointParameteriNV( GLenum pname, GLint param )
+{
+ GLfloat p = (GLfloat) param;
+ save_PointParameterfvEXT(pname, &p);
+}
+
+static void GLAPIENTRY save_PointParameterivNV( GLenum pname, const GLint *param )
+{
+ GLfloat p = (GLfloat) param[0];
+ save_PointParameterfvEXT(pname, &p);
+}
+
+
+static void GLAPIENTRY save_PointSize( GLfloat size )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_SIZE, 1 );
+ if (n) {
+ n[1].f = size;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PointSize)( size );
+ }
+}
+
+
+static void GLAPIENTRY save_PolygonMode( GLenum face, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_MODE, 2 );
+ if (n) {
+ n[1].e = face;
+ n[2].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PolygonMode)( face, mode );
+ }
+}
+
+
+/*
+ * Polygon stipple must have been upacked already!
+ */
+static void GLAPIENTRY save_PolygonStipple( const GLubyte *pattern )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_STIPPLE, 1 );
+ if (n) {
+ void *data;
+ n[1].data = MALLOC( 32 * 4 );
+ data = n[1].data; /* This needed for Acorn compiler */
+ MEMCPY( data, pattern, 32 * 4 );
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PolygonStipple)( (GLubyte*) pattern );
+ }
+}
+
+
+static void GLAPIENTRY save_PolygonOffset( GLfloat factor, GLfloat units )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_OFFSET, 2 );
+ if (n) {
+ n[1].f = factor;
+ n[2].f = units;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PolygonOffset)( factor, units );
+ }
+}
+
+
+static void GLAPIENTRY save_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ save_PolygonOffset(factor, ctx->DepthMaxF * bias);
+}
+
+
+static void GLAPIENTRY save_PopAttrib( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_ATTRIB, 0 );
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PopAttrib)();
+ }
+}
+
+
+static void GLAPIENTRY save_PopMatrix( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_MATRIX, 0 );
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PopMatrix)();
+ }
+}
+
+
+static void GLAPIENTRY save_PopName( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_NAME, 0 );
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PopName)();
+ }
+}
+
+
+static void GLAPIENTRY save_PrioritizeTextures( GLsizei num, const GLuint *textures,
+ const GLclampf *priorities )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ for (i=0;iExecuteFlag) {
+ (*ctx->Exec->PrioritizeTextures)( num, textures, priorities );
+ }
+}
+
+
+static void GLAPIENTRY save_PushAttrib( GLbitfield mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_ATTRIB, 1 );
+ if (n) {
+ n[1].bf = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PushAttrib)( mask );
+ }
+}
+
+
+static void GLAPIENTRY save_PushMatrix( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_MATRIX, 0 );
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PushMatrix)();
+ }
+}
+
+
+static void GLAPIENTRY save_PushName( GLuint name )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_NAME, 1 );
+ if (n) {
+ n[1].ui = name;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PushName)( name );
+ }
+}
+
+
+static void GLAPIENTRY save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_RASTER_POS, 4 );
+ if (n) {
+ n[1].f = x;
+ n[2].f = y;
+ n[3].f = z;
+ n[4].f = w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->RasterPos4f)( x, y, z, w );
+ }
+}
+
+static void GLAPIENTRY save_RasterPos2d(GLdouble x, GLdouble y)
+{
+ save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos2f(GLfloat x, GLfloat y)
+{
+ save_RasterPos4f(x, y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos2i(GLint x, GLint y)
+{
+ save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos2s(GLshort x, GLshort y)
+{
+ save_RasterPos4f(x, y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
+{
+ save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
+{
+ save_RasterPos4f(x, y, z, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3i(GLint x, GLint y, GLint z)
+{
+ save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3s(GLshort x, GLshort y, GLshort z)
+{
+ save_RasterPos4f(x, y, z, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+static void GLAPIENTRY save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
+{
+ save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+static void GLAPIENTRY save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ save_RasterPos4f(x, y, z, w);
+}
+
+static void GLAPIENTRY save_RasterPos2dv(const GLdouble *v)
+{
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos2fv(const GLfloat *v)
+{
+ save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos2iv(const GLint *v)
+{
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos2sv(const GLshort *v)
+{
+ save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3dv(const GLdouble *v)
+{
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3fv(const GLfloat *v)
+{
+ save_RasterPos4f(v[0], v[1], v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3iv(const GLint *v)
+{
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos3sv(const GLshort *v)
+{
+ save_RasterPos4f(v[0], v[1], v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_RasterPos4dv(const GLdouble *v)
+{
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY save_RasterPos4fv(const GLfloat *v)
+{
+ save_RasterPos4f(v[0], v[1], v[2], v[3]);
+}
+
+static void GLAPIENTRY save_RasterPos4iv(const GLint *v)
+{
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY save_RasterPos4sv(const GLshort *v)
+{
+ save_RasterPos4f(v[0], v[1], v[2], v[3]);
+}
+
+
+static void GLAPIENTRY save_PassThrough( GLfloat token )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PASSTHROUGH, 1 );
+ if (n) {
+ n[1].f = token;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PassThrough)( token );
+ }
+}
+
+
+static void GLAPIENTRY save_ReadBuffer( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_READ_BUFFER, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ReadBuffer)( mode );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ResetHistogram(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_HISTOGRAM, 1 );
+ if (n) {
+ n[1].e = target;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ResetHistogram)( target );
+ }
+}
+
+
+static void GLAPIENTRY
+save_ResetMinmax(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_MIN_MAX, 1 );
+ if (n) {
+ n[1].e = target;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ResetMinmax)( target );
+ }
+}
+
+
+static void GLAPIENTRY save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ROTATE, 4 );
+ if (n) {
+ n[1].f = angle;
+ n[2].f = x;
+ n[3].f = y;
+ n[4].f = z;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Rotatef)( angle, x, y, z );
+ }
+}
+
+
+static void GLAPIENTRY save_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z )
+{
+ save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+static void GLAPIENTRY save_Scalef( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_SCALE, 3 );
+ if (n) {
+ n[1].f = x;
+ n[2].f = y;
+ n[3].f = z;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Scalef)( x, y, z );
+ }
+}
+
+
+static void GLAPIENTRY save_Scaled( GLdouble x, GLdouble y, GLdouble z )
+{
+ save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+static void GLAPIENTRY save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_SCISSOR, 4 );
+ if (n) {
+ n[1].i = x;
+ n[2].i = y;
+ n[3].i = width;
+ n[4].i = height;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Scissor)( x, y, width, height );
+ }
+}
+
+
+static void GLAPIENTRY save_ShadeModel( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_SHADE_MODEL, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ShadeModel)( mode );
+ }
+}
+
+
+static void GLAPIENTRY save_StencilFunc( GLenum func, GLint ref, GLuint mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_FUNC, 3 );
+ if (n) {
+ n[1].e = func;
+ n[2].i = ref;
+ n[3].ui = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->StencilFunc)( func, ref, mask );
+ }
+}
+
+
+static void GLAPIENTRY save_StencilMask( GLuint mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_MASK, 1 );
+ if (n) {
+ n[1].ui = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->StencilMask)( mask );
+ }
+}
+
+
+static void GLAPIENTRY save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP, 3 );
+ if (n) {
+ n[1].e = fail;
+ n[2].e = zfail;
+ n[3].e = zpass;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->StencilOp)( fail, zfail, zpass );
+ }
+}
+
+
+static void GLAPIENTRY save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXENV, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ if (pname == GL_TEXTURE_ENV_COLOR) {
+ n[3].f = params[0];
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ else {
+ n[3].f = params[0];
+ n[4].f = n[5].f = n[6].f = 0.0F;
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexEnvfv)( target, pname, params );
+ }
+}
+
+
+static void GLAPIENTRY save_TexEnvf( GLenum target, GLenum pname, GLfloat param )
+{
+ save_TexEnvfv( target, pname, ¶m );
+}
+
+
+static void GLAPIENTRY save_TexEnvi( GLenum target, GLenum pname, GLint param )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) param;
+ p[1] = p[2] = p[3] = 0.0;
+ save_TexEnvfv( target, pname, p );
+}
+
+
+static void GLAPIENTRY save_TexEnviv( GLenum target, GLenum pname, const GLint *param )
+{
+ GLfloat p[4];
+ if (pname == GL_TEXTURE_ENV_COLOR) {
+ p[0] = INT_TO_FLOAT( param[0] );
+ p[1] = INT_TO_FLOAT( param[1] );
+ p[2] = INT_TO_FLOAT( param[2] );
+ p[3] = INT_TO_FLOAT( param[3] );
+ }
+ else {
+ p[0] = (GLfloat) param[0];
+ p[1] = p[2] = p[3] = 0.0F;
+ }
+ save_TexEnvfv( target, pname, p );
+}
+
+
+static void GLAPIENTRY save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXGEN, 6 );
+ if (n) {
+ n[1].e = coord;
+ n[2].e = pname;
+ n[3].f = params[0];
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexGenfv)( coord, pname, params );
+ }
+}
+
+
+static void GLAPIENTRY save_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ save_TexGenfv(coord, pname, p);
+}
+
+
+static void GLAPIENTRY save_TexGend(GLenum coord, GLenum pname, GLdouble param )
+{
+ GLfloat p = (GLfloat) param;
+ save_TexGenfv( coord, pname, &p );
+}
+
+
+static void GLAPIENTRY save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ save_TexGenfv( coord, pname, p );
+}
+
+
+static void GLAPIENTRY save_TexGenf( GLenum coord, GLenum pname, GLfloat param )
+{
+ save_TexGenfv(coord, pname, ¶m);
+}
+
+
+static void GLAPIENTRY save_TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+ save_TexGeniv( coord, pname, ¶m );
+}
+
+
+static void GLAPIENTRY save_TexParameterfv( GLenum target,
+ GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXPARAMETER, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = pname;
+ n[3].f = params[0];
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexParameterfv)( target, pname, params );
+ }
+}
+
+
+static void GLAPIENTRY save_TexParameterf( GLenum target, GLenum pname, GLfloat param )
+{
+ save_TexParameterfv(target, pname, ¶m);
+}
+
+
+static void GLAPIENTRY save_TexParameteri( GLenum target, GLenum pname, GLint param )
+{
+ GLfloat fparam[4];
+ fparam[0] = (GLfloat) param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0;
+ save_TexParameterfv(target, pname, fparam);
+}
+
+
+static void GLAPIENTRY save_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = fparam[2] = fparam[3] = 0.0;
+ save_TexParameterfv(target, pname, fparam);
+}
+
+
+static void GLAPIENTRY save_TexImage1D( GLenum target,
+ GLint level, GLint components,
+ GLsizei width, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_1D) {
+ /* don't compile, execute immediately */
+ (*ctx->Exec->TexImage1D)( target, level, components, width,
+ border, format, type, pixels );
+ }
+ else {
+ GLvoid *image = unpack_image(width, 1, 1, format, type,
+ pixels, &ctx->Unpack);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE1D, 8 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = components;
+ n[4].i = (GLint) width;
+ n[5].i = border;
+ n[6].e = format;
+ n[7].e = type;
+ n[8].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexImage1D)( target, level, components, width,
+ border, format, type, pixels );
+ }
+ }
+}
+
+
+static void GLAPIENTRY save_TexImage2D( GLenum target,
+ GLint level, GLint components,
+ GLsizei width, GLsizei height, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_2D) {
+ /* don't compile, execute immediately */
+ (*ctx->Exec->TexImage2D)( target, level, components, width,
+ height, border, format, type, pixels );
+ }
+ else {
+ GLvoid *image = unpack_image(width, height, 1, format, type,
+ pixels, &ctx->Unpack);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE2D, 9 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = components;
+ n[4].i = (GLint) width;
+ n[5].i = (GLint) height;
+ n[6].i = border;
+ n[7].e = format;
+ n[8].e = type;
+ n[9].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexImage2D)( target, level, components, width,
+ height, border, format, type, pixels );
+ }
+ }
+}
+
+
+static void GLAPIENTRY save_TexImage3D( GLenum target,
+ GLint level, GLint internalFormat,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_3D) {
+ /* don't compile, execute immediately */
+ (*ctx->Exec->TexImage3D)( target, level, internalFormat, width,
+ height, depth, border, format, type, pixels );
+ }
+ else {
+ Node *n;
+ GLvoid *image = unpack_image(width, height, depth, format, type,
+ pixels, &ctx->Unpack);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE3D, 10 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = (GLint) internalFormat;
+ n[4].i = (GLint) width;
+ n[5].i = (GLint) height;
+ n[6].i = (GLint) depth;
+ n[7].i = border;
+ n[8].e = format;
+ n[9].e = type;
+ n[10].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexImage3D)( target, level, internalFormat, width,
+ height, depth, border, format, type, pixels );
+ }
+ }
+}
+
+
+static void GLAPIENTRY save_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
+ GLsizei width, GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLvoid *image = unpack_image(width, 1, 1, format, type,
+ pixels, &ctx->Unpack);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE1D, 7 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = (GLint) width;
+ n[5].e = format;
+ n[6].e = type;
+ n[7].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexSubImage1D)( target, level, xoffset, width,
+ format, type, pixels );
+ }
+}
+
+
+static void GLAPIENTRY save_TexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLvoid *image = unpack_image(width, height, 1, format, type,
+ pixels, &ctx->Unpack);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE2D, 9 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = yoffset;
+ n[5].i = (GLint) width;
+ n[6].i = (GLint) height;
+ n[7].e = format;
+ n[8].e = type;
+ n[9].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexSubImage2D)( target, level, xoffset, yoffset,
+ width, height, format, type, pixels );
+ }
+}
+
+
+static void GLAPIENTRY save_TexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLvoid *image = unpack_image(width, height, depth, format, type,
+ pixels, &ctx->Unpack);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE3D, 11 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = yoffset;
+ n[5].i = zoffset;
+ n[6].i = (GLint) width;
+ n[7].i = (GLint) height;
+ n[8].i = (GLint) depth;
+ n[9].e = format;
+ n[10].e = type;
+ n[11].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TexSubImage3D)( target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth, format, type, pixels );
+ }
+}
+
+
+static void GLAPIENTRY save_Translatef( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TRANSLATE, 3 );
+ if (n) {
+ n[1].f = x;
+ n[2].f = y;
+ n[3].f = z;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Translatef)( x, y, z );
+ }
+}
+
+
+static void GLAPIENTRY save_Translated( GLdouble x, GLdouble y, GLdouble z )
+{
+ save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+
+static void GLAPIENTRY save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_VIEWPORT, 4 );
+ if (n) {
+ n[1].i = x;
+ n[2].i = y;
+ n[3].i = (GLint) width;
+ n[4].i = (GLint) height;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Viewport)( x, y, width, height );
+ }
+}
+
+
+static void GLAPIENTRY save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_WINDOW_POS, 4 );
+ if (n) {
+ n[1].f = x;
+ n[2].f = y;
+ n[3].f = z;
+ n[4].f = w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->WindowPos4fMESA)( x, y, z, w );
+ }
+}
+
+static void GLAPIENTRY save_WindowPos2dMESA(GLdouble x, GLdouble y)
+{
+ save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos2fMESA(GLfloat x, GLfloat y)
+{
+ save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos2iMESA(GLint x, GLint y)
+{
+ save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos2sMESA(GLshort x, GLshort y)
+{
+ save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
+{
+ save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
+{
+ save_WindowPos4fMESA(x, y, z, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3iMESA(GLint x, GLint y, GLint z)
+{
+ save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
+{
+ save_WindowPos4fMESA(x, y, z, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+static void GLAPIENTRY save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
+{
+ save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+static void GLAPIENTRY save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ save_WindowPos4fMESA(x, y, z, w);
+}
+
+static void GLAPIENTRY save_WindowPos2dvMESA(const GLdouble *v)
+{
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos2fvMESA(const GLfloat *v)
+{
+ save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos2ivMESA(const GLint *v)
+{
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos2svMESA(const GLshort *v)
+{
+ save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3dvMESA(const GLdouble *v)
+{
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3fvMESA(const GLfloat *v)
+{
+ save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3ivMESA(const GLint *v)
+{
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos3svMESA(const GLshort *v)
+{
+ save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
+}
+
+static void GLAPIENTRY save_WindowPos4dvMESA(const GLdouble *v)
+{
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY save_WindowPos4fvMESA(const GLfloat *v)
+{
+ save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
+}
+
+static void GLAPIENTRY save_WindowPos4ivMESA(const GLint *v)
+{
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+static void GLAPIENTRY save_WindowPos4svMESA(const GLshort *v)
+{
+ save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
+}
+
+
+
+/* GL_ARB_multitexture */
+static void GLAPIENTRY save_ActiveTextureARB( GLenum target )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_TEXTURE, 1 );
+ if (n) {
+ n[1].e = target;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ActiveTextureARB)( target );
+ }
+}
+
+
+/* GL_ARB_transpose_matrix */
+
+static void GLAPIENTRY save_LoadTransposeMatrixdARB( const GLdouble m[16] )
+{
+ GLfloat tm[16];
+ _math_transposefd(tm, m);
+ save_LoadMatrixf(tm);
+}
+
+
+static void GLAPIENTRY save_LoadTransposeMatrixfARB( const GLfloat m[16] )
+{
+ GLfloat tm[16];
+ _math_transposef(tm, m);
+ save_LoadMatrixf(tm);
+}
+
+
+static void GLAPIENTRY
+save_MultTransposeMatrixdARB( const GLdouble m[16] )
+{
+ GLfloat tm[16];
+ _math_transposefd(tm, m);
+ save_MultMatrixf(tm);
+}
+
+
+static void GLAPIENTRY
+save_MultTransposeMatrixfARB( const GLfloat m[16] )
+{
+ GLfloat tm[16];
+ _math_transposef(tm, m);
+ save_MultMatrixf(tm);
+}
+
+
+static void GLAPIENTRY
+save_PixelTexGenSGIX(GLenum mode)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PixelTexGenSGIX)( mode );
+ }
+}
+
+
+/* GL_ARB_texture_compression */
+static void GLAPIENTRY
+save_CompressedTexImage1DARB(GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLint border, GLsizei imageSize,
+ const GLvoid *data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_1D) {
+ /* don't compile, execute immediately */
+ (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat,
+ width, border, imageSize, data);
+ }
+ else {
+ Node *n;
+ GLvoid *image;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ /* make copy of image */
+ image = MALLOC(imageSize);
+ if (!image) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB");
+ return;
+ }
+ MEMCPY(image, data, imageSize);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].e = internalFormat;
+ n[4].i = (GLint) width;
+ n[5].i = border;
+ n[6].i = imageSize;
+ n[7].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat,
+ width, border, imageSize, data);
+ }
+ }
+}
+
+
+static void GLAPIENTRY
+save_CompressedTexImage2DARB(GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLint border, GLsizei imageSize,
+ const GLvoid *data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_2D) {
+ /* don't compile, execute immediately */
+ (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat,
+ width, height, border, imageSize, data);
+ }
+ else {
+ Node *n;
+ GLvoid *image;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ /* make copy of image */
+ image = MALLOC(imageSize);
+ if (!image) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
+ return;
+ }
+ MEMCPY(image, data, imageSize);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].e = internalFormat;
+ n[4].i = (GLint) width;
+ n[5].i = (GLint) height;
+ n[6].i = border;
+ n[7].i = imageSize;
+ n[8].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat,
+ width, height, border, imageSize, data);
+ }
+ }
+}
+
+
+static void GLAPIENTRY
+save_CompressedTexImage3DARB(GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize, const GLvoid *data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_3D) {
+ /* don't compile, execute immediately */
+ (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat,
+ width, height, depth, border, imageSize, data);
+ }
+ else {
+ Node *n;
+ GLvoid *image;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ /* make copy of image */
+ image = MALLOC(imageSize);
+ if (!image) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB");
+ return;
+ }
+ MEMCPY(image, data, imageSize);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].e = internalFormat;
+ n[4].i = (GLint) width;
+ n[5].i = (GLint) height;
+ n[6].i = (GLint) depth;
+ n[7].i = border;
+ n[8].i = imageSize;
+ n[9].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat,
+ width, height, depth, border, imageSize, data);
+ }
+ }
+}
+
+
+static void GLAPIENTRY
+save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
+ GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ Node *n;
+ GLvoid *image;
+
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* make copy of image */
+ image = MALLOC(imageSize);
+ if (!image) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB");
+ return;
+ }
+ MEMCPY(image, data, imageSize);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = (GLint) width;
+ n[5].e = format;
+ n[6].i = imageSize;
+ n[7].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CompressedTexSubImage1DARB)(target, level, xoffset,
+ width, format, imageSize, data);
+ }
+}
+
+
+static void GLAPIENTRY
+save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
+ GLint yoffset, GLsizei width, GLsizei height,
+ GLenum format, GLsizei imageSize,
+ const GLvoid *data)
+{
+ Node *n;
+ GLvoid *image;
+
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* make copy of image */
+ image = MALLOC(imageSize);
+ if (!image) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB");
+ return;
+ }
+ MEMCPY(image, data, imageSize);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = yoffset;
+ n[5].i = (GLint) width;
+ n[6].i = (GLint) height;
+ n[7].e = format;
+ n[8].i = imageSize;
+ n[9].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CompressedTexSubImage2DARB)(target, level, xoffset, yoffset,
+ width, height, format, imageSize, data);
+ }
+}
+
+
+static void GLAPIENTRY
+save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
+ GLint yoffset, GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ Node *n;
+ GLvoid *image;
+
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* make copy of image */
+ image = MALLOC(imageSize);
+ if (!image) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB");
+ return;
+ }
+ MEMCPY(image, data, imageSize);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = level;
+ n[3].i = xoffset;
+ n[4].i = yoffset;
+ n[5].i = zoffset;
+ n[6].i = (GLint) width;
+ n[7].i = (GLint) height;
+ n[8].i = (GLint) depth;
+ n[9].e = format;
+ n[10].i = imageSize;
+ n[11].data = image;
+ }
+ else if (image) {
+ FREE(image);
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->CompressedTexSubImage3DARB)(target, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, imageSize, data);
+ }
+}
+
+
+/* GL_ARB_multisample */
+static void GLAPIENTRY
+save_SampleCoverageARB(GLclampf value, GLboolean invert)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_SAMPLE_COVERAGE, 2 );
+ if (n) {
+ n[1].f = value;
+ n[2].b = invert;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->SampleCoverageARB)( value, invert );
+ }
+}
+
+
+/* GL_SGIS_pixel_texture */
+
+static void GLAPIENTRY
+save_PixelTexGenParameteriSGIS(GLenum target, GLint value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 );
+ if (n) {
+ n[1].e = target;
+ n[2].i = value;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->PixelTexGenParameteriSGIS)( target, value );
+ }
+}
+
+
+static void GLAPIENTRY
+save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value)
+{
+ save_PixelTexGenParameteriSGIS(target, (GLint) value);
+}
+
+
+static void GLAPIENTRY
+save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value)
+{
+ save_PixelTexGenParameteriSGIS(target, *value);
+}
+
+
+static void GLAPIENTRY
+save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value)
+{
+ save_PixelTexGenParameteriSGIS(target, (GLint) *value);
+}
+
+
+/*
+ * GL_NV_vertex_program
+ */
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+static void GLAPIENTRY
+save_BindProgramNV(GLenum target, GLuint id)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_PROGRAM_NV, 2 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = id;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BindProgramNV)( target, id );
+ }
+}
+#endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
+
+#if FEATURE_NV_vertex_program
+static void GLAPIENTRY
+save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EXECUTE_PROGRAM_NV, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = id;
+ n[3].f = params[0];
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ExecuteProgramNV)(target, id, params);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramParameter4fNV(GLenum target, GLuint index,
+ GLfloat x, GLfloat y,
+ GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = x;
+ n[4].f = y;
+ n[5].f = z;
+ n[6].f = w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramParameter4fNV)(target, index, x, y, z, w);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params)
+{
+ save_ProgramParameter4fNV(target, index, params[0], params[1],
+ params[2], params[3]);
+}
+
+
+static void GLAPIENTRY
+save_ProgramParameter4dNV(GLenum target, GLuint index,
+ GLdouble x, GLdouble y,
+ GLdouble z, GLdouble w)
+{
+ save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y,
+ (GLfloat) z, (GLfloat) w);
+}
+
+
+static void GLAPIENTRY
+save_ProgramParameter4dvNV(GLenum target, GLuint index,
+ const GLdouble *params)
+{
+ save_ProgramParameter4fNV(target, index, (GLfloat) params[0],
+ (GLfloat) params[1], (GLfloat) params[2],
+ (GLfloat) params[3]);
+}
+
+
+static void GLAPIENTRY
+save_ProgramParameters4dvNV(GLenum target, GLuint index,
+ GLuint num, const GLdouble *params)
+{
+ GLuint i;
+ for (i = 0; i < num; i++) {
+ save_ProgramParameter4dvNV(target, index + i, params + 4 * i);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramParameters4fvNV(GLenum target, GLuint index,
+ GLuint num, const GLfloat *params)
+{
+ GLuint i;
+ for (i = 0; i < num; i++) {
+ save_ProgramParameter4fvNV(target, index + i, params + 4 * i);
+ }
+}
+
+
+static void GLAPIENTRY
+save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
+ const GLubyte *program)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLubyte *programCopy;
+
+ programCopy = (GLubyte *) _mesa_malloc(len);
+ if (!programCopy) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
+ return;
+ }
+ _mesa_memcpy(programCopy, program, len);
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_PROGRAM_NV, 4 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = id;
+ n[3].i = len;
+ n[4].data = programCopy;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->LoadProgramNV)(target, id, len, program);
+ }
+}
+
+
+static void GLAPIENTRY
+save_RequestResidentProgramsNV(GLsizei num, const GLuint *ids)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
+ if (!idCopy) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
+ return;
+ }
+ _mesa_memcpy(idCopy, ids, num * sizeof(GLuint));
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TRACK_MATRIX_NV, 2 );
+ if (n) {
+ n[1].i = num;
+ n[2].data = idCopy;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->RequestResidentProgramsNV)(num, ids);
+ }
+}
+
+
+static void GLAPIENTRY
+save_TrackMatrixNV(GLenum target, GLuint address,
+ GLenum matrix, GLenum transform)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_TRACK_MATRIX_NV, 4 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = address;
+ n[3].e = matrix;
+ n[4].e = transform;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->TrackMatrixNV)(target, address, matrix, transform);
+ }
+}
+#endif /* FEATURE_NV_vertex_program */
+
+
+/*
+ * GL_NV_fragment_program
+ */
+#if FEATURE_NV_fragment_program
+static void GLAPIENTRY
+save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = x;
+ n[4].f = y;
+ n[5].f = z;
+ n[6].f = w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramLocalParameter4fARB)(target, index, x, y, z, w);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = params[0];
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramLocalParameter4fvARB)(target, index, params);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y,
+ GLdouble z, GLdouble w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = (GLfloat) x;
+ n[4].f = (GLfloat) y;
+ n[5].f = (GLfloat) z;
+ n[6].f = (GLfloat) w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramLocalParameter4dARB)(target, index, x, y, z, w);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = (GLfloat) params[0];
+ n[4].f = (GLfloat) params[1];
+ n[5].f = (GLfloat) params[2];
+ n[6].f = (GLfloat) params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramLocalParameter4dvARB)(target, index, params);
+ }
+}
+
+static void GLAPIENTRY
+save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
+ if (!nameCopy) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
+ return;
+ }
+ _mesa_memcpy(nameCopy, name, len);
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6 );
+ if (n) {
+ n[1].ui = id;
+ n[2].i = len;
+ n[3].data = nameCopy;
+ n[4].f = x;
+ n[5].f = y;
+ n[6].f = z;
+ n[7].f = w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramNamedParameter4fNV)(id, len, name, x, y, z, w);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name,
+ const float v[])
+{
+ save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
+}
+
+
+static void GLAPIENTRY
+save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name,
+ GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y,
+ (GLfloat) z,(GLfloat) w);
+}
+
+
+static void GLAPIENTRY
+save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name,
+ const double v[])
+{
+ save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0],
+ (GLfloat) v[1], (GLfloat) v[2],
+ (GLfloat) v[3]);
+}
+
+#endif /* FEATURE_NV_fragment_program */
+
+
+
+/* GL_EXT_stencil_two_side */
+static void GLAPIENTRY save_ActiveStencilFaceEXT( GLenum face )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1 );
+ if (n) {
+ n[1].e = face;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ActiveStencilFaceEXT)( face );
+ }
+}
+
+
+/* GL_EXT_depth_bounds_test */
+static void GLAPIENTRY save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 2 );
+ if (n) {
+ n[1].f = (GLfloat) zmin;
+ n[2].f = (GLfloat) zmax;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DepthBoundsEXT)( zmin, zmax );
+ }
+}
+
+
+
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+
+static void GLAPIENTRY
+save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
+ const GLvoid *string)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLubyte *programCopy;
+
+ programCopy = (GLubyte *) _mesa_malloc(len);
+ if (!programCopy) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
+ return;
+ }
+ _mesa_memcpy(programCopy, string, len);
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_STRING_ARB, 4 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = format;
+ n[3].i = len;
+ n[4].data = programCopy;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramStringARB)(target, format, len, string);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = x;
+ n[4].f = y;
+ n[5].f = z;
+ n[6].f = w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramEnvParameter4fARB)( target, index, x, y, z, w);
+ }
+}
+
+
+static void GLAPIENTRY
+save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params)
+{
+ save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
+ params[2], params[3]);
+}
+
+
+static void GLAPIENTRY
+save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ save_ProgramEnvParameter4fARB(target, index,
+ (GLfloat) x,
+ (GLfloat) y,
+ (GLfloat) z,
+ (GLfloat) w);
+}
+
+
+static void GLAPIENTRY
+save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params)
+{
+ save_ProgramEnvParameter4fARB(target, index,
+ (GLfloat) params[0],
+ (GLfloat) params[1],
+ (GLfloat) params[2],
+ (GLfloat) params[3]);
+}
+
+#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
+
+
+#ifdef FEATURE_ARB_occlusion_query
+
+static void GLAPIENTRY
+save_BeginQueryARB(GLenum target, GLuint id)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN_QUERY_ARB, 2 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = id;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BeginQueryARB)( target, id );
+ }
+}
+
+
+static void GLAPIENTRY
+save_EndQueryARB(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_END_QUERY_ARB, 1 );
+ if (n) {
+ n[1].e = target;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EndQueryARB)( target );
+ }
+}
+
+#endif /* FEATURE_ARB_occlusion_query */
+
+
+
+static void save_Attr1f( GLenum attr, GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F, 2 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 1;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib1fNV)( attr, x );
+ }
+}
+
+static void save_Attr2f( GLenum attr, GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F, 3 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 2;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib2fNV)( attr, x, y );
+ }
+}
+
+static void save_Attr3f( GLenum attr, GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F, 4 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ n[4].f = z;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 3;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib3fNV)( attr, x, y, z );
+ }
+}
+
+static void save_Attr4f( GLenum attr, GLfloat x, GLfloat y, GLfloat z,
+ GLfloat w )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F, 5 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ n[4].f = z;
+ n[5].f = w;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 4;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib4fNV)( attr, x, y, z, w );
+ }
+}
+
+static void GLAPIENTRY save_EvalCoord1f( GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C1, 1 );
+ if (n) {
+ n[1].f = x;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalCoord1f)( x );
+ }
+}
+
+static void GLAPIENTRY save_EvalCoord1fv( const GLfloat *v )
+{
+ save_EvalCoord1f( v[0] );
+}
+
+static void GLAPIENTRY save_EvalCoord2f( GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C2, 2 );
+ if (n) {
+ n[1].f = x;
+ n[2].f = y;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalCoord2f)( x, y );
+ }
+}
+
+static void GLAPIENTRY save_EvalCoord2fv( const GLfloat *v )
+{
+ save_EvalCoord2f( v[0], v[1] );
+}
+
+
+static void GLAPIENTRY save_EvalPoint1( GLint x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P1, 1 );
+ if (n) {
+ n[1].i = x;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalPoint1)( x );
+ }
+}
+
+static void GLAPIENTRY save_EvalPoint2( GLint x, GLint y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P2, 2 );
+ if (n) {
+ n[1].i = x;
+ n[2].i = y;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalPoint2)( x, y );
+ }
+}
+
+static void GLAPIENTRY save_Indexf( GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX, 1 );
+ if (n) {
+ n[1].f = x;
+ }
+
+ ctx->ListState.ActiveIndex = 1;
+ ctx->ListState.CurrentIndex = x;
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Indexi)( (GLint) x );
+ }
+}
+
+static void GLAPIENTRY save_Indexfv( const GLfloat *v )
+{
+ save_Indexf( v[0] );
+}
+
+static void GLAPIENTRY save_EdgeFlag( GLboolean x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EDGEFLAG, 1 );
+ if (n) {
+ n[1].b = x;
+ }
+
+ ctx->ListState.ActiveEdgeFlag = 1;
+ ctx->ListState.CurrentEdgeFlag = x;
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EdgeFlag)( x );
+ }
+}
+
+static void GLAPIENTRY save_EdgeFlagv( const GLboolean *v )
+{
+ save_EdgeFlag( v[0] );
+}
+
+static void GLAPIENTRY save_Materialfv( GLenum face, GLenum pname, const GLfloat *param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ int args, i;
+
+ SAVE_FLUSH_VERTICES( ctx );
+
+ switch (face) {
+ case GL_BACK:
+ case GL_FRONT:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(face)" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_EMISSION:
+ case GL_AMBIENT:
+ case GL_DIFFUSE:
+ case GL_SPECULAR:
+ case GL_AMBIENT_AND_DIFFUSE:
+ args = 4;
+ break;
+ case GL_SHININESS:
+ args = 1;
+ break;
+ case GL_COLOR_INDEXES:
+ args = 3;
+ break;
+ default:
+ _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(pname)" );
+ return;
+ }
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MATERIAL, 6 );
+ if (n) {
+ n[1].e = face;
+ n[2].e = pname;
+ for (i = 0 ; i < args ; i++)
+ n[3+i].f = param[i];
+ }
+
+ {
+ GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, 0 );
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (bitmask & (1<ListState.ActiveMaterialSize[i] = args;
+ COPY_SZ_4V( ctx->ListState.CurrentMaterial[i], args, param );
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Materialfv)( face, pname, param );
+ }
+}
+
+static void GLAPIENTRY save_Begin( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLboolean error = GL_FALSE;
+
+ if (/*mode < GL_POINTS ||*/ mode > GL_POLYGON) {
+ _mesa_compile_error( ctx, GL_INVALID_ENUM, "Begin (mode)");
+ error = GL_TRUE;
+ }
+ else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
+ /* Typically the first begin. This may raise an error on
+ * playback, depending on whether CallList is issued from inside
+ * a begin/end or not.
+ */
+ ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
+ }
+ else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
+ ctx->Driver.CurrentSavePrimitive = mode;
+ }
+ else {
+ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "recursive begin" );
+ error = GL_TRUE;
+ }
+
+ if (!error) {
+ /* Give the driver an opportunity to hook in an optimized
+ * display list compiler.
+ */
+ if (ctx->Driver.NotifySaveBegin( ctx, mode ))
+ return;
+
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Begin)( mode );
+ }
+}
+
+static void GLAPIENTRY save_End( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ SAVE_FLUSH_VERTICES( ctx );
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_END, 0 );
+ ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->End)( );
+ }
+}
+
+static void GLAPIENTRY save_Rectf( GLfloat a, GLfloat b,
+ GLfloat c, GLfloat d )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_RECTF, 4 );
+ if (n) {
+ n[1].f = a;
+ n[2].f = b;
+ n[3].f = c;
+ n[4].f = d;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Rectf)( a, b, c, d );
+ }
+}
+
+/*
+ */
+static void GLAPIENTRY save_Vertex2f( GLfloat x, GLfloat y )
+{
+ save_Attr2f( VERT_ATTRIB_POS, x, y );
+}
+
+static void GLAPIENTRY save_Vertex2fv( const GLfloat *v )
+{
+ save_Attr2f( VERT_ATTRIB_POS, v[0], v[1] );
+}
+
+static void GLAPIENTRY save_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_POS, x, y, z );
+}
+
+static void GLAPIENTRY save_Vertex3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_POS, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ save_Attr4f( VERT_ATTRIB_POS, x, y, z, w );
+}
+
+static void GLAPIENTRY save_Vertex4fv( const GLfloat *v )
+{
+ save_Attr4f( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] );
+}
+
+static void GLAPIENTRY save_TexCoord1f( GLfloat x )
+{
+ save_Attr1f( VERT_ATTRIB_TEX0, x );
+}
+
+static void GLAPIENTRY save_TexCoord1fv( const GLfloat *v )
+{
+ save_Attr1f( VERT_ATTRIB_TEX0, v[0] );
+}
+
+static void GLAPIENTRY save_TexCoord2f( GLfloat x, GLfloat y )
+{
+ save_Attr2f( VERT_ATTRIB_TEX0, x, y );
+}
+
+static void GLAPIENTRY save_TexCoord2fv( const GLfloat *v )
+{
+ save_Attr2f( VERT_ATTRIB_TEX0, v[0], v[1] );
+}
+
+static void GLAPIENTRY save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_TEX0, x, y, z );
+}
+
+static void GLAPIENTRY save_TexCoord3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_TEX0, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ save_Attr4f( VERT_ATTRIB_TEX0, x, y, z, w );
+}
+
+static void GLAPIENTRY save_TexCoord4fv( const GLfloat *v )
+{
+ save_Attr4f( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] );
+}
+
+static void GLAPIENTRY save_Normal3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_NORMAL, x, y, z );
+}
+
+static void GLAPIENTRY save_Normal3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_NORMAL, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_FogCoordfEXT( GLfloat x )
+{
+ save_Attr1f( VERT_ATTRIB_FOG, x );
+}
+
+static void GLAPIENTRY save_FogCoordfvEXT( const GLfloat *v )
+{
+ save_Attr1f( VERT_ATTRIB_FOG, v[0] );
+}
+
+static void GLAPIENTRY save_Color3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR0, x, y, z );
+}
+
+static void GLAPIENTRY save_Color3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ save_Attr4f( VERT_ATTRIB_COLOR0, x, y, z, w );
+}
+
+static void GLAPIENTRY save_Color4fv( const GLfloat *v )
+{
+ save_Attr4f( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] );
+}
+
+static void GLAPIENTRY save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR1, x, y, z );
+}
+
+static void GLAPIENTRY save_SecondaryColor3fvEXT( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] );
+}
+
+
+/* Just call the respective ATTR for texcoord
+ */
+static void GLAPIENTRY save_MultiTexCoord1f( GLenum target, GLfloat x )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr1f( attr, x );
+}
+
+static void GLAPIENTRY save_MultiTexCoord1fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr1f( attr, v[0] );
+}
+
+static void GLAPIENTRY save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr2f( attr, x, y );
+}
+
+static void GLAPIENTRY save_MultiTexCoord2fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr2f( attr, v[0], v[1] );
+}
+
+static void GLAPIENTRY save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y,
+ GLfloat z)
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr3f( attr, x, y, z );
+}
+
+static void GLAPIENTRY save_MultiTexCoord3fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr3f( attr, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y,
+ GLfloat z, GLfloat w )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr4f( attr, x, y, z, w );
+}
+
+static void GLAPIENTRY save_MultiTexCoord4fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr4f( attr, v[0], v[1], v[2], v[3] );
+}
+
+
+static void enum_error( void )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ _mesa_error( ctx, GL_INVALID_ENUM, "VertexAttribfNV" );
+}
+
+/* First level for NV_vertex_program:
+ *
+ * Check for errors at compile time?.
+ */
+static void GLAPIENTRY save_VertexAttrib1fNV( GLuint index, GLfloat x )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr1f( index, x );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr1f( index, v[0] );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr2f( index, x, y );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr2f( index, v[0], v[1] );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y,
+ GLfloat z )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr3f( index, x, y, z );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr3f( index, v[0], v[1], v[2] );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y,
+ GLfloat z, GLfloat w )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr4f( index, x, y, z, w );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr4f( index, v[0], v[1], v[2], v[3] );
+ else
+ enum_error();
+}
+
+
+
+
+
+/* KW: Compile commands
+ *
+ * Will appear in the list before the vertex buffer containing the
+ * command that provoked the error. I don't see this as a problem.
+ */
+void
+_mesa_save_error( GLcontext *ctx, GLenum error, const char *s )
+{
+ Node *n;
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ERROR, 2 );
+ if (n) {
+ n[1].e = error;
+ n[2].data = (void *) s;
+ }
+ /* execute already done */
+}
+
+
+/*
+ * Compile an error into current display list.
+ */
+void
+_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s )
+{
+ if (ctx->CompileFlag)
+ _mesa_save_error( ctx, error, s );
+
+ if (ctx->ExecuteFlag)
+ _mesa_error( ctx, error, s );
+}
+
+
+
+static GLboolean
+islist(GLcontext *ctx, GLuint list)
+{
+ if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) {
+ return GL_TRUE;
+ }
+ else {
+ return GL_FALSE;
+ }
+}
+
+
+
+/**********************************************************************/
+/* Display list execution */
+/**********************************************************************/
+
+
+/*
+ * Execute a display list. Note that the ListBase offset must have already
+ * been added before calling this function. I.e. the list argument is
+ * the absolute list number, not relative to ListBase.
+ * \param list - display list number
+ */
+static void GLAPIENTRY
+execute_list( GLcontext *ctx, GLuint list )
+{
+ Node *n;
+ GLboolean done;
+
+ if (list == 0 || !islist(ctx,list))
+ return;
+
+ if (ctx->Driver.BeginCallList)
+ ctx->Driver.BeginCallList( ctx, list );
+
+ ctx->ListState.CallDepth++;
+
+ n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+
+ done = GL_FALSE;
+ while (!done) {
+ OpCode opcode = n[0].opcode;
+ int i = (int)n[0].opcode - (int)OPCODE_EXT_0;
+
+ if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
+ /* this is a driver-extended opcode */
+ ctx->ListExt.Opcode[i].Execute(ctx, &n[1]);
+ n += ctx->ListExt.Opcode[i].Size;
+ }
+ else {
+ switch (opcode) {
+ case OPCODE_ERROR:
+ _mesa_error( ctx, n[1].e, (const char *) n[2].data );
+ break;
+ case OPCODE_ACCUM:
+ (*ctx->Exec->Accum)( n[1].e, n[2].f );
+ break;
+ case OPCODE_ALPHA_FUNC:
+ (*ctx->Exec->AlphaFunc)( n[1].e, n[2].f );
+ break;
+ case OPCODE_BIND_TEXTURE:
+ (*ctx->Exec->BindTexture)( n[1].e, n[2].ui );
+ break;
+ case OPCODE_BITMAP:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->Bitmap)( (GLsizei) n[1].i, (GLsizei) n[2].i,
+ n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_BLEND_COLOR:
+ (*ctx->Exec->BlendColor)( n[1].f, n[2].f, n[3].f, n[4].f );
+ break;
+ case OPCODE_BLEND_EQUATION:
+ (*ctx->Exec->BlendEquation)( n[1].e );
+ break;
+ case OPCODE_BLEND_EQUATION_SEPARATE:
+ (*ctx->Exec->BlendEquationSeparateEXT)( n[1].e, n[2].e );
+ break;
+ case OPCODE_BLEND_FUNC_SEPARATE:
+ (*ctx->Exec->BlendFuncSeparateEXT)(n[1].e, n[2].e, n[3].e, n[4].e);
+ break;
+ case OPCODE_CALL_LIST:
+ /* Generated by glCallList(), don't add ListBase */
+ if (ctx->ListState.CallDepthListState.CallDepth < MAX_LIST_NESTING) {
+ execute_list( ctx, ctx->List.ListBase + n[1].ui );
+ }
+ break;
+ case OPCODE_CLEAR:
+ (*ctx->Exec->Clear)( n[1].bf );
+ break;
+ case OPCODE_CLEAR_COLOR:
+ (*ctx->Exec->ClearColor)( n[1].f, n[2].f, n[3].f, n[4].f );
+ break;
+ case OPCODE_CLEAR_ACCUM:
+ (*ctx->Exec->ClearAccum)( n[1].f, n[2].f, n[3].f, n[4].f );
+ break;
+ case OPCODE_CLEAR_DEPTH:
+ (*ctx->Exec->ClearDepth)( (GLclampd) n[1].f );
+ break;
+ case OPCODE_CLEAR_INDEX:
+ (*ctx->Exec->ClearIndex)( (GLfloat) n[1].ui );
+ break;
+ case OPCODE_CLEAR_STENCIL:
+ (*ctx->Exec->ClearStencil)( n[1].i );
+ break;
+ case OPCODE_CLIP_PLANE:
+ {
+ GLdouble eq[4];
+ eq[0] = n[2].f;
+ eq[1] = n[3].f;
+ eq[2] = n[4].f;
+ eq[3] = n[5].f;
+ (*ctx->Exec->ClipPlane)( n[1].e, eq );
+ }
+ break;
+ case OPCODE_COLOR_MASK:
+ (*ctx->Exec->ColorMask)( n[1].b, n[2].b, n[3].b, n[4].b );
+ break;
+ case OPCODE_COLOR_MATERIAL:
+ (*ctx->Exec->ColorMaterial)( n[1].e, n[2].e );
+ break;
+ case OPCODE_COLOR_TABLE:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->ColorTable)( n[1].e, n[2].e, n[3].i, n[4].e,
+ n[5].e, n[6].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_COLOR_TABLE_PARAMETER_FV:
+ {
+ GLfloat params[4];
+ params[0] = n[3].f;
+ params[1] = n[4].f;
+ params[2] = n[5].f;
+ params[3] = n[6].f;
+ (*ctx->Exec->ColorTableParameterfv)( n[1].e, n[2].e, params );
+ }
+ break;
+ case OPCODE_COLOR_TABLE_PARAMETER_IV:
+ {
+ GLint params[4];
+ params[0] = n[3].i;
+ params[1] = n[4].i;
+ params[2] = n[5].i;
+ params[3] = n[6].i;
+ (*ctx->Exec->ColorTableParameteriv)( n[1].e, n[2].e, params );
+ }
+ break;
+ case OPCODE_COLOR_SUB_TABLE:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->ColorSubTable)( n[1].e, n[2].i, n[3].i,
+ n[4].e, n[5].e, n[6].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_CONVOLUTION_FILTER_1D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->ConvolutionFilter1D)( n[1].e, n[2].i, n[3].i,
+ n[4].e, n[5].e, n[6].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_CONVOLUTION_FILTER_2D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->ConvolutionFilter2D)( n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].e, n[6].e, n[7].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_CONVOLUTION_PARAMETER_I:
+ (*ctx->Exec->ConvolutionParameteri)( n[1].e, n[2].e, n[3].i );
+ break;
+ case OPCODE_CONVOLUTION_PARAMETER_IV:
+ {
+ GLint params[4];
+ params[0] = n[3].i;
+ params[1] = n[4].i;
+ params[2] = n[5].i;
+ params[3] = n[6].i;
+ (*ctx->Exec->ConvolutionParameteriv)( n[1].e, n[2].e, params );
+ }
+ break;
+ case OPCODE_CONVOLUTION_PARAMETER_F:
+ (*ctx->Exec->ConvolutionParameterf)( n[1].e, n[2].e, n[3].f );
+ break;
+ case OPCODE_CONVOLUTION_PARAMETER_FV:
+ {
+ GLfloat params[4];
+ params[0] = n[3].f;
+ params[1] = n[4].f;
+ params[2] = n[5].f;
+ params[3] = n[6].f;
+ (*ctx->Exec->ConvolutionParameterfv)( n[1].e, n[2].e, params );
+ }
+ break;
+ case OPCODE_COPY_COLOR_SUB_TABLE:
+ (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i,
+ n[3].i, n[4].i, n[5].i );
+ break;
+ case OPCODE_COPY_COLOR_TABLE:
+ (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i,
+ n[3].i, n[4].i, n[5].i );
+ break;
+ case OPCODE_COPY_PIXELS:
+ (*ctx->Exec->CopyPixels)( n[1].i, n[2].i,
+ (GLsizei) n[3].i, (GLsizei) n[4].i, n[5].e );
+ break;
+ case OPCODE_COPY_TEX_IMAGE1D:
+ (*ctx->Exec->CopyTexImage1D)( n[1].e, n[2].i, n[3].e, n[4].i,
+ n[5].i, n[6].i, n[7].i );
+ break;
+ case OPCODE_COPY_TEX_IMAGE2D:
+ (*ctx->Exec->CopyTexImage2D)( n[1].e, n[2].i, n[3].e, n[4].i,
+ n[5].i, n[6].i, n[7].i, n[8].i );
+ break;
+ case OPCODE_COPY_TEX_SUB_IMAGE1D:
+ (*ctx->Exec->CopyTexSubImage1D)( n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].i, n[6].i );
+ break;
+ case OPCODE_COPY_TEX_SUB_IMAGE2D:
+ (*ctx->Exec->CopyTexSubImage2D)( n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].i, n[6].i, n[7].i, n[8].i );
+ break;
+ case OPCODE_COPY_TEX_SUB_IMAGE3D:
+ (*ctx->Exec->CopyTexSubImage3D)( n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].i, n[6].i, n[7].i, n[8].i , n[9].i);
+ break;
+ case OPCODE_CULL_FACE:
+ (*ctx->Exec->CullFace)( n[1].e );
+ break;
+ case OPCODE_DEPTH_FUNC:
+ (*ctx->Exec->DepthFunc)( n[1].e );
+ break;
+ case OPCODE_DEPTH_MASK:
+ (*ctx->Exec->DepthMask)( n[1].b );
+ break;
+ case OPCODE_DEPTH_RANGE:
+ (*ctx->Exec->DepthRange)( (GLclampd) n[1].f, (GLclampd) n[2].f );
+ break;
+ case OPCODE_DISABLE:
+ (*ctx->Exec->Disable)( n[1].e );
+ break;
+ case OPCODE_DRAW_BUFFER:
+ (*ctx->Exec->DrawBuffer)( n[1].e );
+ break;
+ case OPCODE_DRAW_PIXELS:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->DrawPixels)( n[1].i, n[2].i, n[3].e, n[4].e,
+ n[5].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_ENABLE:
+ (*ctx->Exec->Enable)( n[1].e );
+ break;
+ case OPCODE_EVALMESH1:
+ (*ctx->Exec->EvalMesh1)( n[1].e, n[2].i, n[3].i );
+ break;
+ case OPCODE_EVALMESH2:
+ (*ctx->Exec->EvalMesh2)( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i );
+ break;
+ case OPCODE_FOG:
+ {
+ GLfloat p[4];
+ p[0] = n[2].f;
+ p[1] = n[3].f;
+ p[2] = n[4].f;
+ p[3] = n[5].f;
+ (*ctx->Exec->Fogfv)( n[1].e, p );
+ }
+ break;
+ case OPCODE_FRONT_FACE:
+ (*ctx->Exec->FrontFace)( n[1].e );
+ break;
+ case OPCODE_FRUSTUM:
+ (*ctx->Exec->Frustum)( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
+ break;
+ case OPCODE_HINT:
+ (*ctx->Exec->Hint)( n[1].e, n[2].e );
+ break;
+ case OPCODE_HISTOGRAM:
+ (*ctx->Exec->Histogram)( n[1].e, n[2].i, n[3].e, n[4].b );
+ break;
+ case OPCODE_INDEX_MASK:
+ (*ctx->Exec->IndexMask)( n[1].ui );
+ break;
+ case OPCODE_INIT_NAMES:
+ (*ctx->Exec->InitNames)();
+ break;
+ case OPCODE_LIGHT:
+ {
+ GLfloat p[4];
+ p[0] = n[3].f;
+ p[1] = n[4].f;
+ p[2] = n[5].f;
+ p[3] = n[6].f;
+ (*ctx->Exec->Lightfv)( n[1].e, n[2].e, p );
+ }
+ break;
+ case OPCODE_LIGHT_MODEL:
+ {
+ GLfloat p[4];
+ p[0] = n[2].f;
+ p[1] = n[3].f;
+ p[2] = n[4].f;
+ p[3] = n[5].f;
+ (*ctx->Exec->LightModelfv)( n[1].e, p );
+ }
+ break;
+ case OPCODE_LINE_STIPPLE:
+ (*ctx->Exec->LineStipple)( n[1].i, n[2].us );
+ break;
+ case OPCODE_LINE_WIDTH:
+ (*ctx->Exec->LineWidth)( n[1].f );
+ break;
+ case OPCODE_LIST_BASE:
+ (*ctx->Exec->ListBase)( n[1].ui );
+ break;
+ case OPCODE_LOAD_IDENTITY:
+ (*ctx->Exec->LoadIdentity)();
+ break;
+ case OPCODE_LOAD_MATRIX:
+ if (sizeof(Node)==sizeof(GLfloat)) {
+ (*ctx->Exec->LoadMatrixf)( &n[1].f );
+ }
+ else {
+ GLfloat m[16];
+ GLuint i;
+ for (i=0;i<16;i++) {
+ m[i] = n[1+i].f;
+ }
+ (*ctx->Exec->LoadMatrixf)( m );
+ }
+ break;
+ case OPCODE_LOAD_NAME:
+ (*ctx->Exec->LoadName)( n[1].ui );
+ break;
+ case OPCODE_LOGIC_OP:
+ (*ctx->Exec->LogicOp)( n[1].e );
+ break;
+ case OPCODE_MAP1:
+ {
+ GLenum target = n[1].e;
+ GLint ustride = _mesa_evaluator_components(target);
+ GLint uorder = n[5].i;
+ GLfloat u1 = n[2].f;
+ GLfloat u2 = n[3].f;
+ (*ctx->Exec->Map1f)( target, u1, u2, ustride, uorder,
+ (GLfloat *) n[6].data );
+ }
+ break;
+ case OPCODE_MAP2:
+ {
+ GLenum target = n[1].e;
+ GLfloat u1 = n[2].f;
+ GLfloat u2 = n[3].f;
+ GLfloat v1 = n[4].f;
+ GLfloat v2 = n[5].f;
+ GLint ustride = n[6].i;
+ GLint vstride = n[7].i;
+ GLint uorder = n[8].i;
+ GLint vorder = n[9].i;
+ (*ctx->Exec->Map2f)( target, u1, u2, ustride, uorder,
+ v1, v2, vstride, vorder,
+ (GLfloat *) n[10].data );
+ }
+ break;
+ case OPCODE_MAPGRID1:
+ (*ctx->Exec->MapGrid1f)( n[1].i, n[2].f, n[3].f );
+ break;
+ case OPCODE_MAPGRID2:
+ (*ctx->Exec->MapGrid2f)( n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
+ break;
+ case OPCODE_MATRIX_MODE:
+ (*ctx->Exec->MatrixMode)( n[1].e );
+ break;
+ case OPCODE_MIN_MAX:
+ (*ctx->Exec->Minmax)(n[1].e, n[2].e, n[3].b);
+ break;
+ case OPCODE_MULT_MATRIX:
+ if (sizeof(Node)==sizeof(GLfloat)) {
+ (*ctx->Exec->MultMatrixf)( &n[1].f );
+ }
+ else {
+ GLfloat m[16];
+ GLuint i;
+ for (i=0;i<16;i++) {
+ m[i] = n[1+i].f;
+ }
+ (*ctx->Exec->MultMatrixf)( m );
+ }
+ break;
+ case OPCODE_ORTHO:
+ (*ctx->Exec->Ortho)( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
+ break;
+ case OPCODE_PASSTHROUGH:
+ (*ctx->Exec->PassThrough)( n[1].f );
+ break;
+ case OPCODE_PIXEL_MAP:
+ (*ctx->Exec->PixelMapfv)( n[1].e, n[2].i, (GLfloat *) n[3].data );
+ break;
+ case OPCODE_PIXEL_TRANSFER:
+ (*ctx->Exec->PixelTransferf)( n[1].e, n[2].f );
+ break;
+ case OPCODE_PIXEL_ZOOM:
+ (*ctx->Exec->PixelZoom)( n[1].f, n[2].f );
+ break;
+ case OPCODE_POINT_SIZE:
+ (*ctx->Exec->PointSize)( n[1].f );
+ break;
+ case OPCODE_POINT_PARAMETERS:
+ {
+ GLfloat params[3];
+ params[0] = n[2].f;
+ params[1] = n[3].f;
+ params[2] = n[4].f;
+ (*ctx->Exec->PointParameterfvEXT)( n[1].e, params );
+ }
+ break;
+ case OPCODE_POLYGON_MODE:
+ (*ctx->Exec->PolygonMode)( n[1].e, n[2].e );
+ break;
+ case OPCODE_POLYGON_STIPPLE:
+ (*ctx->Exec->PolygonStipple)( (GLubyte *) n[1].data );
+ break;
+ case OPCODE_POLYGON_OFFSET:
+ (*ctx->Exec->PolygonOffset)( n[1].f, n[2].f );
+ break;
+ case OPCODE_POP_ATTRIB:
+ (*ctx->Exec->PopAttrib)();
+ break;
+ case OPCODE_POP_MATRIX:
+ (*ctx->Exec->PopMatrix)();
+ break;
+ case OPCODE_POP_NAME:
+ (*ctx->Exec->PopName)();
+ break;
+ case OPCODE_PRIORITIZE_TEXTURE:
+ (*ctx->Exec->PrioritizeTextures)( 1, &n[1].ui, &n[2].f );
+ break;
+ case OPCODE_PUSH_ATTRIB:
+ (*ctx->Exec->PushAttrib)( n[1].bf );
+ break;
+ case OPCODE_PUSH_MATRIX:
+ (*ctx->Exec->PushMatrix)();
+ break;
+ case OPCODE_PUSH_NAME:
+ (*ctx->Exec->PushName)( n[1].ui );
+ break;
+ case OPCODE_RASTER_POS:
+ (*ctx->Exec->RasterPos4f)( n[1].f, n[2].f, n[3].f, n[4].f );
+ break;
+ case OPCODE_READ_BUFFER:
+ (*ctx->Exec->ReadBuffer)( n[1].e );
+ break;
+ case OPCODE_RESET_HISTOGRAM:
+ (*ctx->Exec->ResetHistogram)( n[1].e );
+ break;
+ case OPCODE_RESET_MIN_MAX:
+ (*ctx->Exec->ResetMinmax)( n[1].e );
+ break;
+ case OPCODE_ROTATE:
+ (*ctx->Exec->Rotatef)( n[1].f, n[2].f, n[3].f, n[4].f );
+ break;
+ case OPCODE_SCALE:
+ (*ctx->Exec->Scalef)( n[1].f, n[2].f, n[3].f );
+ break;
+ case OPCODE_SCISSOR:
+ (*ctx->Exec->Scissor)( n[1].i, n[2].i, n[3].i, n[4].i );
+ break;
+ case OPCODE_SHADE_MODEL:
+ (*ctx->Exec->ShadeModel)( n[1].e );
+ break;
+ case OPCODE_STENCIL_FUNC:
+ (*ctx->Exec->StencilFunc)( n[1].e, n[2].i, n[3].ui );
+ break;
+ case OPCODE_STENCIL_MASK:
+ (*ctx->Exec->StencilMask)( n[1].ui );
+ break;
+ case OPCODE_STENCIL_OP:
+ (*ctx->Exec->StencilOp)( n[1].e, n[2].e, n[3].e );
+ break;
+ case OPCODE_TEXENV:
+ {
+ GLfloat params[4];
+ params[0] = n[3].f;
+ params[1] = n[4].f;
+ params[2] = n[5].f;
+ params[3] = n[6].f;
+ (*ctx->Exec->TexEnvfv)( n[1].e, n[2].e, params );
+ }
+ break;
+ case OPCODE_TEXGEN:
+ {
+ GLfloat params[4];
+ params[0] = n[3].f;
+ params[1] = n[4].f;
+ params[2] = n[5].f;
+ params[3] = n[6].f;
+ (*ctx->Exec->TexGenfv)( n[1].e, n[2].e, params );
+ }
+ break;
+ case OPCODE_TEXPARAMETER:
+ {
+ GLfloat params[4];
+ params[0] = n[3].f;
+ params[1] = n[4].f;
+ params[2] = n[5].f;
+ params[3] = n[6].f;
+ (*ctx->Exec->TexParameterfv)( n[1].e, n[2].e, params );
+ }
+ break;
+ case OPCODE_TEX_IMAGE1D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->TexImage1D)(
+ n[1].e, /* target */
+ n[2].i, /* level */
+ n[3].i, /* components */
+ n[4].i, /* width */
+ n[5].e, /* border */
+ n[6].e, /* format */
+ n[7].e, /* type */
+ n[8].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEX_IMAGE2D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->TexImage2D)(
+ n[1].e, /* target */
+ n[2].i, /* level */
+ n[3].i, /* components */
+ n[4].i, /* width */
+ n[5].i, /* height */
+ n[6].e, /* border */
+ n[7].e, /* format */
+ n[8].e, /* type */
+ n[9].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEX_IMAGE3D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->TexImage3D)(
+ n[1].e, /* target */
+ n[2].i, /* level */
+ n[3].i, /* components */
+ n[4].i, /* width */
+ n[5].i, /* height */
+ n[6].i, /* depth */
+ n[7].e, /* border */
+ n[8].e, /* format */
+ n[9].e, /* type */
+ n[10].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEX_SUB_IMAGE1D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->TexSubImage1D)( n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].e,
+ n[6].e, n[7].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEX_SUB_IMAGE2D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->TexSubImage2D)( n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].e,
+ n[6].i, n[7].e, n[8].e, n[9].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEX_SUB_IMAGE3D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ (*ctx->Exec->TexSubImage3D)( n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].i, n[6].i, n[7].i,
+ n[8].i, n[9].e, n[10].e,
+ n[11].data );
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TRANSLATE:
+ (*ctx->Exec->Translatef)( n[1].f, n[2].f, n[3].f );
+ break;
+ case OPCODE_VIEWPORT:
+ (*ctx->Exec->Viewport)(n[1].i, n[2].i,
+ (GLsizei) n[3].i, (GLsizei) n[4].i);
+ break;
+ case OPCODE_WINDOW_POS:
+ (*ctx->Exec->WindowPos4fMESA)( n[1].f, n[2].f, n[3].f, n[4].f );
+ break;
+ case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
+ (*ctx->Exec->ActiveTextureARB)( n[1].e );
+ break;
+ case OPCODE_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */
+ (*ctx->Exec->PixelTexGenSGIX)( n[1].e );
+ break;
+ case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */
+ (*ctx->Exec->PixelTexGenParameteriSGIS)( n[1].e, n[2].i );
+ break;
+ case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
+ (*ctx->Exec->CompressedTexImage1DARB)(n[1].e, n[2].i, n[3].e,
+ n[4].i, n[5].i, n[6].i, n[7].data);
+ break;
+ case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
+ (*ctx->Exec->CompressedTexImage2DARB)(n[1].e, n[2].i, n[3].e,
+ n[4].i, n[5].i, n[6].i, n[7].i, n[8].data);
+ break;
+ case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
+ (*ctx->Exec->CompressedTexImage3DARB)(n[1].e, n[2].i, n[3].e,
+ n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].data);
+ break;
+ case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
+ (*ctx->Exec->CompressedTexSubImage1DARB)(n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].e, n[6].i, n[7].data);
+ break;
+ case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
+ (*ctx->Exec->CompressedTexSubImage2DARB)(n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].i, n[6].i, n[7].e, n[8].i, n[9].data);
+ break;
+ case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
+ (*ctx->Exec->CompressedTexSubImage3DARB)(n[1].e, n[2].i, n[3].i,
+ n[4].i, n[5].i, n[6].i, n[7].i, n[8].i,
+ n[9].e, n[10].i, n[11].data);
+ break;
+ case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
+ (*ctx->Exec->SampleCoverageARB)(n[1].f, n[2].b);
+ break;
+ case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
+ (*ctx->Exec->WindowPos3fMESA)( n[1].f, n[2].f, n[3].f );
+ break;
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
+ (*ctx->Exec->BindProgramNV)( n[1].e, n[2].ui );
+ break;
+#endif
+#if FEATURE_NV_vertex_program
+ case OPCODE_EXECUTE_PROGRAM_NV:
+ {
+ GLfloat v[4];
+ v[0] = n[3].f;
+ v[1] = n[4].f;
+ v[2] = n[5].f;
+ v[3] = n[6].f;
+ (*ctx->Exec->ExecuteProgramNV)(n[1].e, n[2].ui, v);
+ }
+ break;
+ case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
+ (*ctx->Exec->RequestResidentProgramsNV)(n[1].ui,
+ (GLuint *) n[2].data);
+ break;
+ case OPCODE_LOAD_PROGRAM_NV:
+ (*ctx->Exec->LoadProgramNV)(n[1].e, n[2].ui, n[3].i,
+ (const GLubyte *) n[4].data);
+ break;
+ case OPCODE_PROGRAM_PARAMETER4F_NV:
+ (*ctx->Exec->ProgramParameter4fNV)(n[1].e, n[2].ui, n[3].f,
+ n[4].f, n[5].f, n[6].f);
+ break;
+ case OPCODE_TRACK_MATRIX_NV:
+ (*ctx->Exec->TrackMatrixNV)(n[1].e, n[2].ui, n[3].e, n[4].e);
+ break;
+#endif
+
+#if FEATURE_NV_fragment_program
+ case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
+ (*ctx->Exec->ProgramLocalParameter4fARB)(n[1].e, n[2].ui, n[3].f,
+ n[4].f, n[5].f, n[6].f);
+ break;
+ case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
+ (*ctx->Exec->ProgramNamedParameter4fNV)(n[1].ui, n[2].i,
+ (const GLubyte *) n[3].data,
+ n[4].f, n[5].f, n[6].f, n[7].f);
+ break;
+#endif
+
+ case OPCODE_ACTIVE_STENCIL_FACE_EXT:
+ (*ctx->Exec->ActiveStencilFaceEXT)(n[1].e);
+ break;
+ case OPCODE_DEPTH_BOUNDS_EXT:
+ (*ctx->Exec->DepthBoundsEXT)(n[1].f, n[2].f);
+ break;
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ case OPCODE_PROGRAM_STRING_ARB:
+ (*ctx->Exec->ProgramStringARB)(n[1].e, n[2].e, n[3].i, n[4].data);
+ break;
+ case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
+ (*ctx->Exec->ProgramEnvParameter4fARB)(n[1].e, n[2].ui, n[3].f,
+ n[4].f, n[5].f, n[6].f);
+ break;
+#endif
+#if FEATURE_ARB_occlusion_query
+ case OPCODE_BEGIN_QUERY_ARB:
+ ctx->Exec->BeginQueryARB(n[1].e, n[2].ui);
+ break;
+ case OPCODE_END_QUERY_ARB:
+ ctx->Exec->EndQueryARB(n[1].e);
+ break;
+#endif
+ case OPCODE_ATTR_1F:
+ (*ctx->Exec->VertexAttrib1fNV)(n[1].e, n[2].f);
+ break;
+ case OPCODE_ATTR_2F:
+ /* Really shouldn't have to do this - the Node structure
+ * is convenient, but it would be better to store the data
+ * packed appropriately so that it can be sent directly
+ * on. With x86_64 becoming common, this will start to
+ * matter more.
+ */
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib2fvNV)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib2fNV)(n[1].e, n[2].f, n[3].f);
+ break;
+ case OPCODE_ATTR_3F:
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib3fvNV)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib3fNV)(n[1].e, n[2].f, n[3].f,
+ n[4].f);
+ break;
+ case OPCODE_ATTR_4F:
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib4fvNV)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib4fNV)(n[1].e, n[2].f, n[3].f,
+ n[4].f, n[5].f);
+ break;
+ case OPCODE_MATERIAL:
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->Materialfv)(n[1].e, n[2].e, &n[3].f);
+ else {
+ GLfloat f[4];
+ f[0] = n[3].f;
+ f[1] = n[4].f;
+ f[2] = n[5].f;
+ f[3] = n[6].f;
+ (*ctx->Exec->Materialfv)(n[1].e, n[2].e, f);
+ }
+ break;
+ case OPCODE_INDEX:
+ (*ctx->Exec->Indexi)(n[1].i);
+ break;
+ case OPCODE_EDGEFLAG:
+ (*ctx->Exec->EdgeFlag)(n[1].b);
+ break;
+ case OPCODE_BEGIN:
+ (*ctx->Exec->Begin)(n[1].e);
+ break;
+ case OPCODE_END:
+ (*ctx->Exec->End)();
+ break;
+ case OPCODE_RECTF:
+ (*ctx->Exec->Rectf)(n[1].f, n[2].f, n[3].f, n[4].f);
+ break;
+ case OPCODE_EVAL_C1:
+ (*ctx->Exec->EvalCoord1f)(n[1].f);
+ break;
+ case OPCODE_EVAL_C2:
+ (*ctx->Exec->EvalCoord2f)(n[1].f, n[2].f);
+ break;
+ case OPCODE_EVAL_P1:
+ (*ctx->Exec->EvalPoint1)(n[1].i);
+ break;
+ case OPCODE_EVAL_P2:
+ (*ctx->Exec->EvalPoint2)(n[1].i, n[2].i);
+ break;
+
+
+
+
+ case OPCODE_CONTINUE:
+ n = (Node *) n[1].next;
+ break;
+ case OPCODE_END_OF_LIST:
+ done = GL_TRUE;
+ break;
+ default:
+ {
+ char msg[1000];
+ _mesa_sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode);
+ _mesa_problem(ctx, msg);
+ }
+ done = GL_TRUE;
+ }
+
+ /* increment n to point to next compiled command */
+ if (opcode!=OPCODE_CONTINUE) {
+ n += InstSize[opcode];
+ }
+ }
+ }
+ ctx->ListState.CallDepth--;
+
+ if (ctx->Driver.EndCallList)
+ ctx->Driver.EndCallList( ctx );
+}
+
+
+
+
+
+/**********************************************************************/
+/* GL functions */
+/**********************************************************************/
+
+
+
+
+/*
+ * Test if a display list number is valid.
+ */
+GLboolean GLAPIENTRY
+_mesa_IsList( GLuint list )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ return islist(ctx, list);
+}
+
+
+/*
+ * Delete a sequence of consecutive display lists.
+ */
+void GLAPIENTRY
+_mesa_DeleteLists( GLuint list, GLsizei range )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint i;
+ FLUSH_VERTICES(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (range<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glDeleteLists" );
+ return;
+ }
+ for (i=list;iShared->Mutex);
+
+ base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
+ if (base) {
+ /* reserve the list IDs by with empty/dummy lists */
+ GLint i;
+ for (i=0; iShared->DisplayList, base+i, make_empty_list());
+ }
+ }
+
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+
+ return base;
+}
+
+
+
+/*
+ * Begin a new display list.
+ */
+void GLAPIENTRY
+_mesa_NewList( GLuint list, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ FLUSH_CURRENT(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glNewList %u %s\n", list,
+ _mesa_lookup_enum_by_nr(mode));
+
+ if (list==0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glNewList" );
+ return;
+ }
+
+ if (mode!=GL_COMPILE && mode!=GL_COMPILE_AND_EXECUTE) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glNewList" );
+ return;
+ }
+
+ if (ctx->ListState.CurrentListPtr) {
+ /* already compiling a display list */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" );
+ return;
+ }
+
+ ctx->CompileFlag = GL_TRUE;
+ ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
+
+ /* Allocate new display list */
+ ctx->ListState.CurrentListNum = list;
+ ctx->ListState.CurrentBlock = (Node *) CALLOC( sizeof(Node) * BLOCK_SIZE );
+ ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock;
+ ctx->ListState.CurrentPos = 0;
+
+ /* Reset acumulated list state:
+ */
+ for (i = 0; i < VERT_ATTRIB_MAX; i++)
+ ctx->ListState.ActiveAttribSize[i] = 0;
+
+ for (i = 0; i < MAT_ATTRIB_MAX; i++)
+ ctx->ListState.ActiveMaterialSize[i] = 0;
+
+ ctx->ListState.ActiveIndex = 0;
+ ctx->ListState.ActiveEdgeFlag = 0;
+
+ ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+ ctx->Driver.NewList( ctx, list, mode );
+
+ ctx->CurrentDispatch = ctx->Save;
+ _glapi_set_dispatch( ctx->CurrentDispatch );
+}
+
+
+
+/*
+ * End definition of current display list.
+ */
+void GLAPIENTRY
+_mesa_EndList( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ SAVE_FLUSH_VERTICES(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glEndList\n");
+
+ /* Check that a list is under construction */
+ if (!ctx->ListState.CurrentListPtr) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" );
+ return;
+ }
+
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_END_OF_LIST, 0 );
+
+ /* Destroy old list, if any */
+ _mesa_destroy_list(ctx, ctx->ListState.CurrentListNum);
+ /* Install the list */
+ _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentListPtr);
+
+
+ if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
+ mesa_print_display_list(ctx->ListState.CurrentListNum);
+
+ ctx->ListState.CurrentListNum = 0;
+ ctx->ListState.CurrentListPtr = NULL;
+ ctx->ExecuteFlag = GL_TRUE;
+ ctx->CompileFlag = GL_FALSE;
+
+ ctx->Driver.EndList( ctx );
+
+ ctx->CurrentDispatch = ctx->Exec;
+ _glapi_set_dispatch( ctx->CurrentDispatch );
+}
+
+
+
+void GLAPIENTRY
+_mesa_CallList( GLuint list )
+{
+ GLboolean save_compile_flag;
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_CURRENT(ctx, 0);
+ /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
+ /* execute the display list, and restore the CompileFlag. */
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glCallList %d\n", list);
+
+ if (list == 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
+ return;
+ }
+
+/* mesa_print_display_list( list ); */
+
+ save_compile_flag = ctx->CompileFlag;
+ if (save_compile_flag) {
+ ctx->CompileFlag = GL_FALSE;
+ }
+
+ execute_list( ctx, list );
+ ctx->CompileFlag = save_compile_flag;
+
+ /* also restore API function pointers to point to "save" versions */
+ if (save_compile_flag) {
+ ctx->CurrentDispatch = ctx->Save;
+ _glapi_set_dispatch( ctx->CurrentDispatch );
+ }
+}
+
+
+
+/*
+ * Execute glCallLists: call multiple display lists.
+ */
+void GLAPIENTRY
+_mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint list;
+ GLint i;
+ GLboolean save_compile_flag;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glCallLists %d\n", n);
+
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ /* OK */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
+ return;
+ }
+
+ /* Save the CompileFlag status, turn it off, execute display list,
+ * and restore the CompileFlag.
+ */
+ save_compile_flag = ctx->CompileFlag;
+ ctx->CompileFlag = GL_FALSE;
+
+ for (i=0;iList.ListBase + list );
+ }
+
+ ctx->CompileFlag = save_compile_flag;
+
+ /* also restore API function pointers to point to "save" versions */
+ if (save_compile_flag) {
+ ctx->CurrentDispatch = ctx->Save;
+ _glapi_set_dispatch( ctx->CurrentDispatch );
+ }
+}
+
+
+
+/*
+ * Set the offset added to list numbers in glCallLists.
+ */
+void GLAPIENTRY
+_mesa_ListBase( GLuint base )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ ctx->List.ListBase = base;
+}
+
+
+/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
+ */
+static void GLAPIENTRY exec_Finish( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->Finish();
+}
+
+static void GLAPIENTRY exec_Flush( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->Flush( );
+}
+
+static void GLAPIENTRY exec_GetBooleanv( GLenum pname, GLboolean *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetBooleanv( pname, params );
+}
+
+static void GLAPIENTRY exec_GetClipPlane( GLenum plane, GLdouble *equation )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetClipPlane( plane, equation );
+}
+
+static void GLAPIENTRY exec_GetDoublev( GLenum pname, GLdouble *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetDoublev( pname, params );
+}
+
+static GLenum GLAPIENTRY exec_GetError( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->GetError( );
+}
+
+static void GLAPIENTRY exec_GetFloatv( GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetFloatv( pname, params );
+}
+
+static void GLAPIENTRY exec_GetIntegerv( GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetIntegerv( pname, params );
+}
+
+static void GLAPIENTRY exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetLightfv( light, pname, params );
+}
+
+static void GLAPIENTRY exec_GetLightiv( GLenum light, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetLightiv( light, pname, params );
+}
+
+static void GLAPIENTRY exec_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMapdv( target, query, v );
+}
+
+static void GLAPIENTRY exec_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMapfv( target, query, v );
+}
+
+static void GLAPIENTRY exec_GetMapiv( GLenum target, GLenum query, GLint *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMapiv( target, query, v );
+}
+
+static void GLAPIENTRY exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMaterialfv( face, pname, params );
+}
+
+static void GLAPIENTRY exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMaterialiv( face, pname, params );
+}
+
+static void GLAPIENTRY exec_GetPixelMapfv( GLenum map, GLfloat *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelMapfv( map, values );
+}
+
+static void GLAPIENTRY exec_GetPixelMapuiv( GLenum map, GLuint *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelMapuiv( map, values );
+}
+
+static void GLAPIENTRY exec_GetPixelMapusv( GLenum map, GLushort *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelMapusv( map, values );
+}
+
+static void GLAPIENTRY exec_GetPolygonStipple( GLubyte *dest )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPolygonStipple( dest );
+}
+
+static const GLubyte * GLAPIENTRY exec_GetString( GLenum name )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->GetString( name );
+}
+
+static void GLAPIENTRY exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexEnvfv( target, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexEnviv( target, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexGendv( coord, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexGenfv( coord, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexGeniv( coord, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexImage( GLenum target, GLint level, GLenum format,
+ GLenum type, GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexImage( target, level, format, type, pixels );
+}
+
+static void GLAPIENTRY exec_GetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexLevelParameterfv( target, level, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexLevelParameteriv( target, level, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexParameterfv( GLenum target, GLenum pname,
+ GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexParameterfv( target, pname, params );
+}
+
+static void GLAPIENTRY exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexParameteriv( target, pname, params );
+}
+
+static GLboolean GLAPIENTRY exec_IsEnabled( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->IsEnabled( cap );
+}
+
+static void GLAPIENTRY exec_PixelStoref( GLenum pname, GLfloat param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PixelStoref( pname, param );
+}
+
+static void GLAPIENTRY exec_PixelStorei( GLenum pname, GLint param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PixelStorei( pname, param );
+}
+
+static void GLAPIENTRY exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ReadPixels( x, y, width, height, format, type, pixels );
+}
+
+static GLint GLAPIENTRY exec_RenderMode( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->RenderMode( mode );
+}
+
+static void GLAPIENTRY exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->FeedbackBuffer( size, type, buffer );
+}
+
+static void GLAPIENTRY exec_SelectBuffer( GLsizei size, GLuint *buffer )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->SelectBuffer( size, buffer );
+}
+
+static GLboolean GLAPIENTRY exec_AreTexturesResident(GLsizei n, const GLuint *texName,
+ GLboolean *residences)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->AreTexturesResident( n, texName, residences);
+}
+
+static void GLAPIENTRY exec_ColorPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ColorPointer( size, type, stride, ptr);
+}
+
+static void GLAPIENTRY exec_DeleteTextures( GLsizei n, const GLuint *texName)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->DeleteTextures( n, texName);
+}
+
+static void GLAPIENTRY exec_DisableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->DisableClientState( cap );
+}
+
+static void GLAPIENTRY exec_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->EdgeFlagPointer( stride, vptr);
+}
+
+static void GLAPIENTRY exec_EnableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->EnableClientState( cap );
+}
+
+static void GLAPIENTRY exec_GenTextures( GLsizei n, GLuint *texName )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GenTextures( n, texName );
+}
+
+static void GLAPIENTRY exec_GetPointerv( GLenum pname, GLvoid **params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPointerv( pname, params );
+}
+
+static void GLAPIENTRY exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->IndexPointer( type, stride, ptr);
+}
+
+static void GLAPIENTRY exec_InterleavedArrays(GLenum format, GLsizei stride,
+ const GLvoid *pointer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->InterleavedArrays( format, stride, pointer);
+}
+
+static GLboolean GLAPIENTRY exec_IsTexture( GLuint texture )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->IsTexture( texture );
+}
+
+static void GLAPIENTRY exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->NormalPointer( type, stride, ptr );
+}
+
+static void GLAPIENTRY exec_PopClientAttrib(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PopClientAttrib();
+}
+
+static void GLAPIENTRY exec_PushClientAttrib(GLbitfield mask)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PushClientAttrib( mask);
+}
+
+static void GLAPIENTRY exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->TexCoordPointer( size, type, stride, ptr);
+}
+
+static void GLAPIENTRY exec_GetCompressedTexImageARB(GLenum target, GLint level,
+ GLvoid *img)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetCompressedTexImageARB( target, level, img);
+}
+
+static void GLAPIENTRY exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->VertexPointer( size, type, stride, ptr);
+}
+
+static void GLAPIENTRY exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
+ GLint x, GLint y, GLsizei width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->CopyConvolutionFilter1D( target, internalFormat, x, y, width);
+}
+
+static void GLAPIENTRY exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
+ GLint x, GLint y, GLsizei width,
+ GLsizei height)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->CopyConvolutionFilter2D( target, internalFormat, x, y, width,
+ height);
+}
+
+static void GLAPIENTRY exec_GetColorTable( GLenum target, GLenum format,
+ GLenum type, GLvoid *data )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetColorTable( target, format, type, data );
+}
+
+static void GLAPIENTRY exec_GetColorTableParameterfv( GLenum target, GLenum pname,
+ GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetColorTableParameterfv( target, pname, params );
+}
+
+static void GLAPIENTRY exec_GetColorTableParameteriv( GLenum target, GLenum pname,
+ GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetColorTableParameteriv( target, pname, params );
+}
+
+static void GLAPIENTRY exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
+ GLvoid *image)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetConvolutionFilter( target, format, type, image);
+}
+
+static void GLAPIENTRY exec_GetConvolutionParameterfv(GLenum target, GLenum pname,
+ GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetConvolutionParameterfv( target, pname, params);
+}
+
+static void GLAPIENTRY exec_GetConvolutionParameteriv(GLenum target, GLenum pname,
+ GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetConvolutionParameteriv( target, pname, params);
+}
+
+static void GLAPIENTRY exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
+ GLenum type, GLvoid *values)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetHistogram( target, reset, format, type, values);
+}
+
+static void GLAPIENTRY exec_GetHistogramParameterfv(GLenum target, GLenum pname,
+ GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetHistogramParameterfv( target, pname, params);
+}
+
+static void GLAPIENTRY exec_GetHistogramParameteriv(GLenum target, GLenum pname,
+ GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetHistogramParameteriv( target, pname, params);
+}
+
+static void GLAPIENTRY exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
+ GLenum type, GLvoid *values)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMinmax( target, reset, format, type, values);
+}
+
+static void GLAPIENTRY exec_GetMinmaxParameterfv(GLenum target, GLenum pname,
+ GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMinmaxParameterfv( target, pname, params);
+}
+
+static void GLAPIENTRY exec_GetMinmaxParameteriv(GLenum target, GLenum pname,
+ GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMinmaxParameteriv( target, pname, params);
+}
+
+static void GLAPIENTRY exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
+ GLvoid *row, GLvoid *column, GLvoid *span)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetSeparableFilter( target, format, type, row, column, span);
+}
+
+static void GLAPIENTRY exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
+ GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *row,
+ const GLvoid *column)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->SeparableFilter2D( target, internalFormat, width, height, format,
+ type, row, column);
+}
+
+static void GLAPIENTRY exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelTexGenParameterivSGIS( target, value);
+}
+
+static void GLAPIENTRY exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelTexGenParameterfvSGIS( target, value);
+}
+
+static void GLAPIENTRY exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ColorPointerEXT( size, type, stride, count, ptr);
+}
+
+static void GLAPIENTRY exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count,
+ const GLboolean *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->EdgeFlagPointerEXT( stride, count, ptr);
+}
+
+static void GLAPIENTRY exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->IndexPointerEXT( type, stride, count, ptr);
+}
+
+static void GLAPIENTRY exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->NormalPointerEXT( type, stride, count, ptr);
+}
+
+static void GLAPIENTRY exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->TexCoordPointerEXT( size, type, stride, count, ptr);
+}
+
+static void GLAPIENTRY exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->VertexPointerEXT( size, type, stride, count, ptr);
+}
+
+static void GLAPIENTRY exec_LockArraysEXT(GLint first, GLsizei count)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->LockArraysEXT( first, count);
+}
+
+static void GLAPIENTRY exec_UnlockArraysEXT( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->UnlockArraysEXT( );
+}
+
+static void GLAPIENTRY exec_ResizeBuffersMESA( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ResizeBuffersMESA( );
+}
+
+
+static void GLAPIENTRY exec_ClientActiveTextureARB( GLenum target )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ClientActiveTextureARB(target);
+}
+
+static void GLAPIENTRY exec_SecondaryColorPointerEXT(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->SecondaryColorPointerEXT( size, type, stride, ptr);
+}
+
+static void GLAPIENTRY exec_FogCoordPointerEXT(GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->FogCoordPointerEXT( type, stride, ptr);
+}
+
+/* GL_EXT_multi_draw_arrays */
+static void GLAPIENTRY exec_MultiDrawArraysEXT(GLenum mode, GLint *first,
+ GLsizei *count, GLsizei primcount)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->MultiDrawArraysEXT( mode, first, count, primcount );
+}
+
+/* GL_EXT_multi_draw_arrays */
+static void GLAPIENTRY exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count,
+ GLenum type, const GLvoid **indices,
+ GLsizei primcount)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->MultiDrawElementsEXT(mode, count, type, indices, primcount);
+}
+
+/* GL_IBM_multimode_draw_arrays */
+static void GLAPIENTRY exec_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first,
+ const GLsizei *count, GLsizei primcount,
+ GLint modestride)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->MultiModeDrawArraysIBM(mode, first, count, primcount, modestride);
+}
+
+/* GL_IBM_multimode_draw_arrays */
+static void GLAPIENTRY exec_MultiModeDrawElementsIBM(const GLenum *mode,
+ const GLsizei *count,
+ GLenum type,
+ const GLvoid * const *indices,
+ GLsizei primcount, GLint modestride)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->MultiModeDrawElementsIBM(mode, count, type, indices, primcount,
+ modestride);
+}
+
+
+
+
+/**
+ * Setup the given dispatch table to point to Mesa's display list
+ * building functions.
+ *
+ * This does not include any of the tnl functions - they are
+ * initialized from _mesa_init_api_defaults and from the active vtxfmt
+ * struct.
+ */
+void
+_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
+{
+ _mesa_init_no_op_table(table, tableSize);
+
+ _mesa_loopback_init_api_table( table );
+
+ /* GL 1.0 */
+ table->Accum = save_Accum;
+ table->AlphaFunc = save_AlphaFunc;
+ table->Bitmap = save_Bitmap;
+ table->BlendFunc = _mesa_BlendFunc; /* loops-back to BlendFuncSeparate */
+ table->CallList = _mesa_save_CallList;
+ table->CallLists = _mesa_save_CallLists;
+ table->Clear = save_Clear;
+ table->ClearAccum = save_ClearAccum;
+ table->ClearColor = save_ClearColor;
+ table->ClearDepth = save_ClearDepth;
+ table->ClearIndex = save_ClearIndex;
+ table->ClearStencil = save_ClearStencil;
+ table->ClipPlane = save_ClipPlane;
+ table->ColorMask = save_ColorMask;
+ table->ColorMaterial = save_ColorMaterial;
+ table->CopyPixels = save_CopyPixels;
+ table->CullFace = save_CullFace;
+ table->DeleteLists = _mesa_DeleteLists;
+ table->DepthFunc = save_DepthFunc;
+ table->DepthMask = save_DepthMask;
+ table->DepthRange = save_DepthRange;
+ table->Disable = save_Disable;
+ table->DrawBuffer = save_DrawBuffer;
+ table->DrawPixels = save_DrawPixels;
+ table->Enable = save_Enable;
+ table->EndList = _mesa_EndList;
+ table->EvalMesh1 = _mesa_save_EvalMesh1;
+ table->EvalMesh2 = _mesa_save_EvalMesh2;
+ table->Finish = exec_Finish;
+ table->Flush = exec_Flush;
+ table->Fogf = save_Fogf;
+ table->Fogfv = save_Fogfv;
+ table->Fogi = save_Fogi;
+ table->Fogiv = save_Fogiv;
+ table->FrontFace = save_FrontFace;
+ table->Frustum = save_Frustum;
+ table->GenLists = _mesa_GenLists;
+ table->GetBooleanv = exec_GetBooleanv;
+ table->GetClipPlane = exec_GetClipPlane;
+ table->GetDoublev = exec_GetDoublev;
+ table->GetError = exec_GetError;
+ table->GetFloatv = exec_GetFloatv;
+ table->GetIntegerv = exec_GetIntegerv;
+ table->GetLightfv = exec_GetLightfv;
+ table->GetLightiv = exec_GetLightiv;
+ table->GetMapdv = exec_GetMapdv;
+ table->GetMapfv = exec_GetMapfv;
+ table->GetMapiv = exec_GetMapiv;
+ table->GetMaterialfv = exec_GetMaterialfv;
+ table->GetMaterialiv = exec_GetMaterialiv;
+ table->GetPixelMapfv = exec_GetPixelMapfv;
+ table->GetPixelMapuiv = exec_GetPixelMapuiv;
+ table->GetPixelMapusv = exec_GetPixelMapusv;
+ table->GetPolygonStipple = exec_GetPolygonStipple;
+ table->GetString = exec_GetString;
+ table->GetTexEnvfv = exec_GetTexEnvfv;
+ table->GetTexEnviv = exec_GetTexEnviv;
+ table->GetTexGendv = exec_GetTexGendv;
+ table->GetTexGenfv = exec_GetTexGenfv;
+ table->GetTexGeniv = exec_GetTexGeniv;
+ table->GetTexImage = exec_GetTexImage;
+ table->GetTexLevelParameterfv = exec_GetTexLevelParameterfv;
+ table->GetTexLevelParameteriv = exec_GetTexLevelParameteriv;
+ table->GetTexParameterfv = exec_GetTexParameterfv;
+ table->GetTexParameteriv = exec_GetTexParameteriv;
+ table->Hint = save_Hint;
+ table->IndexMask = save_IndexMask;
+ table->InitNames = save_InitNames;
+ table->IsEnabled = exec_IsEnabled;
+ table->IsList = _mesa_IsList;
+ table->LightModelf = save_LightModelf;
+ table->LightModelfv = save_LightModelfv;
+ table->LightModeli = save_LightModeli;
+ table->LightModeliv = save_LightModeliv;
+ table->Lightf = save_Lightf;
+ table->Lightfv = save_Lightfv;
+ table->Lighti = save_Lighti;
+ table->Lightiv = save_Lightiv;
+ table->LineStipple = save_LineStipple;
+ table->LineWidth = save_LineWidth;
+ table->ListBase = save_ListBase;
+ table->LoadIdentity = save_LoadIdentity;
+ table->LoadMatrixd = save_LoadMatrixd;
+ table->LoadMatrixf = save_LoadMatrixf;
+ table->LoadName = save_LoadName;
+ table->LogicOp = save_LogicOp;
+ table->Map1d = save_Map1d;
+ table->Map1f = save_Map1f;
+ table->Map2d = save_Map2d;
+ table->Map2f = save_Map2f;
+ table->MapGrid1d = save_MapGrid1d;
+ table->MapGrid1f = save_MapGrid1f;
+ table->MapGrid2d = save_MapGrid2d;
+ table->MapGrid2f = save_MapGrid2f;
+ table->MatrixMode = save_MatrixMode;
+ table->MultMatrixd = save_MultMatrixd;
+ table->MultMatrixf = save_MultMatrixf;
+ table->NewList = save_NewList;
+ table->Ortho = save_Ortho;
+ table->PassThrough = save_PassThrough;
+ table->PixelMapfv = save_PixelMapfv;
+ table->PixelMapuiv = save_PixelMapuiv;
+ table->PixelMapusv = save_PixelMapusv;
+ table->PixelStoref = exec_PixelStoref;
+ table->PixelStorei = exec_PixelStorei;
+ table->PixelTransferf = save_PixelTransferf;
+ table->PixelTransferi = save_PixelTransferi;
+ table->PixelZoom = save_PixelZoom;
+ table->PointSize = save_PointSize;
+ table->PolygonMode = save_PolygonMode;
+ table->PolygonOffset = save_PolygonOffset;
+ table->PolygonStipple = save_PolygonStipple;
+ table->PopAttrib = save_PopAttrib;
+ table->PopMatrix = save_PopMatrix;
+ table->PopName = save_PopName;
+ table->PushAttrib = save_PushAttrib;
+ table->PushMatrix = save_PushMatrix;
+ table->PushName = save_PushName;
+ table->RasterPos2d = save_RasterPos2d;
+ table->RasterPos2dv = save_RasterPos2dv;
+ table->RasterPos2f = save_RasterPos2f;
+ table->RasterPos2fv = save_RasterPos2fv;
+ table->RasterPos2i = save_RasterPos2i;
+ table->RasterPos2iv = save_RasterPos2iv;
+ table->RasterPos2s = save_RasterPos2s;
+ table->RasterPos2sv = save_RasterPos2sv;
+ table->RasterPos3d = save_RasterPos3d;
+ table->RasterPos3dv = save_RasterPos3dv;
+ table->RasterPos3f = save_RasterPos3f;
+ table->RasterPos3fv = save_RasterPos3fv;
+ table->RasterPos3i = save_RasterPos3i;
+ table->RasterPos3iv = save_RasterPos3iv;
+ table->RasterPos3s = save_RasterPos3s;
+ table->RasterPos3sv = save_RasterPos3sv;
+ table->RasterPos4d = save_RasterPos4d;
+ table->RasterPos4dv = save_RasterPos4dv;
+ table->RasterPos4f = save_RasterPos4f;
+ table->RasterPos4fv = save_RasterPos4fv;
+ table->RasterPos4i = save_RasterPos4i;
+ table->RasterPos4iv = save_RasterPos4iv;
+ table->RasterPos4s = save_RasterPos4s;
+ table->RasterPos4sv = save_RasterPos4sv;
+ table->ReadBuffer = save_ReadBuffer;
+ table->ReadPixels = exec_ReadPixels;
+ table->RenderMode = exec_RenderMode;
+ table->Rotated = save_Rotated;
+ table->Rotatef = save_Rotatef;
+ table->Scaled = save_Scaled;
+ table->Scalef = save_Scalef;
+ table->Scissor = save_Scissor;
+ table->FeedbackBuffer = exec_FeedbackBuffer;
+ table->SelectBuffer = exec_SelectBuffer;
+ table->ShadeModel = save_ShadeModel;
+ table->StencilFunc = save_StencilFunc;
+ table->StencilMask = save_StencilMask;
+ table->StencilOp = save_StencilOp;
+ table->TexEnvf = save_TexEnvf;
+ table->TexEnvfv = save_TexEnvfv;
+ table->TexEnvi = save_TexEnvi;
+ table->TexEnviv = save_TexEnviv;
+ table->TexGend = save_TexGend;
+ table->TexGendv = save_TexGendv;
+ table->TexGenf = save_TexGenf;
+ table->TexGenfv = save_TexGenfv;
+ table->TexGeni = save_TexGeni;
+ table->TexGeniv = save_TexGeniv;
+ table->TexImage1D = save_TexImage1D;
+ table->TexImage2D = save_TexImage2D;
+ table->TexParameterf = save_TexParameterf;
+ table->TexParameterfv = save_TexParameterfv;
+ table->TexParameteri = save_TexParameteri;
+ table->TexParameteriv = save_TexParameteriv;
+ table->Translated = save_Translated;
+ table->Translatef = save_Translatef;
+ table->Viewport = save_Viewport;
+
+ /* GL 1.1 */
+ table->AreTexturesResident = exec_AreTexturesResident;
+ table->AreTexturesResidentEXT = exec_AreTexturesResident;
+ table->BindTexture = save_BindTexture;
+ table->ColorPointer = exec_ColorPointer;
+ table->CopyTexImage1D = save_CopyTexImage1D;
+ table->CopyTexImage2D = save_CopyTexImage2D;
+ table->CopyTexSubImage1D = save_CopyTexSubImage1D;
+ table->CopyTexSubImage2D = save_CopyTexSubImage2D;
+ table->DeleteTextures = exec_DeleteTextures;
+ table->DisableClientState = exec_DisableClientState;
+ table->EdgeFlagPointer = exec_EdgeFlagPointer;
+ table->EnableClientState = exec_EnableClientState;
+ table->GenTextures = exec_GenTextures;
+ table->GenTexturesEXT = exec_GenTextures;
+ table->GetPointerv = exec_GetPointerv;
+ table->IndexPointer = exec_IndexPointer;
+ table->InterleavedArrays = exec_InterleavedArrays;
+ table->IsTexture = exec_IsTexture;
+ table->IsTextureEXT = exec_IsTexture;
+ table->NormalPointer = exec_NormalPointer;
+ table->PopClientAttrib = exec_PopClientAttrib;
+ table->PrioritizeTextures = save_PrioritizeTextures;
+ table->PushClientAttrib = exec_PushClientAttrib;
+ table->TexCoordPointer = exec_TexCoordPointer;
+ table->TexSubImage1D = save_TexSubImage1D;
+ table->TexSubImage2D = save_TexSubImage2D;
+ table->VertexPointer = exec_VertexPointer;
+
+ /* GL 1.2 */
+ table->CopyTexSubImage3D = save_CopyTexSubImage3D;
+ table->TexImage3D = save_TexImage3D;
+ table->TexSubImage3D = save_TexSubImage3D;
+
+ /* GL_ARB_imaging */
+ /* Not all are supported */
+ table->BlendColor = save_BlendColor;
+ table->BlendEquation = save_BlendEquation;
+ table->ColorSubTable = save_ColorSubTable;
+ table->ColorTable = save_ColorTable;
+ table->ColorTableParameterfv = save_ColorTableParameterfv;
+ table->ColorTableParameteriv = save_ColorTableParameteriv;
+ table->ConvolutionFilter1D = save_ConvolutionFilter1D;
+ table->ConvolutionFilter2D = save_ConvolutionFilter2D;
+ table->ConvolutionParameterf = save_ConvolutionParameterf;
+ table->ConvolutionParameterfv = save_ConvolutionParameterfv;
+ table->ConvolutionParameteri = save_ConvolutionParameteri;
+ table->ConvolutionParameteriv = save_ConvolutionParameteriv;
+ table->CopyColorSubTable = save_CopyColorSubTable;
+ table->CopyColorTable = save_CopyColorTable;
+ table->CopyConvolutionFilter1D = exec_CopyConvolutionFilter1D;
+ table->CopyConvolutionFilter2D = exec_CopyConvolutionFilter2D;
+ table->GetColorTable = exec_GetColorTable;
+ table->GetColorTableEXT = exec_GetColorTable;
+ table->GetColorTableParameterfv = exec_GetColorTableParameterfv;
+ table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv;
+ table->GetColorTableParameteriv = exec_GetColorTableParameteriv;
+ table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv;
+ table->GetConvolutionFilter = exec_GetConvolutionFilter;
+ table->GetConvolutionFilterEXT = exec_GetConvolutionFilter;
+ table->GetConvolutionParameterfv = exec_GetConvolutionParameterfv;
+ table->GetConvolutionParameterfvEXT = exec_GetConvolutionParameterfv;
+ table->GetConvolutionParameteriv = exec_GetConvolutionParameteriv;
+ table->GetConvolutionParameterivEXT = exec_GetConvolutionParameteriv;
+ table->GetHistogram = exec_GetHistogram;
+ table->GetHistogramEXT = exec_GetHistogram;
+ table->GetHistogramParameterfv = exec_GetHistogramParameterfv;
+ table->GetHistogramParameterfvEXT = exec_GetHistogramParameterfv;
+ table->GetHistogramParameteriv = exec_GetHistogramParameteriv;
+ table->GetHistogramParameterivEXT = exec_GetHistogramParameteriv;
+ table->GetMinmax = exec_GetMinmax;
+ table->GetMinmaxEXT = exec_GetMinmax;
+ table->GetMinmaxParameterfv = exec_GetMinmaxParameterfv;
+ table->GetMinmaxParameterfvEXT = exec_GetMinmaxParameterfv;
+ table->GetMinmaxParameteriv = exec_GetMinmaxParameteriv;
+ table->GetMinmaxParameterivEXT = exec_GetMinmaxParameteriv;
+ table->GetSeparableFilter = exec_GetSeparableFilter;
+ table->GetSeparableFilterEXT = exec_GetSeparableFilter;
+ table->Histogram = save_Histogram;
+ table->Minmax = save_Minmax;
+ table->ResetHistogram = save_ResetHistogram;
+ table->ResetMinmax = save_ResetMinmax;
+ table->SeparableFilter2D = exec_SeparableFilter2D;
+
+ /* 2. GL_EXT_blend_color */
+#if 0
+ table->BlendColorEXT = save_BlendColorEXT;
+#endif
+
+ /* 3. GL_EXT_polygon_offset */
+ table->PolygonOffsetEXT = save_PolygonOffsetEXT;
+
+ /* 6. GL_EXT_texture3d */
+#if 0
+ table->CopyTexSubImage3DEXT = save_CopyTexSubImage3D;
+ table->TexImage3DEXT = save_TexImage3DEXT;
+ table->TexSubImage3DEXT = save_TexSubImage3D;
+#endif
+
+ /* 15. GL_SGIX_pixel_texture */
+ table->PixelTexGenSGIX = save_PixelTexGenSGIX;
+
+ /* 15. GL_SGIS_pixel_texture */
+ table->PixelTexGenParameteriSGIS = save_PixelTexGenParameteriSGIS;
+ table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS;
+ table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS;
+ table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS;
+ table->GetPixelTexGenParameterivSGIS = exec_GetPixelTexGenParameterivSGIS;
+ table->GetPixelTexGenParameterfvSGIS = exec_GetPixelTexGenParameterfvSGIS;
+
+ /* 30. GL_EXT_vertex_array */
+ table->ColorPointerEXT = exec_ColorPointerEXT;
+ table->EdgeFlagPointerEXT = exec_EdgeFlagPointerEXT;
+ table->IndexPointerEXT = exec_IndexPointerEXT;
+ table->NormalPointerEXT = exec_NormalPointerEXT;
+ table->TexCoordPointerEXT = exec_TexCoordPointerEXT;
+ table->VertexPointerEXT = exec_VertexPointerEXT;
+
+ /* 37. GL_EXT_blend_minmax */
+#if 0
+ table->BlendEquationEXT = save_BlendEquationEXT;
+#endif
+
+ /* 54. GL_EXT_point_parameters */
+ table->PointParameterfEXT = save_PointParameterfEXT;
+ table->PointParameterfvEXT = save_PointParameterfvEXT;
+
+ /* 78. GL_EXT_paletted_texture */
+#if 0
+ table->ColorTableEXT = save_ColorTable;
+ table->ColorSubTableEXT = save_ColorSubTable;
+#endif
+ table->GetColorTableEXT = exec_GetColorTable;
+ table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv;
+ table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv;
+
+ /* 97. GL_EXT_compiled_vertex_array */
+ table->LockArraysEXT = exec_LockArraysEXT;
+ table->UnlockArraysEXT = exec_UnlockArraysEXT;
+
+ /* 145. GL_EXT_secondary_color */
+ table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT;
+
+ /* 148. GL_EXT_multi_draw_arrays */
+ table->MultiDrawArraysEXT = exec_MultiDrawArraysEXT;
+ table->MultiDrawElementsEXT = exec_MultiDrawElementsEXT;
+
+ /* 149. GL_EXT_fog_coord */
+ table->FogCoordPointerEXT = exec_FogCoordPointerEXT;
+
+ /* 173. GL_EXT_blend_func_separate */
+ table->BlendFuncSeparateEXT = save_BlendFuncSeparateEXT;
+
+ /* 196. GL_MESA_resize_buffers */
+ table->ResizeBuffersMESA = exec_ResizeBuffersMESA;
+
+ /* 197. GL_MESA_window_pos */
+ table->WindowPos2dMESA = save_WindowPos2dMESA;
+ table->WindowPos2dvMESA = save_WindowPos2dvMESA;
+ table->WindowPos2fMESA = save_WindowPos2fMESA;
+ table->WindowPos2fvMESA = save_WindowPos2fvMESA;
+ table->WindowPos2iMESA = save_WindowPos2iMESA;
+ table->WindowPos2ivMESA = save_WindowPos2ivMESA;
+ table->WindowPos2sMESA = save_WindowPos2sMESA;
+ table->WindowPos2svMESA = save_WindowPos2svMESA;
+ table->WindowPos3dMESA = save_WindowPos3dMESA;
+ table->WindowPos3dvMESA = save_WindowPos3dvMESA;
+ table->WindowPos3fMESA = save_WindowPos3fMESA;
+ table->WindowPos3fvMESA = save_WindowPos3fvMESA;
+ table->WindowPos3iMESA = save_WindowPos3iMESA;
+ table->WindowPos3ivMESA = save_WindowPos3ivMESA;
+ table->WindowPos3sMESA = save_WindowPos3sMESA;
+ table->WindowPos3svMESA = save_WindowPos3svMESA;
+ table->WindowPos4dMESA = save_WindowPos4dMESA;
+ table->WindowPos4dvMESA = save_WindowPos4dvMESA;
+ table->WindowPos4fMESA = save_WindowPos4fMESA;
+ table->WindowPos4fvMESA = save_WindowPos4fvMESA;
+ table->WindowPos4iMESA = save_WindowPos4iMESA;
+ table->WindowPos4ivMESA = save_WindowPos4ivMESA;
+ table->WindowPos4sMESA = save_WindowPos4sMESA;
+ table->WindowPos4svMESA = save_WindowPos4svMESA;
+
+ /* 200. GL_IBM_multimode_draw_arrays */
+ table->MultiModeDrawArraysIBM = exec_MultiModeDrawArraysIBM;
+ table->MultiModeDrawElementsIBM = exec_MultiModeDrawElementsIBM;
+
+#if FEATURE_NV_vertex_program
+ /* 233. GL_NV_vertex_program */
+ /* The following commands DO NOT go into display lists:
+ * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
+ * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
+ */
+ table->BindProgramNV = save_BindProgramNV;
+ table->DeleteProgramsNV = _mesa_DeletePrograms;
+ table->ExecuteProgramNV = save_ExecuteProgramNV;
+ table->GenProgramsNV = _mesa_GenPrograms;
+ table->AreProgramsResidentNV = _mesa_AreProgramsResidentNV;
+ table->RequestResidentProgramsNV = save_RequestResidentProgramsNV;
+ table->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV;
+ table->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV;
+ table->GetProgramivNV = _mesa_GetProgramivNV;
+ table->GetProgramStringNV = _mesa_GetProgramStringNV;
+ table->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV;
+ table->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
+ table->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
+ table->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
+ table->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
+ table->IsProgramNV = _mesa_IsProgram;
+ table->LoadProgramNV = save_LoadProgramNV;
+ table->ProgramParameter4dNV = save_ProgramParameter4dNV;
+ table->ProgramParameter4dvNV = save_ProgramParameter4dvNV;
+ table->ProgramParameter4fNV = save_ProgramParameter4fNV;
+ table->ProgramParameter4fvNV = save_ProgramParameter4fvNV;
+ table->ProgramParameters4dvNV = save_ProgramParameters4dvNV;
+ table->ProgramParameters4fvNV = save_ProgramParameters4fvNV;
+ table->TrackMatrixNV = save_TrackMatrixNV;
+ table->VertexAttribPointerNV = _mesa_VertexAttribPointerNV;
+#endif
+
+ /* 282. GL_NV_fragment_program */
+#if FEATURE_NV_fragment_program
+ table->ProgramNamedParameter4fNV = save_ProgramNamedParameter4fNV;
+ table->ProgramNamedParameter4dNV = save_ProgramNamedParameter4dNV;
+ table->ProgramNamedParameter4fvNV = save_ProgramNamedParameter4fvNV;
+ table->ProgramNamedParameter4dvNV = save_ProgramNamedParameter4dvNV;
+ table->GetProgramNamedParameterfvNV = _mesa_GetProgramNamedParameterfvNV;
+ table->GetProgramNamedParameterdvNV = _mesa_GetProgramNamedParameterdvNV;
+ table->ProgramLocalParameter4dARB = save_ProgramLocalParameter4dARB;
+ table->ProgramLocalParameter4dvARB = save_ProgramLocalParameter4dvARB;
+ table->ProgramLocalParameter4fARB = save_ProgramLocalParameter4fARB;
+ table->ProgramLocalParameter4fvARB = save_ProgramLocalParameter4fvARB;
+ table->GetProgramLocalParameterdvARB = _mesa_GetProgramLocalParameterdvARB;
+ table->GetProgramLocalParameterfvARB = _mesa_GetProgramLocalParameterfvARB;
+#endif
+
+ /* 262. GL_NV_point_sprite */
+ table->PointParameteriNV = save_PointParameteriNV;
+ table->PointParameterivNV = save_PointParameterivNV;
+
+ /* 268. GL_EXT_stencil_two_side */
+ table->ActiveStencilFaceEXT = save_ActiveStencilFaceEXT;
+
+ /* ???. GL_EXT_depth_bounds_test */
+ table->DepthBoundsEXT = save_DepthBoundsEXT;
+
+ /* ARB 1. GL_ARB_multitexture */
+ table->ActiveTextureARB = save_ActiveTextureARB;
+ table->ClientActiveTextureARB = exec_ClientActiveTextureARB;
+
+ /* ARB 3. GL_ARB_transpose_matrix */
+ table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB;
+ table->LoadTransposeMatrixfARB = save_LoadTransposeMatrixfARB;
+ table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB;
+ table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB;
+
+ /* ARB 5. GL_ARB_multisample */
+ table->SampleCoverageARB = save_SampleCoverageARB;
+
+ /* ARB 12. GL_ARB_texture_compression */
+ table->CompressedTexImage3DARB = save_CompressedTexImage3DARB;
+ table->CompressedTexImage2DARB = save_CompressedTexImage2DARB;
+ table->CompressedTexImage1DARB = save_CompressedTexImage1DARB;
+ table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB;
+ table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB;
+ table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB;
+ table->GetCompressedTexImageARB = exec_GetCompressedTexImageARB;
+
+ /* ARB 14. GL_ARB_point_parameters */
+ /* aliased with EXT_point_parameters functions */
+
+ /* ARB 25. GL_ARB_window_pos */
+ /* aliased with MESA_window_pos functions */
+
+ /* ARB 26. GL_ARB_vertex_program */
+ /* ARB 27. GL_ARB_fragment_program */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
+ table->VertexAttribPointerARB = _mesa_VertexAttribPointerARB;
+ table->EnableVertexAttribArrayARB = _mesa_EnableVertexAttribArrayARB;
+ table->DisableVertexAttribArrayARB = _mesa_DisableVertexAttribArrayARB;
+ table->ProgramStringARB = save_ProgramStringARB;
+ table->BindProgramNV = save_BindProgramNV;
+ table->DeleteProgramsNV = _mesa_DeletePrograms;
+ table->GenProgramsNV = _mesa_GenPrograms;
+ table->IsProgramNV = _mesa_IsProgram;
+ table->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
+ table->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
+ table->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
+ table->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
+ table->ProgramEnvParameter4dARB = save_ProgramEnvParameter4dARB;
+ table->ProgramEnvParameter4dvARB = save_ProgramEnvParameter4dvARB;
+ table->ProgramEnvParameter4fARB = save_ProgramEnvParameter4fARB;
+ table->ProgramEnvParameter4fvARB = save_ProgramEnvParameter4fvARB;
+ table->ProgramLocalParameter4dARB = save_ProgramLocalParameter4dARB;
+ table->ProgramLocalParameter4dvARB = save_ProgramLocalParameter4dvARB;
+ table->ProgramLocalParameter4fARB = save_ProgramLocalParameter4fARB;
+ table->ProgramLocalParameter4fvARB = save_ProgramLocalParameter4fvARB;
+ table->GetProgramEnvParameterdvARB = _mesa_GetProgramEnvParameterdvARB;
+ table->GetProgramEnvParameterfvARB = _mesa_GetProgramEnvParameterfvARB;
+ table->GetProgramLocalParameterdvARB = _mesa_GetProgramLocalParameterdvARB;
+ table->GetProgramLocalParameterfvARB = _mesa_GetProgramLocalParameterfvARB;
+ table->GetProgramivARB = _mesa_GetProgramivARB;
+ table->GetProgramStringARB = _mesa_GetProgramStringARB;
+#endif
+
+ /* ARB 28. GL_ARB_vertex_buffer_object */
+#if FEATURE_ARB_vertex_buffer_object
+ /* None of the extension's functions get compiled */
+ table->BindBufferARB = _mesa_BindBufferARB;
+ table->BufferDataARB = _mesa_BufferDataARB;
+ table->BufferSubDataARB = _mesa_BufferSubDataARB;
+ table->DeleteBuffersARB = _mesa_DeleteBuffersARB;
+ table->GenBuffersARB = _mesa_GenBuffersARB;
+ table->GetBufferParameterivARB = _mesa_GetBufferParameterivARB;
+ table->GetBufferPointervARB = _mesa_GetBufferPointervARB;
+ table->GetBufferSubDataARB = _mesa_GetBufferSubDataARB;
+ table->IsBufferARB = _mesa_IsBufferARB;
+ table->MapBufferARB = _mesa_MapBufferARB;
+ table->UnmapBufferARB = _mesa_UnmapBufferARB;
+#endif
+
+#if FEATURE_ARB_occlusion_query
+ table->BeginQueryARB = save_BeginQueryARB;
+ table->EndQueryARB = save_EndQueryARB;
+ table->GenQueriesARB = _mesa_GenQueriesARB;
+ table->DeleteQueriesARB = _mesa_DeleteQueriesARB;
+ table->IsQueryARB = _mesa_IsQueryARB;
+ table->GetQueryivARB = _mesa_GetQueryivARB;
+ table->GetQueryObjectivARB = _mesa_GetQueryObjectivARB;
+ table->GetQueryObjectuivARB = _mesa_GetQueryObjectuivARB;
+#endif
+
+ /* 299. GL_EXT_blend_equation_separate */
+ table->BlendEquationSeparateEXT = save_BlendEquationSeparateEXT;
+}
+
+
+
+/***
+ *** Debugging code
+ ***/
+static const char *enum_string( GLenum k )
+{
+ return _mesa_lookup_enum_by_nr( k );
+}
+
+
+/*
+ * Print the commands in a display list. For debugging only.
+ * TODO: many commands aren't handled yet.
+ */
+static void GLAPIENTRY print_list( GLcontext *ctx, GLuint list )
+{
+ Node *n;
+ GLboolean done;
+
+ if (!GL_CALL(IsList)(list)) {
+ _mesa_printf("%u is not a display list ID\n", list);
+ return;
+ }
+
+ n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+
+ _mesa_printf("START-LIST %u, address %p\n", list, (void*)n );
+
+ done = n ? GL_FALSE : GL_TRUE;
+ while (!done) {
+ OpCode opcode = n[0].opcode;
+ GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
+
+ if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
+ /* this is a driver-extended opcode */
+ ctx->ListExt.Opcode[i].Print(ctx, &n[1]);
+ n += ctx->ListExt.Opcode[i].Size;
+ }
+ else {
+ switch (opcode) {
+ case OPCODE_ACCUM:
+ _mesa_printf("accum %s %g\n", enum_string(n[1].e), n[2].f );
+ break;
+ case OPCODE_BITMAP:
+ _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
+ n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data );
+ break;
+ case OPCODE_CALL_LIST:
+ _mesa_printf("CallList %d\n", (int) n[1].ui );
+ break;
+ case OPCODE_CALL_LIST_OFFSET:
+ _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui,
+ ctx->List.ListBase, ctx->List.ListBase + n[1].ui );
+ break;
+ case OPCODE_COLOR_TABLE_PARAMETER_FV:
+ _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
+ enum_string(n[1].e), enum_string(n[2].e),
+ n[3].f, n[4].f, n[5].f, n[6].f);
+ break;
+ case OPCODE_COLOR_TABLE_PARAMETER_IV:
+ _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
+ enum_string(n[1].e), enum_string(n[2].e),
+ n[3].i, n[4].i, n[5].i, n[6].i);
+ break;
+ case OPCODE_DISABLE:
+ _mesa_printf("Disable %s\n", enum_string(n[1].e));
+ break;
+ case OPCODE_ENABLE:
+ _mesa_printf("Enable %s\n", enum_string(n[1].e));
+ break;
+ case OPCODE_FRUSTUM:
+ _mesa_printf("Frustum %g %g %g %g %g %g\n",
+ n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
+ break;
+ case OPCODE_LINE_STIPPLE:
+ _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us );
+ break;
+ case OPCODE_LOAD_IDENTITY:
+ _mesa_printf("LoadIdentity\n");
+ break;
+ case OPCODE_LOAD_MATRIX:
+ _mesa_printf("LoadMatrix\n");
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[1].f, n[5].f, n[9].f, n[13].f);
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[2].f, n[6].f, n[10].f, n[14].f);
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[3].f, n[7].f, n[11].f, n[15].f);
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[4].f, n[8].f, n[12].f, n[16].f);
+ break;
+ case OPCODE_MULT_MATRIX:
+ _mesa_printf("MultMatrix (or Rotate)\n");
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[1].f, n[5].f, n[9].f, n[13].f);
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[2].f, n[6].f, n[10].f, n[14].f);
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[3].f, n[7].f, n[11].f, n[15].f);
+ _mesa_printf(" %8f %8f %8f %8f\n",
+ n[4].f, n[8].f, n[12].f, n[16].f);
+ break;
+ case OPCODE_ORTHO:
+ _mesa_printf("Ortho %g %g %g %g %g %g\n",
+ n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
+ break;
+ case OPCODE_POP_ATTRIB:
+ _mesa_printf("PopAttrib\n");
+ break;
+ case OPCODE_POP_MATRIX:
+ _mesa_printf("PopMatrix\n");
+ break;
+ case OPCODE_POP_NAME:
+ _mesa_printf("PopName\n");
+ break;
+ case OPCODE_PUSH_ATTRIB:
+ _mesa_printf("PushAttrib %x\n", n[1].bf );
+ break;
+ case OPCODE_PUSH_MATRIX:
+ _mesa_printf("PushMatrix\n");
+ break;
+ case OPCODE_PUSH_NAME:
+ _mesa_printf("PushName %d\n", (int) n[1].ui );
+ break;
+ case OPCODE_RASTER_POS:
+ _mesa_printf("RasterPos %g %g %g %g\n",
+ n[1].f, n[2].f,n[3].f,n[4].f);
+ break;
+ case OPCODE_ROTATE:
+ _mesa_printf("Rotate %g %g %g %g\n",
+ n[1].f, n[2].f, n[3].f, n[4].f );
+ break;
+ case OPCODE_SCALE:
+ _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f );
+ break;
+ case OPCODE_TRANSLATE:
+ _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f );
+ break;
+ case OPCODE_BIND_TEXTURE:
+ _mesa_printf("BindTexture %s %d\n",
+ _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui);
+ break;
+ case OPCODE_SHADE_MODEL:
+ _mesa_printf("ShadeModel %s\n",
+ _mesa_lookup_enum_by_nr(n[1].ui));
+ break;
+ case OPCODE_MAP1:
+ _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
+ _mesa_lookup_enum_by_nr(n[1].ui),
+ n[2].f, n[3].f, n[4].i, n[5].i);
+ break;
+ case OPCODE_MAP2:
+ _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
+ _mesa_lookup_enum_by_nr(n[1].ui),
+ n[2].f, n[3].f, n[4].f, n[5].f,
+ n[6].i, n[7].i, n[8].i, n[9].i);
+ break;
+ case OPCODE_MAPGRID1:
+ _mesa_printf("MapGrid1 %d %.3f %.3f\n",
+ n[1].i, n[2].f, n[3].f);
+ break;
+ case OPCODE_MAPGRID2:
+ _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
+ n[1].i, n[2].f, n[3].f,
+ n[4].i, n[5].f, n[6].f);
+ break;
+ case OPCODE_EVALMESH1:
+ _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i);
+ break;
+ case OPCODE_EVALMESH2:
+ _mesa_printf("EvalMesh2 %d %d %d %d\n",
+ n[1].i, n[2].i, n[3].i, n[4].i);
+ break;
+
+
+
+ case OPCODE_ATTR_1F:
+ _mesa_printf("ATTR_1F attr %d: %f\n",
+ n[1].i, n[2].f);
+ break;
+ case OPCODE_ATTR_2F:
+ _mesa_printf("ATTR_2F attr %d: %f %f\n",
+ n[1].i, n[2].f, n[3].f);
+ break;
+ case OPCODE_ATTR_3F:
+ _mesa_printf("ATTR_3F attr %d: %f %f %f\n",
+ n[1].i, n[2].f, n[3].f, n[4].f);
+ break;
+ case OPCODE_ATTR_4F:
+ _mesa_printf("ATTR_4F attr %d: %f %f %f %f\n",
+ n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
+ break;
+ case OPCODE_MATERIAL:
+ _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
+ n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
+ break;
+ case OPCODE_INDEX:
+ _mesa_printf("INDEX: %f\n", n[1].f);
+ break;
+ case OPCODE_EDGEFLAG:
+ _mesa_printf("EDGEFLAG: %d\n", n[1].i);
+ break;
+ case OPCODE_BEGIN:
+ _mesa_printf("BEGIN %x\n", n[1].i);
+ break;
+ case OPCODE_END:
+ _mesa_printf("END\n");
+ break;
+ case OPCODE_RECTF:
+ _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, n[4].f);
+ break;
+ case OPCODE_EVAL_C1:
+ _mesa_printf("EVAL_C1 %f\n", n[1].f);
+ break;
+ case OPCODE_EVAL_C2:
+ _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f);
+ break;
+ case OPCODE_EVAL_P1:
+ _mesa_printf("EVAL_P1 %d\n", n[1].i);
+ break;
+ case OPCODE_EVAL_P2:
+ _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
+ break;
+
+
+
+ /*
+ * meta opcodes/commands
+ */
+ case OPCODE_ERROR:
+ _mesa_printf("Error: %s %s\n",
+ enum_string(n[1].e), (const char *)n[2].data );
+ break;
+ case OPCODE_CONTINUE:
+ _mesa_printf("DISPLAY-LIST-CONTINUE\n");
+ n = (Node *) n[1].next;
+ break;
+ case OPCODE_END_OF_LIST:
+ _mesa_printf("END-LIST %u\n", list);
+ done = GL_TRUE;
+ break;
+ default:
+ if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
+ _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
+ opcode, (void*) n);
+ return;
+ }
+ else {
+ _mesa_printf("command %d, %u operands\n", opcode, InstSize[opcode]);
+ }
+ }
+ /* increment n to point to next compiled command */
+ if (opcode!=OPCODE_CONTINUE) {
+ n += InstSize[opcode];
+ }
+ }
+ }
+}
+
+
+
+/*
+ * Clients may call this function to help debug display list problems.
+ * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
+ * changed, or break in the future without notice.
+ */
+void mesa_print_display_list( GLuint list )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ print_list( ctx, list );
+}
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+
+void _mesa_save_vtxfmt_init( GLvertexformat *vfmt )
+{
+ vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
+ vfmt->Begin = save_Begin;
+ vfmt->CallList = _mesa_save_CallList;
+ vfmt->CallLists = _mesa_save_CallLists;
+ vfmt->Color3f = save_Color3f;
+ vfmt->Color3fv = save_Color3fv;
+ vfmt->Color4f = save_Color4f;
+ vfmt->Color4fv = save_Color4fv;
+ vfmt->EdgeFlag = save_EdgeFlag;
+ vfmt->EdgeFlagv = save_EdgeFlagv;
+ vfmt->End = save_End;
+ vfmt->EvalCoord1f = save_EvalCoord1f;
+ vfmt->EvalCoord1fv = save_EvalCoord1fv;
+ vfmt->EvalCoord2f = save_EvalCoord2f;
+ vfmt->EvalCoord2fv = save_EvalCoord2fv;
+ vfmt->EvalPoint1 = save_EvalPoint1;
+ vfmt->EvalPoint2 = save_EvalPoint2;
+ vfmt->FogCoordfEXT = save_FogCoordfEXT;
+ vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
+ vfmt->Indexf = save_Indexf;
+ vfmt->Indexfv = save_Indexfv;
+ vfmt->Materialfv = save_Materialfv;
+ vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
+ vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
+ vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
+ vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
+ vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
+ vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
+ vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
+ vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
+ vfmt->Normal3f = save_Normal3f;
+ vfmt->Normal3fv = save_Normal3fv;
+ vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
+ vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
+ vfmt->TexCoord1f = save_TexCoord1f;
+ vfmt->TexCoord1fv = save_TexCoord1fv;
+ vfmt->TexCoord2f = save_TexCoord2f;
+ vfmt->TexCoord2fv = save_TexCoord2fv;
+ vfmt->TexCoord3f = save_TexCoord3f;
+ vfmt->TexCoord3fv = save_TexCoord3fv;
+ vfmt->TexCoord4f = save_TexCoord4f;
+ vfmt->TexCoord4fv = save_TexCoord4fv;
+ vfmt->Vertex2f = save_Vertex2f;
+ vfmt->Vertex2fv = save_Vertex2fv;
+ vfmt->Vertex3f = save_Vertex3f;
+ vfmt->Vertex3fv = save_Vertex3fv;
+ vfmt->Vertex4f = save_Vertex4f;
+ vfmt->Vertex4fv = save_Vertex4fv;
+ vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
+ vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
+ vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
+ vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
+ vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
+ vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
+ vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
+ vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
+
+ vfmt->EvalMesh1 = _mesa_save_EvalMesh1;
+ vfmt->EvalMesh2 = _mesa_save_EvalMesh2;
+ vfmt->Rectf = save_Rectf;
+
+ /* The driver is required to implement these as
+ * 1) They can probably do a better job.
+ * 2) A lot of new mechanisms would have to be added to this module
+ * to support it. That code would probably never get used,
+ * because of (1).
+ */
+#if 0
+ vfmt->DrawArrays = 0;
+ vfmt->DrawElements = 0;
+ vfmt->DrawRangeElements = 0;
+#endif
+}
+
+
+
+void _mesa_init_display_list( GLcontext * ctx )
+{
+ /* Display list */
+ ctx->ListState.CallDepth = 0;
+ ctx->ExecuteFlag = GL_TRUE;
+ ctx->CompileFlag = GL_FALSE;
+ ctx->ListState.CurrentListPtr = NULL;
+ ctx->ListState.CurrentBlock = NULL;
+ ctx->ListState.CurrentListNum = 0;
+ ctx->ListState.CurrentPos = 0;
+
+ /* Display List group */
+ ctx->List.ListBase = 0;
+
+ _mesa_save_vtxfmt_init( &ctx->ListState.ListVtxfmt );
+}
Index: xc/extras/Mesa/src/mesa/main/dlist.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/dlist.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/dlist.h Thu Jun 10 10:23:47 2004
@@ -0,0 +1,104 @@
+/**
+ * \file dlist.h
+ * Display lists management.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef DLIST_H
+#define DLIST_H
+
+
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+
+extern void _mesa_init_lists( void );
+
+extern void _mesa_destroy_list( GLcontext *ctx, GLuint list );
+
+extern void GLAPIENTRY _mesa_CallList( GLuint list );
+
+extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
+
+extern void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range );
+
+extern void GLAPIENTRY _mesa_EndList( void );
+
+extern GLuint GLAPIENTRY _mesa_GenLists( GLsizei range );
+
+extern GLboolean GLAPIENTRY _mesa_IsList( GLuint list );
+
+extern void GLAPIENTRY _mesa_ListBase( GLuint base );
+
+extern void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode );
+
+extern void _mesa_init_dlist_table( struct _glapi_table *table,
+ GLuint tableSize );
+
+extern void _mesa_save_error( GLcontext *ctx, GLenum error, const char *s );
+
+extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s );
+
+
+extern void *_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz );
+
+extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz,
+ void (*execute)( GLcontext *, void * ),
+ void (*destroy)( GLcontext *, void * ),
+ void (*print)( GLcontext *, void * ) );
+
+extern void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2,
+ GLint j1, GLint j2 );
+extern void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 );
+extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
+extern void GLAPIENTRY _mesa_save_CallList( GLuint list );
+extern void _mesa_init_display_list( GLcontext * ctx );
+extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
+
+
+#else
+
+/** No-op */
+#define _mesa_init_lists() ((void)0)
+
+/** No-op */
+#define _mesa_destroy_list(c,l) ((void)0)
+
+/** No-op */
+#define _mesa_init_dlist_table(t,ts) ((void)0)
+
+/** No-op */
+#define _mesa_init_display_list(c) ((void)0)
+
+/** No-op */
+#define _mesa_save_vtxfmt_init(v) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/drawpix.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/drawpix.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/drawpix.c Fri Dec 10 10:05:12 2004
@@ -0,0 +1,298 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "context.h"
+#include "drawpix.h"
+#include "feedback.h"
+#include "macros.h"
+#include "state.h"
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+
+/*
+ * Execute glDrawPixels
+ */
+void GLAPIENTRY
+_mesa_DrawPixels( GLsizei width, GLsizei height,
+ GLenum format, GLenum type, const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawPixels (invalid fragment program)");
+ return;
+ }
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glDrawPixels(width or height < 0" );
+ return;
+ }
+
+ if (ctx->RenderMode==GL_RENDER) {
+ GLint x, y;
+ if (!ctx->Current.RasterPosValid) {
+ return;
+ }
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
+ x = IROUND(ctx->Current.RasterPos[0]);
+ y = IROUND(ctx->Current.RasterPos[1]);
+
+ ctx->OcclusionResult = GL_TRUE;
+ ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
+ &ctx->Unpack, pixels);
+ }
+ else if (ctx->RenderMode==GL_FEEDBACK) {
+ /* Feedback the current raster pos info */
+ if (ctx->Current.RasterPosValid) {
+ FLUSH_CURRENT( ctx, 0 );
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
+ _mesa_feedback_vertex( ctx,
+ ctx->Current.RasterPos,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterIndex,
+ ctx->Current.RasterTexCoords[0] );
+ }
+ }
+ else if (ctx->RenderMode==GL_SELECT) {
+ if (ctx->Current.RasterPosValid) {
+ _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
+ }
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
+ GLenum type )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint destx, desty;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyPixels (invalid fragment program)");
+ return;
+ }
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glCopyPixels(width or height < 0)" );
+ return;
+ }
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ if (ctx->RenderMode==GL_RENDER) {
+ /* Destination of copy: */
+ if (!ctx->Current.RasterPosValid) {
+ return;
+ }
+
+ /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
+ destx = IROUND(ctx->Current.RasterPos[0]);
+ desty = IROUND(ctx->Current.RasterPos[1]);
+
+ ctx->OcclusionResult = GL_TRUE;
+
+ ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
+ type );
+ }
+ else if (ctx->RenderMode == GL_FEEDBACK) {
+ if (ctx->Current.RasterPosValid) {
+ FLUSH_CURRENT( ctx, 0 );
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN );
+ _mesa_feedback_vertex( ctx,
+ ctx->Current.RasterPos,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterIndex,
+ ctx->Current.RasterTexCoords[0] );
+ }
+ }
+ else if (ctx->RenderMode == GL_SELECT) {
+ _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
+ }
+}
+
+#endif /* _HAVE_FULL_GL */
+
+
+
+void GLAPIENTRY
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glReadPixels(width=%d height=%d)", width, height );
+ return;
+ }
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ ctx->Driver.ReadPixels(ctx, x, y, width, height,
+ format, type, &ctx->Pack, pixels);
+}
+
+
+
+void GLAPIENTRY
+_mesa_Bitmap( GLsizei width, GLsizei height,
+ GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
+ const GLubyte *bitmap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBitmap (invalid fragment program)");
+ return;
+ }
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glBitmap(width or height < 0)" );
+ return;
+ }
+
+ if (ctx->Current.RasterPosValid == GL_FALSE) {
+ return; /* do nothing */
+ }
+
+ if (ctx->RenderMode==GL_RENDER) {
+ /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */
+ GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig);
+ GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig);
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ ctx->OcclusionResult = GL_TRUE;
+ ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap );
+ }
+#if _HAVE_FULL_GL
+ else if (ctx->RenderMode==GL_FEEDBACK) {
+ if (ctx->Current.RasterPosValid) {
+ FLUSH_CURRENT(ctx, 0);
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
+ _mesa_feedback_vertex( ctx,
+ ctx->Current.RasterPos,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterIndex,
+ ctx->Current.RasterTexCoords[0] );
+ }
+ }
+ else {
+ ASSERT(ctx->RenderMode == GL_SELECT);
+ /* Bitmaps don't generate selection hits. See appendix B of 1.1 spec. */
+ }
+#endif
+
+ /* update raster position */
+ ctx->Current.RasterPos[0] += xmove;
+ ctx->Current.RasterPos[1] += ymove;
+}
+
+
+
+#if 0 /* experimental */
+/*
+ * Execute glDrawDepthPixelsMESA(). This function accepts both a color
+ * image and depth (Z) image. Rasterization produces fragments with
+ * color and Z taken from these images. This function is intended for
+ * Z-compositing. Normally, this operation requires two glDrawPixels
+ * calls with stencil testing.
+ */
+void GLAPIENTRY
+_mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height,
+ GLenum colorFormat, GLenum colorType,
+ const GLvoid *colors,
+ GLenum depthType, const GLvoid *depths )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glDrawDepthPixelsMESA(width or height < 0" );
+ return;
+ }
+
+ if (ctx->RenderMode==GL_RENDER) {
+ GLint x, y;
+ if (!colors || !depths || !ctx->Current.RasterPosValid) {
+ return;
+ }
+
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
+ x = IROUND(ctx->Current.RasterPos[0]);
+ y = IROUND(ctx->Current.RasterPos[1]);
+
+ ctx->OcclusionResult = GL_TRUE;
+ ctx->Driver.DrawDepthPixelsMESA(ctx, x, y, width, height,
+ colorFormat, colorType, colors,
+ depthType, depths, &ctx->Unpack);
+ }
+ else if (ctx->RenderMode==GL_FEEDBACK) {
+ /* Feedback the current raster pos info */
+ if (ctx->Current.RasterPosValid) {
+ FLUSH_CURRENT( ctx, 0 );
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
+ _mesa_feedback_vertex( ctx,
+ ctx->Current.RasterPos,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterIndex,
+ ctx->Current.RasterTexCoords[0] );
+ }
+ }
+ else if (ctx->RenderMode==GL_SELECT) {
+ if (ctx->Current.RasterPosValid) {
+ _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
+ }
+ }
+}
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/drawpix.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/drawpix.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/drawpix.h Thu Apr 8 05:17:42 2004
@@ -0,0 +1,55 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef DRAWPIXELS_H
+#define DRAWPIXELS_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_DrawPixels( GLsizei width, GLsizei height,
+ GLenum format, GLenum type, const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
+ GLenum type );
+
+
+extern void GLAPIENTRY
+_mesa_Bitmap( GLsizei width, GLsizei height,
+ GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
+ const GLubyte *bitmap );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/enable.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/enable.c:1.4
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/enable.c Fri Dec 10 10:30:12 2004
@@ -0,0 +1,1433 @@
+/**
+ * \file enable.c
+ * Enable/disable/query GL capabilities.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/* $XFree86: xc/extras/Mesa/src/mesa/main/enable.c,v 1.4 2004/12/10 15:30:12 alanh Exp $ */
+
+#include "glheader.h"
+#include "context.h"
+#include "enable.h"
+#include "light.h"
+#include "macros.h"
+#include "simple_list.h"
+#include "mtypes.h"
+#include "enums.h"
+#include "math/m_matrix.h"
+#include "math/m_xform.h"
+
+
+
+#define CHECK_EXTENSION(EXTNAME, CAP) \
+ if (!ctx->Extensions.EXTNAME) { \
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \
+ state ? "Enable" : "Disable", CAP); \
+ return; \
+ }
+
+
+static void
+client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+{
+ GLuint flag;
+ GLuint *var;
+
+ switch (cap) {
+ case GL_VERTEX_ARRAY:
+ var = &ctx->Array.Vertex.Enabled;
+ flag = _NEW_ARRAY_VERTEX;
+ break;
+ case GL_NORMAL_ARRAY:
+ var = &ctx->Array.Normal.Enabled;
+ flag = _NEW_ARRAY_NORMAL;
+ break;
+ case GL_COLOR_ARRAY:
+ var = &ctx->Array.Color.Enabled;
+ flag = _NEW_ARRAY_COLOR0;
+ break;
+ case GL_INDEX_ARRAY:
+ var = &ctx->Array.Index.Enabled;
+ flag = _NEW_ARRAY_INDEX;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
+ flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ var = &ctx->Array.EdgeFlag.Enabled;
+ flag = _NEW_ARRAY_EDGEFLAG;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ var = &ctx->Array.FogCoord.Enabled;
+ flag = _NEW_ARRAY_FOGCOORD;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ var = &ctx->Array.SecondaryColor.Enabled;
+ flag = _NEW_ARRAY_COLOR1;
+ break;
+
+#if FEATURE_NV_vertex_program
+ case GL_VERTEX_ATTRIB_ARRAY0_NV:
+ case GL_VERTEX_ATTRIB_ARRAY1_NV:
+ case GL_VERTEX_ATTRIB_ARRAY2_NV:
+ case GL_VERTEX_ATTRIB_ARRAY3_NV:
+ case GL_VERTEX_ATTRIB_ARRAY4_NV:
+ case GL_VERTEX_ATTRIB_ARRAY5_NV:
+ case GL_VERTEX_ATTRIB_ARRAY6_NV:
+ case GL_VERTEX_ATTRIB_ARRAY7_NV:
+ case GL_VERTEX_ATTRIB_ARRAY8_NV:
+ case GL_VERTEX_ATTRIB_ARRAY9_NV:
+ case GL_VERTEX_ATTRIB_ARRAY10_NV:
+ case GL_VERTEX_ATTRIB_ARRAY11_NV:
+ case GL_VERTEX_ATTRIB_ARRAY12_NV:
+ case GL_VERTEX_ATTRIB_ARRAY13_NV:
+ case GL_VERTEX_ATTRIB_ARRAY14_NV:
+ case GL_VERTEX_ATTRIB_ARRAY15_NV:
+ CHECK_EXTENSION(NV_vertex_program, cap);
+ {
+ GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
+ var = &ctx->Array.VertexAttrib[n].Enabled;
+ flag = _NEW_ARRAY_ATTRIB(n);
+ }
+ break;
+#endif /* FEATURE_NV_vertex_program */
+
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM,
+ "glEnable/DisableClientState(0x%x)", cap);
+ return;
+ }
+
+ if (*var == state)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.NewState |= flag;
+ *var = state;
+
+ if (state)
+ ctx->Array._Enabled |= flag;
+ else
+ ctx->Array._Enabled &= ~flag;
+
+ if (ctx->Driver.Enable) {
+ (*ctx->Driver.Enable)( ctx, cap, state );
+ }
+}
+
+
+/**
+ * Enable GL capability.
+ *
+ * \param cap capability.
+ *
+ * \sa glEnable().
+ *
+ * Get's the current context, assures that we're outside glBegin()/glEnd() and
+ * calls client_state().
+ */
+void GLAPIENTRY
+_mesa_EnableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ client_state( ctx, cap, GL_TRUE );
+}
+
+
+/**
+ * Disable GL capability.
+ *
+ * \param cap capability.
+ *
+ * \sa glDisable().
+ *
+ * Get's the current context, assures that we're outside glBegin()/glEnd() and
+ * calls client_state().
+ */
+void GLAPIENTRY
+_mesa_DisableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ client_state( ctx, cap, GL_FALSE );
+}
+
+
+#undef CHECK_EXTENSION
+#define CHECK_EXTENSION(EXTNAME, CAP) \
+ if (!ctx->Extensions.EXTNAME) { \
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \
+ state ? "Enable" : "Disable", CAP); \
+ return; \
+ }
+
+#define CHECK_EXTENSION2(EXT1, EXT2, CAP) \
+ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \
+ state ? "Enable" : "Disable", CAP); \
+ return; \
+ }
+
+
+
+/**
+ * Perform glEnable() and glDisable() calls.
+ *
+ * \param ctx GL context.
+ * \param cap capability.
+ * \param state whether to enable or disable the specified capability.
+ *
+ * Updates the current context and flushes the vertices as needed. For
+ * capabilities associated with extensions it verifies that those extensions
+ * are effectivly present before updating. Notifies the driver via
+ * dd_function_table::Enable.
+ */
+void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
+{
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "%s %s (newstate is %x)\n",
+ state ? "glEnable" : "glDisable",
+ _mesa_lookup_enum_by_nr(cap),
+ ctx->NewState);
+
+ switch (cap) {
+ case GL_ALPHA_TEST:
+ if (ctx->Color.AlphaEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.AlphaEnabled = state;
+ break;
+ case GL_AUTO_NORMAL:
+ if (ctx->Eval.AutoNormal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.AutoNormal = state;
+ break;
+ case GL_BLEND:
+ if (ctx->Color.BlendEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.BlendEnabled = state;
+ /* This is needed to support 1.1's RGB logic ops AND
+ * 1.0's blending logicops.
+ */
+ ctx->Color._LogicOpEnabled =
+ (ctx->Color.ColorLogicOpEnabled ||
+ (state && ctx->Color.BlendEquationRGB == GL_LOGIC_OP));
+ break;
+#if FEATURE_userclip
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ {
+ const GLuint p = cap - GL_CLIP_PLANE0;
+
+ if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+
+ if (state) {
+ ctx->Transform.ClipPlanesEnabled |= (1 << p);
+
+ if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
+ _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
+
+ /* This derived state also calculated in clip.c and
+ * from _mesa_update_state() on changes to EyeUserPlane
+ * and ctx->ProjectionMatrix respectively.
+ */
+ _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
+ ctx->Transform.EyeUserPlane[p],
+ ctx->ProjectionMatrixStack.Top->inv );
+ }
+ else {
+ ctx->Transform.ClipPlanesEnabled &= ~(1 << p);
+ }
+ }
+ break;
+#endif
+ case GL_COLOR_MATERIAL:
+ if (ctx->Light.ColorMaterialEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ FLUSH_CURRENT(ctx, 0);
+ ctx->Light.ColorMaterialEnabled = state;
+ if (state) {
+ _mesa_update_color_material( ctx,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
+ }
+ break;
+ case GL_CULL_FACE:
+ if (ctx->Polygon.CullFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.CullFlag = state;
+ break;
+
+ case GL_CULL_VERTEX_EXT:
+ CHECK_EXTENSION(EXT_cull_vertex, cap);
+ if (ctx->Transform.CullVertexFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.CullVertexFlag = state;
+ break;
+
+ case GL_DEPTH_TEST:
+ if (state && ctx->Visual.depthBits==0) {
+ _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
+ return;
+ }
+ if (ctx->Depth.Test==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Test = state;
+ break;
+ case GL_DITHER:
+ if (ctx->NoDither) {
+ state = GL_FALSE; /* MESA_NO_DITHER env var */
+ }
+ if (ctx->Color.DitherFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.DitherFlag = state;
+ break;
+ case GL_FOG:
+ if (ctx->Fog.Enabled==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Enabled = state;
+ break;
+ case GL_HISTOGRAM:
+ CHECK_EXTENSION(EXT_histogram, cap);
+ if (ctx->Pixel.HistogramEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.HistogramEnabled = state;
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
+ if (state) {
+ insert_at_tail(&ctx->Light.EnabledList,
+ &ctx->Light.Light[cap-GL_LIGHT0]);
+ }
+ else {
+ remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
+ }
+ break;
+ case GL_LIGHTING:
+ if (ctx->Light.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Enabled = state;
+
+ if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+ ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
+ else
+ ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
+
+ break;
+ case GL_LINE_SMOOTH:
+ if (ctx->Line.SmoothFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LINE);
+ ctx->Line.SmoothFlag = state;
+ ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
+ break;
+ case GL_LINE_STIPPLE:
+ if (ctx->Line.StippleFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LINE);
+ ctx->Line.StippleFlag = state;
+ ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
+ break;
+ case GL_INDEX_LOGIC_OP:
+ if (ctx->Color.IndexLogicOpEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.IndexLogicOpEnabled = state;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ if (ctx->Color.ColorLogicOpEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.ColorLogicOpEnabled = state;
+ /* This is needed to support 1.1's RGB logic ops AND
+ * 1.0's blending logicops.
+ */
+ ctx->Color._LogicOpEnabled =
+ (state || (ctx->Color.BlendEnabled &&
+ ctx->Color.BlendEquationRGB == GL_LOGIC_OP));
+ break;
+ case GL_MAP1_COLOR_4:
+ if (ctx->Eval.Map1Color4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Color4 = state;
+ break;
+ case GL_MAP1_INDEX:
+ if (ctx->Eval.Map1Index == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Index = state;
+ break;
+ case GL_MAP1_NORMAL:
+ if (ctx->Eval.Map1Normal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Normal = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_1:
+ if (ctx->Eval.Map1TextureCoord1 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord1 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_2:
+ if (ctx->Eval.Map1TextureCoord2 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord2 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_3:
+ if (ctx->Eval.Map1TextureCoord3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord3 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_4:
+ if (ctx->Eval.Map1TextureCoord4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord4 = state;
+ break;
+ case GL_MAP1_VERTEX_3:
+ if (ctx->Eval.Map1Vertex3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Vertex3 = state;
+ break;
+ case GL_MAP1_VERTEX_4:
+ if (ctx->Eval.Map1Vertex4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Vertex4 = state;
+ break;
+ case GL_MAP2_COLOR_4:
+ if (ctx->Eval.Map2Color4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Color4 = state;
+ break;
+ case GL_MAP2_INDEX:
+ if (ctx->Eval.Map2Index == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Index = state;
+ break;
+ case GL_MAP2_NORMAL:
+ if (ctx->Eval.Map2Normal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Normal = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_1:
+ if (ctx->Eval.Map2TextureCoord1 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord1 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_2:
+ if (ctx->Eval.Map2TextureCoord2 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord2 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_3:
+ if (ctx->Eval.Map2TextureCoord3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord3 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_4:
+ if (ctx->Eval.Map2TextureCoord4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord4 = state;
+ break;
+ case GL_MAP2_VERTEX_3:
+ if (ctx->Eval.Map2Vertex3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Vertex3 = state;
+ break;
+ case GL_MAP2_VERTEX_4:
+ if (ctx->Eval.Map2Vertex4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Vertex4 = state;
+ break;
+ case GL_MINMAX:
+ if (ctx->Pixel.MinMaxEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.MinMaxEnabled = state;
+ break;
+ case GL_NORMALIZE:
+ if (ctx->Transform.Normalize == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.Normalize = state;
+ break;
+ case GL_POINT_SMOOTH:
+ if (ctx->Point.SmoothFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SmoothFlag = state;
+ ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
+ break;
+ case GL_POLYGON_SMOOTH:
+ if (ctx->Polygon.SmoothFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.SmoothFlag = state;
+ ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
+ break;
+ case GL_POLYGON_STIPPLE:
+ if (ctx->Polygon.StippleFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.StippleFlag = state;
+ ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
+ break;
+ case GL_POLYGON_OFFSET_POINT:
+ if (ctx->Polygon.OffsetPoint==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetPoint = state;
+ break;
+ case GL_POLYGON_OFFSET_LINE:
+ if (ctx->Polygon.OffsetLine==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetLine = state;
+ break;
+ case GL_POLYGON_OFFSET_FILL:
+ /*case GL_POLYGON_OFFSET_EXT:*/
+ if (ctx->Polygon.OffsetFill==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetFill = state;
+ break;
+ case GL_RESCALE_NORMAL_EXT:
+ if (ctx->Transform.RescaleNormals == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.RescaleNormals = state;
+ break;
+ case GL_SCISSOR_TEST:
+ if (ctx->Scissor.Enabled==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+ ctx->Scissor.Enabled = state;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ if (ctx->Texture.SharedPalette == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.SharedPalette = state;
+ break;
+ case GL_STENCIL_TEST:
+ if (state && ctx->Visual.stencilBits==0) {
+ _mesa_warning(ctx,
+ "glEnable(GL_STENCIL_TEST) but no stencil buffer");
+ return;
+ }
+ if (ctx->Stencil.Enabled==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.Enabled = state;
+ break;
+ case GL_TEXTURE_1D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT;
+ if (state)
+ newenabled |= TEXTURE_1D_BIT;
+ if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_2D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT;
+ if (state)
+ newenabled |= TEXTURE_2D_BIT;
+ if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_3D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT;
+ if (state)
+ newenabled |= TEXTURE_3D_BIT;
+ if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_Q: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
+ if (state)
+ newenabled |= Q_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_R: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
+ if (state)
+ newenabled |= R_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_S: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
+ if (state)
+ newenabled |= S_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_T: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
+ if (state)
+ newenabled |= T_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+
+ /*
+ * CLIENT STATE!!!
+ */
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_INDEX_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ client_state( ctx, cap, state );
+ return;
+
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ CHECK_EXTENSION(HP_occlusion_test, cap);
+ if (ctx->Depth.OcclusionTest == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.OcclusionTest = state;
+ if (state)
+ ctx->OcclusionResult = ctx->OcclusionResultSaved;
+ else
+ ctx->OcclusionResultSaved = ctx->OcclusionResult;
+ break;
+
+ /* GL_SGIS_pixel_texture */
+ case GL_PIXEL_TEXTURE_SGIS:
+ CHECK_EXTENSION(SGIS_pixel_texture, cap);
+ if (ctx->Pixel.PixelTextureEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PixelTextureEnabled = state;
+ break;
+
+ /* GL_SGIX_pixel_texture */
+ case GL_PIXEL_TEX_GEN_SGIX:
+ CHECK_EXTENSION(SGIX_pixel_texture, cap);
+ if (ctx->Pixel.PixelTextureEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PixelTextureEnabled = state;
+ break;
+
+ /* GL_SGI_color_table */
+ case GL_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_color_table, cap);
+ if (ctx->Pixel.ColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.ColorTableEnabled = state;
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_color_table, cap);
+ if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionColorTableEnabled = state;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_color_table, cap);
+ if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_texture_color_table, cap);
+ if (ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled = state;
+ break;
+
+ /* GL_EXT_convolution */
+ case GL_CONVOLUTION_1D:
+ CHECK_EXTENSION(EXT_convolution, cap);
+ if (ctx->Pixel.Convolution1DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Convolution1DEnabled = state;
+ break;
+ case GL_CONVOLUTION_2D:
+ CHECK_EXTENSION(EXT_convolution, cap);
+ if (ctx->Pixel.Convolution2DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Convolution2DEnabled = state;
+ break;
+ case GL_SEPARABLE_2D:
+ CHECK_EXTENSION(EXT_convolution, cap);
+ if (ctx->Pixel.Separable2DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Separable2DEnabled = state;
+ break;
+
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT;
+ CHECK_EXTENSION(ARB_texture_cube_map, cap);
+ if (state)
+ newenabled |= TEXTURE_CUBE_BIT;
+ if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ }
+ break;
+
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ CHECK_EXTENSION(EXT_secondary_color, cap);
+ if (ctx->Fog.ColorSumEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.ColorSumEnabled = state;
+ break;
+
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ CHECK_EXTENSION(ARB_multisample, cap);
+ if (ctx->Multisample.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.Enabled = state;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ CHECK_EXTENSION(ARB_multisample, cap);
+ if (ctx->Multisample.SampleAlphaToCoverage == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleAlphaToCoverage = state;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ CHECK_EXTENSION(ARB_multisample, cap);
+ if (ctx->Multisample.SampleAlphaToOne == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleAlphaToOne = state;
+ break;
+ case GL_SAMPLE_COVERAGE_ARB:
+ CHECK_EXTENSION(ARB_multisample, cap);
+ if (ctx->Multisample.SampleCoverage == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleCoverage = state;
+ break;
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ CHECK_EXTENSION(ARB_multisample, cap);
+ if (ctx->Multisample.SampleCoverageInvert == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleCoverageInvert = state;
+ break;
+
+ /* GL_IBM_rasterpos_clip */
+ case GL_RASTER_POSITION_UNCLIPPED_IBM:
+ CHECK_EXTENSION(IBM_rasterpos_clip, cap);
+ if (ctx->Transform.RasterPositionUnclipped == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.RasterPositionUnclipped = state;
+ break;
+
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite, cap);
+ if (ctx->Point.PointSprite == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.PointSprite = state;
+ break;
+
+#if FEATURE_NV_vertex_program
+ case GL_VERTEX_PROGRAM_NV:
+ CHECK_EXTENSION2(NV_vertex_program, ARB_vertex_program, cap);
+ if (ctx->VertexProgram.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ ctx->VertexProgram.Enabled = state;
+ break;
+ case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+ CHECK_EXTENSION2(NV_vertex_program, ARB_vertex_program, cap);
+ if (ctx->VertexProgram.PointSizeEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ ctx->VertexProgram.PointSizeEnabled = state;
+ break;
+ case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+ CHECK_EXTENSION2(NV_vertex_program, ARB_vertex_program, cap);
+ if (ctx->VertexProgram.TwoSideEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ ctx->VertexProgram.TwoSideEnabled = state;
+ break;
+ case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION(NV_vertex_program, cap);
+ {
+ const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Attrib[map] = state;
+ }
+ break;
+ case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION(NV_vertex_program, cap);
+ {
+ const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Attrib[map] = state;
+ }
+ break;
+#endif /* FEATURE_NV_vertex_program */
+
+#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION(NV_fragment_program, cap);
+ if (ctx->FragmentProgram.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ ctx->FragmentProgram.Enabled = state;
+ break;
+#endif /* FEATURE_NV_fragment_program */
+
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION(NV_texture_rectangle, cap);
+ {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT;
+ CHECK_EXTENSION(NV_texture_rectangle, cap);
+ if (state)
+ newenabled |= TEXTURE_RECT_BIT;
+ if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ }
+ break;
+
+ /* GL_EXT_stencil_two_side */
+ case GL_STENCIL_TEST_TWO_SIDE_EXT:
+ CHECK_EXTENSION(EXT_stencil_two_side, cap);
+ if (ctx->Stencil.TestTwoSide == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.TestTwoSide = state;
+ break;
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION(ARB_fragment_program, cap);
+ if (ctx->FragmentProgram.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ ctx->FragmentProgram.Enabled = state;
+ break;
+#endif /* FEATURE_ARB_fragment_program */
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION(EXT_depth_bounds_test, cap);
+ if (state && ctx->Visual.depthBits==0) {
+ _mesa_warning(ctx,
+ "glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer");
+ return;
+ }
+ if (ctx->Depth.BoundsTest == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.BoundsTest = state;
+ break;
+
+ /* GL_MESA_program_debug */
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION(MESA_program_debug, cap);
+ ctx->FragmentProgram.CallbackEnabled = state;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION(MESA_program_debug, cap);
+ ctx->VertexProgram.CallbackEnabled = state;
+ break;
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(0x%x)", state ? "glEnable" : "glDisable", cap);
+ return;
+ }
+
+ if (ctx->Driver.Enable) {
+ (*ctx->Driver.Enable)( ctx, cap, state );
+ }
+}
+
+
+/**
+ * Enable GL capability.
+ *
+ * \param cap capability.
+ *
+ * \sa glEnable().
+ *
+ * Get's the current context, assures that we're outside glBegin()/glEnd() and
+ * calls _mesa_set_enable().
+ */
+void GLAPIENTRY
+_mesa_Enable( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ _mesa_set_enable( ctx, cap, GL_TRUE );
+}
+
+
+/**
+ * Disable GL capability.
+ *
+ * \param cap capability.
+ *
+ * \sa glDisable().
+ *
+ * Get's the current context, assures that we're outside glBegin()/glEnd() and
+ * calls _mesa_set_enable().
+ */
+void GLAPIENTRY
+_mesa_Disable( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ _mesa_set_enable( ctx, cap, GL_FALSE );
+}
+
+
+#undef CHECK_EXTENSION
+#define CHECK_EXTENSION(EXTNAME) \
+ if (!ctx->Extensions.EXTNAME) { \
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \
+ return GL_FALSE; \
+ }
+
+
+/**
+ * Test whether a capability is enabled.
+ *
+ * \param cap capability.
+ *
+ * Returns the state of the specified capability from the current GL context.
+ * For the capabilities associated with extensions verifies that those
+ * extensions are effectively present before reporting.
+ */
+GLboolean GLAPIENTRY
+_mesa_IsEnabled( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ switch (cap) {
+ case GL_ALPHA_TEST:
+ return ctx->Color.AlphaEnabled;
+ case GL_AUTO_NORMAL:
+ return ctx->Eval.AutoNormal;
+ case GL_BLEND:
+ return ctx->Color.BlendEnabled;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1;
+ case GL_COLOR_MATERIAL:
+ return ctx->Light.ColorMaterialEnabled;
+ case GL_CULL_FACE:
+ return ctx->Polygon.CullFlag;
+ case GL_DEPTH_TEST:
+ return ctx->Depth.Test;
+ case GL_DITHER:
+ return ctx->Color.DitherFlag;
+ case GL_FOG:
+ return ctx->Fog.Enabled;
+ case GL_LIGHTING:
+ return ctx->Light.Enabled;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
+ case GL_LINE_SMOOTH:
+ return ctx->Line.SmoothFlag;
+ case GL_LINE_STIPPLE:
+ return ctx->Line.StippleFlag;
+ case GL_INDEX_LOGIC_OP:
+ return ctx->Color.IndexLogicOpEnabled;
+ case GL_COLOR_LOGIC_OP:
+ return ctx->Color.ColorLogicOpEnabled;
+ case GL_MAP1_COLOR_4:
+ return ctx->Eval.Map1Color4;
+ case GL_MAP1_INDEX:
+ return ctx->Eval.Map1Index;
+ case GL_MAP1_NORMAL:
+ return ctx->Eval.Map1Normal;
+ case GL_MAP1_TEXTURE_COORD_1:
+ return ctx->Eval.Map1TextureCoord1;
+ case GL_MAP1_TEXTURE_COORD_2:
+ return ctx->Eval.Map1TextureCoord2;
+ case GL_MAP1_TEXTURE_COORD_3:
+ return ctx->Eval.Map1TextureCoord3;
+ case GL_MAP1_TEXTURE_COORD_4:
+ return ctx->Eval.Map1TextureCoord4;
+ case GL_MAP1_VERTEX_3:
+ return ctx->Eval.Map1Vertex3;
+ case GL_MAP1_VERTEX_4:
+ return ctx->Eval.Map1Vertex4;
+ case GL_MAP2_COLOR_4:
+ return ctx->Eval.Map2Color4;
+ case GL_MAP2_INDEX:
+ return ctx->Eval.Map2Index;
+ case GL_MAP2_NORMAL:
+ return ctx->Eval.Map2Normal;
+ case GL_MAP2_TEXTURE_COORD_1:
+ return ctx->Eval.Map2TextureCoord1;
+ case GL_MAP2_TEXTURE_COORD_2:
+ return ctx->Eval.Map2TextureCoord2;
+ case GL_MAP2_TEXTURE_COORD_3:
+ return ctx->Eval.Map2TextureCoord3;
+ case GL_MAP2_TEXTURE_COORD_4:
+ return ctx->Eval.Map2TextureCoord4;
+ case GL_MAP2_VERTEX_3:
+ return ctx->Eval.Map2Vertex3;
+ case GL_MAP2_VERTEX_4:
+ return ctx->Eval.Map2Vertex4;
+ case GL_NORMALIZE:
+ return ctx->Transform.Normalize;
+ case GL_POINT_SMOOTH:
+ return ctx->Point.SmoothFlag;
+ case GL_POLYGON_SMOOTH:
+ return ctx->Polygon.SmoothFlag;
+ case GL_POLYGON_STIPPLE:
+ return ctx->Polygon.StippleFlag;
+ case GL_POLYGON_OFFSET_POINT:
+ return ctx->Polygon.OffsetPoint;
+ case GL_POLYGON_OFFSET_LINE:
+ return ctx->Polygon.OffsetLine;
+ case GL_POLYGON_OFFSET_FILL:
+ /*case GL_POLYGON_OFFSET_EXT:*/
+ return ctx->Polygon.OffsetFill;
+ case GL_RESCALE_NORMAL_EXT:
+ return ctx->Transform.RescaleNormals;
+ case GL_SCISSOR_TEST:
+ return ctx->Scissor.Enabled;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ return ctx->Texture.SharedPalette;
+ case GL_STENCIL_TEST:
+ return ctx->Stencil.Enabled;
+ case GL_TEXTURE_1D:
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE;
+ }
+ case GL_TEXTURE_2D:
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE;
+ }
+ case GL_TEXTURE_3D:
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE;
+ }
+ case GL_TEXTURE_GEN_Q:
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
+ }
+ case GL_TEXTURE_GEN_R:
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
+ }
+ case GL_TEXTURE_GEN_S:
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
+ }
+ case GL_TEXTURE_GEN_T:
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
+ }
+
+ /*
+ * CLIENT STATE!!!
+ */
+ case GL_VERTEX_ARRAY:
+ return (ctx->Array.Vertex.Enabled != 0);
+ case GL_NORMAL_ARRAY:
+ return (ctx->Array.Normal.Enabled != 0);
+ case GL_COLOR_ARRAY:
+ return (ctx->Array.Color.Enabled != 0);
+ case GL_INDEX_ARRAY:
+ return (ctx->Array.Index.Enabled != 0);
+ case GL_TEXTURE_COORD_ARRAY:
+ return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0);
+ case GL_EDGE_FLAG_ARRAY:
+ return (ctx->Array.EdgeFlag.Enabled != 0);
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ CHECK_EXTENSION(EXT_fog_coord);
+ return (ctx->Array.FogCoord.Enabled != 0);
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ CHECK_EXTENSION(EXT_secondary_color);
+ return (ctx->Array.SecondaryColor.Enabled != 0);
+
+ /* GL_EXT_histogram */
+ case GL_HISTOGRAM:
+ CHECK_EXTENSION(EXT_histogram);
+ return ctx->Pixel.HistogramEnabled;
+ case GL_MINMAX:
+ CHECK_EXTENSION(EXT_histogram);
+ return ctx->Pixel.MinMaxEnabled;
+
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ CHECK_EXTENSION(HP_occlusion_test);
+ return ctx->Depth.OcclusionTest;
+
+ /* GL_SGIS_pixel_texture */
+ case GL_PIXEL_TEXTURE_SGIS:
+ CHECK_EXTENSION(SGIS_pixel_texture);
+ return ctx->Pixel.PixelTextureEnabled;
+
+ /* GL_SGIX_pixel_texture */
+ case GL_PIXEL_TEX_GEN_SGIX:
+ CHECK_EXTENSION(SGIX_pixel_texture);
+ return ctx->Pixel.PixelTextureEnabled;
+
+ /* GL_SGI_color_table */
+ case GL_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_color_table);
+ return ctx->Pixel.ColorTableEnabled;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_color_table);
+ return ctx->Pixel.PostConvolutionColorTableEnabled;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_color_table);
+ return ctx->Pixel.PostColorMatrixColorTableEnabled;
+
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_texture_color_table);
+ return ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled;
+
+ /* GL_EXT_convolution */
+ case GL_CONVOLUTION_1D:
+ CHECK_EXTENSION(EXT_convolution);
+ return ctx->Pixel.Convolution1DEnabled;
+ case GL_CONVOLUTION_2D:
+ CHECK_EXTENSION(EXT_convolution);
+ return ctx->Pixel.Convolution2DEnabled;
+ case GL_SEPARABLE_2D:
+ CHECK_EXTENSION(EXT_convolution);
+ return ctx->Pixel.Separable2DEnabled;
+
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ CHECK_EXTENSION(ARB_texture_cube_map);
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE;
+ }
+
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ CHECK_EXTENSION(ARB_multisample);
+ return ctx->Multisample.Enabled;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ CHECK_EXTENSION(ARB_multisample);
+ return ctx->Multisample.SampleAlphaToCoverage;
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ CHECK_EXTENSION(ARB_multisample);
+ return ctx->Multisample.SampleAlphaToOne;
+ case GL_SAMPLE_COVERAGE_ARB:
+ CHECK_EXTENSION(ARB_multisample);
+ return ctx->Multisample.SampleCoverage;
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ CHECK_EXTENSION(ARB_multisample);
+ return ctx->Multisample.SampleCoverageInvert;
+
+ /* GL_IBM_rasterpos_clip */
+ case GL_RASTER_POSITION_UNCLIPPED_IBM:
+ CHECK_EXTENSION(IBM_rasterpos_clip);
+ return ctx->Transform.RasterPositionUnclipped;
+
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ return ctx->Point.PointSprite;
+
+#if FEATURE_NV_vertex_program
+ case GL_VERTEX_PROGRAM_NV:
+ CHECK_EXTENSION(NV_vertex_program);
+ return ctx->VertexProgram.Enabled;
+ case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+ CHECK_EXTENSION(NV_vertex_program);
+ return ctx->VertexProgram.PointSizeEnabled;
+ case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+ CHECK_EXTENSION(NV_vertex_program);
+ return ctx->VertexProgram.TwoSideEnabled;
+ case GL_VERTEX_ATTRIB_ARRAY0_NV:
+ case GL_VERTEX_ATTRIB_ARRAY1_NV:
+ case GL_VERTEX_ATTRIB_ARRAY2_NV:
+ case GL_VERTEX_ATTRIB_ARRAY3_NV:
+ case GL_VERTEX_ATTRIB_ARRAY4_NV:
+ case GL_VERTEX_ATTRIB_ARRAY5_NV:
+ case GL_VERTEX_ATTRIB_ARRAY6_NV:
+ case GL_VERTEX_ATTRIB_ARRAY7_NV:
+ case GL_VERTEX_ATTRIB_ARRAY8_NV:
+ case GL_VERTEX_ATTRIB_ARRAY9_NV:
+ case GL_VERTEX_ATTRIB_ARRAY10_NV:
+ case GL_VERTEX_ATTRIB_ARRAY11_NV:
+ case GL_VERTEX_ATTRIB_ARRAY12_NV:
+ case GL_VERTEX_ATTRIB_ARRAY13_NV:
+ case GL_VERTEX_ATTRIB_ARRAY14_NV:
+ case GL_VERTEX_ATTRIB_ARRAY15_NV:
+ CHECK_EXTENSION(NV_vertex_program);
+ {
+ GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
+ return (ctx->Array.VertexAttrib[n].Enabled != 0);
+ }
+ case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION(NV_vertex_program);
+ {
+ const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
+ return ctx->Eval.Map1Attrib[map];
+ }
+ case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION(NV_vertex_program);
+ {
+ const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
+ return ctx->Eval.Map2Attrib[map];
+ }
+#endif /* FEATURE_NV_vertex_program */
+
+#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION(NV_fragment_program);
+ return ctx->FragmentProgram.Enabled;
+#endif /* FEATURE_NV_fragment_program */
+
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION(NV_texture_rectangle);
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE;
+ }
+
+ /* GL_EXT_stencil_two_side */
+ case GL_STENCIL_TEST_TWO_SIDE_EXT:
+ CHECK_EXTENSION(EXT_stencil_two_side);
+ return ctx->Stencil.TestTwoSide;
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ return ctx->FragmentProgram.Enabled;
+#endif /* FEATURE_ARB_fragment_program */
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION(EXT_depth_bounds_test);
+ return ctx->Depth.BoundsTest;
+
+ /* GL_MESA_program_debug */
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION(MESA_program_debug);
+ return ctx->FragmentProgram.CallbackEnabled;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION(MESA_program_debug);
+ return ctx->VertexProgram.CallbackEnabled;
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap);
+ return GL_FALSE;
+ }
+}
Index: xc/extras/Mesa/src/mesa/main/enable.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/enable.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/enable.h Thu Apr 8 05:17:42 2004
@@ -0,0 +1,57 @@
+/**
+ * \file enable.h
+ * Enable/disable/query GL capabilities.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef ENABLE_H
+#define ENABLE_H
+
+
+#include "mtypes.h"
+
+
+extern void
+_mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state );
+
+extern void GLAPIENTRY
+_mesa_Disable( GLenum cap );
+
+extern void GLAPIENTRY
+_mesa_Enable( GLenum cap );
+
+extern GLboolean GLAPIENTRY
+_mesa_IsEnabled( GLenum cap );
+
+extern void GLAPIENTRY
+_mesa_EnableClientState( GLenum cap );
+
+extern void GLAPIENTRY
+_mesa_DisableClientState( GLenum cap );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/enums.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/enums.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/enums.c Thu Apr 8 05:17:43 2004
@@ -0,0 +1,973 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Author:
+ * Keith Whitwell
+ */
+
+
+#include "glheader.h"
+#include "enums.h"
+#include "imports.h"
+
+
+typedef struct {
+ const char *c;
+ int n;
+} enum_elt;
+
+enum_elt all_enums[] =
+{
+ /* Boolean values */
+ { "GL_FALSE", 0 },
+ { "GL_TRUE", 1 },
+
+ /* Data types */
+ { "GL_BYTE", 0x1400 },
+ { "GL_UNSIGNED_BYTE", 0x1401 },
+ { "GL_SHORT", 0x1402 },
+ { "GL_UNSIGNED_SHORT", 0x1403 },
+ { "GL_INT", 0x1404 },
+ { "GL_UNSIGNED_INT", 0x1405 },
+ { "GL_FLOAT", 0x1406 },
+ { "GL_DOUBLE", 0x140A },
+ { "GL_2_BYTES", 0x1407 },
+ { "GL_3_BYTES", 0x1408 },
+ { "GL_4_BYTES", 0x1409 },
+
+ /* Primitives */
+ { "GL_LINES", 0x0001 },
+ { "GL_POINTS", 0x0000 },
+ { "GL_LINE_STRIP", 0x0003 },
+ { "GL_LINE_LOOP", 0x0002 },
+ { "GL_TRIANGLES", 0x0004 },
+ { "GL_TRIANGLE_STRIP", 0x0005 },
+ { "GL_TRIANGLE_FAN", 0x0006 },
+ { "GL_QUADS", 0x0007 },
+ { "GL_QUAD_STRIP", 0x0008 },
+ { "GL_POLYGON", 0x0009 },
+ { "GL_EDGE_FLAG", 0x0B43 },
+
+ /* Vertex Arrays */
+ { "GL_VERTEX_ARRAY", 0x8074 },
+ { "GL_NORMAL_ARRAY", 0x8075 },
+ { "GL_COLOR_ARRAY", 0x8076 },
+ { "GL_INDEX_ARRAY", 0x8077 },
+ { "GL_TEXTURE_COORD_ARRAY", 0x8078 },
+ { "GL_EDGE_FLAG_ARRAY", 0x8079 },
+ { "GL_VERTEX_ARRAY_SIZE", 0x807A },
+ { "GL_VERTEX_ARRAY_TYPE", 0x807B },
+ { "GL_VERTEX_ARRAY_STRIDE", 0x807C },
+ { "GL_NORMAL_ARRAY_TYPE", 0x807E },
+ { "GL_NORMAL_ARRAY_STRIDE", 0x807F },
+ { "GL_COLOR_ARRAY_SIZE", 0x8081 },
+ { "GL_COLOR_ARRAY_TYPE", 0x8082 },
+ { "GL_COLOR_ARRAY_STRIDE", 0x8083 },
+ { "GL_INDEX_ARRAY_TYPE", 0x8085 },
+ { "GL_INDEX_ARRAY_STRIDE", 0x8086 },
+ { "GL_TEXTURE_COORD_ARRAY_SIZE", 0x8088 },
+ { "GL_TEXTURE_COORD_ARRAY_TYPE", 0x8089 },
+ { "GL_TEXTURE_COORD_ARRAY_STRIDE", 0x808A },
+ { "GL_EDGE_FLAG_ARRAY_STRIDE", 0x808C },
+ { "GL_VERTEX_ARRAY_POINTER", 0x808E },
+ { "GL_NORMAL_ARRAY_POINTER", 0x808F },
+ { "GL_COLOR_ARRAY_POINTER", 0x8090 },
+ { "GL_INDEX_ARRAY_POINTER", 0x8091 },
+ { "GL_TEXTURE_COORD_ARRAY_POINTER", 0x8092 },
+ { "GL_EDGE_FLAG_ARRAY_POINTER", 0x8093 },
+ { "GL_V2F", 0x2A20 },
+ { "GL_V3F", 0x2A21 },
+ { "GL_C4UB_V2F", 0x2A22 },
+ { "GL_C4UB_V3F", 0x2A23 },
+ { "GL_C3F_V3F", 0x2A24 },
+ { "GL_N3F_V3F", 0x2A25 },
+ { "GL_C4F_N3F_V3F", 0x2A26 },
+ { "GL_T2F_V3F", 0x2A27 },
+ { "GL_T4F_V4F", 0x2A28 },
+ { "GL_T2F_C4UB_V3F", 0x2A29 },
+ { "GL_T2F_C3F_V3F", 0x2A2A },
+ { "GL_T2F_N3F_V3F", 0x2A2B },
+ { "GL_T2F_C4F_N3F_V3F", 0x2A2C },
+ { "GL_T4F_C4F_N3F_V4F", 0x2A2D },
+
+ /* Matrix Mode */
+ { "GL_MATRIX_MODE", 0x0BA0 },
+ { "GL_MODELVIEW", 0x1700 },
+ { "GL_PROJECTION", 0x1701 },
+ { "GL_TEXTURE", 0x1702 },
+
+ /* Points */
+ { "GL_POINT_SMOOTH", 0x0B10 },
+ { "GL_POINT_SIZE", 0x0B11 },
+ { "GL_POINT_SIZE_GRANULARITY ", 0x0B13 },
+ { "GL_POINT_SIZE_RANGE", 0x0B12 },
+
+ /* Lines */
+ { "GL_LINE_SMOOTH", 0x0B20 },
+ { "GL_LINE_STIPPLE", 0x0B24 },
+ { "GL_LINE_STIPPLE_PATTERN", 0x0B25 },
+ { "GL_LINE_STIPPLE_REPEAT", 0x0B26 },
+ { "GL_LINE_WIDTH", 0x0B21 },
+ { "GL_LINE_WIDTH_GRANULARITY", 0x0B23 },
+ { "GL_LINE_WIDTH_RANGE", 0x0B22 },
+
+ /* Polygons */
+ { "GL_POINT", 0x1B00 },
+ { "GL_LINE", 0x1B01 },
+ { "GL_FILL", 0x1B02 },
+ { "GL_CCW", 0x0901 },
+ { "GL_CW", 0x0900 },
+ { "GL_FRONT", 0x0404 },
+ { "GL_BACK", 0x0405 },
+ { "GL_CULL_FACE", 0x0B44 },
+ { "GL_CULL_FACE_MODE", 0x0B45 },
+ { "GL_POLYGON_SMOOTH", 0x0B41 },
+ { "GL_POLYGON_STIPPLE", 0x0B42 },
+ { "GL_FRONT_FACE", 0x0B46 },
+ { "GL_POLYGON_MODE", 0x0B40 },
+ { "GL_POLYGON_OFFSET_FACTOR", 0x8038 },
+ { "GL_POLYGON_OFFSET_UNITS", 0x2A00 },
+ { "GL_POLYGON_OFFSET_POINT", 0x2A01 },
+ { "GL_POLYGON_OFFSET_LINE", 0x2A02 },
+ { "GL_POLYGON_OFFSET_FILL", 0x8037 },
+
+ /* Display Lists */
+ { "GL_COMPILE", 0x1300 },
+ { "GL_COMPILE_AND_EXECUTE", 0x1301 },
+ { "GL_LIST_BASE", 0x0B32 },
+ { "GL_LIST_INDEX", 0x0B33 },
+ { "GL_LIST_MODE", 0x0B30 },
+
+ /* Depth buffer */
+ { "GL_NEVER", 0x0200 },
+ { "GL_LESS", 0x0201 },
+ { "GL_GEQUAL", 0x0206 },
+ { "GL_LEQUAL", 0x0203 },
+ { "GL_GREATER", 0x0204 },
+ { "GL_NOTEQUAL", 0x0205 },
+ { "GL_EQUAL", 0x0202 },
+ { "GL_ALWAYS", 0x0207 },
+ { "GL_DEPTH_TEST", 0x0B71 },
+ { "GL_DEPTH_BITS", 0x0D56 },
+ { "GL_DEPTH_CLEAR_VALUE", 0x0B73 },
+ { "GL_DEPTH_FUNC", 0x0B74 },
+ { "GL_DEPTH_RANGE", 0x0B70 },
+ { "GL_DEPTH_WRITEMASK", 0x0B72 },
+ { "GL_DEPTH_COMPONENT", 0x1902 },
+
+ /* Lighting */
+ { "GL_LIGHTING", 0x0B50 },
+ { "GL_LIGHT0", 0x4000 },
+ { "GL_LIGHT1", 0x4001 },
+ { "GL_LIGHT2", 0x4002 },
+ { "GL_LIGHT3", 0x4003 },
+ { "GL_LIGHT4", 0x4004 },
+ { "GL_LIGHT5", 0x4005 },
+ { "GL_LIGHT6", 0x4006 },
+ { "GL_LIGHT7", 0x4007 },
+ { "GL_SPOT_EXPONENT", 0x1205 },
+ { "GL_SPOT_CUTOFF", 0x1206 },
+ { "GL_CONSTANT_ATTENUATION", 0x1207 },
+ { "GL_LINEAR_ATTENUATION", 0x1208 },
+ { "GL_QUADRATIC_ATTENUATION", 0x1209 },
+ { "GL_AMBIENT", 0x1200 },
+ { "GL_DIFFUSE", 0x1201 },
+ { "GL_SPECULAR", 0x1202 },
+ { "GL_SHININESS", 0x1601 },
+ { "GL_EMISSION", 0x1600 },
+ { "GL_POSITION", 0x1203 },
+ { "GL_SPOT_DIRECTION", 0x1204 },
+ { "GL_AMBIENT_AND_DIFFUSE", 0x1602 },
+ { "GL_COLOR_INDEXES", 0x1603 },
+ { "GL_LIGHT_MODEL_TWO_SIDE", 0x0B52 },
+ { "GL_LIGHT_MODEL_LOCAL_VIEWER", 0x0B51 },
+ { "GL_LIGHT_MODEL_AMBIENT", 0x0B53 },
+ { "GL_FRONT_AND_BACK", 0x0408 },
+ { "GL_SHADE_MODEL", 0x0B54 },
+ { "GL_FLAT", 0x1D00 },
+ { "GL_SMOOTH", 0x1D01 },
+ { "GL_COLOR_MATERIAL", 0x0B57 },
+ { "GL_COLOR_MATERIAL_FACE", 0x0B55 },
+ { "GL_COLOR_MATERIAL_PARAMETER", 0x0B56 },
+ { "GL_NORMALIZE", 0x0BA1 },
+
+ /* User clipping planes */
+ { "GL_CLIP_PLANE0", 0x3000 },
+ { "GL_CLIP_PLANE1", 0x3001 },
+ { "GL_CLIP_PLANE2", 0x3002 },
+ { "GL_CLIP_PLANE3", 0x3003 },
+ { "GL_CLIP_PLANE4", 0x3004 },
+ { "GL_CLIP_PLANE5", 0x3005 },
+
+ /* Accumulation buffer */
+ { "GL_ACCUM_RED_BITS", 0x0D58 },
+ { "GL_ACCUM_GREEN_BITS", 0x0D59 },
+ { "GL_ACCUM_BLUE_BITS", 0x0D5A },
+ { "GL_ACCUM_ALPHA_BITS", 0x0D5B },
+ { "GL_ACCUM_CLEAR_VALUE", 0x0B80 },
+ { "GL_ACCUM", 0x0100 },
+ { "GL_ADD", 0x0104 },
+ { "GL_LOAD", 0x0101 },
+ { "GL_MULT", 0x0103 },
+ { "GL_RETURN", 0x0102 },
+
+ /* Alpha testing */
+ { "GL_ALPHA_TEST", 0x0BC0 },
+ { "GL_ALPHA_TEST_REF", 0x0BC2 },
+ { "GL_ALPHA_TEST_FUNC", 0x0BC1 },
+
+ /* Blending */
+ { "GL_BLEND", 0x0BE2 },
+ { "GL_BLEND_SRC", 0x0BE1 },
+ { "GL_BLEND_DST", 0x0BE0 },
+ { "GL_ZERO", 0 },
+ { "GL_ONE", 1 },
+ { "GL_SRC_COLOR", 0x0300 },
+ { "GL_ONE_MINUS_SRC_COLOR", 0x0301 },
+ { "GL_DST_COLOR", 0x0306 },
+ { "GL_ONE_MINUS_DST_COLOR", 0x0307 },
+ { "GL_SRC_ALPHA", 0x0302 },
+ { "GL_ONE_MINUS_SRC_ALPHA", 0x0303 },
+ { "GL_DST_ALPHA", 0x0304 },
+ { "GL_ONE_MINUS_DST_ALPHA", 0x0305 },
+ { "GL_SRC_ALPHA_SATURATE", 0x0308 },
+ { "GL_CONSTANT_COLOR", 0x8001 },
+ { "GL_ONE_MINUS_CONSTANT_COLOR", 0x8002 },
+ { "GL_CONSTANT_ALPHA", 0x8003 },
+ { "GL_ONE_MINUS_CONSTANT_ALPHA", 0x8004 },
+
+ /* Render Mode */
+ { "GL_FEEDBACK", 0x1C01 },
+ { "GL_RENDER", 0x1C00 },
+ { "GL_SELECT", 0x1C02 },
+
+ /* Feedback */
+ { "GL_2D", 0x0600 },
+ { "GL_3D", 0x0601 },
+ { "GL_3D_COLOR", 0x0602 },
+ { "GL_3D_COLOR_TEXTURE", 0x0603 },
+ { "GL_4D_COLOR_TEXTURE", 0x0604 },
+ { "GL_POINT_TOKEN", 0x0701 },
+ { "GL_LINE_TOKEN", 0x0702 },
+ { "GL_LINE_RESET_TOKEN", 0x0707 },
+ { "GL_POLYGON_TOKEN", 0x0703 },
+ { "GL_BITMAP_TOKEN", 0x0704 },
+ { "GL_DRAW_PIXEL_TOKEN", 0x0705 },
+ { "GL_COPY_PIXEL_TOKEN", 0x0706 },
+ { "GL_PASS_THROUGH_TOKEN", 0x0700 },
+ { "GL_FEEDBACK_BUFFER_POINTER", 0x0DF0 },
+ { "GL_FEEDBACK_BUFFER_SIZE", 0x0DF1 },
+ { "GL_FEEDBACK_BUFFER_TYPE", 0x0DF2 },
+
+ /* Selection */
+ { "GL_SELECTION_BUFFER_POINTER", 0x0DF3 },
+ { "GL_SELECTION_BUFFER_SIZE", 0x0DF4 },
+
+ /* Fog */
+ { "GL_FOG", 0x0B60 },
+ { "GL_FOG_MODE", 0x0B65 },
+ { "GL_FOG_DENSITY", 0x0B62 },
+ { "GL_FOG_COLOR", 0x0B66 },
+ { "GL_FOG_INDEX", 0x0B61 },
+ { "GL_FOG_START", 0x0B63 },
+ { "GL_FOG_END", 0x0B64 },
+ { "GL_LINEAR", 0x2601 },
+ { "GL_EXP", 0x0800 },
+ { "GL_EXP2", 0x0801 },
+
+ /* Logic Ops */
+ { "GL_LOGIC_OP", 0x0BF1 },
+ { "GL_INDEX_LOGIC_OP", 0x0BF1 },
+ { "GL_COLOR_LOGIC_OP", 0x0BF2 },
+ { "GL_LOGIC_OP_MODE", 0x0BF0 },
+ { "GL_CLEAR", 0x1500 },
+ { "GL_SET", 0x150F },
+ { "GL_COPY", 0x1503 },
+ { "GL_COPY_INVERTED", 0x150C },
+ { "GL_NOOP", 0x1505 },
+ { "GL_INVERT", 0x150A },
+ { "GL_AND", 0x1501 },
+ { "GL_NAND", 0x150E },
+ { "GL_OR", 0x1507 },
+ { "GL_NOR", 0x1508 },
+ { "GL_XOR", 0x1506 },
+ { "GL_EQUIV", 0x1509 },
+ { "GL_AND_REVERSE", 0x1502 },
+ { "GL_AND_INVERTED", 0x1504 },
+ { "GL_OR_REVERSE", 0x150B },
+ { "GL_OR_INVERTED", 0x150D },
+
+ /* Stencil */
+ { "GL_STENCIL_TEST", 0x0B90 },
+ { "GL_STENCIL_WRITEMASK", 0x0B98 },
+ { "GL_STENCIL_BITS", 0x0D57 },
+ { "GL_STENCIL_FUNC", 0x0B92 },
+ { "GL_STENCIL_VALUE_MASK", 0x0B93 },
+ { "GL_STENCIL_REF", 0x0B97 },
+ { "GL_STENCIL_FAIL", 0x0B94 },
+ { "GL_STENCIL_PASS_DEPTH_PASS", 0x0B96 },
+ { "GL_STENCIL_PASS_DEPTH_FAIL", 0x0B95 },
+ { "GL_STENCIL_CLEAR_VALUE", 0x0B91 },
+ { "GL_STENCIL_INDEX", 0x1901 },
+ { "GL_KEEP", 0x1E00 },
+ { "GL_REPLACE", 0x1E01 },
+ { "GL_INCR", 0x1E02 },
+ { "GL_DECR", 0x1E03 },
+
+ /* Buffers, Pixel Drawing/Reading */
+ { "GL_NONE", 0 },
+ { "GL_LEFT", 0x0406 },
+ { "GL_RIGHT", 0x0407 },
+ { "GL_FRONT_LEFT", 0x0400 },
+ { "GL_FRONT_RIGHT", 0x0401 },
+ { "GL_BACK_LEFT", 0x0402 },
+ { "GL_BACK_RIGHT", 0x0403 },
+ { "GL_AUX0", 0x0409 },
+ { "GL_AUX1", 0x040A },
+ { "GL_AUX2", 0x040B },
+ { "GL_AUX3", 0x040C },
+ { "GL_COLOR_INDEX", 0x1900 },
+ { "GL_RED", 0x1903 },
+ { "GL_GREEN", 0x1904 },
+ { "GL_BLUE", 0x1905 },
+ { "GL_ALPHA", 0x1906 },
+ { "GL_LUMINANCE", 0x1909 },
+ { "GL_LUMINANCE_ALPHA", 0x190A },
+ { "GL_ALPHA_BITS", 0x0D55 },
+ { "GL_RED_BITS", 0x0D52 },
+ { "GL_GREEN_BITS", 0x0D53 },
+ { "GL_BLUE_BITS", 0x0D54 },
+ { "GL_INDEX_BITS", 0x0D51 },
+ { "GL_SUBPIXEL_BITS", 0x0D50 },
+ { "GL_AUX_BUFFERS", 0x0C00 },
+ { "GL_READ_BUFFER", 0x0C02 },
+ { "GL_DRAW_BUFFER", 0x0C01 },
+ { "GL_DOUBLEBUFFER", 0x0C32 },
+ { "GL_STEREO", 0x0C33 },
+ { "GL_BITMAP", 0x1A00 },
+ { "GL_COLOR", 0x1800 },
+ { "GL_DEPTH", 0x1801 },
+ { "GL_STENCIL", 0x1802 },
+ { "GL_DITHER", 0x0BD0 },
+ { "GL_RGB", 0x1907 },
+ { "GL_RGBA", 0x1908 },
+
+ /* Implementation limits */
+ { "GL_MAX_LIST_NESTING", 0x0B31 },
+ { "GL_MAX_ATTRIB_STACK_DEPTH", 0x0D35 },
+ { "GL_MAX_MODELVIEW_STACK_DEPTH", 0x0D36 },
+ { "GL_MAX_NAME_STACK_DEPTH", 0x0D37 },
+ { "GL_MAX_PROJECTION_STACK_DEPTH", 0x0D38 },
+ { "GL_MAX_TEXTURE_STACK_DEPTH", 0x0D39 },
+ { "GL_MAX_EVAL_ORDER", 0x0D30 },
+ { "GL_MAX_LIGHTS", 0x0D31 },
+ { "GL_MAX_CLIP_PLANES", 0x0D32 },
+ { "GL_MAX_TEXTURE_SIZE", 0x0D33 },
+ { "GL_MAX_PIXEL_MAP_TABLE", 0x0D34 },
+ { "GL_MAX_VIEWPORT_DIMS", 0x0D3A },
+ { "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", 0x0D3B },
+
+
+ { "GL_ATTRIB_STACK_DEPTH", 0x0BB0 },
+ { "GL_CLIENT_ATTRIB_STACK_DEPTH", 0x0BB1 },
+ { "GL_COLOR_CLEAR_VALUE", 0x0C22 },
+ { "GL_COLOR_WRITEMASK", 0x0C23 },
+ { "GL_CURRENT_INDEX", 0x0B01 },
+ { "GL_CURRENT_COLOR", 0x0B00 },
+ { "GL_CURRENT_NORMAL", 0x0B02 },
+ { "GL_CURRENT_RASTER_COLOR", 0x0B04 },
+ { "GL_CURRENT_RASTER_DISTANCE", 0x0B09 },
+ { "GL_CURRENT_RASTER_INDEX", 0x0B05 },
+ { "GL_CURRENT_RASTER_POSITION", 0x0B07 },
+ { "GL_CURRENT_RASTER_TEXTURE_COORDS", 0x0B06},
+ { "GL_CURRENT_RASTER_POSITION_VALID", 0x0B08 },
+ { "GL_CURRENT_TEXTURE_COORDS", 0x0B03 },
+ { "GL_INDEX_CLEAR_VALUE", 0x0C20 },
+ { "GL_INDEX_MODE", 0x0C30 },
+ { "GL_INDEX_WRITEMASK", 0x0C21 },
+ { "GL_MODELVIEW_MATRIX", 0x0BA6 },
+ { "GL_MODELVIEW_STACK_DEPTH", 0x0BA3 },
+ { "GL_NAME_STACK_DEPTH", 0x0D70 },
+ { "GL_PROJECTION_MATRIX", 0x0BA7 },
+ { "GL_PROJECTION_STACK_DEPTH", 0x0BA4 },
+ { "GL_RENDER_MODE", 0x0C40 },
+ { "GL_RGBA_MODE", 0x0C31 },
+ { "GL_TEXTURE_MATRIX", 0x0BA8 },
+ { "GL_TEXTURE_STACK_DEPTH", 0x0BA5 },
+ { "GL_VIEWPORT", 0x0BA2 },
+
+
+ /* Evaluators */
+ { "GL_AUTO_NORMAL", 0x0D80 },
+ { "GL_MAP1_COLOR_4", 0x0D90 },
+ { "GL_MAP1_GRID_DOMAIN", 0x0DD0 },
+ { "GL_MAP1_GRID_SEGMENTS", 0x0DD1 },
+ { "GL_MAP1_INDEX", 0x0D91 },
+ { "GL_MAP1_NORMAL", 0x0D92 },
+ { "GL_MAP1_TEXTURE_COORD_1", 0x0D93 },
+ { "GL_MAP1_TEXTURE_COORD_2", 0x0D94 },
+ { "GL_MAP1_TEXTURE_COORD_3", 0x0D95 },
+ { "GL_MAP1_TEXTURE_COORD_4", 0x0D96 },
+ { "GL_MAP1_VERTEX_3", 0x0D97 },
+ { "GL_MAP1_VERTEX_4", 0x0D98 },
+ { "GL_MAP2_COLOR_4", 0x0DB0 },
+ { "GL_MAP2_GRID_DOMAIN", 0x0DD2 },
+ { "GL_MAP2_GRID_SEGMENTS", 0x0DD3 },
+ { "GL_MAP2_INDEX", 0x0DB1 },
+ { "GL_MAP2_NORMAL", 0x0DB2 },
+ { "GL_MAP2_TEXTURE_COORD_1", 0x0DB3 },
+ { "GL_MAP2_TEXTURE_COORD_2", 0x0DB4 },
+ { "GL_MAP2_TEXTURE_COORD_3", 0x0DB5 },
+ { "GL_MAP2_TEXTURE_COORD_4", 0x0DB6 },
+ { "GL_MAP2_VERTEX_3", 0x0DB7 },
+ { "GL_MAP2_VERTEX_4", 0x0DB8 },
+ { "GL_COEFF", 0x0A00 },
+ { "GL_DOMAIN", 0x0A02 },
+ { "GL_ORDER", 0x0A01 },
+
+ /* Hints */
+ { "GL_FOG_HINT", 0x0C54 },
+ { "GL_LINE_SMOOTH_HINT", 0x0C52 },
+ { "GL_PERSPECTIVE_CORRECTION_HINT", 0x0C50 },
+ { "GL_POINT_SMOOTH_HINT", 0x0C51 },
+ { "GL_POLYGON_SMOOTH_HINT", 0x0C53 },
+ { "GL_DONT_CARE", 0x1100 },
+ { "GL_FASTEST", 0x1101 },
+ { "GL_NICEST", 0x1102 },
+
+ /* Scissor box */
+ { "GL_SCISSOR_TEST", 0x0C11 },
+ { "GL_SCISSOR_BOX", 0x0C10 },
+
+ /* Pixel Mode / Transfer */
+ { "GL_MAP_COLOR", 0x0D10 },
+ { "GL_MAP_STENCIL", 0x0D11 },
+ { "GL_INDEX_SHIFT", 0x0D12 },
+ { "GL_INDEX_OFFSET", 0x0D13 },
+ { "GL_RED_SCALE", 0x0D14 },
+ { "GL_RED_BIAS", 0x0D15 },
+ { "GL_GREEN_SCALE", 0x0D18 },
+ { "GL_GREEN_BIAS", 0x0D19 },
+ { "GL_BLUE_SCALE", 0x0D1A },
+ { "GL_BLUE_BIAS", 0x0D1B },
+ { "GL_ALPHA_SCALE", 0x0D1C },
+ { "GL_ALPHA_BIAS", 0x0D1D },
+ { "GL_DEPTH_SCALE", 0x0D1E },
+ { "GL_DEPTH_BIAS", 0x0D1F },
+ { "GL_PIXEL_MAP_S_TO_S_SIZE", 0x0CB1 },
+ { "GL_PIXEL_MAP_I_TO_I_SIZE", 0x0CB0 },
+ { "GL_PIXEL_MAP_I_TO_R_SIZE", 0x0CB2 },
+ { "GL_PIXEL_MAP_I_TO_G_SIZE", 0x0CB3 },
+ { "GL_PIXEL_MAP_I_TO_B_SIZE", 0x0CB4 },
+ { "GL_PIXEL_MAP_I_TO_A_SIZE", 0x0CB5 },
+ { "GL_PIXEL_MAP_R_TO_R_SIZE", 0x0CB6 },
+ { "GL_PIXEL_MAP_G_TO_G_SIZE", 0x0CB7 },
+ { "GL_PIXEL_MAP_B_TO_B_SIZE", 0x0CB8 },
+ { "GL_PIXEL_MAP_A_TO_A_SIZE", 0x0CB9 },
+ { "GL_PIXEL_MAP_S_TO_S", 0x0C71 },
+ { "GL_PIXEL_MAP_I_TO_I", 0x0C70 },
+ { "GL_PIXEL_MAP_I_TO_R", 0x0C72 },
+ { "GL_PIXEL_MAP_I_TO_G", 0x0C73 },
+ { "GL_PIXEL_MAP_I_TO_B", 0x0C74 },
+ { "GL_PIXEL_MAP_I_TO_A", 0x0C75 },
+ { "GL_PIXEL_MAP_R_TO_R", 0x0C76 },
+ { "GL_PIXEL_MAP_G_TO_G", 0x0C77 },
+ { "GL_PIXEL_MAP_B_TO_B", 0x0C78 },
+ { "GL_PIXEL_MAP_A_TO_A", 0x0C79 },
+ { "GL_PACK_ALIGNMENT", 0x0D05 },
+ { "GL_PACK_LSB_FIRST", 0x0D01 },
+ { "GL_PACK_ROW_LENGTH", 0x0D02 },
+ { "GL_PACK_SKIP_PIXELS", 0x0D04 },
+ { "GL_PACK_SKIP_ROWS", 0x0D03 },
+ { "GL_PACK_SWAP_BYTES", 0x0D00 },
+ { "GL_UNPACK_ALIGNMENT", 0x0CF5 },
+ { "GL_UNPACK_LSB_FIRST", 0x0CF1 },
+ { "GL_UNPACK_ROW_LENGTH", 0x0CF2 },
+ { "GL_UNPACK_SKIP_PIXELS", 0x0CF4 },
+ { "GL_UNPACK_SKIP_ROWS", 0x0CF3 },
+ { "GL_UNPACK_SWAP_BYTES", 0x0CF0 },
+ { "GL_ZOOM_X", 0x0D16 },
+ { "GL_ZOOM_Y", 0x0D17 },
+
+ /* Texture mapping */
+ { "GL_TEXTURE_ENV", 0x2300 },
+ { "GL_TEXTURE_ENV_MODE", 0x2200 },
+ { "GL_TEXTURE_1D", 0x0DE0 },
+ { "GL_TEXTURE_2D", 0x0DE1 },
+ { "GL_TEXTURE_WRAP_S", 0x2802 },
+ { "GL_TEXTURE_WRAP_T", 0x2803 },
+ { "GL_TEXTURE_MAG_FILTER", 0x2800 },
+ { "GL_TEXTURE_MIN_FILTER", 0x2801 },
+ { "GL_TEXTURE_ENV_COLOR", 0x2201 },
+ { "GL_TEXTURE_GEN_S", 0x0C60 },
+ { "GL_TEXTURE_GEN_T", 0x0C61 },
+ { "GL_TEXTURE_GEN_MODE", 0x2500 },
+ { "GL_TEXTURE_BORDER_COLOR", 0x1004 },
+ { "GL_TEXTURE_WIDTH", 0x1000 },
+ { "GL_TEXTURE_HEIGHT", 0x1001 },
+ { "GL_TEXTURE_BORDER", 0x1005 },
+ { "GL_TEXTURE_COMPONENTS", 0x1003 },
+ { "GL_TEXTURE_RED_SIZE", 0x805C },
+ { "GL_TEXTURE_GREEN_SIZE", 0x805D },
+ { "GL_TEXTURE_BLUE_SIZE", 0x805E },
+ { "GL_TEXTURE_ALPHA_SIZE", 0x805F },
+ { "GL_TEXTURE_LUMINANCE_SIZE", 0x8060 },
+ { "GL_TEXTURE_INTENSITY_SIZE", 0x8061 },
+ { "GL_NEAREST_MIPMAP_NEAREST", 0x2700 },
+ { "GL_NEAREST_MIPMAP_LINEAR", 0x2702 },
+ { "GL_LINEAR_MIPMAP_NEAREST", 0x2701 },
+ { "GL_LINEAR_MIPMAP_LINEAR", 0x2703 },
+ { "GL_OBJECT_LINEAR", 0x2401 },
+ { "GL_OBJECT_PLANE", 0x2501 },
+ { "GL_EYE_LINEAR", 0x2400 },
+ { "GL_EYE_PLANE", 0x2502 },
+ { "GL_SPHERE_MAP", 0x2402 },
+ { "GL_DECAL", 0x2101 },
+ { "GL_MODULATE", 0x2100 },
+ { "GL_NEAREST", 0x2600 },
+ { "GL_REPEAT", 0x2901 },
+ { "GL_CLAMP", 0x2900 },
+ { "GL_S", 0x2000 },
+ { "GL_T", 0x2001 },
+ { "GL_R", 0x2002 },
+ { "GL_Q", 0x2003 },
+ { "GL_TEXTURE_GEN_R", 0x0C62 },
+ { "GL_TEXTURE_GEN_Q", 0x0C63 },
+
+ /* GL 1.1 texturing */
+ { "GL_PROXY_TEXTURE_1D", 0x8063 },
+ { "GL_PROXY_TEXTURE_2D", 0x8064 },
+ { "GL_TEXTURE_PRIORITY", 0x8066 },
+ { "GL_TEXTURE_RESIDENT", 0x8067 },
+ { "GL_TEXTURE_BINDING_1D", 0x8068 },
+ { "GL_TEXTURE_BINDING_2D", 0x8069 },
+ { "GL_TEXTURE_INTERNAL_FORMAT", 0x1003 },
+
+ /* GL 1.2 texturing */
+ { "GL_PACK_SKIP_IMAGES", 0x806B },
+ { "GL_PACK_IMAGE_HEIGHT", 0x806C },
+ { "GL_UNPACK_SKIP_IMAGES", 0x806D },
+ { "GL_UNPACK_IMAGE_HEIGHT", 0x806E },
+ { "GL_TEXTURE_3D", 0x806F },
+ { "GL_PROXY_TEXTURE_3D", 0x8070 },
+ { "GL_TEXTURE_DEPTH", 0x8071 },
+ { "GL_TEXTURE_WRAP_R", 0x8072 },
+ { "GL_MAX_3D_TEXTURE_SIZE", 0x8073 },
+ { "GL_TEXTURE_BINDING_3D", 0x806A },
+
+ /* Internal texture formats (GL 1.1) */
+ { "GL_ALPHA4", 0x803B },
+ { "GL_ALPHA8", 0x803C },
+ { "GL_ALPHA12", 0x803D },
+ { "GL_ALPHA16", 0x803E },
+ { "GL_LUMINANCE4", 0x803F },
+ { "GL_LUMINANCE8", 0x8040 },
+ { "GL_LUMINANCE12", 0x8041 },
+ { "GL_LUMINANCE16", 0x8042 },
+ { "GL_LUMINANCE4_ALPHA4", 0x8043 },
+ { "GL_LUMINANCE6_ALPHA2", 0x8044 },
+ { "GL_LUMINANCE8_ALPHA8", 0x8045 },
+ { "GL_LUMINANCE12_ALPHA4", 0x8046 },
+ { "GL_LUMINANCE12_ALPHA12", 0x8047 },
+ { "GL_LUMINANCE16_ALPHA16", 0x8048 },
+ { "GL_INTENSITY", 0x8049 },
+ { "GL_INTENSITY4", 0x804A },
+ { "GL_INTENSITY8", 0x804B },
+ { "GL_INTENSITY12", 0x804C },
+ { "GL_INTENSITY16", 0x804D },
+ { "GL_R3_G3_B2", 0x2A10 },
+ { "GL_RGB4", 0x804F },
+ { "GL_RGB5", 0x8050 },
+ { "GL_RGB8", 0x8051 },
+ { "GL_RGB10", 0x8052 },
+ { "GL_RGB12", 0x8053 },
+ { "GL_RGB16", 0x8054 },
+ { "GL_RGBA2", 0x8055 },
+ { "GL_RGBA4", 0x8056 },
+ { "GL_RGB5_A1", 0x8057 },
+ { "GL_RGBA8", 0x8058 },
+ { "GL_RGB10_A2", 0x8059 },
+ { "GL_RGBA12", 0x805A },
+ { "GL_RGBA16", 0x805B },
+
+ /* Utility */
+ { "GL_VENDOR", 0x1F00 },
+ { "GL_RENDERER", 0x1F01 },
+ { "GL_VERSION", 0x1F02 },
+ { "GL_EXTENSIONS", 0x1F03 },
+
+ /* Errors */
+ { "GL_INVALID_VALUE", 0x0501 },
+ { "GL_INVALID_ENUM", 0x0500 },
+ { "GL_INVALID_OPERATION", 0x0502 },
+ { "GL_STACK_OVERFLOW", 0x0503 },
+ { "GL_STACK_UNDERFLOW", 0x0504 },
+ { "GL_OUT_OF_MEMORY", 0x0505 },
+
+ /*
+ * Extensions
+ */
+
+ { "GL_CONSTANT_COLOR_EXT", 0x8001 },
+ { "GL_ONE_MINUS_CONSTANT_COLOR_EXT", 0x8002 },
+ { "GL_CONSTANT_ALPHA_EXT", 0x8003 },
+ { "GL_ONE_MINUS_CONSTANT_ALPHA_EXT", 0x8004 },
+ { "GL_BLEND_EQUATION_EXT", 0x8009 },
+ { "GL_MIN_EXT", 0x8007 },
+ { "GL_MAX_EXT", 0x8008 },
+ { "GL_FUNC_ADD_EXT", 0x8006 },
+ { "GL_FUNC_SUBTRACT_EXT", 0x800A },
+ { "GL_FUNC_REVERSE_SUBTRACT_EXT", 0x800B },
+ { "GL_BLEND_COLOR_EXT", 0x8005 },
+
+ { "GL_POLYGON_OFFSET_EXT", 0x8037 },
+ { "GL_POLYGON_OFFSET_FACTOR_EXT", 0x8038 },
+ { "GL_POLYGON_OFFSET_BIAS_EXT", 0x8039 },
+
+
+ { "GL_VERTEX_ARRAY_EXT", 0x8074 },
+ { "GL_NORMAL_ARRAY_EXT", 0x8075 },
+ { "GL_COLOR_ARRAY_EXT", 0x8076 },
+ { "GL_INDEX_ARRAY_EXT", 0x8077 },
+ { "GL_TEXTURE_COORD_ARRAY_EXT", 0x8078 },
+ { "GL_EDGE_FLAG_ARRAY_EXT", 0x8079 },
+ { "GL_VERTEX_ARRAY_SIZE_EXT", 0x807A },
+ { "GL_VERTEX_ARRAY_TYPE_EXT", 0x807B },
+ { "GL_VERTEX_ARRAY_STRIDE_EXT", 0x807C },
+ { "GL_VERTEX_ARRAY_COUNT_EXT", 0x807D },
+ { "GL_NORMAL_ARRAY_TYPE_EXT", 0x807E },
+ { "GL_NORMAL_ARRAY_STRIDE_EXT", 0x807F },
+ { "GL_NORMAL_ARRAY_COUNT_EXT", 0x8080 },
+ { "GL_COLOR_ARRAY_SIZE_EXT", 0x8081 },
+ { "GL_COLOR_ARRAY_TYPE_EXT", 0x8082 },
+ { "GL_COLOR_ARRAY_STRIDE_EXT", 0x8083 },
+ { "GL_COLOR_ARRAY_COUNT_EXT", 0x8084 },
+ { "GL_INDEX_ARRAY_TYPE_EXT", 0x8085 },
+ { "GL_INDEX_ARRAY_STRIDE_EXT", 0x8086 },
+ { "GL_INDEX_ARRAY_COUNT_EXT", 0x8087 },
+ { "GL_TEXTURE_COORD_ARRAY_SIZE_EXT", 0x8088 },
+ { "GL_TEXTURE_COORD_ARRAY_TYPE_EXT", 0x8089 },
+ { "GL_TEXTURE_COORD_ARRAY_STRIDE_EXT", 0x808A },
+ { "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", 0x808B },
+ { "GL_EDGE_FLAG_ARRAY_STRIDE_EXT", 0x808C },
+ { "GL_EDGE_FLAG_ARRAY_COUNT_EXT", 0x808D },
+ { "GL_VERTEX_ARRAY_POINTER_EXT", 0x808E },
+ { "GL_NORMAL_ARRAY_POINTER_EXT", 0x808F },
+ { "GL_COLOR_ARRAY_POINTER_EXT", 0x8090 },
+ { "GL_INDEX_ARRAY_POINTER_EXT", 0x8091 },
+ { "GL_TEXTURE_COORD_ARRAY_POINTER_EXT", 0x8092 },
+ { "GL_EDGE_FLAG_ARRAY_POINTER_EXT", 0x8093 },
+
+ { "GL_TEXTURE_PRIORITY_EXT", 0x8066 },
+ { "GL_TEXTURE_RESIDENT_EXT", 0x8067 },
+ { "GL_TEXTURE_1D_BINDING_EXT", 0x8068 },
+ { "GL_TEXTURE_2D_BINDING_EXT", 0x8069 },
+
+ { "GL_PACK_SKIP_IMAGES_EXT", 0x806B },
+ { "GL_PACK_IMAGE_HEIGHT_EXT", 0x806C },
+ { "GL_UNPACK_SKIP_IMAGES_EXT", 0x806D },
+ { "GL_UNPACK_IMAGE_HEIGHT_EXT", 0x806E },
+ { "GL_TEXTURE_3D_EXT", 0x806F },
+ { "GL_PROXY_TEXTURE_3D_EXT", 0x8070 },
+ { "GL_TEXTURE_DEPTH_EXT", 0x8071 },
+ { "GL_TEXTURE_WRAP_R_EXT", 0x8072 },
+ { "GL_MAX_3D_TEXTURE_SIZE_EXT", 0x8073 },
+ { "GL_TEXTURE_3D_BINDING_EXT", 0x806A },
+
+ { "GL_TABLE_TOO_LARGE_EXT", 0x8031 },
+ { "GL_COLOR_TABLE_FORMAT_EXT", 0x80D8 },
+ { "GL_COLOR_TABLE_WIDTH_EXT", 0x80D9 },
+ { "GL_COLOR_TABLE_RED_SIZE_EXT", 0x80DA },
+ { "GL_COLOR_TABLE_GREEN_SIZE_EXT", 0x80DB },
+ { "GL_COLOR_TABLE_BLUE_SIZE_EXT", 0x80DC },
+ { "GL_COLOR_TABLE_ALPHA_SIZE_EXT", 0x80DD },
+ { "GL_COLOR_TABLE_LUMINANCE_SIZE_EXT", 0x80DE },
+ { "GL_COLOR_TABLE_INTENSITY_SIZE_EXT", 0x80DF },
+ { "GL_TEXTURE_INDEX_SIZE_EXT", 0x80ED },
+ { "GL_COLOR_INDEX1_EXT", 0x80E2 },
+ { "GL_COLOR_INDEX2_EXT", 0x80E3 },
+ { "GL_COLOR_INDEX4_EXT", 0x80E4 },
+ { "GL_COLOR_INDEX8_EXT", 0x80E5 },
+ { "GL_COLOR_INDEX12_EXT", 0x80E6 },
+ { "GL_COLOR_INDEX16_EXT", 0x80E7 },
+
+ { "GL_SHARED_TEXTURE_PALETTE_EXT", 0x81FB },
+
+ { "GL_POINT_SIZE_MIN_EXT", 0x8126 },
+ { "GL_POINT_SIZE_MAX_EXT", 0x8127 },
+ { "GL_POINT_FADE_THRESHOLD_SIZE_EXT", 0x8128 },
+ { "GL_DISTANCE_ATTENUATION_EXT", 0x8129 },
+
+ { "GL_RESCALE_NORMAL_EXT", 0x803A },
+
+ { "GL_ABGR_EXT", 0x8000 },
+
+ { "GL_INCR_WRAP_EXT", 0x8507 },
+ { "GL_DECR_WRAP_EXT", 0x8508 },
+
+ { "GL_CLAMP_TO_EDGE_SGIS", 0x812F },
+
+ { "GL_BLEND_DST_RGB_INGR", 0x80C8 },
+ { "GL_BLEND_SRC_RGB_INGR", 0x80C9 },
+ { "GL_BLEND_DST_ALPHA_INGR", 0x80CA },
+ { "GL_BLEND_SRC_ALPHA_INGR", 0x80CB },
+
+ { "GL_RESCALE_NORMAL", 0x803A },
+ { "GL_CLAMP_TO_EDGE", 0x812F },
+ { "GL_MAX_ELEMENTS_VERTICES", 0xF0E8 },
+ { "GL_MAX_ELEMENTS_INDICES", 0xF0E9 },
+ { "GL_BGR", 0x80E0 },
+ { "GL_BGRA", 0x80E1 },
+ { "GL_UNSIGNED_BYTE_3_3_2", 0x8032 },
+ { "GL_UNSIGNED_BYTE_2_3_3_REV", 0x8362 },
+ { "GL_UNSIGNED_SHORT_5_6_5", 0x8363 },
+ { "GL_UNSIGNED_SHORT_5_6_5_REV", 0x8364 },
+ { "GL_UNSIGNED_SHORT_4_4_4_4", 0x8033 },
+ { "GL_UNSIGNED_SHORT_4_4_4_4_REV", 0x8365 },
+ { "GL_UNSIGNED_SHORT_5_5_5_1", 0x8034 },
+ { "GL_UNSIGNED_SHORT_1_5_5_5_REV", 0x8366 },
+ { "GL_UNSIGNED_INT_8_8_8_8", 0x8035 },
+ { "GL_UNSIGNED_INT_8_8_8_8_REV", 0x8367 },
+ { "GL_UNSIGNED_INT_10_10_10_2", 0x8036 },
+ { "GL_UNSIGNED_INT_2_10_10_10_REV", 0x8368 },
+ { "GL_LIGHT_MODEL_COLOR_CONTROL", 0x81F8 },
+ { "GL_SINGLE_COLOR", 0x81F9 },
+ { "GL_SEPARATE_SPECULAR_COLOR", 0x81FA },
+ { "GL_TEXTURE_MIN_LOD", 0x813A },
+ { "GL_TEXTURE_MAX_LOD", 0x813B },
+ { "GL_TEXTURE_BASE_LEVEL", 0x813C },
+ { "GL_TEXTURE_MAX_LEVEL", 0x813D },
+
+ { "GL_TEXTURE0_ARB", 0x84C0 },
+ { "GL_TEXTURE1_ARB", 0x84C1 },
+ { "GL_TEXTURE2_ARB", 0x84C2 },
+ { "GL_TEXTURE3_ARB", 0x84C3 },
+ { "GL_ACTIVE_TEXTURE_ARB", 0x84E0 },
+ { "GL_CLIENT_ACTIVE_TEXTURE_ARB", 0x84E1 },
+ { "GL_MAX_TEXTURE_UNITS_ARB", 0x84E2 },
+
+ { "GL_OCCLUSION_TEST_HP", 0x8165 },
+ { "GL_OCCLUSION_TEST_RESULT_HP", 0x8166 },
+
+ { "GL_TEXTURE_FILTER_CONTROL_EXT", 0x8500 },
+ { "GL_TEXTURE_LOD_BIAS_EXT", 0x8501 },
+
+ /* GL_ARB_texture_cube_map */
+ { "GL_NORMAL_MAP_ARB", 0x8511 },
+ { "GL_REFLECTION_MAP_ARB", 0x8512 },
+ { "GL_TEXTURE_CUBE_MAP_ARB", 0x8513 },
+ { "GL_TEXTURE_BINDING_CUBE_MAP_ARB", 0x8514 },
+ { "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB", 0x8515 },
+ { "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB", 0x8516 },
+ { "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB", 0x8517 },
+ { "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB", 0x8518 },
+ { "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB", 0x8519 },
+ { "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB", 0x851a },
+ { "GL_PROXY_TEXTURE_CUBE_MAP_ARB", 0x851b },
+ { "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", 0x851c },
+
+ { "GL_PREFER_DOUBLEBUFFER_HINT_PGI", 107000 },
+ { "GL_STRICT_DEPTHFUNC_HINT_PGI", 107030 },
+ { "GL_STRICT_LIGHTING_HINT_PGI", 107031 },
+ { "GL_STRICT_SCISSOR_HINT_PGI", 107032 },
+ { "GL_FULL_STIPPLE_HINT_PGI", 107033 },
+ { "GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI", 107011 },
+ { "GL_NATIVE_GRAPHICS_END_HINT_PGI", 107012 },
+ { "GL_CONSERVE_MEMORY_HINT_PGI", 107005 },
+ { "GL_RECLAIM_MEMORY_HINT_PGI", 107006 },
+ { "GL_ALWAYS_FAST_HINT_PGI", 107020 },
+ { "GL_ALWAYS_SOFT_HINT_PGI", 107021 },
+ { "GL_ALLOW_DRAW_OBJ_HINT_PGI", 107022 },
+ { "GL_ALLOW_DRAW_WIN_HINT_PGI", 107023 },
+ { "GL_ALLOW_DRAW_FRG_HINT_PGI", 107024 },
+ { "GL_ALLOW_DRAW_SPN_HINT_PGI", 107024 },
+ { "GL_ALLOW_DRAW_MEM_HINT_PGI", 107025 },
+ { "GL_CLIP_NEAR_HINT_PGI", 107040 },
+ { "GL_CLIP_FAR_HINT_PGI", 107041 },
+ { "GL_WIDE_LINE_HINT_PGI", 107042 },
+ { "GL_BACK_NORMALS_HINT_PGI", 107043 },
+ { "GL_NATIVE_GRAPHICS_HANDLE_PGI", 107010 },
+
+ /* GL_EXT_compiled_vertex_array */
+ { "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", 0x81A8},
+ { "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", 0x81A9},
+
+ /* GL_EXT_clip_volume_hint */
+ { "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0},
+
+ /* GL_EXT_texture_env_combine */
+ { "GL_COMBINE_EXT", 0x8570 },
+ { "GL_COMBINE_RGB_EXT", 0x8571 },
+ { "GL_COMBINE_ALPHA_EXT", 0x8572 },
+ { "GL_SOURCE0_RGB_EXT", 0x8580 },
+ { "GL_SOURCE1_RGB_EXT", 0x8581 },
+ { "GL_SOURCE2_RGB_EXT", 0x8582 },
+ { "GL_SOURCE0_ALPHA_EXT", 0x8588 },
+ { "GL_SOURCE1_ALPHA_EXT", 0x8589 },
+ { "GL_SOURCE2_ALPHA_EXT", 0x858A },
+ { "GL_OPERAND0_RGB_EXT", 0x8590 },
+ { "GL_OPERAND1_RGB_EXT", 0x8591 },
+ { "GL_OPERAND2_RGB_EXT", 0x8592 },
+ { "GL_OPERAND0_ALPHA_EXT", 0x8598 },
+ { "GL_OPERAND1_ALPHA_EXT", 0x8599 },
+ { "GL_OPERAND2_ALPHA_EXT", 0x859A },
+ { "GL_RGB_SCALE_EXT", 0x8573 },
+ { "GL_ADD_SIGNED_EXT", 0x8574 },
+ { "GL_INTERPOLATE_EXT", 0x8575 },
+ { "GL_CONSTANT_EXT", 0x8576 },
+ { "GL_PRIMARY_COLOR_EXT", 0x8577 },
+ { "GL_PREVIOUS_EXT", 0x8578 },
+
+ /* GL_ARB_texture_env_combine */
+ { "GL_SUBTRACT_ARB", 0x84E7 },
+
+ /* GL_EXT_texture_env_dot3 */
+ { "GL_DOT3_RGB_EXT", 0x8740 },
+ { "GL_DOT3_RGBA_EXT", 0x8741 },
+
+ /* GL_ARB_texture_env_dot3 */
+ { "GL_DOT3_RGB_ARB", 0x86ae },
+ { "GL_DOT3_RGBA_ARB", 0x86af },
+
+ /* GL_ARB_texture_border_clamp */
+ { "GL_CLAMP_TO_BORDER_ARB", 0x812D },
+
+ /* GL_ATI_texture_env_combine3 */
+ { "GL_MODULATE_ADD_ATI", 0x8744 },
+ { "GL_MODULATE_SIGNED_ADD_ATI", 0x8745 },
+ { "GL_MODULATE_SUBTRACT_ATI", 0x8746 },
+
+ /* GL_ARB_texture_compression */
+ { "GL_COMPRESSED_ALPHA_ARB", 0x84E9 },
+ { "GL_COMPRESSED_LUMINANCE_ARB", 0x84EA },
+ { "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", 0x84EB },
+ { "GL_COMPRESSED_INTENSITY_ARB", 0x84EC },
+ { "GL_COMPRESSED_RGB_ARB", 0x84ED },
+ { "GL_COMPRESSED_RGBA_ARB", 0x84EE },
+ { "GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB", 0x86A0 },
+ { "GL_TEXTURE_COMPRESSED_ARB", 0x86A1 },
+ { "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", 0x86A2 },
+ { "GL_COMPRESSED_TEXTURE_FORMATS_ARB", 0x86A3 },
+
+ /* GL_EXT_texture_compression_s3tc */
+ { "GL_COMPRESSED_RGB_S3TC_DXT1_EXT", 0x83F0 },
+ { "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT", 0x83F1 },
+ { "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT", 0x83F2 },
+ { "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT", 0x83F3 },
+
+ /* GL_S3_s3tc */
+ { "GL_RGB_S3TC", 0x83A0 },
+ { "GL_RGB4_S3TC", 0x83A1 },
+ { "GL_RGBA_S3TC", 0x83A2 },
+ { "GL_RGBA4_S3TC", 0x83A3 },
+
+ /* GL_3DFX_texture_compression_FXT1 */
+ { "GL_COMPRESSED_RGB_FXT1_3DFX", 0x86B0 },
+ { "GL_COMPRESSED_RGBA_FXT1_3DFX", 0x86B1 },
+};
+
+#define Elements(x) sizeof(x)/sizeof(*x)
+
+typedef int (GLWINAPIV *cfunc)(const void *, const void *);
+
+static enum_elt **index1 = 0;
+static int sorted = 0;
+
+static int compar_name( const enum_elt *a, const enum_elt *b )
+{
+ return _mesa_strcmp(a->c, b->c);
+}
+
+
+/* note the extra level of indirection
+ */
+static int compar_nr( const enum_elt **a, const enum_elt **b )
+{
+ return (*a)->n - (*b)->n;
+}
+
+
+static void sort_enums( void )
+{
+ GLuint i;
+ index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) );
+ sorted = 1;
+
+ if (!index1)
+ return; /* what else can we do? */
+
+ qsort( all_enums, Elements(all_enums), sizeof(*all_enums),
+ (cfunc) compar_name );
+
+ for (i = 0 ; i < Elements(all_enums) ; i++)
+ index1[i] = &all_enums[i];
+
+ qsort( index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr );
+}
+
+
+
+int _mesa_lookup_enum_by_name( const char *symbol )
+{
+ enum_elt tmp;
+ enum_elt *e;
+
+ if (!sorted)
+ sort_enums();
+
+ if (!symbol)
+ return 0;
+
+ tmp.c = symbol;
+ e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums),
+ sizeof(*all_enums), (cfunc) compar_name );
+
+ return e ? e->n : -1;
+}
+
+
+static char token_tmp[20];
+
+const char *_mesa_lookup_enum_by_nr( int nr )
+{
+ enum_elt tmp, *e, **f;
+
+ if (!sorted)
+ sort_enums();
+
+ tmp.n = nr;
+ e = &tmp;
+
+ f = (enum_elt **)bsearch( &e, index1, Elements(all_enums),
+ sizeof(*index1), (cfunc) compar_nr );
+
+ if (f) {
+ return (*f)->c;
+ }
+ else {
+ /* this isn't re-entrant safe, no big deal here */
+ _mesa_sprintf(token_tmp, "0x%x", nr);
+ return token_tmp;
+ }
+}
Index: xc/extras/Mesa/src/mesa/main/enums.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/enums.h:1.2
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/enums.h Wed Jun 23 15:40:14 2004
@@ -0,0 +1,55 @@
+/**
+ * \file enums.h
+ * Enumeration name/number lookup functions.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/* $XFree86: xc/extras/Mesa/src/mesa/main/enums.h,v 1.2 2004/06/23 19:40:14 tsi Exp $ */
+
+#ifndef _ENUMS_H_
+#define _ENUMS_H_
+
+
+#if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL
+
+extern const char *_mesa_lookup_enum_by_nr( int nr );
+extern int _mesa_lookup_enum_by_name( const char *symbol );
+
+#else
+
+/** No-op */
+#define _mesa_lookup_enum_by_name( s ) 0
+
+/** No-op */
+#define _mesa_lookup_enum_by_nr( n ) "unknown"
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/eval.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/eval.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/eval.c Thu Apr 8 05:17:43 2004
@@ -0,0 +1,962 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * eval.c was written by
+ * Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and
+ * Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de).
+ *
+ * My original implementation of evaluators was simplistic and didn't
+ * compute surface normal vectors properly. Bernd and Volker applied
+ * used more sophisticated methods to get better results.
+ *
+ * Thanks guys!
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "context.h"
+#include "eval.h"
+#include "macros.h"
+#include "mtypes.h"
+
+
+/*
+ * Return the number of components per control point for any type of
+ * evaluator. Return 0 if bad target.
+ * See table 5.1 in the OpenGL 1.2 spec.
+ */
+GLuint _mesa_evaluator_components( GLenum target )
+{
+ switch (target) {
+ case GL_MAP1_VERTEX_3: return 3;
+ case GL_MAP1_VERTEX_4: return 4;
+ case GL_MAP1_INDEX: return 1;
+ case GL_MAP1_COLOR_4: return 4;
+ case GL_MAP1_NORMAL: return 3;
+ case GL_MAP1_TEXTURE_COORD_1: return 1;
+ case GL_MAP1_TEXTURE_COORD_2: return 2;
+ case GL_MAP1_TEXTURE_COORD_3: return 3;
+ case GL_MAP1_TEXTURE_COORD_4: return 4;
+ case GL_MAP2_VERTEX_3: return 3;
+ case GL_MAP2_VERTEX_4: return 4;
+ case GL_MAP2_INDEX: return 1;
+ case GL_MAP2_COLOR_4: return 4;
+ case GL_MAP2_NORMAL: return 3;
+ case GL_MAP2_TEXTURE_COORD_1: return 1;
+ case GL_MAP2_TEXTURE_COORD_2: return 2;
+ case GL_MAP2_TEXTURE_COORD_3: return 3;
+ case GL_MAP2_TEXTURE_COORD_4: return 4;
+ default: break;
+ }
+
+ /* XXX need to check for the vertex program extension
+ if (!ctx->Extensions.NV_vertex_program)
+ return 0;
+ */
+
+ if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV &&
+ target <= GL_MAP1_VERTEX_ATTRIB15_4_NV)
+ return 4;
+
+ if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV &&
+ target <= GL_MAP2_VERTEX_ATTRIB15_4_NV)
+ return 4;
+
+ return 0;
+}
+
+
+/*
+ * Return pointer to the gl_1d_map struct for the named target.
+ */
+static struct gl_1d_map *
+get_1d_map( GLcontext *ctx, GLenum target )
+{
+ switch (target) {
+ case GL_MAP1_VERTEX_3:
+ return &ctx->EvalMap.Map1Vertex3;
+ case GL_MAP1_VERTEX_4:
+ return &ctx->EvalMap.Map1Vertex4;
+ case GL_MAP1_INDEX:
+ return &ctx->EvalMap.Map1Index;
+ case GL_MAP1_COLOR_4:
+ return &ctx->EvalMap.Map1Color4;
+ case GL_MAP1_NORMAL:
+ return &ctx->EvalMap.Map1Normal;
+ case GL_MAP1_TEXTURE_COORD_1:
+ return &ctx->EvalMap.Map1Texture1;
+ case GL_MAP1_TEXTURE_COORD_2:
+ return &ctx->EvalMap.Map1Texture2;
+ case GL_MAP1_TEXTURE_COORD_3:
+ return &ctx->EvalMap.Map1Texture3;
+ case GL_MAP1_TEXTURE_COORD_4:
+ return &ctx->EvalMap.Map1Texture4;
+ case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ if (!ctx->Extensions.NV_vertex_program)
+ return NULL;
+ return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV];
+ default:
+ return NULL;
+ }
+}
+
+
+/*
+ * Return pointer to the gl_2d_map struct for the named target.
+ */
+static struct gl_2d_map *
+get_2d_map( GLcontext *ctx, GLenum target )
+{
+ switch (target) {
+ case GL_MAP2_VERTEX_3:
+ return &ctx->EvalMap.Map2Vertex3;
+ case GL_MAP2_VERTEX_4:
+ return &ctx->EvalMap.Map2Vertex4;
+ case GL_MAP2_INDEX:
+ return &ctx->EvalMap.Map2Index;
+ case GL_MAP2_COLOR_4:
+ return &ctx->EvalMap.Map2Color4;
+ case GL_MAP2_NORMAL:
+ return &ctx->EvalMap.Map2Normal;
+ case GL_MAP2_TEXTURE_COORD_1:
+ return &ctx->EvalMap.Map2Texture1;
+ case GL_MAP2_TEXTURE_COORD_2:
+ return &ctx->EvalMap.Map2Texture2;
+ case GL_MAP2_TEXTURE_COORD_3:
+ return &ctx->EvalMap.Map2Texture3;
+ case GL_MAP2_TEXTURE_COORD_4:
+ return &ctx->EvalMap.Map2Texture4;
+ case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ if (!ctx->Extensions.NV_vertex_program)
+ return NULL;
+ return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV];
+ default:
+ return NULL;
+ }
+}
+
+
+/**********************************************************************/
+/*** Copy and deallocate control points ***/
+/**********************************************************************/
+
+
+/*
+ * Copy 1-parametric evaluator control points from user-specified
+ * memory space to a buffer of contiguous control points.
+ * \param see glMap1f for details
+ * \return pointer to buffer of contiguous control points or NULL if out
+ * of memory.
+ */
+GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
+ const GLfloat *points )
+{
+ GLfloat *buffer, *p;
+ GLint i, k, size = _mesa_evaluator_components(target);
+
+ if (!points || !size)
+ return NULL;
+
+ buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
+
+ if (buffer)
+ for (i = 0, p = buffer; i < uorder; i++, points += ustride)
+ for (k = 0; k < size; k++)
+ *p++ = points[k];
+
+ return buffer;
+}
+
+
+
+/*
+ * Same as above but convert doubles to floats.
+ */
+GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
+ const GLdouble *points )
+{
+ GLfloat *buffer, *p;
+ GLint i, k, size = _mesa_evaluator_components(target);
+
+ if (!points || !size)
+ return NULL;
+
+ buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
+
+ if (buffer)
+ for (i = 0, p = buffer; i < uorder; i++, points += ustride)
+ for (k = 0; k < size; k++)
+ *p++ = (GLfloat) points[k];
+
+ return buffer;
+}
+
+
+
+/*
+ * Copy 2-parametric evaluator control points from user-specified
+ * memory space to a buffer of contiguous control points.
+ * Additional memory is allocated to be used by the horner and
+ * de Casteljau evaluation schemes.
+ *
+ * \param see glMap2f for details
+ * \return pointer to buffer of contiguous control points or NULL if out
+ * of memory.
+ */
+GLfloat *_mesa_copy_map_points2f( GLenum target,
+ GLint ustride, GLint uorder,
+ GLint vstride, GLint vorder,
+ const GLfloat *points )
+{
+ GLfloat *buffer, *p;
+ GLint i, j, k, size, dsize, hsize;
+ GLint uinc;
+
+ size = _mesa_evaluator_components(target);
+
+ if (!points || size==0) {
+ return NULL;
+ }
+
+ /* max(uorder, vorder) additional points are used in */
+ /* horner evaluation and uorder*vorder additional */
+ /* values are needed for de Casteljau */
+ dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder;
+ hsize = (uorder > vorder ? uorder : vorder)*size;
+
+ if(hsize>dsize)
+ buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ else
+ buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
+
+ /* compute the increment value for the u-loop */
+ uinc = ustride - vorder*vstride;
+
+ if (buffer)
+ for (i=0, p=buffer; i vorder ? uorder : vorder)*size;
+
+ if(hsize>dsize)
+ buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ else
+ buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
+
+ /* compute the increment value for the u-loop */
+ uinc = ustride - vorder*vstride;
+
+ if (buffer)
+ for (i=0, p=buffer; i MAX_EVAL_ORDER) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(order)" );
+ return;
+ }
+ if (!points) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(points)" );
+ return;
+ }
+
+ k = _mesa_evaluator_components( target );
+ if (k == 0) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
+ }
+
+ if (ustride < k) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" );
+ return;
+ }
+
+ if (ctx->Texture.CurrentUnit != 0) {
+ /* See OpenGL 1.2.1 spec, section F.2.13 */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
+ return;
+ }
+
+ map = get_1d_map(ctx, target);
+ if (!map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
+ return;
+ }
+
+ /* make copy of the control points */
+ if (type == GL_FLOAT)
+ pnts = _mesa_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
+ else
+ pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
+
+
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ map->Order = uorder;
+ map->u1 = u1;
+ map->u2 = u2;
+ map->du = 1.0F / (u2 - u1);
+ if (map->Points)
+ FREE( map->Points );
+ map->Points = pnts;
+}
+
+
+
+void GLAPIENTRY
+_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+ GLint order, const GLfloat *points )
+{
+ map1(target, u1, u2, stride, order, points, GL_FLOAT);
+}
+
+
+void GLAPIENTRY
+_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+ GLint order, const GLdouble *points )
+{
+ map1(target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE);
+}
+
+
+static void
+map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+ GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+ const GLvoid *points, GLenum type )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint k;
+ GLfloat *pnts;
+ struct gl_2d_map *map = NULL;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
+
+ if (u1==u2) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
+ return;
+ }
+
+ if (v1==v2) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" );
+ return;
+ }
+
+ if (uorder<1 || uorder>MAX_EVAL_ORDER) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" );
+ return;
+ }
+
+ if (vorder<1 || vorder>MAX_EVAL_ORDER) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" );
+ return;
+ }
+
+ k = _mesa_evaluator_components( target );
+ if (k==0) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
+ }
+
+ if (ustride < k) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" );
+ return;
+ }
+ if (vstride < k) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" );
+ return;
+ }
+
+ if (ctx->Texture.CurrentUnit != 0) {
+ /* See OpenGL 1.2.1 spec, section F.2.13 */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
+ return;
+ }
+
+ map = get_2d_map(ctx, target);
+ if (!map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
+ return;
+ }
+
+ /* make copy of the control points */
+ if (type == GL_FLOAT)
+ pnts = _mesa_copy_map_points2f(target, ustride, uorder,
+ vstride, vorder, (GLfloat*) points);
+ else
+ pnts = _mesa_copy_map_points2d(target, ustride, uorder,
+ vstride, vorder, (GLdouble*) points);
+
+
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ map->Uorder = uorder;
+ map->u1 = u1;
+ map->u2 = u2;
+ map->du = 1.0F / (u2 - u1);
+ map->Vorder = vorder;
+ map->v1 = v1;
+ map->v2 = v2;
+ map->dv = 1.0F / (v2 - v1);
+ if (map->Points)
+ FREE( map->Points );
+ map->Points = pnts;
+}
+
+
+void GLAPIENTRY
+_mesa_Map2f( GLenum target,
+ GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+ GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+ const GLfloat *points)
+{
+ map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
+ points, GL_FLOAT);
+}
+
+
+void GLAPIENTRY
+_mesa_Map2d( GLenum target,
+ GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+ GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+ const GLdouble *points )
+{
+ map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder,
+ (GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE);
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_1d_map *map1d;
+ struct gl_2d_map *map2d;
+ GLint i, n;
+ GLfloat *data;
+ GLuint comps;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ comps = _mesa_evaluator_components(target);
+ if (!comps) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
+ return;
+ }
+
+ map1d = get_1d_map(ctx, target);
+ map2d = get_2d_map(ctx, target);
+ ASSERT(map1d || map2d);
+
+ switch (query) {
+ case GL_COEFF:
+ if (map1d) {
+ data = map1d->Points;
+ n = map1d->Order * comps;
+ }
+ else {
+ data = map2d->Points;
+ n = map2d->Uorder * map2d->Vorder * comps;
+ }
+ if (data) {
+ for (i=0;iOrder;
+ }
+ else {
+ v[0] = (GLdouble) map2d->Uorder;
+ v[1] = (GLdouble) map2d->Vorder;
+ }
+ break;
+ case GL_DOMAIN:
+ if (map1d) {
+ v[0] = (GLdouble) map1d->u1;
+ v[1] = (GLdouble) map1d->u2;
+ }
+ else {
+ v[0] = (GLdouble) map2d->u1;
+ v[1] = (GLdouble) map2d->u2;
+ v[2] = (GLdouble) map2d->v1;
+ v[3] = (GLdouble) map2d->v2;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_1d_map *map1d;
+ struct gl_2d_map *map2d;
+ GLint i, n;
+ GLfloat *data;
+ GLuint comps;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ comps = _mesa_evaluator_components(target);
+ if (!comps) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
+ return;
+ }
+
+ map1d = get_1d_map(ctx, target);
+ map2d = get_2d_map(ctx, target);
+ ASSERT(map1d || map2d);
+
+ switch (query) {
+ case GL_COEFF:
+ if (map1d) {
+ data = map1d->Points;
+ n = map1d->Order * comps;
+ }
+ else {
+ data = map2d->Points;
+ n = map2d->Uorder * map2d->Vorder * comps;
+ }
+ if (data) {
+ for (i=0;iOrder;
+ }
+ else {
+ v[0] = (GLfloat) map2d->Uorder;
+ v[1] = (GLfloat) map2d->Vorder;
+ }
+ break;
+ case GL_DOMAIN:
+ if (map1d) {
+ v[0] = map1d->u1;
+ v[1] = map1d->u2;
+ }
+ else {
+ v[0] = map2d->u1;
+ v[1] = map2d->u2;
+ v[2] = map2d->v1;
+ v[3] = map2d->v2;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_1d_map *map1d;
+ struct gl_2d_map *map2d;
+ GLuint i, n;
+ GLfloat *data;
+ GLuint comps;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ comps = _mesa_evaluator_components(target);
+ if (!comps) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
+ return;
+ }
+
+ map1d = get_1d_map(ctx, target);
+ map2d = get_2d_map(ctx, target);
+ ASSERT(map1d || map2d);
+
+ switch (query) {
+ case GL_COEFF:
+ if (map1d) {
+ data = map1d->Points;
+ n = map1d->Order * comps;
+ }
+ else {
+ data = map2d->Points;
+ n = map2d->Uorder * map2d->Vorder * comps;
+ }
+ if (data) {
+ for (i=0;iOrder;
+ }
+ else {
+ v[0] = map2d->Uorder;
+ v[1] = map2d->Vorder;
+ }
+ break;
+ case GL_DOMAIN:
+ if (map1d) {
+ v[0] = IROUND(map1d->u1);
+ v[1] = IROUND(map1d->u2);
+ }
+ else {
+ v[0] = IROUND(map2d->u1);
+ v[1] = IROUND(map2d->u2);
+ v[2] = IROUND(map2d->v1);
+ v[3] = IROUND(map2d->v2);
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" );
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (un<1) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.MapGrid1un = un;
+ ctx->Eval.MapGrid1u1 = u1;
+ ctx->Eval.MapGrid1u2 = u2;
+ ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un;
+}
+
+
+void GLAPIENTRY
+_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
+{
+ _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 );
+}
+
+
+void GLAPIENTRY
+_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+ GLint vn, GLfloat v1, GLfloat v2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (un<1) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
+ return;
+ }
+ if (vn<1) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" );
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.MapGrid2un = un;
+ ctx->Eval.MapGrid2u1 = u1;
+ ctx->Eval.MapGrid2u2 = u2;
+ ctx->Eval.MapGrid2du = (u2 - u1) / (GLfloat) un;
+ ctx->Eval.MapGrid2vn = vn;
+ ctx->Eval.MapGrid2v1 = v1;
+ ctx->Eval.MapGrid2v2 = v2;
+ ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn;
+}
+
+
+void GLAPIENTRY
+_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+ GLint vn, GLdouble v1, GLdouble v2 )
+{
+ _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2,
+ vn, (GLfloat) v1, (GLfloat) v2 );
+}
+
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+/**
+ * Initialize a 1-D evaluator map.
+ */
+static void
+init_1d_map( struct gl_1d_map *map, int n, const float *initial )
+{
+ map->Order = 1;
+ map->u1 = 0.0;
+ map->u2 = 1.0;
+ map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+ if (map->Points) {
+ GLint i;
+ for (i=0;iPoints[i] = initial[i];
+ }
+}
+
+
+/**
+ * Initialize a 2-D evaluator map
+ */
+static void
+init_2d_map( struct gl_2d_map *map, int n, const float *initial )
+{
+ map->Uorder = 1;
+ map->Vorder = 1;
+ map->u1 = 0.0;
+ map->u2 = 1.0;
+ map->v1 = 0.0;
+ map->v2 = 1.0;
+ map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+ if (map->Points) {
+ GLint i;
+ for (i=0;iPoints[i] = initial[i];
+ }
+}
+
+
+void _mesa_init_eval( GLcontext *ctx )
+{
+ int i;
+
+ /* Evaluators group */
+ ctx->Eval.Map1Color4 = GL_FALSE;
+ ctx->Eval.Map1Index = GL_FALSE;
+ ctx->Eval.Map1Normal = GL_FALSE;
+ ctx->Eval.Map1TextureCoord1 = GL_FALSE;
+ ctx->Eval.Map1TextureCoord2 = GL_FALSE;
+ ctx->Eval.Map1TextureCoord3 = GL_FALSE;
+ ctx->Eval.Map1TextureCoord4 = GL_FALSE;
+ ctx->Eval.Map1Vertex3 = GL_FALSE;
+ ctx->Eval.Map1Vertex4 = GL_FALSE;
+ MEMSET(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib));
+ ctx->Eval.Map2Color4 = GL_FALSE;
+ ctx->Eval.Map2Index = GL_FALSE;
+ ctx->Eval.Map2Normal = GL_FALSE;
+ ctx->Eval.Map2TextureCoord1 = GL_FALSE;
+ ctx->Eval.Map2TextureCoord2 = GL_FALSE;
+ ctx->Eval.Map2TextureCoord3 = GL_FALSE;
+ ctx->Eval.Map2TextureCoord4 = GL_FALSE;
+ ctx->Eval.Map2Vertex3 = GL_FALSE;
+ ctx->Eval.Map2Vertex4 = GL_FALSE;
+ MEMSET(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib));
+ ctx->Eval.AutoNormal = GL_FALSE;
+ ctx->Eval.MapGrid1un = 1;
+ ctx->Eval.MapGrid1u1 = 0.0;
+ ctx->Eval.MapGrid1u2 = 1.0;
+ ctx->Eval.MapGrid2un = 1;
+ ctx->Eval.MapGrid2vn = 1;
+ ctx->Eval.MapGrid2u1 = 0.0;
+ ctx->Eval.MapGrid2u2 = 1.0;
+ ctx->Eval.MapGrid2v1 = 0.0;
+ ctx->Eval.MapGrid2v2 = 1.0;
+
+ /* Evaluator data */
+ {
+ static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 };
+ static GLfloat normal[3] = { 0.0, 0.0, 1.0 };
+ static GLfloat index[1] = { 1.0 };
+ static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
+ static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 };
+ static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 };
+
+ init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex );
+ init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex );
+ init_1d_map( &ctx->EvalMap.Map1Index, 1, index );
+ init_1d_map( &ctx->EvalMap.Map1Color4, 4, color );
+ init_1d_map( &ctx->EvalMap.Map1Normal, 3, normal );
+ init_1d_map( &ctx->EvalMap.Map1Texture1, 1, texcoord );
+ init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord );
+ init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord );
+ init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord );
+ for (i = 0; i < 16; i++)
+ init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib );
+
+ init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex );
+ init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex );
+ init_2d_map( &ctx->EvalMap.Map2Index, 1, index );
+ init_2d_map( &ctx->EvalMap.Map2Color4, 4, color );
+ init_2d_map( &ctx->EvalMap.Map2Normal, 3, normal );
+ init_2d_map( &ctx->EvalMap.Map2Texture1, 1, texcoord );
+ init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord );
+ init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord );
+ init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord );
+ for (i = 0; i < 16; i++)
+ init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib );
+ }
+}
+
+
+void _mesa_free_eval_data( GLcontext *ctx )
+{
+ int i;
+
+ /* Free evaluator data */
+ if (ctx->EvalMap.Map1Vertex3.Points)
+ FREE( ctx->EvalMap.Map1Vertex3.Points );
+ if (ctx->EvalMap.Map1Vertex4.Points)
+ FREE( ctx->EvalMap.Map1Vertex4.Points );
+ if (ctx->EvalMap.Map1Index.Points)
+ FREE( ctx->EvalMap.Map1Index.Points );
+ if (ctx->EvalMap.Map1Color4.Points)
+ FREE( ctx->EvalMap.Map1Color4.Points );
+ if (ctx->EvalMap.Map1Normal.Points)
+ FREE( ctx->EvalMap.Map1Normal.Points );
+ if (ctx->EvalMap.Map1Texture1.Points)
+ FREE( ctx->EvalMap.Map1Texture1.Points );
+ if (ctx->EvalMap.Map1Texture2.Points)
+ FREE( ctx->EvalMap.Map1Texture2.Points );
+ if (ctx->EvalMap.Map1Texture3.Points)
+ FREE( ctx->EvalMap.Map1Texture3.Points );
+ if (ctx->EvalMap.Map1Texture4.Points)
+ FREE( ctx->EvalMap.Map1Texture4.Points );
+ for (i = 0; i < 16; i++)
+ FREE((ctx->EvalMap.Map1Attrib[i].Points));
+
+ if (ctx->EvalMap.Map2Vertex3.Points)
+ FREE( ctx->EvalMap.Map2Vertex3.Points );
+ if (ctx->EvalMap.Map2Vertex4.Points)
+ FREE( ctx->EvalMap.Map2Vertex4.Points );
+ if (ctx->EvalMap.Map2Index.Points)
+ FREE( ctx->EvalMap.Map2Index.Points );
+ if (ctx->EvalMap.Map2Color4.Points)
+ FREE( ctx->EvalMap.Map2Color4.Points );
+ if (ctx->EvalMap.Map2Normal.Points)
+ FREE( ctx->EvalMap.Map2Normal.Points );
+ if (ctx->EvalMap.Map2Texture1.Points)
+ FREE( ctx->EvalMap.Map2Texture1.Points );
+ if (ctx->EvalMap.Map2Texture2.Points)
+ FREE( ctx->EvalMap.Map2Texture2.Points );
+ if (ctx->EvalMap.Map2Texture3.Points)
+ FREE( ctx->EvalMap.Map2Texture3.Points );
+ if (ctx->EvalMap.Map2Texture4.Points)
+ FREE( ctx->EvalMap.Map2Texture4.Points );
+ for (i = 0; i < 16; i++)
+ FREE((ctx->EvalMap.Map2Attrib[i].Points));
+}
Index: xc/extras/Mesa/src/mesa/main/eval.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/eval.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/eval.h Thu Apr 8 05:17:43 2004
@@ -0,0 +1,128 @@
+/**
+ * \file eval.h
+ * Eval operations.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef EVAL_H
+#define EVAL_H
+
+
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+
+extern void _mesa_init_eval( GLcontext *ctx );
+extern void _mesa_free_eval_data( GLcontext *ctx );
+
+
+extern GLuint _mesa_evaluator_components( GLenum target );
+
+
+extern void gl_free_control_points( GLcontext *ctx,
+ GLenum target, GLfloat *data );
+
+
+extern GLfloat *_mesa_copy_map_points1f( GLenum target,
+ GLint ustride, GLint uorder,
+ const GLfloat *points );
+
+extern GLfloat *_mesa_copy_map_points1d( GLenum target,
+ GLint ustride, GLint uorder,
+ const GLdouble *points );
+
+extern GLfloat *_mesa_copy_map_points2f( GLenum target,
+ GLint ustride, GLint uorder,
+ GLint vstride, GLint vorder,
+ const GLfloat *points );
+
+extern GLfloat *_mesa_copy_map_points2d(GLenum target,
+ GLint ustride, GLint uorder,
+ GLint vstride, GLint vorder,
+ const GLdouble *points );
+
+
+
+extern void GLAPIENTRY
+_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+ GLint order, const GLfloat *points );
+
+extern void GLAPIENTRY
+_mesa_Map2f( GLenum target,
+ GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+ GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+ const GLfloat *points );
+
+extern void GLAPIENTRY
+_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+ GLint order, const GLdouble *points );
+
+extern void GLAPIENTRY
+_mesa_Map2d( GLenum target,
+ GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+ GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+ const GLdouble *points );
+
+extern void GLAPIENTRY
+_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
+
+extern void GLAPIENTRY
+_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
+
+extern void GLAPIENTRY
+_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+ GLint vn, GLfloat v1, GLfloat v2 );
+
+extern void GLAPIENTRY
+_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+ GLint vn, GLdouble v1, GLdouble v2 );
+
+extern void GLAPIENTRY
+_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v );
+
+extern void GLAPIENTRY
+_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v );
+
+extern void GLAPIENTRY
+_mesa_GetMapiv( GLenum target, GLenum query, GLint *v );
+
+#else
+
+/** No-op */
+#define _mesa_init_eval( c ) ((void)0)
+
+/** No-op */
+#define _mesa_free_eval_data( c ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/extensions.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/extensions.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:26 2005
+++ xc/extras/Mesa/src/mesa/main/extensions.c Fri Dec 10 10:05:23 2004
@@ -0,0 +1,461 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "extensions.h"
+#include "simple_list.h"
+#include "mtypes.h"
+
+
+#define F(x) (int)(unsigned long)&(((struct gl_extensions *)0)->x)
+#define ON GL_TRUE
+#define OFF GL_FALSE
+
+
+/*
+ * Note: The GL_MESAX_* extensions are placeholders for future ARB extensions.
+ */
+static const struct {
+ GLboolean enabled;
+ const char *name;
+ int flag_offset;
+} default_extensions[] = {
+ { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) },
+ { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
+ { OFF, "GL_MESAX_half_float_pixel", F(ARB_half_float_pixel) },
+ { OFF, "GL_ARB_imaging", F(ARB_imaging) },
+ { OFF, "GL_ARB_multisample", F(ARB_multisample) },
+ { OFF, "GL_ARB_multitexture", F(ARB_multitexture) },
+ { OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) },
+ { OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) },
+ { OFF, "GL_ARB_point_sprite", F(ARB_point_sprite) },
+ { OFF, "GL_ARB_shadow", F(ARB_shadow) },
+ { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) },
+ { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) },
+ { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) },
+ { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) },
+ { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) },
+ { OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) },
+ { OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) },
+ { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) },
+ { OFF, "GL_MESAX_texture_float", F(ARB_texture_float) },
+ { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
+ { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)},
+ { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) },
+ { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) },
+ { OFF, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) },
+ { OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) },
+ { ON, "GL_ARB_window_pos", F(ARB_window_pos) },
+ { ON, "GL_EXT_abgr", F(EXT_abgr) },
+ { ON, "GL_EXT_bgra", F(EXT_bgra) },
+ { OFF, "GL_EXT_blend_color", F(EXT_blend_color) },
+ { OFF, "GL_EXT_blend_equation_separate", F(EXT_blend_equation_separate) },
+ { OFF, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate) },
+ { OFF, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) },
+ { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) },
+ { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) },
+ { ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) },
+ { OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) },
+ { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) },
+ { OFF, "GL_EXT_convolution", F(EXT_convolution) },
+ { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
+ { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
+ { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) },
+ { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) },
+ { OFF, "GL_EXT_histogram", F(EXT_histogram) },
+ { OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) },
+ { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) },
+ { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) },
+ { OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) },
+ { OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) },
+ { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) },
+ { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) },
+ { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) },
+ { ON, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color) },
+ { OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) },
+ { OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) },
+ { OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) },
+ { OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) },
+ { ON, "GL_EXT_subtexture", F(EXT_subtexture) },
+ { ON, "GL_EXT_texture", F(EXT_texture) },
+ { ON, "GL_EXT_texture3D", F(EXT_texture3D) },
+ { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) },
+ { ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
+ { OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) },
+ { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) },
+ { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) },
+ { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) },
+ { OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) },
+ { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) },
+ { ON, "GL_EXT_texture_object", F(EXT_texture_object) },
+ { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) },
+ { ON, "GL_EXT_vertex_array", F(EXT_vertex_array) },
+ { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) },
+ { OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) },
+ { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) },
+ { ON, "GL_APPLE_packed_pixels", F(APPLE_packed_pixels) },
+ { OFF, "GL_ATI_blend_equation_separate", F(EXT_blend_equation_separate) },
+ { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)},
+ { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)},
+ { OFF, "GL_HP_occlusion_test", F(HP_occlusion_test) },
+ { OFF, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) },
+ { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
+ { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
+ { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) },
+ { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) },
+ { OFF, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil) },
+ { OFF, "GL_MESA_program_debug", F(MESA_program_debug) },
+ { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
+ { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
+ { ON, "GL_MESA_window_pos", F(ARB_window_pos) },
+ { OFF, "GL_NV_blend_square", F(NV_blend_square) },
+ { OFF, "GL_NV_fragment_program", F(NV_fragment_program) },
+ { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) },
+ { OFF, "GL_NV_point_sprite", F(NV_point_sprite) },
+ { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) },
+ { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
+ { OFF, "GL_NV_vertex_program", F(NV_vertex_program) },
+ { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
+ { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) },
+ { OFF, "GL_SGI_color_table", F(SGI_color_table) },
+ { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
+ { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
+ { OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) },
+ { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
+ { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
+ { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) },
+ { OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) },
+ { OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) },
+ { OFF, "GL_SGIX_shadow", F(SGIX_shadow) },
+ { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) },
+ { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) },
+ { OFF, "GL_S3_s3tc", F(S3_s3tc) },
+};
+
+
+
+/**
+ * Enable all extensions suitable for a software-only renderer.
+ * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc.
+ */
+void
+_mesa_enable_sw_extensions(GLcontext *ctx)
+{
+ ctx->Extensions.ARB_depth_texture = GL_TRUE;
+#if FEATURE_ARB_fragment_program
+ ctx->Extensions.ARB_fragment_program = GL_TRUE;
+#endif
+ /*ctx->Extensions.ARB_half_float_pixel = GL_TRUE;*/
+ ctx->Extensions.ARB_imaging = GL_TRUE;
+ ctx->Extensions.ARB_multitexture = GL_TRUE;
+#if FEATURE_ARB_occlusion_query
+ ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+#endif
+ ctx->Extensions.ARB_point_sprite = GL_TRUE;
+ ctx->Extensions.ARB_shadow = GL_TRUE;
+ ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
+ ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
+ ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
+ ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
+ ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
+ /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/
+ ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
+ ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
+#if FEATURE_ARB_vertex_program
+ ctx->Extensions.ARB_vertex_program = GL_TRUE;
+#endif
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
+#endif
+ ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
+ ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
+ ctx->Extensions.EXT_blend_color = GL_TRUE;
+ ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
+ ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
+ ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
+ ctx->Extensions.EXT_blend_minmax = GL_TRUE;
+ ctx->Extensions.EXT_blend_subtract = GL_TRUE;
+ ctx->Extensions.EXT_convolution = GL_TRUE;
+ ctx->Extensions.EXT_depth_bounds_test = GL_TRUE;
+ ctx->Extensions.EXT_fog_coord = GL_TRUE;
+ ctx->Extensions.EXT_histogram = GL_TRUE;
+ ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;
+ ctx->Extensions.EXT_paletted_texture = GL_TRUE;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
+#endif
+ ctx->Extensions.EXT_point_parameters = GL_TRUE;
+ ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
+ ctx->Extensions.EXT_secondary_color = GL_TRUE;
+ ctx->Extensions.EXT_shared_texture_palette = GL_TRUE;
+ ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
+ ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
+ ctx->Extensions.EXT_texture_env_add = GL_TRUE;
+ ctx->Extensions.EXT_texture_env_combine = GL_TRUE;
+ ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
+ ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE;
+ ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
+ ctx->Extensions.HP_occlusion_test = GL_TRUE;
+ ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;
+ ctx->Extensions.MESA_pack_invert = GL_TRUE;
+#if FEATURE_MESA_program_debug
+ ctx->Extensions.MESA_program_debug = GL_TRUE;
+#endif
+ ctx->Extensions.MESA_resize_buffers = GL_TRUE;
+ ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
+ ctx->Extensions.NV_blend_square = GL_TRUE;
+ /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/
+ ctx->Extensions.NV_point_sprite = GL_TRUE;
+ ctx->Extensions.NV_texture_rectangle = GL_TRUE;
+ /*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
+#if FEATURE_NV_vertex_program
+ ctx->Extensions.NV_vertex_program = GL_TRUE;
+ ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
+#endif
+#if FEATURE_NV_fragment_program
+ ctx->Extensions.NV_fragment_program = GL_TRUE;
+#endif
+ ctx->Extensions.SGI_color_matrix = GL_TRUE;
+ ctx->Extensions.SGI_color_table = GL_TRUE;
+ ctx->Extensions.SGI_texture_color_table = GL_TRUE;
+ ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
+ ctx->Extensions.SGIS_pixel_texture = GL_TRUE;
+ ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE;
+ ctx->Extensions.SGIX_depth_texture = GL_TRUE;
+ ctx->Extensions.SGIX_pixel_texture = GL_TRUE;
+ ctx->Extensions.SGIX_shadow = GL_TRUE;
+ ctx->Extensions.SGIX_shadow_ambient = GL_TRUE;
+}
+
+
+/**
+ * Enable GL_ARB_imaging and all the EXT extensions that are subsets of it.
+ */
+void
+_mesa_enable_imaging_extensions(GLcontext *ctx)
+{
+ ctx->Extensions.ARB_imaging = GL_TRUE;
+ ctx->Extensions.EXT_blend_color = GL_TRUE;
+ ctx->Extensions.EXT_blend_minmax = GL_TRUE;
+ ctx->Extensions.EXT_blend_subtract = GL_TRUE;
+ ctx->Extensions.EXT_convolution = GL_TRUE;
+ ctx->Extensions.EXT_histogram = GL_TRUE;
+ ctx->Extensions.SGI_color_matrix = GL_TRUE;
+ ctx->Extensions.SGI_color_table = GL_TRUE;
+}
+
+
+
+/**
+ * Enable all OpenGL 1.3 features and extensions.
+ * A convenience function to be called by drivers.
+ */
+void
+_mesa_enable_1_3_extensions(GLcontext *ctx)
+{
+ ctx->Extensions.ARB_multisample = GL_TRUE;
+ ctx->Extensions.ARB_multitexture = GL_TRUE;
+ ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
+ ctx->Extensions.ARB_texture_compression = GL_TRUE;
+ ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
+ ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
+ ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
+ ctx->Extensions.EXT_texture_env_add = GL_TRUE;
+ /*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/
+}
+
+
+
+/**
+ * Enable all OpenGL 1.4 features and extensions.
+ * A convenience function to be called by drivers.
+ */
+void
+_mesa_enable_1_4_extensions(GLcontext *ctx)
+{
+ ctx->Extensions.ARB_depth_texture = GL_TRUE;
+ ctx->Extensions.ARB_shadow = GL_TRUE;
+ ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
+ ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
+ ctx->Extensions.ARB_window_pos = GL_TRUE;
+ ctx->Extensions.EXT_blend_color = GL_TRUE;
+ ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
+ ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
+ ctx->Extensions.EXT_blend_minmax = GL_TRUE;
+ ctx->Extensions.EXT_blend_subtract = GL_TRUE;
+ ctx->Extensions.EXT_fog_coord = GL_TRUE;
+ ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;
+ ctx->Extensions.EXT_point_parameters = GL_TRUE;
+ ctx->Extensions.EXT_secondary_color = GL_TRUE;
+ ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
+ ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
+ ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
+}
+
+
+/**
+ * Enable all OpenGL 1.5 features and extensions.
+ * A convenience function to be called by drivers.
+ */
+void
+_mesa_enable_1_5_extensions(GLcontext *ctx)
+{
+ ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+ ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
+ ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
+}
+
+
+/**
+ * Either enable or disable the named extension.
+ */
+static void
+set_extension( GLcontext *ctx, const char *name, GLboolean state )
+{
+ GLboolean *base = (GLboolean *) &ctx->Extensions;
+ GLuint i;
+
+ if (ctx->Extensions.String) {
+ /* The string was already queried - can't change it now! */
+ _mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name);
+ return;
+ }
+
+ for (i = 0 ; i < Elements(default_extensions) ; i++) {
+ if (_mesa_strcmp(default_extensions[i].name, name) == 0) {
+ if (default_extensions[i].flag_offset) {
+ GLboolean *enabled = base + default_extensions[i].flag_offset;
+ *enabled = state;
+ }
+ return;
+ }
+ }
+ _mesa_problem(ctx, "Trying to enable unknown extension: %s", name);
+}
+
+
+/**
+ * Enable the named extension.
+ * Typically called by drivers.
+ */
+void
+_mesa_enable_extension( GLcontext *ctx, const char *name )
+{
+ set_extension(ctx, name, GL_TRUE);
+}
+
+
+/**
+ * Disable the named extension.
+ * XXX is this really needed???
+ */
+void
+_mesa_disable_extension( GLcontext *ctx, const char *name )
+{
+ set_extension(ctx, name, GL_FALSE);
+}
+
+
+/**
+ * Test if the named extension is enabled in this context.
+ */
+GLboolean
+_mesa_extension_is_enabled( GLcontext *ctx, const char *name )
+{
+ const GLboolean *base = (const GLboolean *) &ctx->Extensions;
+ GLuint i;
+
+ for (i = 0 ; i < Elements(default_extensions) ; i++) {
+ if (_mesa_strcmp(default_extensions[i].name, name) == 0) {
+ if (!default_extensions[i].flag_offset)
+ return GL_TRUE;
+ return *(base + default_extensions[i].flag_offset);
+ }
+ }
+ return GL_FALSE;
+}
+
+
+/**
+ * Run through the default_extensions array above and set the
+ * ctx->Extensions.ARB/EXT_* flags accordingly.
+ * To be called during context initialization.
+ */
+void
+_mesa_init_extensions( GLcontext *ctx )
+{
+ GLboolean *base = (GLboolean *) &ctx->Extensions;
+ GLuint i;
+
+ for (i = 0 ; i < Elements(default_extensions) ; i++) {
+ if (default_extensions[i].enabled &&
+ default_extensions[i].flag_offset) {
+ *(base + default_extensions[i].flag_offset) = GL_TRUE;
+ }
+ }
+}
+
+
+/**
+ * Construct the GL_EXTENSIONS string. Called the first time that
+ * glGetString(GL_EXTENSIONS) is called.
+ */
+GLubyte *
+_mesa_make_extension_string( GLcontext *ctx )
+{
+ const GLboolean *base = (const GLboolean *) &ctx->Extensions;
+ GLuint extStrLen = 0;
+ GLubyte *s;
+ GLuint i;
+
+ /* first, compute length of the extension string */
+ for (i = 0 ; i < Elements(default_extensions) ; i++) {
+ if (!default_extensions[i].flag_offset ||
+ *(base + default_extensions[i].flag_offset)) {
+ extStrLen += _mesa_strlen(default_extensions[i].name) + 1;
+ }
+ }
+ s = (GLubyte *) _mesa_malloc(extStrLen);
+
+ /* second, build the extension string */
+ extStrLen = 0;
+ for (i = 0 ; i < Elements(default_extensions) ; i++) {
+ if (!default_extensions[i].flag_offset ||
+ *(base + default_extensions[i].flag_offset)) {
+ GLuint len = _mesa_strlen(default_extensions[i].name);
+ _mesa_memcpy(s + extStrLen, default_extensions[i].name, len);
+ extStrLen += len;
+ s[extStrLen] = (GLubyte) ' ';
+ extStrLen++;
+ }
+ }
+ ASSERT(extStrLen > 0);
+
+ s[extStrLen - 1] = 0;
+
+ return s;
+}
Index: xc/extras/Mesa/src/mesa/main/extensions.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/extensions.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/extensions.h Thu Apr 8 05:17:43 2004
@@ -0,0 +1,82 @@
+/**
+ * \file extensions.h
+ * Extension handling.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _EXTENSIONS_H_
+#define _EXTENSIONS_H_
+
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+
+extern void _mesa_enable_sw_extensions(GLcontext *ctx);
+
+extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
+
+extern void _mesa_enable_1_3_extensions(GLcontext *ctx);
+
+extern void _mesa_enable_1_4_extensions(GLcontext *ctx);
+
+extern void _mesa_enable_1_5_extensions(GLcontext *ctx);
+
+extern void _mesa_enable_extension(GLcontext *ctx, const char *name);
+
+extern void _mesa_disable_extension(GLcontext *ctx, const char *name);
+
+extern GLboolean _mesa_extension_is_enabled(GLcontext *ctx, const char *name);
+
+extern void _mesa_init_extensions(GLcontext *ctx);
+
+extern GLubyte *_mesa_make_extension_string(GLcontext *ctx);
+
+#else
+
+/** No-op */
+#define _mesa_extensions_dtr( ctx ) ((void)0)
+
+/** No-op */
+#define _mesa_extensions_ctr( ctx ) ((void)0)
+
+/** No-op */
+#define _mesa_extensions_get_string( ctx ) "GL_EXT_texture_object"
+
+/** No-op */
+#define _mesa_enable_imaging_extensions( c ) ((void)0)
+
+/** No-op */
+#define _mesa_enable_extension( c, n ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/feedback.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/feedback.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/feedback.c Thu Jun 10 10:23:48 2004
@@ -0,0 +1,541 @@
+/**
+ * \file feedback.c
+ * Selection and feedback modes functions.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "colormac.h"
+#include "context.h"
+#include "enums.h"
+#include "feedback.h"
+#include "macros.h"
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+
+
+#define FB_3D 0x01
+#define FB_4D 0x02
+#define FB_INDEX 0x04
+#define FB_COLOR 0x08
+#define FB_TEXTURE 0X10
+
+
+
+void GLAPIENTRY
+_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->RenderMode==GL_FEEDBACK) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" );
+ return;
+ }
+ if (size<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(size<0)" );
+ return;
+ }
+ if (!buffer) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" );
+ ctx->Feedback.BufferSize = 0;
+ return;
+ }
+
+ switch (type) {
+ case GL_2D:
+ ctx->Feedback._Mask = 0;
+ break;
+ case GL_3D:
+ ctx->Feedback._Mask = FB_3D;
+ break;
+ case GL_3D_COLOR:
+ ctx->Feedback._Mask = (FB_3D |
+ (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX));
+ break;
+ case GL_3D_COLOR_TEXTURE:
+ ctx->Feedback._Mask = (FB_3D |
+ (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) |
+ FB_TEXTURE);
+ break;
+ case GL_4D_COLOR_TEXTURE:
+ ctx->Feedback._Mask = (FB_3D | FB_4D |
+ (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) |
+ FB_TEXTURE);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" );
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* Always flush */
+ ctx->Feedback.Type = type;
+ ctx->Feedback.BufferSize = size;
+ ctx->Feedback.Buffer = buffer;
+ ctx->Feedback.Count = 0; /* Becaues of this. */
+}
+
+
+void GLAPIENTRY
+_mesa_PassThrough( GLfloat token )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->RenderMode==GL_FEEDBACK) {
+ FLUSH_VERTICES(ctx, 0);
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN );
+ FEEDBACK_TOKEN( ctx, token );
+ }
+}
+
+
+
+/*
+ * Put a vertex into the feedback buffer.
+ */
+void _mesa_feedback_vertex( GLcontext *ctx,
+ const GLfloat win[4],
+ const GLfloat color[4],
+ GLfloat index,
+ const GLfloat texcoord[4] )
+{
+#if 0
+ {
+ /* snap window x, y to fractional pixel position */
+ const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1);
+ GLfixed x, y;
+ x = FloatToFixed(win[0]) & snapMask;
+ y = FloatToFixed(win[1]) & snapMask;
+ FEEDBACK_TOKEN(ctx, FixedToFloat(x));
+ FEEDBACK_TOKEN(ctx, FixedToFloat(y) );
+ }
+#else
+ FEEDBACK_TOKEN( ctx, win[0] );
+ FEEDBACK_TOKEN( ctx, win[1] );
+#endif
+ if (ctx->Feedback._Mask & FB_3D) {
+ FEEDBACK_TOKEN( ctx, win[2] );
+ }
+ if (ctx->Feedback._Mask & FB_4D) {
+ FEEDBACK_TOKEN( ctx, win[3] );
+ }
+ if (ctx->Feedback._Mask & FB_INDEX) {
+ FEEDBACK_TOKEN( ctx, (GLfloat) index );
+ }
+ if (ctx->Feedback._Mask & FB_COLOR) {
+ FEEDBACK_TOKEN( ctx, color[0] );
+ FEEDBACK_TOKEN( ctx, color[1] );
+ FEEDBACK_TOKEN( ctx, color[2] );
+ FEEDBACK_TOKEN( ctx, color[3] );
+ }
+ if (ctx->Feedback._Mask & FB_TEXTURE) {
+ FEEDBACK_TOKEN( ctx, texcoord[0] );
+ FEEDBACK_TOKEN( ctx, texcoord[1] );
+ FEEDBACK_TOKEN( ctx, texcoord[2] );
+ FEEDBACK_TOKEN( ctx, texcoord[3] );
+ }
+}
+
+#endif
+
+
+/**********************************************************************/
+/** \name Selection */
+/*@{*/
+
+/**
+ * Establish a buffer for selection mode values.
+ *
+ * \param size buffer size.
+ * \param buffer buffer.
+ *
+ * \sa glSelectBuffer().
+ *
+ * \note this function can't be put in a display list.
+ *
+ * Verifies we're not in selection mode, flushes the vertices and initialize
+ * the fields in __GLcontextRec::Select with the given buffer.
+ */
+void GLAPIENTRY
+_mesa_SelectBuffer( GLsizei size, GLuint *buffer )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->RenderMode==GL_SELECT) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" );
+ return; /* KW: added return */
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
+ ctx->Select.Buffer = buffer;
+ ctx->Select.BufferSize = size;
+ ctx->Select.BufferCount = 0;
+ ctx->Select.HitFlag = GL_FALSE;
+ ctx->Select.HitMinZ = 1.0;
+ ctx->Select.HitMaxZ = 0.0;
+}
+
+
+/**
+ * Write a value of a record into the selection buffer.
+ *
+ * \param CTX GL context.
+ * \param V value.
+ *
+ * Verifies there is free space in the buffer to write the value and
+ * increments the pointer.
+ */
+#define WRITE_RECORD( CTX, V ) \
+ if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \
+ CTX->Select.Buffer[CTX->Select.BufferCount] = (V); \
+ } \
+ CTX->Select.BufferCount++;
+
+
+/**
+ * Update the hit flag and the maximum and minimum depth values.
+ *
+ * \param ctx GL context.
+ * \param z depth.
+ *
+ * Sets gl_selection::HitFlag and updates gl_selection::HitMinZ and
+ * gl_selection::HitMaxZ.
+ */
+void _mesa_update_hitflag( GLcontext *ctx, GLfloat z )
+{
+ ctx->Select.HitFlag = GL_TRUE;
+ if (z < ctx->Select.HitMinZ) {
+ ctx->Select.HitMinZ = z;
+ }
+ if (z > ctx->Select.HitMaxZ) {
+ ctx->Select.HitMaxZ = z;
+ }
+}
+
+
+/**
+ * Write the hit record.
+ *
+ * \param ctx GL context.
+ *
+ * Write the hit record, i.e., the number of names in the stack, the minimum and
+ * maximum depth values and the number of names in the name stack at the time
+ * of the event. Resets the hit flag.
+ *
+ * \sa gl_selection.
+ */
+static void write_hit_record( GLcontext *ctx )
+{
+ GLuint i;
+ GLuint zmin, zmax, zscale = (~0u);
+
+ /* HitMinZ and HitMaxZ are in [0,1]. Multiply these values by */
+ /* 2^32-1 and round to nearest unsigned integer. */
+
+ assert( ctx != NULL ); /* this line magically fixes a SunOS 5.x/gcc bug */
+ zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ);
+ zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ);
+
+ WRITE_RECORD( ctx, ctx->Select.NameStackDepth );
+ WRITE_RECORD( ctx, zmin );
+ WRITE_RECORD( ctx, zmax );
+ for (i = 0; i < ctx->Select.NameStackDepth; i++) {
+ WRITE_RECORD( ctx, ctx->Select.NameStack[i] );
+ }
+
+ ctx->Select.Hits++;
+ ctx->Select.HitFlag = GL_FALSE;
+ ctx->Select.HitMinZ = 1.0;
+ ctx->Select.HitMaxZ = -1.0;
+}
+
+
+/**
+ * Initialize the name stack.
+ *
+ * Verifies we are in select mode and resets the name stack depth and resets
+ * the hit record data in gl_selection. Marks new render mode in
+ * __GLcontextRec::NewState.
+ */
+void GLAPIENTRY
+_mesa_InitNames( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* Record the hit before the HitFlag is wiped out again. */
+ if (ctx->RenderMode == GL_SELECT) {
+ if (ctx->Select.HitFlag) {
+ write_hit_record( ctx );
+ }
+ }
+ ctx->Select.NameStackDepth = 0;
+ ctx->Select.HitFlag = GL_FALSE;
+ ctx->Select.HitMinZ = 1.0;
+ ctx->Select.HitMaxZ = 0.0;
+ ctx->NewState |= _NEW_RENDERMODE;
+}
+
+
+/**
+ * Load the top-most name of the name stack.
+ *
+ * \param name name.
+ *
+ * Verifies we are in selection mode and that the name stack is not empty.
+ * Flushes vertices. If there is a hit flag writes it (via write_hit_record()),
+ * and replace the top-most name in the stack.
+ *
+ * sa __GLcontextRec::Select.
+ */
+void GLAPIENTRY
+_mesa_LoadName( GLuint name )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->RenderMode != GL_SELECT) {
+ return;
+ }
+ if (ctx->Select.NameStackDepth == 0) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glLoadName" );
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
+
+ if (ctx->Select.HitFlag) {
+ write_hit_record( ctx );
+ }
+ if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) {
+ ctx->Select.NameStack[ctx->Select.NameStackDepth-1] = name;
+ }
+ else {
+ ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name;
+ }
+}
+
+
+/**
+ * Push a name into the name stack.
+ *
+ * \param name name.
+ *
+ * Verifies we are in selection mode and that the name stack is not full.
+ * Flushes vertices. If there is a hit flag writes it (via write_hit_record()),
+ * and adds the name to the top of the name stack.
+ *
+ * sa __GLcontextRec::Select.
+ */
+void GLAPIENTRY
+_mesa_PushName( GLuint name )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->RenderMode != GL_SELECT) {
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
+ if (ctx->Select.HitFlag) {
+ write_hit_record( ctx );
+ }
+ if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) {
+ _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushName" );
+ }
+ else
+ ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name;
+}
+
+
+/**
+ * Pop a name into the name stack.
+ *
+ * Verifies we are in selection mode and that the name stack is not empty.
+ * Flushes vertices. If there is a hit flag writes it (via write_hit_record()),
+ * and removes top-most name in the name stack.
+ *
+ * sa __GLcontextRec::Select.
+ */
+void GLAPIENTRY
+_mesa_PopName( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->RenderMode != GL_SELECT) {
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
+ if (ctx->Select.HitFlag) {
+ write_hit_record( ctx );
+ }
+ if (ctx->Select.NameStackDepth == 0) {
+ _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopName" );
+ }
+ else
+ ctx->Select.NameStackDepth--;
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Render Mode */
+/*@{*/
+
+/**
+ * Set rasterization mode.
+ *
+ * \param mode rasterization mode.
+ *
+ * \note this function can't be put in a display list.
+ *
+ * \sa glRenderMode().
+ *
+ * Flushes the vertices and do the necessary cleanup according to the previous
+ * rasterization mode, such as writing the hit record or resent the select
+ * buffer index when exiting the select mode. Updates
+ * __GLcontextRec::RenderMode and notifies the driver via the
+ * dd_function_table::RenderMode callback.
+ */
+GLint GLAPIENTRY
+_mesa_RenderMode( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint result;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode));
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
+
+ switch (ctx->RenderMode) {
+ case GL_RENDER:
+ result = 0;
+ break;
+ case GL_SELECT:
+ if (ctx->Select.HitFlag) {
+ write_hit_record( ctx );
+ }
+ if (ctx->Select.BufferCount > ctx->Select.BufferSize) {
+ /* overflow */
+#ifdef DEBUG
+ _mesa_warning(ctx, "Feedback buffer overflow");
+#endif
+ result = -1;
+ }
+ else {
+ result = ctx->Select.Hits;
+ }
+ ctx->Select.BufferCount = 0;
+ ctx->Select.Hits = 0;
+ ctx->Select.NameStackDepth = 0;
+ break;
+#if _HAVE_FULL_GL
+ case GL_FEEDBACK:
+ if (ctx->Feedback.Count > ctx->Feedback.BufferSize) {
+ /* overflow */
+ result = -1;
+ }
+ else {
+ result = ctx->Feedback.Count;
+ }
+ ctx->Feedback.Count = 0;
+ break;
+#endif
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
+ return 0;
+ }
+
+ switch (mode) {
+ case GL_RENDER:
+ break;
+ case GL_SELECT:
+ if (ctx->Select.BufferSize==0) {
+ /* haven't called glSelectBuffer yet */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );
+ }
+ break;
+#if _HAVE_FULL_GL
+ case GL_FEEDBACK:
+ if (ctx->Feedback.BufferSize==0) {
+ /* haven't called glFeedbackBuffer yet */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );
+ }
+ break;
+#endif
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
+ return 0;
+ }
+
+ ctx->RenderMode = mode;
+ if (ctx->Driver.RenderMode)
+ ctx->Driver.RenderMode( ctx, mode );
+
+ return result;
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Initialization */
+/*@{*/
+
+/**
+ * Initialize context feedback data.
+ */
+void _mesa_init_feedback( GLcontext * ctx )
+{
+ /* Feedback */
+ ctx->Feedback.Type = GL_2D; /* TODO: verify */
+ ctx->Feedback.Buffer = NULL;
+ ctx->Feedback.BufferSize = 0;
+ ctx->Feedback.Count = 0;
+
+ /* Selection/picking */
+ ctx->Select.Buffer = NULL;
+ ctx->Select.BufferSize = 0;
+ ctx->Select.BufferCount = 0;
+ ctx->Select.Hits = 0;
+ ctx->Select.NameStackDepth = 0;
+
+ /* Miscellaneous */
+ ctx->RenderMode = GL_RENDER;
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/feedback.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/feedback.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/feedback.h Thu Apr 8 05:17:43 2004
@@ -0,0 +1,82 @@
+/**
+ * \file feedback.h
+ * Selection and feedback modes functions.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef FEEDBACK_H
+#define FEEDBACK_H
+
+
+#include "mtypes.h"
+
+
+#define FEEDBACK_TOKEN( CTX, T ) \
+ if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \
+ CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \
+ } \
+ CTX->Feedback.Count++;
+
+
+extern void _mesa_init_feedback( GLcontext * ctx );
+
+extern void _mesa_feedback_vertex( GLcontext *ctx,
+ const GLfloat win[4],
+ const GLfloat color[4],
+ GLfloat index,
+ const GLfloat texcoord[4] );
+
+
+extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z );
+
+
+extern void GLAPIENTRY
+_mesa_PassThrough( GLfloat token );
+
+extern void GLAPIENTRY
+_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
+
+extern void GLAPIENTRY
+_mesa_SelectBuffer( GLsizei size, GLuint *buffer );
+
+extern void GLAPIENTRY
+_mesa_InitNames( void );
+
+extern void GLAPIENTRY
+_mesa_LoadName( GLuint name );
+
+extern void GLAPIENTRY
+_mesa_PushName( GLuint name );
+
+extern void GLAPIENTRY
+_mesa_PopName( void );
+
+extern GLint GLAPIENTRY
+_mesa_RenderMode( GLenum mode );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/fog.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/fog.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/fog.c Thu Apr 8 05:17:43 2004
@@ -0,0 +1,177 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "colormac.h"
+#include "context.h"
+#include "fog.h"
+#include "mtypes.h"
+
+
+
+void GLAPIENTRY
+_mesa_Fogf(GLenum pname, GLfloat param)
+{
+ _mesa_Fogfv(pname, ¶m);
+}
+
+
+void GLAPIENTRY
+_mesa_Fogi(GLenum pname, GLint param )
+{
+ GLfloat fparam = (GLfloat) param;
+ _mesa_Fogfv(pname, &fparam);
+}
+
+
+void GLAPIENTRY
+_mesa_Fogiv(GLenum pname, const GLint *params )
+{
+ GLfloat p[4];
+ switch (pname) {
+ case GL_FOG_MODE:
+ case GL_FOG_DENSITY:
+ case GL_FOG_START:
+ case GL_FOG_END:
+ case GL_FOG_INDEX:
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ p[0] = (GLfloat) *params;
+ break;
+ case GL_FOG_COLOR:
+ p[0] = INT_TO_FLOAT( params[0] );
+ p[1] = INT_TO_FLOAT( params[1] );
+ p[2] = INT_TO_FLOAT( params[2] );
+ p[3] = INT_TO_FLOAT( params[3] );
+ break;
+ default:
+ /* Error will be caught later in _mesa_Fogfv */
+ ;
+ }
+ _mesa_Fogfv(pname, p);
+}
+
+
+void GLAPIENTRY
+_mesa_Fogfv( GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLenum m;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (pname) {
+ case GL_FOG_MODE:
+ m = (GLenum) (GLint) *params;
+ switch (m) {
+ case GL_LINEAR:
+ case GL_EXP:
+ case GL_EXP2:
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
+ return;
+ }
+ if (ctx->Fog.Mode == m)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Mode = m;
+ break;
+ case GL_FOG_DENSITY:
+ if (*params<0.0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glFog" );
+ return;
+ }
+ if (ctx->Fog.Density == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Density = *params;
+ break;
+ case GL_FOG_START:
+ if (ctx->Fog.Start == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Start = *params;
+ break;
+ case GL_FOG_END:
+ if (ctx->Fog.End == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.End = *params;
+ break;
+ case GL_FOG_INDEX:
+ if (ctx->Fog.Index == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Index = *params;
+ break;
+ case GL_FOG_COLOR:
+ if (TEST_EQ_4V(ctx->Fog.Color, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Color[0] = CLAMP(params[0], 0.0F, 1.0F);
+ ctx->Fog.Color[1] = CLAMP(params[1], 0.0F, 1.0F);
+ ctx->Fog.Color[2] = CLAMP(params[2], 0.0F, 1.0F);
+ ctx->Fog.Color[3] = CLAMP(params[3], 0.0F, 1.0F);
+ break;
+ case GL_FOG_COORDINATE_SOURCE_EXT: {
+ GLenum p = (GLenum) (GLint) *params;
+ if (!ctx->Extensions.EXT_fog_coord ||
+ (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glFog");
+ return;
+ }
+ if (ctx->Fog.FogCoordinateSource == p)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.FogCoordinateSource = p;
+ break;
+ }
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
+ return;
+ }
+
+ if (ctx->Driver.Fogfv) {
+ (*ctx->Driver.Fogfv)( ctx, pname, params );
+ }
+}
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+void _mesa_init_fog( GLcontext * ctx )
+{
+ /* Fog group */
+ ctx->Fog.Enabled = GL_FALSE;
+ ctx->Fog.Mode = GL_EXP;
+ ASSIGN_4V( ctx->Fog.Color, 0.0, 0.0, 0.0, 0.0 );
+ ctx->Fog.Index = 0.0;
+ ctx->Fog.Density = 1.0;
+ ctx->Fog.Start = 0.0;
+ ctx->Fog.End = 1.0;
+ ctx->Fog.ColorSumEnabled = GL_FALSE;
+ ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT;
+}
Index: xc/extras/Mesa/src/mesa/main/fog.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/fog.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/fog.h Thu Apr 8 05:17:43 2004
@@ -0,0 +1,66 @@
+/**
+ * \file fog.h
+ * Fog operations.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef FOG_H
+#define FOG_H
+
+
+#include "mtypes.h"
+
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_Fogf(GLenum pname, GLfloat param);
+
+extern void GLAPIENTRY
+_mesa_Fogi(GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_Fogfv(GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_Fogiv(GLenum pname, const GLint *params );
+
+extern void _mesa_init_fog( GLcontext * ctx );
+
+#else
+
+/** No-op */
+#define _mesa_init_fog( c ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/get.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/get.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/get.c Fri Dec 10 10:05:14 2004
@@ -0,0 +1,6587 @@
+/**
+ * \file get.c
+ * State query functions.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Regarding GL_NV_light_max_exponent:
+ *
+ * Portions of this software may use or implement intellectual
+ * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
+ * any and all warranties with respect to such intellectual property,
+ * including any use thereof or modifications thereto.
+ */
+
+#include "glheader.h"
+#include "colormac.h"
+#include "context.h"
+#include "enable.h"
+#include "enums.h"
+#include "extensions.h"
+#include "get.h"
+#include "macros.h"
+#include "mtypes.h"
+#include "texcompress.h"
+#include "version.h"
+#include "math/m_matrix.h"
+
+
+#define FLOAT_TO_BOOL(X) ( (X)==0.0F ? GL_FALSE : GL_TRUE )
+#define INT_TO_BOOL(I) ( (I)==0 ? GL_FALSE : GL_TRUE )
+#define ENUM_TO_BOOL(E) ( (E)==0 ? GL_FALSE : GL_TRUE )
+
+#ifdef SPECIALCAST
+/* Needed for an Amiga compiler */
+#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X))
+#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X))
+#else
+/* all other compilers */
+#define ENUM_TO_FLOAT(X) ((GLfloat)(X))
+#define ENUM_TO_DOUBLE(X) ((GLdouble)(X))
+#endif
+
+
+/* Check if named extension is enabled, if not generate error and return */
+
+#define CHECK1(E1, str, PNAME) \
+ if (!ctx->Extensions.E1) { \
+ _mesa_error(ctx, GL_INVALID_VALUE, \
+ "glGet" str "v(0x%x)", (int) PNAME); \
+ return; \
+ }
+
+#define CHECK2(E1, E2, str, PNAME) \
+ if (!ctx->Extensions.E1 && !ctx->Extensions.E2) { \
+ _mesa_error(ctx, GL_INVALID_VALUE, \
+ "glGet" str "v(0x%x)", (int) PNAME); \
+ return; \
+ }
+
+#define CHECK_EXTENSION_B(EXTNAME, PNAME) \
+ CHECK1(EXTNAME, "Boolean", PNAME )
+
+#define CHECK_EXTENSION_I(EXTNAME, PNAME) \
+ CHECK1(EXTNAME, "Integer", PNAME )
+
+#define CHECK_EXTENSION_F(EXTNAME, PNAME) \
+ CHECK1(EXTNAME, "Float", PNAME )
+
+#define CHECK_EXTENSION_D(EXTNAME, PNAME) \
+ CHECK1(EXTNAME, "Double", PNAME )
+
+#define CHECK_EXTENSION2_B(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Boolean", PNAME)
+
+#define CHECK_EXTENSION2_I(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Integer", PNAME)
+
+#define CHECK_EXTENSION2_F(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Float", PNAME)
+
+#define CHECK_EXTENSION2_D(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Double", PNAME)
+
+
+
+static GLenum
+pixel_texgen_mode(const GLcontext *ctx)
+{
+ if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) {
+ if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
+ return GL_RGBA;
+ }
+ else {
+ return GL_RGB;
+ }
+ }
+ else {
+ if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
+ return GL_ALPHA;
+ }
+ else {
+ return GL_NONE;
+ }
+ }
+}
+
+
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetBooleanv().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetBooleanv,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLboolean.
+ */
+void GLAPIENTRY
+_mesa_GetBooleanv( GLenum pname, GLboolean *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint i;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
+ const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!params)
+ return;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname));
+
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
+ if (ctx->Driver.GetBooleanv
+ && (*ctx->Driver.GetBooleanv)(ctx, pname, params))
+ return;
+
+ switch (pname) {
+ case GL_ACCUM_RED_BITS:
+ *params = INT_TO_BOOL(ctx->Visual.accumRedBits);
+ break;
+ case GL_ACCUM_GREEN_BITS:
+ *params = INT_TO_BOOL(ctx->Visual.accumGreenBits);
+ break;
+ case GL_ACCUM_BLUE_BITS:
+ *params = INT_TO_BOOL(ctx->Visual.accumBlueBits);
+ break;
+ case GL_ACCUM_ALPHA_BITS:
+ *params = INT_TO_BOOL(ctx->Visual.accumAlphaBits);
+ break;
+ case GL_ACCUM_CLEAR_VALUE:
+ params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[3]);
+ break;
+ case GL_ALPHA_BIAS:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaBias);
+ break;
+ case GL_ALPHA_BITS:
+ *params = INT_TO_BOOL(ctx->Visual.alphaBits);
+ break;
+ case GL_ALPHA_SCALE:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaScale);
+ break;
+ case GL_ALPHA_TEST:
+ *params = ctx->Color.AlphaEnabled;
+ break;
+ case GL_ALPHA_TEST_FUNC:
+ *params = ENUM_TO_BOOL(ctx->Color.AlphaFunc);
+ break;
+ case GL_ALPHA_TEST_REF:
+ *params = ctx->Color.AlphaRef ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_ATTRIB_STACK_DEPTH:
+ *params = INT_TO_BOOL(ctx->AttribStackDepth);
+ break;
+ case GL_AUTO_NORMAL:
+ *params = ctx->Eval.AutoNormal;
+ break;
+ case GL_AUX_BUFFERS:
+ *params = (ctx->Visual.numAuxBuffers) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_BLEND:
+ *params = ctx->Color.BlendEnabled;
+ break;
+ case GL_BLEND_DST:
+ *params = ENUM_TO_BOOL(ctx->Color.BlendDstRGB);
+ break;
+ case GL_BLEND_SRC:
+ *params = ENUM_TO_BOOL(ctx->Color.BlendSrcRGB);
+ break;
+ case GL_BLEND_SRC_RGB_EXT:
+ *params = ENUM_TO_BOOL(ctx->Color.BlendSrcRGB);
+ break;
+ case GL_BLEND_DST_RGB_EXT:
+ *params = ENUM_TO_BOOL(ctx->Color.BlendDstRGB);
+ break;
+ case GL_BLEND_SRC_ALPHA_EXT:
+ *params = ENUM_TO_BOOL(ctx->Color.BlendSrcA);
+ break;
+ case GL_BLEND_DST_ALPHA_EXT:
+ *params = ENUM_TO_BOOL(ctx->Color.BlendDstA);
+ break;
+ case GL_BLEND_EQUATION:
+ *params = ENUM_TO_BOOL( ctx->Color.BlendEquationRGB );
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = ENUM_TO_BOOL( ctx->Color.BlendEquationA );
+ break;
+ case GL_BLEND_COLOR_EXT:
+ params[0] = FLOAT_TO_BOOL( ctx->Color.BlendColor[0] );
+ params[1] = FLOAT_TO_BOOL( ctx->Color.BlendColor[1] );
+ params[2] = FLOAT_TO_BOOL( ctx->Color.BlendColor[2] );
+ params[3] = FLOAT_TO_BOOL( ctx->Color.BlendColor[3] );
+ break;
+ case GL_BLUE_BIAS:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.BlueBias);
+ break;
+ case GL_BLUE_BITS:
+ *params = INT_TO_BOOL( ctx->Visual.blueBits );
+ break;
+ case GL_BLUE_SCALE:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.BlueScale);
+ break;
+ case GL_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = INT_TO_BOOL(ctx->ClientAttribStackDepth);
+ break;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = GL_TRUE;
+ else
+ *params = GL_FALSE;
+ break;
+ case GL_COLOR_CLEAR_VALUE:
+ params[0] = ctx->Color.ClearColor[0] ? GL_TRUE : GL_FALSE;
+ params[1] = ctx->Color.ClearColor[1] ? GL_TRUE : GL_FALSE;
+ params[2] = ctx->Color.ClearColor[2] ? GL_TRUE : GL_FALSE;
+ params[3] = ctx->Color.ClearColor[3] ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_COLOR_MATERIAL:
+ *params = ctx->Light.ColorMaterialEnabled;
+ break;
+ case GL_COLOR_MATERIAL_FACE:
+ *params = ENUM_TO_BOOL(ctx->Light.ColorMaterialFace);
+ break;
+ case GL_COLOR_MATERIAL_PARAMETER:
+ *params = ENUM_TO_BOOL(ctx->Light.ColorMaterialMode);
+ break;
+ case GL_COLOR_WRITEMASK:
+ params[0] = ctx->Color.ColorMask[RCOMP] ? GL_TRUE : GL_FALSE;
+ params[1] = ctx->Color.ColorMask[GCOMP] ? GL_TRUE : GL_FALSE;
+ params[2] = ctx->Color.ColorMask[BCOMP] ? GL_TRUE : GL_FALSE;
+ params[3] = ctx->Color.ColorMask[ACOMP] ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_CULL_FACE:
+ *params = ctx->Polygon.CullFlag;
+ break;
+ case GL_CULL_FACE_MODE:
+ *params = ENUM_TO_BOOL(ctx->Polygon.CullFaceMode);
+ break;
+ case GL_CURRENT_COLOR:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
+ break;
+ case GL_CURRENT_INDEX:
+ FLUSH_CURRENT(ctx, 0);
+ *params = FLOAT_TO_BOOL(ctx->Current.Index);
+ break;
+ case GL_CURRENT_NORMAL:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
+ break;
+ case GL_CURRENT_RASTER_COLOR:
+ params[0] = FLOAT_TO_BOOL(ctx->Current.RasterColor[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Current.RasterColor[1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Current.RasterColor[2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Current.RasterColor[3]);
+ break;
+ case GL_CURRENT_RASTER_DISTANCE:
+ *params = FLOAT_TO_BOOL(ctx->Current.RasterDistance);
+ break;
+ case GL_CURRENT_RASTER_INDEX:
+ *params = FLOAT_TO_BOOL(ctx->Current.RasterIndex);
+ break;
+ case GL_CURRENT_RASTER_POSITION:
+ params[0] = FLOAT_TO_BOOL(ctx->Current.RasterPos[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Current.RasterPos[1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Current.RasterPos[2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Current.RasterPos[3]);
+ break;
+ case GL_CURRENT_RASTER_TEXTURE_COORDS:
+ params[0] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][3]);
+ break;
+ case GL_CURRENT_RASTER_POSITION_VALID:
+ *params = ctx->Current.RasterPosValid;
+ break;
+ case GL_CURRENT_TEXTURE_COORDS:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]);
+ break;
+ case GL_DEPTH_BIAS:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias);
+ break;
+ case GL_DEPTH_BITS:
+ *params = INT_TO_BOOL(ctx->Visual.depthBits);
+ break;
+ case GL_DEPTH_CLEAR_VALUE:
+ *params = FLOAT_TO_BOOL(ctx->Depth.Clear);
+ break;
+ case GL_DEPTH_FUNC:
+ *params = ENUM_TO_BOOL(ctx->Depth.Func);
+ break;
+ case GL_DEPTH_RANGE:
+ params[0] = FLOAT_TO_BOOL(ctx->Viewport.Near);
+ params[1] = FLOAT_TO_BOOL(ctx->Viewport.Far);
+ break;
+ case GL_DEPTH_SCALE:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.DepthScale);
+ break;
+ case GL_DEPTH_TEST:
+ *params = ctx->Depth.Test;
+ break;
+ case GL_DEPTH_WRITEMASK:
+ *params = ctx->Depth.Mask;
+ break;
+ case GL_DITHER:
+ *params = ctx->Color.DitherFlag;
+ break;
+ case GL_DOUBLEBUFFER:
+ *params = ctx->Visual.doubleBufferMode;
+ break;
+ case GL_DRAW_BUFFER:
+ *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer);
+ break;
+ case GL_EDGE_FLAG:
+ FLUSH_CURRENT(ctx, 0);
+ *params = ctx->Current.EdgeFlag;
+ break;
+ case GL_FEEDBACK_BUFFER_SIZE:
+ *params = INT_TO_BOOL(ctx->Feedback.BufferSize);
+ break;
+ case GL_FEEDBACK_BUFFER_TYPE:
+ *params = INT_TO_BOOL(ctx->Feedback.Type);
+ break;
+ case GL_FOG:
+ *params = ctx->Fog.Enabled;
+ break;
+ case GL_FOG_COLOR:
+ params[0] = FLOAT_TO_BOOL(ctx->Fog.Color[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Fog.Color[1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Fog.Color[2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Fog.Color[3]);
+ break;
+ case GL_FOG_DENSITY:
+ *params = FLOAT_TO_BOOL(ctx->Fog.Density);
+ break;
+ case GL_FOG_END:
+ *params = FLOAT_TO_BOOL(ctx->Fog.End);
+ break;
+ case GL_FOG_HINT:
+ *params = ENUM_TO_BOOL(ctx->Hint.Fog);
+ break;
+ case GL_FOG_INDEX:
+ *params = FLOAT_TO_BOOL(ctx->Fog.Index);
+ break;
+ case GL_FOG_MODE:
+ *params = ENUM_TO_BOOL(ctx->Fog.Mode);
+ break;
+ case GL_FOG_START:
+ *params = FLOAT_TO_BOOL(ctx->Fog.End);
+ break;
+ case GL_FRONT_FACE:
+ *params = ENUM_TO_BOOL(ctx->Polygon.FrontFace);
+ break;
+ case GL_GREEN_BIAS:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.GreenBias);
+ break;
+ case GL_GREEN_BITS:
+ *params = INT_TO_BOOL( ctx->Visual.greenBits );
+ break;
+ case GL_GREEN_SCALE:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale);
+ break;
+ case GL_INDEX_BITS:
+ *params = INT_TO_BOOL( ctx->Visual.indexBits );
+ break;
+ case GL_INDEX_CLEAR_VALUE:
+ *params = INT_TO_BOOL(ctx->Color.ClearIndex);
+ break;
+ case GL_INDEX_MODE:
+ *params = ctx->Visual.rgbMode ? GL_FALSE : GL_TRUE;
+ break;
+ case GL_INDEX_OFFSET:
+ *params = INT_TO_BOOL(ctx->Pixel.IndexOffset);
+ break;
+ case GL_INDEX_SHIFT:
+ *params = INT_TO_BOOL(ctx->Pixel.IndexShift);
+ break;
+ case GL_INDEX_WRITEMASK:
+ *params = INT_TO_BOOL(ctx->Color.IndexMask);
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ *params = ctx->Light.Light[pname-GL_LIGHT0].Enabled;
+ break;
+ case GL_LIGHTING:
+ *params = ctx->Light.Enabled;
+ break;
+ case GL_LIGHT_MODEL_AMBIENT:
+ params[0] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[3]);
+ break;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ params[0] = ENUM_TO_BOOL(ctx->Light.Model.ColorControl);
+ break;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ *params = ctx->Light.Model.LocalViewer;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *params = ctx->Light.Model.TwoSide;
+ break;
+ case GL_LINE_SMOOTH:
+ *params = ctx->Line.SmoothFlag;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ *params = ENUM_TO_BOOL(ctx->Hint.LineSmooth);
+ break;
+ case GL_LINE_STIPPLE:
+ *params = ctx->Line.StippleFlag;
+ break;
+ case GL_LINE_STIPPLE_PATTERN:
+ *params = INT_TO_BOOL(ctx->Line.StipplePattern);
+ break;
+ case GL_LINE_STIPPLE_REPEAT:
+ *params = INT_TO_BOOL(ctx->Line.StippleFactor);
+ break;
+ case GL_LINE_WIDTH:
+ *params = FLOAT_TO_BOOL(ctx->Line.Width);
+ break;
+ case GL_LINE_WIDTH_GRANULARITY:
+ *params = FLOAT_TO_BOOL(ctx->Const.LineWidthGranularity);
+ break;
+ case GL_LINE_WIDTH_RANGE:
+ params[0] = FLOAT_TO_BOOL(ctx->Const.MinLineWidthAA);
+ params[1] = FLOAT_TO_BOOL(ctx->Const.MaxLineWidthAA);
+ break;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ params[0] = FLOAT_TO_BOOL(ctx->Const.MinLineWidth);
+ params[1] = FLOAT_TO_BOOL(ctx->Const.MaxLineWidth);
+ break;
+ case GL_LIST_BASE:
+ *params = INT_TO_BOOL(ctx->List.ListBase);
+ break;
+ case GL_LIST_INDEX:
+ *params = INT_TO_BOOL( ctx->ListState.CurrentListNum );
+ break;
+ case GL_LIST_MODE:
+ if (!ctx->CompileFlag)
+ *params = 0;
+ else if (ctx->ExecuteFlag)
+ *params = ENUM_TO_BOOL(GL_COMPILE_AND_EXECUTE);
+ else
+ *params = ENUM_TO_BOOL(GL_COMPILE);
+ break;
+ case GL_INDEX_LOGIC_OP:
+ *params = ctx->Color.IndexLogicOpEnabled;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ *params = ctx->Color.ColorLogicOpEnabled;
+ break;
+ case GL_LOGIC_OP_MODE:
+ *params = ENUM_TO_BOOL(ctx->Color.LogicOp);
+ break;
+ case GL_MAP1_COLOR_4:
+ *params = ctx->Eval.Map1Color4;
+ break;
+ case GL_MAP1_GRID_DOMAIN:
+ params[0] = FLOAT_TO_BOOL(ctx->Eval.MapGrid1u1);
+ params[1] = FLOAT_TO_BOOL(ctx->Eval.MapGrid1u2);
+ break;
+ case GL_MAP1_GRID_SEGMENTS:
+ *params = INT_TO_BOOL(ctx->Eval.MapGrid1un);
+ break;
+ case GL_MAP1_INDEX:
+ *params = ctx->Eval.Map1Index;
+ break;
+ case GL_MAP1_NORMAL:
+ *params = ctx->Eval.Map1Normal;
+ break;
+ case GL_MAP1_TEXTURE_COORD_1:
+ *params = ctx->Eval.Map1TextureCoord1;
+ break;
+ case GL_MAP1_TEXTURE_COORD_2:
+ *params = ctx->Eval.Map1TextureCoord2;
+ break;
+ case GL_MAP1_TEXTURE_COORD_3:
+ *params = ctx->Eval.Map1TextureCoord3;
+ break;
+ case GL_MAP1_TEXTURE_COORD_4:
+ *params = ctx->Eval.Map1TextureCoord4;
+ break;
+ case GL_MAP1_VERTEX_3:
+ *params = ctx->Eval.Map1Vertex3;
+ break;
+ case GL_MAP1_VERTEX_4:
+ *params = ctx->Eval.Map1Vertex4;
+ break;
+ case GL_MAP2_COLOR_4:
+ *params = ctx->Eval.Map2Color4;
+ break;
+ case GL_MAP2_GRID_DOMAIN:
+ params[0] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2u1);
+ params[1] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2u2);
+ params[2] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2v1);
+ params[3] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2v2);
+ break;
+ case GL_MAP2_GRID_SEGMENTS:
+ params[0] = INT_TO_BOOL(ctx->Eval.MapGrid2un);
+ params[1] = INT_TO_BOOL(ctx->Eval.MapGrid2vn);
+ break;
+ case GL_MAP2_INDEX:
+ *params = ctx->Eval.Map2Index;
+ break;
+ case GL_MAP2_NORMAL:
+ *params = ctx->Eval.Map2Normal;
+ break;
+ case GL_MAP2_TEXTURE_COORD_1:
+ *params = ctx->Eval.Map2TextureCoord1;
+ break;
+ case GL_MAP2_TEXTURE_COORD_2:
+ *params = ctx->Eval.Map2TextureCoord2;
+ break;
+ case GL_MAP2_TEXTURE_COORD_3:
+ *params = ctx->Eval.Map2TextureCoord3;
+ break;
+ case GL_MAP2_TEXTURE_COORD_4:
+ *params = ctx->Eval.Map2TextureCoord4;
+ break;
+ case GL_MAP2_VERTEX_3:
+ *params = ctx->Eval.Map2Vertex3;
+ break;
+ case GL_MAP2_VERTEX_4:
+ *params = ctx->Eval.Map2Vertex4;
+ break;
+ case GL_MAP_COLOR:
+ *params = ctx->Pixel.MapColorFlag;
+ break;
+ case GL_MAP_STENCIL:
+ *params = ctx->Pixel.MapStencilFlag;
+ break;
+ case GL_MATRIX_MODE:
+ *params = ENUM_TO_BOOL( ctx->Transform.MatrixMode );
+ break;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ *params = INT_TO_BOOL(MAX_ATTRIB_STACK_DEPTH);
+ break;
+ case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = INT_TO_BOOL( MAX_CLIENT_ATTRIB_STACK_DEPTH);
+ break;
+ case GL_MAX_CLIP_PLANES:
+ *params = INT_TO_BOOL(ctx->Const.MaxClipPlanes);
+ break;
+ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
+ *params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize);
+ break;
+ case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
+ *params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize);
+ break;
+ case GL_MAX_EVAL_ORDER:
+ *params = INT_TO_BOOL(MAX_EVAL_ORDER);
+ break;
+ case GL_MAX_LIGHTS:
+ *params = INT_TO_BOOL(ctx->Const.MaxLights);
+ break;
+ case GL_MAX_LIST_NESTING:
+ *params = INT_TO_BOOL(MAX_LIST_NESTING);
+ break;
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ *params = INT_TO_BOOL(MAX_MODELVIEW_STACK_DEPTH);
+ break;
+ case GL_MAX_NAME_STACK_DEPTH:
+ *params = INT_TO_BOOL(MAX_NAME_STACK_DEPTH);
+ break;
+ case GL_MAX_PIXEL_MAP_TABLE:
+ *params = INT_TO_BOOL(MAX_PIXEL_MAP_TABLE);
+ break;
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ *params = INT_TO_BOOL(MAX_PROJECTION_STACK_DEPTH);
+ break;
+ case GL_MAX_TEXTURE_SIZE:
+ *params = INT_TO_BOOL(1 << (ctx->Const.MaxTextureLevels - 1));
+ break;
+ case GL_MAX_3D_TEXTURE_SIZE:
+ *params = INT_TO_BOOL(1 << (ctx->Const.Max3DTextureLevels - 1));
+ break;
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ *params = INT_TO_BOOL(MAX_TEXTURE_STACK_DEPTH);
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ params[0] = INT_TO_BOOL(MAX_WIDTH);
+ params[1] = INT_TO_BOOL(MAX_HEIGHT);
+ break;
+ case GL_MODELVIEW_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(ctx->ModelviewMatrixStack.Top->m[i]);
+ }
+ break;
+ case GL_MODELVIEW_STACK_DEPTH:
+ *params = INT_TO_BOOL(ctx->ModelviewMatrixStack.Depth + 1);
+ break;
+ case GL_NAME_STACK_DEPTH:
+ *params = INT_TO_BOOL(ctx->Select.NameStackDepth);
+ break;
+ case GL_NORMALIZE:
+ *params = ctx->Transform.Normalize;
+ break;
+ case GL_PACK_ALIGNMENT:
+ *params = INT_TO_BOOL(ctx->Pack.Alignment);
+ break;
+ case GL_PACK_LSB_FIRST:
+ *params = ctx->Pack.LsbFirst;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ *params = INT_TO_BOOL(ctx->Pack.RowLength);
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ *params = INT_TO_BOOL(ctx->Pack.SkipPixels);
+ break;
+ case GL_PACK_SKIP_ROWS:
+ *params = INT_TO_BOOL(ctx->Pack.SkipRows);
+ break;
+ case GL_PACK_SWAP_BYTES:
+ *params = ctx->Pack.SwapBytes;
+ break;
+ case GL_PACK_SKIP_IMAGES_EXT:
+ *params = ctx->Pack.SkipImages;
+ break;
+ case GL_PACK_IMAGE_HEIGHT_EXT:
+ *params = ctx->Pack.ImageHeight;
+ break;
+ case GL_PACK_INVERT_MESA:
+ *params = ctx->Pack.Invert;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ *params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection);
+ break;
+ case GL_PIXEL_MAP_A_TO_A_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapAtoAsize);
+ break;
+ case GL_PIXEL_MAP_B_TO_B_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapBtoBsize);
+ break;
+ case GL_PIXEL_MAP_G_TO_G_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapGtoGsize);
+ break;
+ case GL_PIXEL_MAP_I_TO_A_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapItoAsize);
+ break;
+ case GL_PIXEL_MAP_I_TO_B_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapItoBsize);
+ break;
+ case GL_PIXEL_MAP_I_TO_G_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapItoGsize);
+ break;
+ case GL_PIXEL_MAP_I_TO_I_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapItoIsize);
+ break;
+ case GL_PIXEL_MAP_I_TO_R_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapItoRsize);
+ break;
+ case GL_PIXEL_MAP_R_TO_R_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapRtoRsize);
+ break;
+ case GL_PIXEL_MAP_S_TO_S_SIZE:
+ *params = INT_TO_BOOL(ctx->Pixel.MapStoSsize);
+ break;
+ case GL_POINT_SIZE:
+ *params = FLOAT_TO_BOOL(ctx->Point.Size);
+ break;
+ case GL_POINT_SIZE_GRANULARITY:
+ *params = FLOAT_TO_BOOL(ctx->Const.PointSizeGranularity );
+ break;
+ case GL_POINT_SIZE_RANGE:
+ params[0] = FLOAT_TO_BOOL(ctx->Const.MinPointSizeAA);
+ params[1] = FLOAT_TO_BOOL(ctx->Const.MaxPointSizeAA);
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ params[0] = FLOAT_TO_BOOL(ctx->Const.MinPointSize);
+ params[1] = FLOAT_TO_BOOL(ctx->Const.MaxPointSize);
+ break;
+ case GL_POINT_SMOOTH:
+ *params = ctx->Point.SmoothFlag;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ *params = ENUM_TO_BOOL(ctx->Hint.PointSmooth);
+ break;
+ case GL_POINT_SIZE_MIN_EXT:
+ *params = FLOAT_TO_BOOL(ctx->Point.MinSize);
+ break;
+ case GL_POINT_SIZE_MAX_EXT:
+ *params = FLOAT_TO_BOOL(ctx->Point.MaxSize);
+ break;
+ case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+ *params = FLOAT_TO_BOOL(ctx->Point.Threshold);
+ break;
+ case GL_DISTANCE_ATTENUATION_EXT:
+ params[0] = FLOAT_TO_BOOL(ctx->Point.Params[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Point.Params[1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Point.Params[2]);
+ break;
+ case GL_POLYGON_MODE:
+ params[0] = ENUM_TO_BOOL(ctx->Polygon.FrontMode);
+ params[1] = ENUM_TO_BOOL(ctx->Polygon.BackMode);
+ break;
+ case GL_POLYGON_OFFSET_BIAS_EXT: /* GL_EXT_polygon_offset */
+ *params = FLOAT_TO_BOOL( ctx->Polygon.OffsetUnits );
+ break;
+ case GL_POLYGON_OFFSET_FACTOR:
+ *params = FLOAT_TO_BOOL( ctx->Polygon.OffsetFactor );
+ break;
+ case GL_POLYGON_OFFSET_UNITS:
+ *params = FLOAT_TO_BOOL( ctx->Polygon.OffsetUnits );
+ break;
+ case GL_POLYGON_SMOOTH:
+ *params = ctx->Polygon.SmoothFlag;
+ break;
+ case GL_POLYGON_SMOOTH_HINT:
+ *params = ENUM_TO_BOOL(ctx->Hint.PolygonSmooth);
+ break;
+ case GL_POLYGON_STIPPLE:
+ *params = ctx->Polygon.StippleFlag;
+ break;
+ case GL_PROJECTION_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(ctx->ProjectionMatrixStack.Top->m[i]);
+ }
+ break;
+ case GL_PROJECTION_STACK_DEPTH:
+ *params = INT_TO_BOOL(ctx->ProjectionMatrixStack.Depth + 1);
+ break;
+ case GL_READ_BUFFER:
+ *params = ENUM_TO_BOOL(ctx->Pixel.ReadBuffer);
+ break;
+ case GL_RED_BIAS:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.RedBias);
+ break;
+ case GL_RED_BITS:
+ *params = INT_TO_BOOL( ctx->Visual.redBits );
+ break;
+ case GL_RED_SCALE:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.RedScale);
+ break;
+ case GL_RENDER_MODE:
+ *params = ENUM_TO_BOOL(ctx->RenderMode);
+ break;
+ case GL_RESCALE_NORMAL:
+ *params = ctx->Transform.RescaleNormals;
+ break;
+ case GL_RGBA_MODE:
+ *params = ctx->Visual.rgbMode;
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = INT_TO_BOOL(ctx->Scissor.X);
+ params[1] = INT_TO_BOOL(ctx->Scissor.Y);
+ params[2] = INT_TO_BOOL(ctx->Scissor.Width);
+ params[3] = INT_TO_BOOL(ctx->Scissor.Height);
+ break;
+ case GL_SCISSOR_TEST:
+ *params = ctx->Scissor.Enabled;
+ break;
+ case GL_SELECTION_BUFFER_SIZE:
+ *params = INT_TO_BOOL(ctx->Select.BufferSize);
+ break;
+ case GL_SHADE_MODEL:
+ *params = ENUM_TO_BOOL(ctx->Light.ShadeModel);
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ *params = ctx->Texture.SharedPalette;
+ break;
+ case GL_STENCIL_BITS:
+ *params = INT_TO_BOOL(ctx->Visual.stencilBits);
+ break;
+ case GL_STENCIL_CLEAR_VALUE:
+ *params = INT_TO_BOOL(ctx->Stencil.Clear);
+ break;
+ case GL_STENCIL_FAIL:
+ *params = ENUM_TO_BOOL(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_FUNC:
+ *params = ENUM_TO_BOOL(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *params = ENUM_TO_BOOL(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *params = ENUM_TO_BOOL(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_REF:
+ *params = INT_TO_BOOL(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_TEST:
+ *params = ctx->Stencil.Enabled;
+ break;
+ case GL_STENCIL_VALUE_MASK:
+ *params = INT_TO_BOOL(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_WRITEMASK:
+ *params = INT_TO_BOOL(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STEREO:
+ *params = ctx->Visual.stereoMode;
+ break;
+ case GL_SUBPIXEL_BITS:
+ *params = INT_TO_BOOL(ctx->Const.SubPixelBits);
+ break;
+ case GL_TEXTURE_1D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_1D);
+ break;
+ case GL_TEXTURE_2D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_2D);
+ break;
+ case GL_TEXTURE_3D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_3D);
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ *params = INT_TO_BOOL(textureUnit->Current1D->Name);
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ *params = INT_TO_BOOL(textureUnit->Current2D->Name);
+ break;
+ case GL_TEXTURE_BINDING_3D:
+ *params = INT_TO_BOOL(textureUnit->Current3D->Name);
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ {
+ params[0] = FLOAT_TO_BOOL(textureUnit->EnvColor[0]);
+ params[1] = FLOAT_TO_BOOL(textureUnit->EnvColor[1]);
+ params[2] = FLOAT_TO_BOOL(textureUnit->EnvColor[2]);
+ params[3] = FLOAT_TO_BOOL(textureUnit->EnvColor[3]);
+ }
+ break;
+ case GL_TEXTURE_ENV_MODE:
+ *params = ENUM_TO_BOOL(textureUnit->EnvMode);
+ break;
+ case GL_TEXTURE_GEN_S:
+ *params = (textureUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_TEXTURE_GEN_T:
+ *params = (textureUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_TEXTURE_GEN_R:
+ *params = (textureUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_TEXTURE_GEN_Q:
+ *params = (textureUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_TEXTURE_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] =
+ FLOAT_TO_BOOL(ctx->TextureMatrixStack[texUnit].Top->m[i]);
+ }
+ break;
+ case GL_TEXTURE_STACK_DEPTH:
+ *params = INT_TO_BOOL(ctx->TextureMatrixStack[texUnit].Depth + 1);
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ *params = INT_TO_BOOL(ctx->Unpack.Alignment);
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ *params = ctx->Unpack.LsbFirst;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ *params = INT_TO_BOOL(ctx->Unpack.RowLength);
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ *params = INT_TO_BOOL(ctx->Unpack.SkipPixels);
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ *params = INT_TO_BOOL(ctx->Unpack.SkipRows);
+ break;
+ case GL_UNPACK_SWAP_BYTES:
+ *params = ctx->Unpack.SwapBytes;
+ break;
+ case GL_UNPACK_SKIP_IMAGES_EXT:
+ *params = ctx->Unpack.SkipImages;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT_EXT:
+ *params = ctx->Unpack.ImageHeight;
+ break;
+ case GL_UNPACK_CLIENT_STORAGE_APPLE:
+ *params = ctx->Unpack.ClientStorage;
+ break;
+ case GL_VIEWPORT:
+ params[0] = INT_TO_BOOL(ctx->Viewport.X);
+ params[1] = INT_TO_BOOL(ctx->Viewport.Y);
+ params[2] = INT_TO_BOOL(ctx->Viewport.Width);
+ params[3] = INT_TO_BOOL(ctx->Viewport.Height);
+ break;
+ case GL_ZOOM_X:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.ZoomX);
+ break;
+ case GL_ZOOM_Y:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.ZoomY);
+ break;
+ case GL_VERTEX_ARRAY:
+ *params = ctx->Array.Vertex.Enabled;
+ break;
+ case GL_VERTEX_ARRAY_SIZE:
+ *params = INT_TO_BOOL(ctx->Array.Vertex.Size);
+ break;
+ case GL_VERTEX_ARRAY_TYPE:
+ *params = ENUM_TO_BOOL(ctx->Array.Vertex.Type);
+ break;
+ case GL_VERTEX_ARRAY_STRIDE:
+ *params = INT_TO_BOOL(ctx->Array.Vertex.Stride);
+ break;
+ case GL_VERTEX_ARRAY_COUNT_EXT:
+ *params = INT_TO_BOOL(0);
+ break;
+ case GL_NORMAL_ARRAY:
+ *params = ctx->Array.Normal.Enabled;
+ break;
+ case GL_NORMAL_ARRAY_TYPE:
+ *params = ENUM_TO_BOOL(ctx->Array.Normal.Type);
+ break;
+ case GL_NORMAL_ARRAY_STRIDE:
+ *params = INT_TO_BOOL(ctx->Array.Normal.Stride);
+ break;
+ case GL_NORMAL_ARRAY_COUNT_EXT:
+ *params = INT_TO_BOOL(0);
+ break;
+ case GL_COLOR_ARRAY:
+ *params = ctx->Array.Color.Enabled;
+ break;
+ case GL_COLOR_ARRAY_SIZE:
+ *params = INT_TO_BOOL(ctx->Array.Color.Size);
+ break;
+ case GL_COLOR_ARRAY_TYPE:
+ *params = ENUM_TO_BOOL(ctx->Array.Color.Type);
+ break;
+ case GL_COLOR_ARRAY_STRIDE:
+ *params = INT_TO_BOOL(ctx->Array.Color.Stride);
+ break;
+ case GL_COLOR_ARRAY_COUNT_EXT:
+ *params = INT_TO_BOOL(0);
+ break;
+ case GL_INDEX_ARRAY:
+ *params = ctx->Array.Index.Enabled;
+ break;
+ case GL_INDEX_ARRAY_TYPE:
+ *params = ENUM_TO_BOOL(ctx->Array.Index.Type);
+ break;
+ case GL_INDEX_ARRAY_STRIDE:
+ *params = INT_TO_BOOL(ctx->Array.Index.Stride);
+ break;
+ case GL_INDEX_ARRAY_COUNT_EXT:
+ *params = INT_TO_BOOL(0);
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ *params = ctx->Array.TexCoord[clientUnit].Enabled;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].Size);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ *params = ENUM_TO_BOOL(ctx->Array.TexCoord[clientUnit].Type);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].Stride);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
+ *params = INT_TO_BOOL(0);
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ *params = ctx->Array.EdgeFlag.Enabled;
+ break;
+ case GL_EDGE_FLAG_ARRAY_STRIDE:
+ *params = INT_TO_BOOL(ctx->Array.EdgeFlag.Stride);
+ break;
+ case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
+ *params = INT_TO_BOOL(0);
+ break;
+
+ /* GL_ARB_multitexture */
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ CHECK_EXTENSION_B(ARB_multitexture, pname);
+ *params = INT_TO_BOOL(MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits));
+ break;
+ case GL_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_B(ARB_multitexture, pname);
+ *params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit);
+ break;
+ case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_B(ARB_multitexture, pname);
+ *params = INT_TO_BOOL(GL_TEXTURE0_ARB + clientUnit);
+ break;
+
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ CHECK_EXTENSION_B(ARB_texture_cube_map, pname);
+ *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ CHECK_EXTENSION_B(ARB_texture_cube_map, pname);
+ *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name);
+ break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ CHECK_EXTENSION_B(ARB_texture_cube_map, pname);
+ *params = INT_TO_BOOL(1 << (ctx->Const.MaxCubeTextureLevels - 1));
+ break;
+
+ /* GL_ARB_texture_compression */
+ case GL_TEXTURE_COMPRESSION_HINT_ARB:
+ CHECK_EXTENSION_B(ARB_texture_compression, pname);
+ *params = INT_TO_BOOL(ctx->Hint.TextureCompression);
+ break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_B(ARB_texture_compression, pname);
+ *params = INT_TO_BOOL(_mesa_get_compressed_formats(ctx, NULL));
+ break;
+ case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_B(ARB_texture_compression, pname);
+ {
+ GLint formats[100];
+ GLuint i, n;
+ n = _mesa_get_compressed_formats(ctx, formats);
+ for (i = 0; i < n; i++)
+ params[i] = INT_TO_BOOL(formats[i]);
+ }
+ break;
+
+ /* GL_EXT_compiled_vertex_array */
+ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
+ *params = ctx->Array.LockFirst ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:
+ *params = ctx->Array.LockCount ? GL_TRUE : GL_FALSE;
+ break;
+
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ColorMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ModelviewMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ProjectionMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
+ break;
+
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ CHECK_EXTENSION_B(HP_occlusion_test, pname);
+ *params = ctx->Depth.OcclusionTest;
+ return;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ CHECK_EXTENSION_B(HP_occlusion_test, pname);
+ if (ctx->Depth.OcclusionTest)
+ *params = ctx->OcclusionResult;
+ else
+ *params = ctx->OcclusionResultSaved;
+ /* reset flag now */
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+ return;
+
+ /* GL_SGIS_pixel_texture */
+ case GL_PIXEL_TEXTURE_SGIS:
+ *params = ctx->Pixel.PixelTextureEnabled;
+ break;
+
+ /* GL_SGIX_pixel_texture */
+ case GL_PIXEL_TEX_GEN_SGIX:
+ *params = ctx->Pixel.PixelTextureEnabled;
+ break;
+ case GL_PIXEL_TEX_GEN_MODE_SGIX:
+ *params = (GLboolean) pixel_texgen_mode(ctx);
+ break;
+
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(ctx->ColorMatrixStack.Top->m[i]);
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = INT_TO_BOOL(ctx->ColorMatrixStack.Depth + 1);
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = FLOAT_TO_BOOL(MAX_COLOR_STACK_DEPTH);
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[0]);
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[1]);
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[2]);
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[3]);
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[0]);
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[1]);
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[2]);
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[3]);
+ break;
+
+ /* GL_EXT_convolution (also in 1.2 imaging) */
+ case GL_CONVOLUTION_1D_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = ctx->Pixel.Convolution1DEnabled;
+ break;
+ case GL_CONVOLUTION_2D:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = ctx->Pixel.Convolution2DEnabled;
+ break;
+ case GL_SEPARABLE_2D:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = ctx->Pixel.Separable2DEnabled;
+ break;
+ case GL_POST_CONVOLUTION_RED_SCALE_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[0]);
+ break;
+ case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[1]);
+ break;
+ case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[2]);
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[3]);
+ break;
+ case GL_POST_CONVOLUTION_RED_BIAS_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[0]);
+ break;
+ case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[1]);
+ break;
+ case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]);
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:
+ CHECK_EXTENSION_B(EXT_convolution, pname);
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]);
+ break;
+
+ /* GL_EXT_histogram (also in 1.2 imaging) */
+ case GL_HISTOGRAM:
+ CHECK_EXTENSION_B(EXT_histogram, pname);
+ *params = ctx->Pixel.HistogramEnabled;
+ break;
+ case GL_MINMAX:
+ CHECK_EXTENSION_B(EXT_histogram, pname);
+ *params = ctx->Pixel.MinMaxEnabled;
+ break;
+
+ /* GL_SGI_color_table (also in 1.2 imaging */
+ case GL_COLOR_TABLE_SGI:
+ *params = ctx->Pixel.ColorTableEnabled;
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ *params = ctx->Pixel.PostConvolutionColorTableEnabled;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ *params = ctx->Pixel.PostColorMatrixColorTableEnabled;
+ break;
+
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_B(SGI_texture_color_table, pname);
+ *params = textureUnit->ColorTableEnabled;
+ break;
+
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ CHECK_EXTENSION_B(EXT_secondary_color, pname);
+ *params = ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ CHECK_EXTENSION_B(EXT_secondary_color, pname);
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
+ params[1] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
+ params[2] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
+ params[3] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ CHECK_EXTENSION_B(EXT_secondary_color, pname);
+ *params = ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_B(EXT_secondary_color, pname);
+ *params = ENUM_TO_BOOL(ctx->Array.SecondaryColor.Type);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_B(EXT_secondary_color, pname);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ CHECK_EXTENSION_B(EXT_secondary_color, pname);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Size);
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ CHECK_EXTENSION_B(EXT_fog_coord, pname);
+ FLUSH_CURRENT(ctx, 0);
+ *params = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ CHECK_EXTENSION_B(EXT_fog_coord, pname);
+ *params = ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_B(EXT_fog_coord, pname);
+ *params = ENUM_TO_BOOL(ctx->Array.FogCoord.Type);
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_B(EXT_fog_coord, pname);
+ *params = INT_TO_BOOL(ctx->Array.FogCoord.Stride);
+ break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_B(EXT_fog_coord, pname);
+ *params = ENUM_TO_BOOL(ctx->Fog.FogCoordinateSource);
+ break;
+
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = FLOAT_TO_BOOL(ctx->Const.MaxTextureLodBias);
+ break;
+
+ /* GL_EXT_texture_filter_anisotropic */
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ CHECK_EXTENSION_B(EXT_texture_filter_anisotropic, pname);
+ *params = FLOAT_TO_BOOL(ctx->Const.MaxTextureMaxAnisotropy);
+ break;
+
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = ctx->Multisample.Enabled;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = ctx->Multisample.SampleAlphaToCoverage;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = ctx->Multisample.SampleAlphaToOne;
+ break;
+ case GL_SAMPLE_COVERAGE_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = ctx->Multisample.SampleCoverage;
+ break;
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = FLOAT_TO_BOOL(ctx->Multisample.SampleCoverageValue);
+ break;
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = ctx->Multisample.SampleCoverageInvert;
+ break;
+ case GL_SAMPLE_BUFFERS_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = 0; /* XXX fix someday */
+ break;
+ case GL_SAMPLES_ARB:
+ CHECK_EXTENSION_B(ARB_multisample, pname);
+ *params = 0; /* XXX fix someday */
+ break;
+
+ /* GL_IBM_rasterpos_clip */
+ case GL_RASTER_POSITION_UNCLIPPED_IBM:
+ CHECK_EXTENSION_B(IBM_rasterpos_clip, pname);
+ *params = ctx->Transform.RasterPositionUnclipped;
+ break;
+
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION2_B(NV_point_sprite, ARB_point_sprite, pname);
+ *params = ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite, pname);
+ *params = ENUM_TO_BOOL(ctx->Point.SpriteRMode);
+ break;
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_B(ARB_point_sprite, pname);
+ *params = ENUM_TO_BOOL(ctx->Point.SpriteOrigin);
+ break;
+
+ /* GL_SGIS_generate_mipmap */
+ case GL_GENERATE_MIPMAP_HINT_SGIS:
+ CHECK_EXTENSION_B(SGIS_generate_mipmap, pname);
+ *params = ENUM_TO_BOOL(ctx->Hint.GenerateMipmap);
+ break;
+
+#if FEATURE_NV_vertex_program
+ case GL_VERTEX_PROGRAM_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ *params = ctx->VertexProgram.Enabled;
+ break;
+ case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ *params = ctx->VertexProgram.PointSizeEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ *params = ctx->VertexProgram.TwoSideEnabled;
+ break;
+ case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ *params = (ctx->Const.MaxProgramMatrixStackDepth > 0) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_MAX_TRACK_MATRICES_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ *params = (ctx->Const.MaxProgramMatrices > 0) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ *params = GL_TRUE;
+ break;
+ case GL_CURRENT_MATRIX_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ for (i = 0; i < 16; i++)
+ params[i] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[i]);
+ break;
+ case GL_VERTEX_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ if (ctx->VertexProgram.Current &&
+ ctx->VertexProgram.Current->Base.Id != 0)
+ *params = GL_TRUE;
+ else
+ *params = GL_FALSE;
+ break;
+ case GL_PROGRAM_ERROR_POSITION_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ *params = (ctx->Program.ErrorPos != 0) ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY0_NV:
+ case GL_VERTEX_ATTRIB_ARRAY1_NV:
+ case GL_VERTEX_ATTRIB_ARRAY2_NV:
+ case GL_VERTEX_ATTRIB_ARRAY3_NV:
+ case GL_VERTEX_ATTRIB_ARRAY4_NV:
+ case GL_VERTEX_ATTRIB_ARRAY5_NV:
+ case GL_VERTEX_ATTRIB_ARRAY6_NV:
+ case GL_VERTEX_ATTRIB_ARRAY7_NV:
+ case GL_VERTEX_ATTRIB_ARRAY8_NV:
+ case GL_VERTEX_ATTRIB_ARRAY9_NV:
+ case GL_VERTEX_ATTRIB_ARRAY10_NV:
+ case GL_VERTEX_ATTRIB_ARRAY11_NV:
+ case GL_VERTEX_ATTRIB_ARRAY12_NV:
+ case GL_VERTEX_ATTRIB_ARRAY13_NV:
+ case GL_VERTEX_ATTRIB_ARRAY14_NV:
+ case GL_VERTEX_ATTRIB_ARRAY15_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV;
+ *params = ctx->Array.VertexAttrib[n].Enabled;
+ }
+ break;
+ case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV;
+ *params = ctx->Eval.Map1Attrib[n];
+ }
+ break;
+ case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV;
+ *params = ctx->Eval.Map2Attrib[n];
+ }
+ break;
+#endif /* FEATURE_NV_vertex_program */
+
+#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ *params = ctx->FragmentProgram.Enabled;
+ break;
+ case GL_MAX_TEXTURE_COORDS_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ *params = INT_TO_BOOL(ctx->Const.MaxTextureCoordUnits);
+ break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ *params = INT_TO_BOOL(ctx->Const.MaxTextureImageUnits);
+ break;
+ case GL_FRAGMENT_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ if (ctx->VertexProgram.Current &&
+ ctx->VertexProgram.Current->Base.Id != 0)
+ *params = GL_TRUE;
+ else
+ *params = GL_FALSE;
+ break;
+ case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ *params = MAX_NV_FRAGMENT_PROGRAM_PARAMS ? GL_TRUE : GL_FALSE;
+ break;
+#endif /* FEATURE_NV_fragment_program */
+
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_B(NV_texture_rectangle, pname);
+ *params = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_B(NV_texture_rectangle, pname);
+ *params = INT_TO_BOOL(textureUnit->CurrentRect->Name);
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_B(NV_texture_rectangle, pname);
+ *params = INT_TO_BOOL(ctx->Const.MaxTextureRectSize);
+ break;
+
+ /* GL_EXT_stencil_two_side */
+ case GL_STENCIL_TEST_TWO_SIDE_EXT:
+ CHECK_EXTENSION_B(EXT_stencil_two_side, pname);
+ *params = ctx->Stencil.TestTwoSide;
+ break;
+ case GL_ACTIVE_STENCIL_FACE_EXT:
+ CHECK_EXTENSION_B(EXT_stencil_two_side, pname);
+ *params = ENUM_TO_BOOL(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
+ break;
+
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = FLOAT_TO_BOOL(ctx->Const.MaxShininess);
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = FLOAT_TO_BOOL(ctx->Const.MaxSpotExponent);
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.ArrayBufferObj->Name);
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Vertex.BufferObj->Name);
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Normal.BufferObj->Name);
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Color.BufferObj->Name);
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Index.BufferObj->Name);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].BufferObj->Name);
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.EdgeFlag.BufferObj->Name);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.BufferObj->Name);
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.FogCoord.BufferObj->Name);
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.ElementArrayBufferObj->Name);
+ break;
+#endif
+#if FEATURE_EXT_pixel_buffer_object
+ case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Pack.BufferObj->Name);
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Unpack.BufferObj->Name);
+ break;
+#endif
+
+#if FEATURE_ARB_vertex_program
+ /* GL_NV_vertex_program and GL_ARB_fragment_program define others */
+ case GL_MAX_VERTEX_ATTRIBS_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_program, pname);
+ *params = (ctx->Const.MaxVertexProgramAttribs > 0) ? GL_TRUE : GL_FALSE;
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_B(ARB_fragment_program, pname);
+ *params = ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_B(ARB_fragment_program, pname);
+ params[0] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[4]);
+ params[2] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[8]);
+ params[3] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[12]);
+ params[4] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[1]);
+ params[5] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[5]);
+ params[6] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[9]);
+ params[7] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[13]);
+ params[8] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[2]);
+ params[9] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[6]);
+ params[10] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[10]);
+ params[11] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[14]);
+ params[12] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[3]);
+ params[13] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[7]);
+ params[14] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[11]);
+ params[15] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[15]);
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+ params[0] = FLOAT_TO_BOOL(ctx->Depth.BoundsMin);
+ params[1] = FLOAT_TO_BOOL(ctx->Depth.BoundsMax);
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = INT_TO_BOOL(ctx->FragmentProgram.CurrentPosition);
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = INT_TO_BOOL(ctx->VertexProgram.CurrentPosition);
+ break;
+#endif
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
+ }
+}
+
+
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetDoublev().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetDoublev,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLdouble.
+ */
+void GLAPIENTRY
+_mesa_GetDoublev( GLenum pname, GLdouble *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint i;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
+ const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!params)
+ return;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname));
+
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
+ if (ctx->Driver.GetDoublev && (*ctx->Driver.GetDoublev)(ctx, pname, params))
+ return;
+
+ switch (pname) {
+ case GL_ACCUM_RED_BITS:
+ *params = (GLdouble) ctx->Visual.accumRedBits;
+ break;
+ case GL_ACCUM_GREEN_BITS:
+ *params = (GLdouble) ctx->Visual.accumGreenBits;
+ break;
+ case GL_ACCUM_BLUE_BITS:
+ *params = (GLdouble) ctx->Visual.accumBlueBits;
+ break;
+ case GL_ACCUM_ALPHA_BITS:
+ *params = (GLdouble) ctx->Visual.accumAlphaBits;
+ break;
+ case GL_ACCUM_CLEAR_VALUE:
+ params[0] = (GLdouble) ctx->Accum.ClearColor[0];
+ params[1] = (GLdouble) ctx->Accum.ClearColor[1];
+ params[2] = (GLdouble) ctx->Accum.ClearColor[2];
+ params[3] = (GLdouble) ctx->Accum.ClearColor[3];
+ break;
+ case GL_ALPHA_BIAS:
+ *params = (GLdouble) ctx->Pixel.AlphaBias;
+ break;
+ case GL_ALPHA_BITS:
+ *params = (GLdouble) ctx->Visual.alphaBits;
+ break;
+ case GL_ALPHA_SCALE:
+ *params = (GLdouble) ctx->Pixel.AlphaScale;
+ break;
+ case GL_ALPHA_TEST:
+ *params = (GLdouble) ctx->Color.AlphaEnabled;
+ break;
+ case GL_ALPHA_TEST_FUNC:
+ *params = ENUM_TO_DOUBLE(ctx->Color.AlphaFunc);
+ break;
+ case GL_ALPHA_TEST_REF:
+ *params = (GLdouble) ctx->Color.AlphaRef;
+ break;
+ case GL_ATTRIB_STACK_DEPTH:
+ *params = (GLdouble ) (ctx->AttribStackDepth);
+ break;
+ case GL_AUTO_NORMAL:
+ *params = (GLdouble) ctx->Eval.AutoNormal;
+ break;
+ case GL_AUX_BUFFERS:
+ *params = (GLdouble) ctx->Visual.numAuxBuffers;
+ break;
+ case GL_BLEND:
+ *params = (GLdouble) ctx->Color.BlendEnabled;
+ break;
+ case GL_BLEND_DST:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendDstRGB);
+ break;
+ case GL_BLEND_SRC:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendSrcRGB);
+ break;
+ case GL_BLEND_SRC_RGB_EXT:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendSrcRGB);
+ break;
+ case GL_BLEND_DST_RGB_EXT:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendDstRGB);
+ break;
+ case GL_BLEND_SRC_ALPHA_EXT:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendSrcA);
+ break;
+ case GL_BLEND_DST_ALPHA_EXT:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendDstA);
+ break;
+ case GL_BLEND_EQUATION:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendEquationRGB);
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendEquationA);
+ break;
+ case GL_BLEND_COLOR_EXT:
+ params[0] = (GLdouble) ctx->Color.BlendColor[0];
+ params[1] = (GLdouble) ctx->Color.BlendColor[1];
+ params[2] = (GLdouble) ctx->Color.BlendColor[2];
+ params[3] = (GLdouble) ctx->Color.BlendColor[3];
+ break;
+ case GL_BLUE_BIAS:
+ *params = (GLdouble) ctx->Pixel.BlueBias;
+ break;
+ case GL_BLUE_BITS:
+ *params = (GLdouble) ctx->Visual.blueBits;
+ break;
+ case GL_BLUE_SCALE:
+ *params = (GLdouble) ctx->Pixel.BlueScale;
+ break;
+ case GL_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = (GLdouble) (ctx->ClientAttribStackDepth);
+ break;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = 1.0;
+ else
+ *params = 0.0;
+ break;
+ case GL_COLOR_CLEAR_VALUE:
+ params[0] = (GLdouble) ctx->Color.ClearColor[0];
+ params[1] = (GLdouble) ctx->Color.ClearColor[1];
+ params[2] = (GLdouble) ctx->Color.ClearColor[2];
+ params[3] = (GLdouble) ctx->Color.ClearColor[3];
+ break;
+ case GL_COLOR_MATERIAL:
+ *params = (GLdouble) ctx->Light.ColorMaterialEnabled;
+ break;
+ case GL_COLOR_MATERIAL_FACE:
+ *params = ENUM_TO_DOUBLE(ctx->Light.ColorMaterialFace);
+ break;
+ case GL_COLOR_MATERIAL_PARAMETER:
+ *params = ENUM_TO_DOUBLE(ctx->Light.ColorMaterialMode);
+ break;
+ case GL_COLOR_WRITEMASK:
+ params[0] = ctx->Color.ColorMask[RCOMP] ? 1.0 : 0.0;
+ params[1] = ctx->Color.ColorMask[GCOMP] ? 1.0 : 0.0;
+ params[2] = ctx->Color.ColorMask[BCOMP] ? 1.0 : 0.0;
+ params[3] = ctx->Color.ColorMask[ACOMP] ? 1.0 : 0.0;
+ break;
+ case GL_CULL_FACE:
+ *params = (GLdouble) ctx->Polygon.CullFlag;
+ break;
+ case GL_CULL_FACE_MODE:
+ *params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode);
+ break;
+ case GL_CURRENT_COLOR:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
+ params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
+ params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
+ params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
+ break;
+ case GL_CURRENT_INDEX:
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLdouble) ctx->Current.Index;
+ break;
+ case GL_CURRENT_NORMAL:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
+ params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
+ params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
+ break;
+ case GL_CURRENT_RASTER_COLOR:
+ params[0] = (GLdouble) ctx->Current.RasterColor[0];
+ params[1] = (GLdouble) ctx->Current.RasterColor[1];
+ params[2] = (GLdouble) ctx->Current.RasterColor[2];
+ params[3] = (GLdouble) ctx->Current.RasterColor[3];
+ break;
+ case GL_CURRENT_RASTER_DISTANCE:
+ params[0] = (GLdouble) ctx->Current.RasterDistance;
+ break;
+ case GL_CURRENT_RASTER_INDEX:
+ *params = (GLdouble) ctx->Current.RasterIndex;
+ break;
+ case GL_CURRENT_RASTER_POSITION:
+ params[0] = (GLdouble) ctx->Current.RasterPos[0];
+ params[1] = (GLdouble) ctx->Current.RasterPos[1];
+ params[2] = (GLdouble) ctx->Current.RasterPos[2];
+ params[3] = (GLdouble) ctx->Current.RasterPos[3];
+ break;
+ case GL_CURRENT_RASTER_TEXTURE_COORDS:
+ params[0] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][0];
+ params[1] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][1];
+ params[2] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][2];
+ params[3] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][3];
+ break;
+ case GL_CURRENT_RASTER_POSITION_VALID:
+ *params = (GLdouble) ctx->Current.RasterPosValid;
+ break;
+ case GL_CURRENT_TEXTURE_COORDS:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0];
+ params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1];
+ params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2];
+ params[3] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3];
+ break;
+ case GL_DEPTH_BIAS:
+ *params = (GLdouble) ctx->Pixel.DepthBias;
+ break;
+ case GL_DEPTH_BITS:
+ *params = (GLdouble) ctx->Visual.depthBits;
+ break;
+ case GL_DEPTH_CLEAR_VALUE:
+ *params = (GLdouble) ctx->Depth.Clear;
+ break;
+ case GL_DEPTH_FUNC:
+ *params = ENUM_TO_DOUBLE(ctx->Depth.Func);
+ break;
+ case GL_DEPTH_RANGE:
+ params[0] = (GLdouble) ctx->Viewport.Near;
+ params[1] = (GLdouble) ctx->Viewport.Far;
+ break;
+ case GL_DEPTH_SCALE:
+ *params = (GLdouble) ctx->Pixel.DepthScale;
+ break;
+ case GL_DEPTH_TEST:
+ *params = (GLdouble) ctx->Depth.Test;
+ break;
+ case GL_DEPTH_WRITEMASK:
+ *params = (GLdouble) ctx->Depth.Mask;
+ break;
+ case GL_DITHER:
+ *params = (GLdouble) ctx->Color.DitherFlag;
+ break;
+ case GL_DOUBLEBUFFER:
+ *params = (GLdouble) ctx->Visual.doubleBufferMode;
+ break;
+ case GL_DRAW_BUFFER:
+ *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer);
+ break;
+ case GL_EDGE_FLAG:
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLdouble) ctx->Current.EdgeFlag;
+ break;
+ case GL_FEEDBACK_BUFFER_SIZE:
+ *params = (GLdouble) ctx->Feedback.BufferSize;
+ break;
+ case GL_FEEDBACK_BUFFER_TYPE:
+ *params = ENUM_TO_DOUBLE(ctx->Feedback.Type);
+ break;
+ case GL_FOG:
+ *params = (GLdouble) ctx->Fog.Enabled;
+ break;
+ case GL_FOG_COLOR:
+ params[0] = (GLdouble) ctx->Fog.Color[0];
+ params[1] = (GLdouble) ctx->Fog.Color[1];
+ params[2] = (GLdouble) ctx->Fog.Color[2];
+ params[3] = (GLdouble) ctx->Fog.Color[3];
+ break;
+ case GL_FOG_DENSITY:
+ *params = (GLdouble) ctx->Fog.Density;
+ break;
+ case GL_FOG_END:
+ *params = (GLdouble) ctx->Fog.End;
+ break;
+ case GL_FOG_HINT:
+ *params = ENUM_TO_DOUBLE(ctx->Hint.Fog);
+ break;
+ case GL_FOG_INDEX:
+ *params = (GLdouble) ctx->Fog.Index;
+ break;
+ case GL_FOG_MODE:
+ *params = ENUM_TO_DOUBLE(ctx->Fog.Mode);
+ break;
+ case GL_FOG_START:
+ *params = (GLdouble) ctx->Fog.Start;
+ break;
+ case GL_FRONT_FACE:
+ *params = ENUM_TO_DOUBLE(ctx->Polygon.FrontFace);
+ break;
+ case GL_GREEN_BIAS:
+ *params = (GLdouble) ctx->Pixel.GreenBias;
+ break;
+ case GL_GREEN_BITS:
+ *params = (GLdouble) ctx->Visual.greenBits;
+ break;
+ case GL_GREEN_SCALE:
+ *params = (GLdouble) ctx->Pixel.GreenScale;
+ break;
+ case GL_INDEX_BITS:
+ *params = (GLdouble) ctx->Visual.indexBits;
+ break;
+ case GL_INDEX_CLEAR_VALUE:
+ *params = (GLdouble) ctx->Color.ClearIndex;
+ break;
+ case GL_INDEX_MODE:
+ *params = ctx->Visual.rgbMode ? 0.0 : 1.0;
+ break;
+ case GL_INDEX_OFFSET:
+ *params = (GLdouble) ctx->Pixel.IndexOffset;
+ break;
+ case GL_INDEX_SHIFT:
+ *params = (GLdouble) ctx->Pixel.IndexShift;
+ break;
+ case GL_INDEX_WRITEMASK:
+ *params = (GLdouble) ctx->Color.IndexMask;
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ *params = (GLdouble) ctx->Light.Light[pname-GL_LIGHT0].Enabled;
+ break;
+ case GL_LIGHTING:
+ *params = (GLdouble) ctx->Light.Enabled;
+ break;
+ case GL_LIGHT_MODEL_AMBIENT:
+ params[0] = (GLdouble) ctx->Light.Model.Ambient[0];
+ params[1] = (GLdouble) ctx->Light.Model.Ambient[1];
+ params[2] = (GLdouble) ctx->Light.Model.Ambient[2];
+ params[3] = (GLdouble) ctx->Light.Model.Ambient[3];
+ break;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ params[0] = (GLdouble) ctx->Light.Model.ColorControl;
+ break;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ *params = (GLdouble) ctx->Light.Model.LocalViewer;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *params = (GLdouble) ctx->Light.Model.TwoSide;
+ break;
+ case GL_LINE_SMOOTH:
+ *params = (GLdouble) ctx->Line.SmoothFlag;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ *params = ENUM_TO_DOUBLE(ctx->Hint.LineSmooth);
+ break;
+ case GL_LINE_STIPPLE:
+ *params = (GLdouble) ctx->Line.StippleFlag;
+ break;
+ case GL_LINE_STIPPLE_PATTERN:
+ *params = (GLdouble) ctx->Line.StipplePattern;
+ break;
+ case GL_LINE_STIPPLE_REPEAT:
+ *params = (GLdouble) ctx->Line.StippleFactor;
+ break;
+ case GL_LINE_WIDTH:
+ *params = (GLdouble) ctx->Line.Width;
+ break;
+ case GL_LINE_WIDTH_GRANULARITY:
+ *params = (GLdouble) ctx->Const.LineWidthGranularity;
+ break;
+ case GL_LINE_WIDTH_RANGE:
+ params[0] = (GLdouble) ctx->Const.MinLineWidthAA;
+ params[1] = (GLdouble) ctx->Const.MaxLineWidthAA;
+ break;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ params[0] = (GLdouble) ctx->Const.MinLineWidth;
+ params[1] = (GLdouble) ctx->Const.MaxLineWidth;
+ break;
+ case GL_LIST_BASE:
+ *params = (GLdouble) ctx->List.ListBase;
+ break;
+ case GL_LIST_INDEX:
+ *params = (GLdouble) ctx->ListState.CurrentListNum;
+ break;
+ case GL_LIST_MODE:
+ if (!ctx->CompileFlag)
+ *params = 0.0;
+ else if (ctx->ExecuteFlag)
+ *params = ENUM_TO_DOUBLE(GL_COMPILE_AND_EXECUTE);
+ else
+ *params = ENUM_TO_DOUBLE(GL_COMPILE);
+ break;
+ case GL_INDEX_LOGIC_OP:
+ *params = (GLdouble) ctx->Color.IndexLogicOpEnabled;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ *params = (GLdouble) ctx->Color.ColorLogicOpEnabled;
+ break;
+ case GL_LOGIC_OP_MODE:
+ *params = ENUM_TO_DOUBLE(ctx->Color.LogicOp);
+ break;
+ case GL_MAP1_COLOR_4:
+ *params = (GLdouble) ctx->Eval.Map1Color4;
+ break;
+ case GL_MAP1_GRID_DOMAIN:
+ params[0] = (GLdouble) ctx->Eval.MapGrid1u1;
+ params[1] = (GLdouble) ctx->Eval.MapGrid1u2;
+ break;
+ case GL_MAP1_GRID_SEGMENTS:
+ *params = (GLdouble) ctx->Eval.MapGrid1un;
+ break;
+ case GL_MAP1_INDEX:
+ *params = (GLdouble) ctx->Eval.Map1Index;
+ break;
+ case GL_MAP1_NORMAL:
+ *params = (GLdouble) ctx->Eval.Map1Normal;
+ break;
+ case GL_MAP1_TEXTURE_COORD_1:
+ *params = (GLdouble) ctx->Eval.Map1TextureCoord1;
+ break;
+ case GL_MAP1_TEXTURE_COORD_2:
+ *params = (GLdouble) ctx->Eval.Map1TextureCoord2;
+ break;
+ case GL_MAP1_TEXTURE_COORD_3:
+ *params = (GLdouble) ctx->Eval.Map1TextureCoord3;
+ break;
+ case GL_MAP1_TEXTURE_COORD_4:
+ *params = (GLdouble) ctx->Eval.Map1TextureCoord4;
+ break;
+ case GL_MAP1_VERTEX_3:
+ *params = (GLdouble) ctx->Eval.Map1Vertex3;
+ break;
+ case GL_MAP1_VERTEX_4:
+ *params = (GLdouble) ctx->Eval.Map1Vertex4;
+ break;
+ case GL_MAP2_COLOR_4:
+ *params = (GLdouble) ctx->Eval.Map2Color4;
+ break;
+ case GL_MAP2_GRID_DOMAIN:
+ params[0] = (GLdouble) ctx->Eval.MapGrid2u1;
+ params[1] = (GLdouble) ctx->Eval.MapGrid2u2;
+ params[2] = (GLdouble) ctx->Eval.MapGrid2v1;
+ params[3] = (GLdouble) ctx->Eval.MapGrid2v2;
+ break;
+ case GL_MAP2_GRID_SEGMENTS:
+ params[0] = (GLdouble) ctx->Eval.MapGrid2un;
+ params[1] = (GLdouble) ctx->Eval.MapGrid2vn;
+ break;
+ case GL_MAP2_INDEX:
+ *params = (GLdouble) ctx->Eval.Map2Index;
+ break;
+ case GL_MAP2_NORMAL:
+ *params = (GLdouble) ctx->Eval.Map2Normal;
+ break;
+ case GL_MAP2_TEXTURE_COORD_1:
+ *params = (GLdouble) ctx->Eval.Map2TextureCoord1;
+ break;
+ case GL_MAP2_TEXTURE_COORD_2:
+ *params = (GLdouble) ctx->Eval.Map2TextureCoord2;
+ break;
+ case GL_MAP2_TEXTURE_COORD_3:
+ *params = (GLdouble) ctx->Eval.Map2TextureCoord3;
+ break;
+ case GL_MAP2_TEXTURE_COORD_4:
+ *params = (GLdouble) ctx->Eval.Map2TextureCoord4;
+ break;
+ case GL_MAP2_VERTEX_3:
+ *params = (GLdouble) ctx->Eval.Map2Vertex3;
+ break;
+ case GL_MAP2_VERTEX_4:
+ *params = (GLdouble) ctx->Eval.Map2Vertex4;
+ break;
+ case GL_MAP_COLOR:
+ *params = (GLdouble) ctx->Pixel.MapColorFlag;
+ break;
+ case GL_MAP_STENCIL:
+ *params = (GLdouble) ctx->Pixel.MapStencilFlag;
+ break;
+ case GL_MATRIX_MODE:
+ *params = ENUM_TO_DOUBLE(ctx->Transform.MatrixMode);
+ break;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ *params = (GLdouble) MAX_ATTRIB_STACK_DEPTH;
+ break;
+ case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = (GLdouble) MAX_CLIENT_ATTRIB_STACK_DEPTH;
+ break;
+ case GL_MAX_CLIP_PLANES:
+ *params = (GLdouble) ctx->Const.MaxClipPlanes;
+ break;
+ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
+ *params = (GLdouble) ctx->Const.MaxArrayLockSize;
+ break;
+ case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
+ *params = (GLdouble) ctx->Const.MaxArrayLockSize;
+ break;
+ case GL_MAX_EVAL_ORDER:
+ *params = (GLdouble) MAX_EVAL_ORDER;
+ break;
+ case GL_MAX_LIGHTS:
+ *params = (GLdouble) ctx->Const.MaxLights;
+ break;
+ case GL_MAX_LIST_NESTING:
+ *params = (GLdouble) MAX_LIST_NESTING;
+ break;
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ *params = (GLdouble) MAX_MODELVIEW_STACK_DEPTH;
+ break;
+ case GL_MAX_NAME_STACK_DEPTH:
+ *params = (GLdouble) MAX_NAME_STACK_DEPTH;
+ break;
+ case GL_MAX_PIXEL_MAP_TABLE:
+ *params = (GLdouble) MAX_PIXEL_MAP_TABLE;
+ break;
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ *params = (GLdouble) MAX_PROJECTION_STACK_DEPTH;
+ break;
+ case GL_MAX_TEXTURE_SIZE:
+ *params = (GLdouble) (1 << (ctx->Const.MaxTextureLevels - 1));
+ break;
+ case GL_MAX_3D_TEXTURE_SIZE:
+ *params = (GLdouble) (1 << (ctx->Const.Max3DTextureLevels - 1));
+ break;
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ *params = (GLdouble) MAX_TEXTURE_STACK_DEPTH;
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ params[0] = (GLdouble) MAX_WIDTH;
+ params[1] = (GLdouble) MAX_HEIGHT;
+ break;
+ case GL_MODELVIEW_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) ctx->ModelviewMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_MODELVIEW_STACK_DEPTH:
+ *params = (GLdouble) (ctx->ModelviewMatrixStack.Depth + 1);
+ break;
+ case GL_NAME_STACK_DEPTH:
+ *params = (GLdouble) ctx->Select.NameStackDepth;
+ break;
+ case GL_NORMALIZE:
+ *params = (GLdouble) ctx->Transform.Normalize;
+ break;
+ case GL_PACK_ALIGNMENT:
+ *params = (GLdouble) ctx->Pack.Alignment;
+ break;
+ case GL_PACK_LSB_FIRST:
+ *params = (GLdouble) ctx->Pack.LsbFirst;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ *params = (GLdouble) ctx->Pack.RowLength;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ *params = (GLdouble) ctx->Pack.SkipPixels;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ *params = (GLdouble) ctx->Pack.SkipRows;
+ break;
+ case GL_PACK_SWAP_BYTES:
+ *params = (GLdouble) ctx->Pack.SwapBytes;
+ break;
+ case GL_PACK_SKIP_IMAGES_EXT:
+ *params = (GLdouble) ctx->Pack.SkipImages;
+ break;
+ case GL_PACK_IMAGE_HEIGHT_EXT:
+ *params = (GLdouble) ctx->Pack.ImageHeight;
+ break;
+ case GL_PACK_INVERT_MESA:
+ *params = (GLdouble) ctx->Pack.Invert;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ *params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection);
+ break;
+ case GL_PIXEL_MAP_A_TO_A_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapAtoAsize;
+ break;
+ case GL_PIXEL_MAP_B_TO_B_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapBtoBsize;
+ break;
+ case GL_PIXEL_MAP_G_TO_G_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapGtoGsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_A_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapItoAsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_B_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapItoBsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_G_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapItoGsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_I_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapItoIsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_R_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapItoRsize;
+ break;
+ case GL_PIXEL_MAP_R_TO_R_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapRtoRsize;
+ break;
+ case GL_PIXEL_MAP_S_TO_S_SIZE:
+ *params = (GLdouble) ctx->Pixel.MapStoSsize;
+ break;
+ case GL_POINT_SIZE:
+ *params = (GLdouble) ctx->Point.Size;
+ break;
+ case GL_POINT_SIZE_GRANULARITY:
+ *params = (GLdouble) ctx->Const.PointSizeGranularity;
+ break;
+ case GL_POINT_SIZE_RANGE:
+ params[0] = (GLdouble) ctx->Const.MinPointSizeAA;
+ params[1] = (GLdouble) ctx->Const.MaxPointSizeAA;
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ params[0] = (GLdouble) ctx->Const.MinPointSize;
+ params[1] = (GLdouble) ctx->Const.MaxPointSize;
+ break;
+ case GL_POINT_SMOOTH:
+ *params = (GLdouble) ctx->Point.SmoothFlag;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ *params = ENUM_TO_DOUBLE(ctx->Hint.PointSmooth);
+ break;
+ case GL_POINT_SIZE_MIN_EXT:
+ *params = (GLdouble) (ctx->Point.MinSize);
+ break;
+ case GL_POINT_SIZE_MAX_EXT:
+ *params = (GLdouble) (ctx->Point.MaxSize);
+ break;
+ case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+ *params = (GLdouble) (ctx->Point.Threshold);
+ break;
+ case GL_DISTANCE_ATTENUATION_EXT:
+ params[0] = (GLdouble) (ctx->Point.Params[0]);
+ params[1] = (GLdouble) (ctx->Point.Params[1]);
+ params[2] = (GLdouble) (ctx->Point.Params[2]);
+ break;
+ case GL_POLYGON_MODE:
+ params[0] = ENUM_TO_DOUBLE(ctx->Polygon.FrontMode);
+ params[1] = ENUM_TO_DOUBLE(ctx->Polygon.BackMode);
+ break;
+ case GL_POLYGON_OFFSET_BIAS_EXT: /* GL_EXT_polygon_offset */
+ *params = (GLdouble) ctx->Polygon.OffsetUnits;
+ break;
+ case GL_POLYGON_OFFSET_FACTOR:
+ *params = (GLdouble) ctx->Polygon.OffsetFactor;
+ break;
+ case GL_POLYGON_OFFSET_UNITS:
+ *params = (GLdouble) ctx->Polygon.OffsetUnits;
+ break;
+ case GL_POLYGON_SMOOTH:
+ *params = (GLdouble) ctx->Polygon.SmoothFlag;
+ break;
+ case GL_POLYGON_SMOOTH_HINT:
+ *params = ENUM_TO_DOUBLE(ctx->Hint.PolygonSmooth);
+ break;
+ case GL_POLYGON_STIPPLE:
+ *params = (GLdouble) ctx->Polygon.StippleFlag;
+ break;
+ case GL_PROJECTION_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) ctx->ProjectionMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_PROJECTION_STACK_DEPTH:
+ *params = (GLdouble) (ctx->ProjectionMatrixStack.Depth + 1);
+ break;
+ case GL_READ_BUFFER:
+ *params = ENUM_TO_DOUBLE(ctx->Pixel.ReadBuffer);
+ break;
+ case GL_RED_BIAS:
+ *params = (GLdouble) ctx->Pixel.RedBias;
+ break;
+ case GL_RED_BITS:
+ *params = (GLdouble) ctx->Visual.redBits;
+ break;
+ case GL_RED_SCALE:
+ *params = (GLdouble) ctx->Pixel.RedScale;
+ break;
+ case GL_RENDER_MODE:
+ *params = ENUM_TO_DOUBLE(ctx->RenderMode);
+ break;
+ case GL_RESCALE_NORMAL:
+ *params = (GLdouble) ctx->Transform.RescaleNormals;
+ break;
+ case GL_RGBA_MODE:
+ *params = (GLdouble) ctx->Visual.rgbMode;
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = (GLdouble) ctx->Scissor.X;
+ params[1] = (GLdouble) ctx->Scissor.Y;
+ params[2] = (GLdouble) ctx->Scissor.Width;
+ params[3] = (GLdouble) ctx->Scissor.Height;
+ break;
+ case GL_SCISSOR_TEST:
+ *params = (GLdouble) ctx->Scissor.Enabled;
+ break;
+ case GL_SELECTION_BUFFER_SIZE:
+ *params = (GLdouble) ctx->Select.BufferSize;
+ break;
+ case GL_SHADE_MODEL:
+ *params = ENUM_TO_DOUBLE(ctx->Light.ShadeModel);
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ *params = (GLdouble) ctx->Texture.SharedPalette;
+ break;
+ case GL_STENCIL_BITS:
+ *params = (GLdouble) ctx->Visual.stencilBits;
+ break;
+ case GL_STENCIL_CLEAR_VALUE:
+ *params = (GLdouble) ctx->Stencil.Clear;
+ break;
+ case GL_STENCIL_FAIL:
+ *params = ENUM_TO_DOUBLE(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_FUNC:
+ *params = ENUM_TO_DOUBLE(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *params = ENUM_TO_DOUBLE(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *params = ENUM_TO_DOUBLE(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_REF:
+ *params = (GLdouble) ctx->Stencil.Ref[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_TEST:
+ *params = (GLdouble) ctx->Stencil.Enabled;
+ break;
+ case GL_STENCIL_VALUE_MASK:
+ *params = (GLdouble) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_WRITEMASK:
+ *params = (GLdouble) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STEREO:
+ *params = (GLdouble) ctx->Visual.stereoMode;
+ break;
+ case GL_SUBPIXEL_BITS:
+ *params = (GLdouble) ctx->Const.SubPixelBits;
+ break;
+ case GL_TEXTURE_1D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0 : 0.0;
+ break;
+ case GL_TEXTURE_2D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0 : 0.0;
+ break;
+ case GL_TEXTURE_3D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0;
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ *params = (GLdouble) textureUnit->Current1D->Name;
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ *params = (GLdouble) textureUnit->Current2D->Name;
+ break;
+ case GL_TEXTURE_BINDING_3D:
+ *params = (GLdouble) textureUnit->Current3D->Name;
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ params[0] = (GLdouble) textureUnit->EnvColor[0];
+ params[1] = (GLdouble) textureUnit->EnvColor[1];
+ params[2] = (GLdouble) textureUnit->EnvColor[2];
+ params[3] = (GLdouble) textureUnit->EnvColor[3];
+ break;
+ case GL_TEXTURE_ENV_MODE:
+ *params = ENUM_TO_DOUBLE(textureUnit->EnvMode);
+ break;
+ case GL_TEXTURE_GEN_S:
+ *params = (textureUnit->TexGenEnabled & S_BIT) ? 1.0 : 0.0;
+ break;
+ case GL_TEXTURE_GEN_T:
+ *params = (textureUnit->TexGenEnabled & T_BIT) ? 1.0 : 0.0;
+ break;
+ case GL_TEXTURE_GEN_R:
+ *params = (textureUnit->TexGenEnabled & R_BIT) ? 1.0 : 0.0;
+ break;
+ case GL_TEXTURE_GEN_Q:
+ *params = (textureUnit->TexGenEnabled & Q_BIT) ? 1.0 : 0.0;
+ break;
+ case GL_TEXTURE_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) ctx->TextureMatrixStack[texUnit].Top->m[i];
+ }
+ break;
+ case GL_TEXTURE_STACK_DEPTH:
+ *params = (GLdouble) (ctx->TextureMatrixStack[texUnit].Depth + 1);
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ *params = (GLdouble) ctx->Unpack.Alignment;
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ *params = (GLdouble) ctx->Unpack.LsbFirst;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ *params = (GLdouble) ctx->Unpack.RowLength;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ *params = (GLdouble) ctx->Unpack.SkipPixels;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ *params = (GLdouble) ctx->Unpack.SkipRows;
+ break;
+ case GL_UNPACK_SWAP_BYTES:
+ *params = (GLdouble) ctx->Unpack.SwapBytes;
+ break;
+ case GL_UNPACK_SKIP_IMAGES_EXT:
+ *params = (GLdouble) ctx->Unpack.SkipImages;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT_EXT:
+ *params = (GLdouble) ctx->Unpack.ImageHeight;
+ break;
+ case GL_UNPACK_CLIENT_STORAGE_APPLE:
+ *params = (GLdouble) ctx->Unpack.ClientStorage;
+ break;
+ case GL_VIEWPORT:
+ params[0] = (GLdouble) ctx->Viewport.X;
+ params[1] = (GLdouble) ctx->Viewport.Y;
+ params[2] = (GLdouble) ctx->Viewport.Width;
+ params[3] = (GLdouble) ctx->Viewport.Height;
+ break;
+ case GL_ZOOM_X:
+ *params = (GLdouble) ctx->Pixel.ZoomX;
+ break;
+ case GL_ZOOM_Y:
+ *params = (GLdouble) ctx->Pixel.ZoomY;
+ break;
+ case GL_VERTEX_ARRAY:
+ *params = (GLdouble) ctx->Array.Vertex.Enabled;
+ break;
+ case GL_VERTEX_ARRAY_SIZE:
+ *params = (GLdouble) ctx->Array.Vertex.Size;
+ break;
+ case GL_VERTEX_ARRAY_TYPE:
+ *params = ENUM_TO_DOUBLE(ctx->Array.Vertex.Type);
+ break;
+ case GL_VERTEX_ARRAY_STRIDE:
+ *params = (GLdouble) ctx->Array.Vertex.Stride;
+ break;
+ case GL_VERTEX_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_NORMAL_ARRAY:
+ *params = (GLdouble) ctx->Array.Normal.Enabled;
+ break;
+ case GL_NORMAL_ARRAY_TYPE:
+ *params = ENUM_TO_DOUBLE(ctx->Array.Normal.Type);
+ break;
+ case GL_NORMAL_ARRAY_STRIDE:
+ *params = (GLdouble) ctx->Array.Normal.Stride;
+ break;
+ case GL_NORMAL_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_COLOR_ARRAY:
+ *params = (GLdouble) ctx->Array.Color.Enabled;
+ break;
+ case GL_COLOR_ARRAY_SIZE:
+ *params = (GLdouble) ctx->Array.Color.Size;
+ break;
+ case GL_COLOR_ARRAY_TYPE:
+ *params = ENUM_TO_DOUBLE(ctx->Array.Color.Type);
+ break;
+ case GL_COLOR_ARRAY_STRIDE:
+ *params = (GLdouble) ctx->Array.Color.Stride;
+ break;
+ case GL_COLOR_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_INDEX_ARRAY:
+ *params = (GLdouble) ctx->Array.Index.Enabled;
+ break;
+ case GL_INDEX_ARRAY_TYPE:
+ *params = ENUM_TO_DOUBLE(ctx->Array.Index.Type);
+ break;
+ case GL_INDEX_ARRAY_STRIDE:
+ *params = (GLdouble) ctx->Array.Index.Stride;
+ break;
+ case GL_INDEX_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Enabled;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Size;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ *params = ENUM_TO_DOUBLE(ctx->Array.TexCoord[clientUnit].Type);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Stride;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ *params = (GLdouble) ctx->Array.EdgeFlag.Enabled;
+ break;
+ case GL_EDGE_FLAG_ARRAY_STRIDE:
+ *params = (GLdouble) ctx->Array.EdgeFlag.Stride;
+ break;
+ case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+
+ /* GL_ARB_multitexture */
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ CHECK_EXTENSION_D(ARB_multitexture, pname);
+ *params = (GLdouble) MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
+ break;
+ case GL_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_D(ARB_multitexture, pname);
+ *params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit);
+ break;
+ case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_D(ARB_multitexture, pname);
+ *params = (GLdouble) (GL_TEXTURE0_ARB + clientUnit);
+ break;
+
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ CHECK_EXTENSION_D(ARB_texture_cube_map, pname);
+ *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ CHECK_EXTENSION_D(ARB_texture_cube_map, pname);
+ *params = (GLdouble) textureUnit->CurrentCubeMap->Name;
+ break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ CHECK_EXTENSION_D(ARB_texture_cube_map, pname);
+ *params = (GLdouble) (1 << (ctx->Const.MaxCubeTextureLevels - 1));
+ break;
+
+ /* GL_ARB_texture_compression */
+ case GL_TEXTURE_COMPRESSION_HINT_ARB:
+ CHECK_EXTENSION_D(ARB_texture_compression, pname);
+ *params = (GLdouble) ctx->Hint.TextureCompression;
+ break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_D(ARB_texture_compression, pname);
+ *params = (GLdouble) _mesa_get_compressed_formats(ctx, NULL);
+ break;
+ case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_D(ARB_texture_compression, pname);
+ {
+ GLint formats[100];
+ GLuint i, n;
+ n = _mesa_get_compressed_formats(ctx, formats);
+ for (i = 0; i < n; i++)
+ params[i] = (GLdouble) formats[i];
+ }
+ break;
+
+ /* GL_EXT_compiled_vertex_array */
+ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
+ *params = (GLdouble) ctx->Array.LockFirst;
+ break;
+ case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:
+ *params = (GLdouble) ctx->Array.LockCount;
+ break;
+
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ColorMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ModelviewMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ProjectionMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
+ break;
+
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ CHECK_EXTENSION_D(HP_occlusion_test, pname);
+ *params = (GLdouble) ctx->Depth.OcclusionTest;
+ break;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ CHECK_EXTENSION_D(HP_occlusion_test, pname);
+ if (ctx->Depth.OcclusionTest)
+ *params = (GLdouble) ctx->OcclusionResult;
+ else
+ *params = (GLdouble) ctx->OcclusionResultSaved;
+ /* reset flag now */
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+ break;
+
+ /* GL_SGIS_pixel_texture */
+ case GL_PIXEL_TEXTURE_SGIS:
+ *params = (GLdouble) ctx->Pixel.PixelTextureEnabled;
+ break;
+
+ /* GL_SGIX_pixel_texture */
+ case GL_PIXEL_TEX_GEN_SGIX:
+ *params = (GLdouble) ctx->Pixel.PixelTextureEnabled;
+ break;
+ case GL_PIXEL_TEX_GEN_MODE_SGIX:
+ *params = (GLdouble) pixel_texgen_mode(ctx);
+ break;
+
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) ctx->ColorMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLdouble) (ctx->ColorMatrixStack.Depth + 1);
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLdouble) MAX_COLOR_STACK_DEPTH;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[0];
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[1];
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[2];
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[3];
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[0];
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[1];
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[2];
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[3];
+ break;
+
+ /* GL_EXT_convolution (also in 1.2 imaging) */
+ case GL_CONVOLUTION_1D_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.Convolution1DEnabled;
+ break;
+ case GL_CONVOLUTION_2D:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.Convolution2DEnabled;
+ break;
+ case GL_SEPARABLE_2D:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.Separable2DEnabled;
+ break;
+ case GL_POST_CONVOLUTION_RED_SCALE_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionScale[0];
+ break;
+ case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionScale[1];
+ break;
+ case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionScale[2];
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionScale[3];
+ break;
+ case GL_POST_CONVOLUTION_RED_BIAS_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionBias[0];
+ break;
+ case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionBias[1];
+ break;
+ case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2];
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:
+ CHECK_EXTENSION_D(EXT_convolution, pname);
+ *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2];
+ break;
+
+ /* GL_EXT_histogram (also in 1.2 imaging) */
+ case GL_HISTOGRAM:
+ CHECK_EXTENSION_D(EXT_histogram, pname);
+ *params = (GLdouble) ctx->Pixel.HistogramEnabled;
+ break;
+ case GL_MINMAX:
+ CHECK_EXTENSION_D(EXT_histogram, pname);
+ *params = (GLdouble) ctx->Pixel.MinMaxEnabled;
+ break;
+
+ /* GL_SGI_color_table (also in 1.2 imaging */
+ case GL_COLOR_TABLE_SGI:
+ *params = (GLdouble) ctx->Pixel.ColorTableEnabled;
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostConvolutionColorTableEnabled;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled;
+ break;
+
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_D(SGI_texture_color_table, pname);
+ *params = (GLdouble) textureUnit->ColorTableEnabled;
+ break;
+
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ CHECK_EXTENSION_D(EXT_secondary_color, pname);
+ *params = (GLdouble) ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ CHECK_EXTENSION_D(EXT_secondary_color, pname);
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0];
+ params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1];
+ params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2];
+ params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3];
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ CHECK_EXTENSION_D(EXT_secondary_color, pname);
+ *params = (GLdouble) ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_D(EXT_secondary_color, pname);
+ *params = (GLdouble) ctx->Array.SecondaryColor.Type;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_D(EXT_secondary_color, pname);
+ *params = (GLdouble) ctx->Array.SecondaryColor.Stride;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ CHECK_EXTENSION_D(EXT_secondary_color, pname);
+ *params = (GLdouble) ctx->Array.SecondaryColor.Size;
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ CHECK_EXTENSION_D(EXT_fog_coord, pname);
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ CHECK_EXTENSION_D(EXT_fog_coord, pname);
+ *params = (GLdouble) ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_D(EXT_fog_coord, pname);
+ *params = (GLdouble) ctx->Array.FogCoord.Type;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_D(EXT_fog_coord, pname);
+ *params = (GLdouble) ctx->Array.FogCoord.Stride;
+ break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_D(EXT_fog_coord, pname);
+ *params = (GLdouble) ctx->Fog.FogCoordinateSource;
+ break;
+
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = (GLdouble) ctx->Const.MaxTextureLodBias;
+ break;
+
+ /* GL_EXT_texture_filter_anisotropic */
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ CHECK_EXTENSION_D(EXT_texture_filter_anisotropic, pname);
+ *params = (GLdouble) ctx->Const.MaxTextureMaxAnisotropy;
+ break;
+
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = (GLdouble) ctx->Multisample.Enabled;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = (GLdouble) ctx->Multisample.SampleAlphaToCoverage;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = (GLdouble) ctx->Multisample.SampleAlphaToOne;
+ break;
+ case GL_SAMPLE_COVERAGE_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = (GLdouble) ctx->Multisample.SampleCoverage;
+ break;
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = ctx->Multisample.SampleCoverageValue;
+ break;
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = (GLdouble) ctx->Multisample.SampleCoverageInvert;
+ break;
+ case GL_SAMPLE_BUFFERS_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = 0.0; /* XXX fix someday */
+ break;
+ case GL_SAMPLES_ARB:
+ CHECK_EXTENSION_D(ARB_multisample, pname);
+ *params = 0.0; /* XXX fix someday */
+ break;
+
+ /* GL_IBM_rasterpos_clip */
+ case GL_RASTER_POSITION_UNCLIPPED_IBM:
+ CHECK_EXTENSION_D(IBM_rasterpos_clip, pname);
+ *params = (GLdouble) ctx->Transform.RasterPositionUnclipped;
+ break;
+
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION2_D(NV_point_sprite, ARB_point_sprite, pname);
+ *params = (GLdouble) ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_D(NV_point_sprite, pname);
+ *params = (GLdouble) ctx->Point.SpriteRMode;
+ break;
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_D(ARB_point_sprite, pname);
+ *params = (GLdouble) ctx->Point.SpriteOrigin;
+ break;
+
+ /* GL_SGIS_generate_mipmap */
+ case GL_GENERATE_MIPMAP_HINT_SGIS:
+ CHECK_EXTENSION_D(SGIS_generate_mipmap, pname);
+ *params = (GLdouble) ctx->Hint.GenerateMipmap;
+ break;
+
+#if FEATURE_NV_vertex_program
+ case GL_VERTEX_PROGRAM_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ *params = (GLdouble) ctx->VertexProgram.Enabled;
+ break;
+ case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ *params = (GLdouble) ctx->VertexProgram.PointSizeEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ *params = (GLdouble) ctx->VertexProgram.TwoSideEnabled;
+ break;
+ case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ *params = (GLdouble) ctx->Const.MaxProgramMatrixStackDepth;
+ break;
+ case GL_MAX_TRACK_MATRICES_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ *params = (GLdouble) ctx->Const.MaxProgramMatrices;
+ break;
+ case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ *params = (GLdouble) ctx->CurrentStack->Depth + 1;
+ break;
+ case GL_CURRENT_MATRIX_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ for (i = 0; i < 16; i++)
+ params[i] = (GLdouble) ctx->CurrentStack->Top->m[i];
+ break;
+ case GL_VERTEX_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ if (ctx->VertexProgram.Current)
+ *params = (GLdouble) ctx->VertexProgram.Current->Base.Id;
+ else
+ *params = 0.0;
+ break;
+ case GL_PROGRAM_ERROR_POSITION_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ *params = (GLdouble) ctx->Program.ErrorPos;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY0_NV:
+ case GL_VERTEX_ATTRIB_ARRAY1_NV:
+ case GL_VERTEX_ATTRIB_ARRAY2_NV:
+ case GL_VERTEX_ATTRIB_ARRAY3_NV:
+ case GL_VERTEX_ATTRIB_ARRAY4_NV:
+ case GL_VERTEX_ATTRIB_ARRAY5_NV:
+ case GL_VERTEX_ATTRIB_ARRAY6_NV:
+ case GL_VERTEX_ATTRIB_ARRAY7_NV:
+ case GL_VERTEX_ATTRIB_ARRAY8_NV:
+ case GL_VERTEX_ATTRIB_ARRAY9_NV:
+ case GL_VERTEX_ATTRIB_ARRAY10_NV:
+ case GL_VERTEX_ATTRIB_ARRAY11_NV:
+ case GL_VERTEX_ATTRIB_ARRAY12_NV:
+ case GL_VERTEX_ATTRIB_ARRAY13_NV:
+ case GL_VERTEX_ATTRIB_ARRAY14_NV:
+ case GL_VERTEX_ATTRIB_ARRAY15_NV:
+ CHECK_EXTENSION_D(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV;
+ *params = (GLdouble) ctx->Array.VertexAttrib[n].Enabled;
+ }
+ break;
+ case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV;
+ *params = (GLdouble) ctx->Eval.Map1Attrib[n];
+ }
+ break;
+ case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_B(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV;
+ *params = (GLdouble) ctx->Eval.Map2Attrib[n];
+ }
+ break;
+#endif /* FEATURE_NV_vertex_program */
+
+#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_D(NV_fragment_program, pname);
+ *params = (GLdouble) ctx->FragmentProgram.Enabled;
+ break;
+ case GL_MAX_TEXTURE_COORDS_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ *params = (GLdouble) ctx->Const.MaxTextureCoordUnits;
+ break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ *params = (GLdouble) ctx->Const.MaxTextureImageUnits;
+ break;
+ case GL_FRAGMENT_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_D(NV_fragment_program, pname);
+ if (ctx->FragmentProgram.Current)
+ *params = (GLdouble) ctx->FragmentProgram.Current->Base.Id;
+ else
+ *params = 0.0;
+ break;
+ case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:
+ CHECK_EXTENSION_D(NV_fragment_program, pname);
+ *params = (GLdouble) MAX_NV_FRAGMENT_PROGRAM_PARAMS;
+ break;
+#endif /* FEATURE_NV_fragment_program */
+
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_D(NV_texture_rectangle, pname);
+ *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_D(NV_texture_rectangle, pname);
+ *params = (GLdouble) textureUnit->CurrentRect->Name;
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_D(NV_texture_rectangle, pname);
+ *params = (GLdouble) ctx->Const.MaxTextureRectSize;
+ break;
+
+ /* GL_EXT_stencil_two_side */
+ case GL_STENCIL_TEST_TWO_SIDE_EXT:
+ CHECK_EXTENSION_D(EXT_stencil_two_side, pname);
+ *params = (GLdouble) ctx->Stencil.TestTwoSide;
+ break;
+ case GL_ACTIVE_STENCIL_FACE_EXT:
+ CHECK_EXTENSION_D(EXT_stencil_two_side, pname);
+ *params = (GLdouble) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
+ break;
+
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = (GLdouble) ctx->Const.MaxShininess;
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = (GLdouble) ctx->Const.MaxSpotExponent;
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.ArrayBufferObj->Name;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Vertex.BufferObj->Name;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Normal.BufferObj->Name;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Color.BufferObj->Name;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Index.BufferObj->Name;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.EdgeFlag.BufferObj->Name;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.SecondaryColor.BufferObj->Name;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.FogCoord.BufferObj->Name;
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.ElementArrayBufferObj->Name;
+ break;
+#endif
+#if FEATURE_EXT_pixel_buffer_object
+ case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_D(EXT_pixel_buffer_object, pname);
+ *params = (GLdouble) ctx->Pack.BufferObj->Name;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_D(EXT_pixel_buffer_object, pname);
+ *params = (GLdouble) ctx->Unpack.BufferObj->Name;
+ break;
+#endif
+
+#if FEATURE_ARB_vertex_program
+ /* GL_NV_vertex_program and GL_ARB_fragment_program define others */
+ case GL_MAX_VERTEX_ATTRIBS_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_program, pname);
+ *params = (GLdouble) ctx->Const.MaxVertexProgramAttribs;
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_D(ARB_fragment_program, pname);
+ *params = (GLdouble) ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_D(ARB_fragment_program, pname);
+ params[0] = ctx->CurrentStack->Top->m[0];
+ params[1] = ctx->CurrentStack->Top->m[4];
+ params[2] = ctx->CurrentStack->Top->m[8];
+ params[3] = ctx->CurrentStack->Top->m[12];
+ params[4] = ctx->CurrentStack->Top->m[1];
+ params[5] = ctx->CurrentStack->Top->m[5];
+ params[6] = ctx->CurrentStack->Top->m[9];
+ params[7] = ctx->CurrentStack->Top->m[13];
+ params[8] = ctx->CurrentStack->Top->m[2];
+ params[9] = ctx->CurrentStack->Top->m[6];
+ params[10] = ctx->CurrentStack->Top->m[10];
+ params[11] = ctx->CurrentStack->Top->m[14];
+ params[12] = ctx->CurrentStack->Top->m[3];
+ params[13] = ctx->CurrentStack->Top->m[7];
+ params[14] = ctx->CurrentStack->Top->m[11];
+ params[15] = ctx->CurrentStack->Top->m[15];
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_D(EXT_depth_bounds_test, pname);
+ params[0] = (GLdouble) ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_D(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsMin;
+ params[1] = ctx->Depth.BoundsMax;
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->FragmentProgram.CurrentPosition;
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->VertexProgram.CurrentPosition;
+ break;
+#endif
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname);
+ }
+}
+
+
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetFloatv().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetFloatv,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLfloat.
+ */
+void GLAPIENTRY
+_mesa_GetFloatv( GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint i;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
+ const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!params)
+ return;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname));
+
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
+ if (ctx->Driver.GetFloatv && (*ctx->Driver.GetFloatv)(ctx, pname, params))
+ return;
+
+ switch (pname) {
+ case GL_ACCUM_RED_BITS:
+ *params = (GLfloat) ctx->Visual.accumRedBits;
+ break;
+ case GL_ACCUM_GREEN_BITS:
+ *params = (GLfloat) ctx->Visual.accumGreenBits;
+ break;
+ case GL_ACCUM_BLUE_BITS:
+ *params = (GLfloat) ctx->Visual.accumBlueBits;
+ break;
+ case GL_ACCUM_ALPHA_BITS:
+ *params = (GLfloat) ctx->Visual.accumAlphaBits;
+ break;
+ case GL_ACCUM_CLEAR_VALUE:
+ params[0] = ctx->Accum.ClearColor[0];
+ params[1] = ctx->Accum.ClearColor[1];
+ params[2] = ctx->Accum.ClearColor[2];
+ params[3] = ctx->Accum.ClearColor[3];
+ break;
+ case GL_ALPHA_BIAS:
+ *params = ctx->Pixel.AlphaBias;
+ break;
+ case GL_ALPHA_BITS:
+ *params = (GLfloat) ctx->Visual.alphaBits;
+ break;
+ case GL_ALPHA_SCALE:
+ *params = ctx->Pixel.AlphaScale;
+ break;
+ case GL_ALPHA_TEST:
+ *params = (GLfloat) ctx->Color.AlphaEnabled;
+ break;
+ case GL_ALPHA_TEST_FUNC:
+ *params = ENUM_TO_FLOAT(ctx->Color.AlphaFunc);
+ break;
+ case GL_ALPHA_TEST_REF:
+ *params = (GLfloat) ctx->Color.AlphaRef;
+ break;
+ case GL_ATTRIB_STACK_DEPTH:
+ *params = (GLfloat) (ctx->AttribStackDepth);
+ break;
+ case GL_AUTO_NORMAL:
+ *params = (GLfloat) ctx->Eval.AutoNormal;
+ break;
+ case GL_AUX_BUFFERS:
+ *params = (GLfloat) ctx->Visual.numAuxBuffers;
+ break;
+ case GL_BLEND:
+ *params = (GLfloat) ctx->Color.BlendEnabled;
+ break;
+ case GL_BLEND_DST:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB);
+ break;
+ case GL_BLEND_SRC:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB);
+ break;
+ case GL_BLEND_SRC_RGB_EXT:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB);
+ break;
+ case GL_BLEND_DST_RGB_EXT:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB);
+ break;
+ case GL_BLEND_SRC_ALPHA_EXT:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendSrcA);
+ break;
+ case GL_BLEND_DST_ALPHA_EXT:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendDstA);
+ break;
+ case GL_BLEND_EQUATION:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB);
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendEquationA);
+ break;
+ case GL_BLEND_COLOR_EXT:
+ params[0] = ctx->Color.BlendColor[0];
+ params[1] = ctx->Color.BlendColor[1];
+ params[2] = ctx->Color.BlendColor[2];
+ params[3] = ctx->Color.BlendColor[3];
+ break;
+ case GL_BLUE_BIAS:
+ *params = ctx->Pixel.BlueBias;
+ break;
+ case GL_BLUE_BITS:
+ *params = (GLfloat) ctx->Visual.blueBits;
+ break;
+ case GL_BLUE_SCALE:
+ *params = ctx->Pixel.BlueScale;
+ break;
+ case GL_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = (GLfloat) (ctx->ClientAttribStackDepth);
+ break;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = 1.0;
+ else
+ *params = 0.0;
+ break;
+ case GL_COLOR_CLEAR_VALUE:
+ params[0] = ctx->Color.ClearColor[0];
+ params[1] = ctx->Color.ClearColor[1];
+ params[2] = ctx->Color.ClearColor[2];
+ params[3] = ctx->Color.ClearColor[3];
+ break;
+ case GL_COLOR_MATERIAL:
+ *params = (GLfloat) ctx->Light.ColorMaterialEnabled;
+ break;
+ case GL_COLOR_MATERIAL_FACE:
+ *params = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace);
+ break;
+ case GL_COLOR_MATERIAL_PARAMETER:
+ *params = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode);
+ break;
+ case GL_COLOR_WRITEMASK:
+ params[0] = ctx->Color.ColorMask[RCOMP] ? 1.0F : 0.0F;
+ params[1] = ctx->Color.ColorMask[GCOMP] ? 1.0F : 0.0F;
+ params[2] = ctx->Color.ColorMask[BCOMP] ? 1.0F : 0.0F;
+ params[3] = ctx->Color.ColorMask[ACOMP] ? 1.0F : 0.0F;
+ break;
+ case GL_CULL_FACE:
+ *params = (GLfloat) ctx->Polygon.CullFlag;
+ break;
+ case GL_CULL_FACE_MODE:
+ *params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
+ break;
+ case GL_CURRENT_COLOR:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
+ params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
+ params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
+ params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
+ break;
+ case GL_CURRENT_INDEX:
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLfloat) ctx->Current.Index;
+ break;
+ case GL_CURRENT_NORMAL:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
+ params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
+ params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
+ break;
+ case GL_CURRENT_RASTER_COLOR:
+ params[0] = ctx->Current.RasterColor[0];
+ params[1] = ctx->Current.RasterColor[1];
+ params[2] = ctx->Current.RasterColor[2];
+ params[3] = ctx->Current.RasterColor[3];
+ break;
+ case GL_CURRENT_RASTER_DISTANCE:
+ params[0] = ctx->Current.RasterDistance;
+ break;
+ case GL_CURRENT_RASTER_INDEX:
+ *params = ctx->Current.RasterIndex;
+ break;
+ case GL_CURRENT_RASTER_POSITION:
+ params[0] = ctx->Current.RasterPos[0];
+ params[1] = ctx->Current.RasterPos[1];
+ params[2] = ctx->Current.RasterPos[2];
+ params[3] = ctx->Current.RasterPos[3];
+ break;
+ case GL_CURRENT_RASTER_TEXTURE_COORDS:
+ params[0] = ctx->Current.RasterTexCoords[texUnit][0];
+ params[1] = ctx->Current.RasterTexCoords[texUnit][1];
+ params[2] = ctx->Current.RasterTexCoords[texUnit][2];
+ params[3] = ctx->Current.RasterTexCoords[texUnit][3];
+ break;
+ case GL_CURRENT_RASTER_POSITION_VALID:
+ *params = (GLfloat) ctx->Current.RasterPosValid;
+ break;
+ case GL_CURRENT_TEXTURE_COORDS:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0];
+ params[1] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1];
+ params[2] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2];
+ params[3] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3];
+ break;
+ case GL_DEPTH_BIAS:
+ *params = (GLfloat) ctx->Pixel.DepthBias;
+ break;
+ case GL_DEPTH_BITS:
+ *params = (GLfloat) ctx->Visual.depthBits;
+ break;
+ case GL_DEPTH_CLEAR_VALUE:
+ *params = (GLfloat) ctx->Depth.Clear;
+ break;
+ case GL_DEPTH_FUNC:
+ *params = ENUM_TO_FLOAT(ctx->Depth.Func);
+ break;
+ case GL_DEPTH_RANGE:
+ params[0] = (GLfloat) ctx->Viewport.Near;
+ params[1] = (GLfloat) ctx->Viewport.Far;
+ break;
+ case GL_DEPTH_SCALE:
+ *params = (GLfloat) ctx->Pixel.DepthScale;
+ break;
+ case GL_DEPTH_TEST:
+ *params = (GLfloat) ctx->Depth.Test;
+ break;
+ case GL_DEPTH_WRITEMASK:
+ *params = (GLfloat) ctx->Depth.Mask;
+ break;
+ case GL_DITHER:
+ *params = (GLfloat) ctx->Color.DitherFlag;
+ break;
+ case GL_DOUBLEBUFFER:
+ *params = (GLfloat) ctx->Visual.doubleBufferMode;
+ break;
+ case GL_DRAW_BUFFER:
+ *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer);
+ break;
+ case GL_EDGE_FLAG:
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLfloat) ctx->Current.EdgeFlag;
+ break;
+ case GL_FEEDBACK_BUFFER_SIZE:
+ *params = (GLfloat) ctx->Feedback.BufferSize;
+ break;
+ case GL_FEEDBACK_BUFFER_TYPE:
+ *params = ENUM_TO_FLOAT(ctx->Feedback.Type);
+ break;
+ case GL_FOG:
+ *params = (GLfloat) ctx->Fog.Enabled;
+ break;
+ case GL_FOG_COLOR:
+ params[0] = ctx->Fog.Color[0];
+ params[1] = ctx->Fog.Color[1];
+ params[2] = ctx->Fog.Color[2];
+ params[3] = ctx->Fog.Color[3];
+ break;
+ case GL_FOG_DENSITY:
+ *params = ctx->Fog.Density;
+ break;
+ case GL_FOG_END:
+ *params = ctx->Fog.End;
+ break;
+ case GL_FOG_HINT:
+ *params = ENUM_TO_FLOAT(ctx->Hint.Fog);
+ break;
+ case GL_FOG_INDEX:
+ *params = ctx->Fog.Index;
+ break;
+ case GL_FOG_MODE:
+ *params = ENUM_TO_FLOAT(ctx->Fog.Mode);
+ break;
+ case GL_FOG_START:
+ *params = ctx->Fog.Start;
+ break;
+ case GL_FRONT_FACE:
+ *params = ENUM_TO_FLOAT(ctx->Polygon.FrontFace);
+ break;
+ case GL_GREEN_BIAS:
+ *params = (GLfloat) ctx->Pixel.GreenBias;
+ break;
+ case GL_GREEN_BITS:
+ *params = (GLfloat) ctx->Visual.greenBits;
+ break;
+ case GL_GREEN_SCALE:
+ *params = (GLfloat) ctx->Pixel.GreenScale;
+ break;
+ case GL_INDEX_BITS:
+ *params = (GLfloat) ctx->Visual.indexBits;
+ break;
+ case GL_INDEX_CLEAR_VALUE:
+ *params = (GLfloat) ctx->Color.ClearIndex;
+ break;
+ case GL_INDEX_MODE:
+ *params = ctx->Visual.rgbMode ? 0.0F : 1.0F;
+ break;
+ case GL_INDEX_OFFSET:
+ *params = (GLfloat) ctx->Pixel.IndexOffset;
+ break;
+ case GL_INDEX_SHIFT:
+ *params = (GLfloat) ctx->Pixel.IndexShift;
+ break;
+ case GL_INDEX_WRITEMASK:
+ *params = (GLfloat) ctx->Color.IndexMask;
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ *params = (GLfloat) ctx->Light.Light[pname-GL_LIGHT0].Enabled;
+ break;
+ case GL_LIGHTING:
+ *params = (GLfloat) ctx->Light.Enabled;
+ break;
+ case GL_LIGHT_MODEL_AMBIENT:
+ params[0] = ctx->Light.Model.Ambient[0];
+ params[1] = ctx->Light.Model.Ambient[1];
+ params[2] = ctx->Light.Model.Ambient[2];
+ params[3] = ctx->Light.Model.Ambient[3];
+ break;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl);
+ break;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ *params = (GLfloat) ctx->Light.Model.LocalViewer;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *params = (GLfloat) ctx->Light.Model.TwoSide;
+ break;
+ case GL_LINE_SMOOTH:
+ *params = (GLfloat) ctx->Line.SmoothFlag;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ *params = ENUM_TO_FLOAT(ctx->Hint.LineSmooth);
+ break;
+ case GL_LINE_STIPPLE:
+ *params = (GLfloat) ctx->Line.StippleFlag;
+ break;
+ case GL_LINE_STIPPLE_PATTERN:
+ *params = (GLfloat) ctx->Line.StipplePattern;
+ break;
+ case GL_LINE_STIPPLE_REPEAT:
+ *params = (GLfloat) ctx->Line.StippleFactor;
+ break;
+ case GL_LINE_WIDTH:
+ *params = (GLfloat) ctx->Line.Width;
+ break;
+ case GL_LINE_WIDTH_GRANULARITY:
+ *params = (GLfloat) ctx->Const.LineWidthGranularity;
+ break;
+ case GL_LINE_WIDTH_RANGE:
+ params[0] = (GLfloat) ctx->Const.MinLineWidthAA;
+ params[1] = (GLfloat) ctx->Const.MaxLineWidthAA;
+ break;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ params[0] = (GLfloat) ctx->Const.MinLineWidth;
+ params[1] = (GLfloat) ctx->Const.MaxLineWidth;
+ break;
+ case GL_LIST_BASE:
+ *params = (GLfloat) ctx->List.ListBase;
+ break;
+ case GL_LIST_INDEX:
+ *params = (GLfloat) ctx->ListState.CurrentListNum;
+ break;
+ case GL_LIST_MODE:
+ if (!ctx->CompileFlag)
+ *params = 0.0F;
+ else if (ctx->ExecuteFlag)
+ *params = ENUM_TO_FLOAT(GL_COMPILE_AND_EXECUTE);
+ else
+ *params = ENUM_TO_FLOAT(GL_COMPILE);
+ break;
+ case GL_INDEX_LOGIC_OP:
+ *params = (GLfloat) ctx->Color.IndexLogicOpEnabled;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ *params = (GLfloat) ctx->Color.ColorLogicOpEnabled;
+ break;
+ case GL_LOGIC_OP_MODE:
+ *params = ENUM_TO_FLOAT(ctx->Color.LogicOp);
+ break;
+ case GL_MAP1_COLOR_4:
+ *params = (GLfloat) ctx->Eval.Map1Color4;
+ break;
+ case GL_MAP1_GRID_DOMAIN:
+ params[0] = ctx->Eval.MapGrid1u1;
+ params[1] = ctx->Eval.MapGrid1u2;
+ break;
+ case GL_MAP1_GRID_SEGMENTS:
+ *params = (GLfloat) ctx->Eval.MapGrid1un;
+ break;
+ case GL_MAP1_INDEX:
+ *params = (GLfloat) ctx->Eval.Map1Index;
+ break;
+ case GL_MAP1_NORMAL:
+ *params = (GLfloat) ctx->Eval.Map1Normal;
+ break;
+ case GL_MAP1_TEXTURE_COORD_1:
+ *params = (GLfloat) ctx->Eval.Map1TextureCoord1;
+ break;
+ case GL_MAP1_TEXTURE_COORD_2:
+ *params = (GLfloat) ctx->Eval.Map1TextureCoord2;
+ break;
+ case GL_MAP1_TEXTURE_COORD_3:
+ *params = (GLfloat) ctx->Eval.Map1TextureCoord3;
+ break;
+ case GL_MAP1_TEXTURE_COORD_4:
+ *params = (GLfloat) ctx->Eval.Map1TextureCoord4;
+ break;
+ case GL_MAP1_VERTEX_3:
+ *params = (GLfloat) ctx->Eval.Map1Vertex3;
+ break;
+ case GL_MAP1_VERTEX_4:
+ *params = (GLfloat) ctx->Eval.Map1Vertex4;
+ break;
+ case GL_MAP2_COLOR_4:
+ *params = (GLfloat) ctx->Eval.Map2Color4;
+ break;
+ case GL_MAP2_GRID_DOMAIN:
+ params[0] = ctx->Eval.MapGrid2u1;
+ params[1] = ctx->Eval.MapGrid2u2;
+ params[2] = ctx->Eval.MapGrid2v1;
+ params[3] = ctx->Eval.MapGrid2v2;
+ break;
+ case GL_MAP2_GRID_SEGMENTS:
+ params[0] = (GLfloat) ctx->Eval.MapGrid2un;
+ params[1] = (GLfloat) ctx->Eval.MapGrid2vn;
+ break;
+ case GL_MAP2_INDEX:
+ *params = (GLfloat) ctx->Eval.Map2Index;
+ break;
+ case GL_MAP2_NORMAL:
+ *params = (GLfloat) ctx->Eval.Map2Normal;
+ break;
+ case GL_MAP2_TEXTURE_COORD_1:
+ *params = ctx->Eval.Map2TextureCoord1;
+ break;
+ case GL_MAP2_TEXTURE_COORD_2:
+ *params = ctx->Eval.Map2TextureCoord2;
+ break;
+ case GL_MAP2_TEXTURE_COORD_3:
+ *params = ctx->Eval.Map2TextureCoord3;
+ break;
+ case GL_MAP2_TEXTURE_COORD_4:
+ *params = ctx->Eval.Map2TextureCoord4;
+ break;
+ case GL_MAP2_VERTEX_3:
+ *params = (GLfloat) ctx->Eval.Map2Vertex3;
+ break;
+ case GL_MAP2_VERTEX_4:
+ *params = (GLfloat) ctx->Eval.Map2Vertex4;
+ break;
+ case GL_MAP_COLOR:
+ *params = (GLfloat) ctx->Pixel.MapColorFlag;
+ break;
+ case GL_MAP_STENCIL:
+ *params = (GLfloat) ctx->Pixel.MapStencilFlag;
+ break;
+ case GL_MATRIX_MODE:
+ *params = ENUM_TO_FLOAT(ctx->Transform.MatrixMode);
+ break;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ *params = (GLfloat) MAX_ATTRIB_STACK_DEPTH;
+ break;
+ case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = (GLfloat) MAX_CLIENT_ATTRIB_STACK_DEPTH;
+ break;
+ case GL_MAX_CLIP_PLANES:
+ *params = (GLfloat) ctx->Const.MaxClipPlanes;
+ break;
+ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
+ *params = (GLfloat) ctx->Const.MaxArrayLockSize;
+ break;
+ case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
+ *params = (GLfloat) ctx->Const.MaxArrayLockSize;
+ break;
+ case GL_MAX_EVAL_ORDER:
+ *params = (GLfloat) MAX_EVAL_ORDER;
+ break;
+ case GL_MAX_LIGHTS:
+ *params = (GLfloat) ctx->Const.MaxLights;
+ break;
+ case GL_MAX_LIST_NESTING:
+ *params = (GLfloat) MAX_LIST_NESTING;
+ break;
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ *params = (GLfloat) MAX_MODELVIEW_STACK_DEPTH;
+ break;
+ case GL_MAX_NAME_STACK_DEPTH:
+ *params = (GLfloat) MAX_NAME_STACK_DEPTH;
+ break;
+ case GL_MAX_PIXEL_MAP_TABLE:
+ *params = (GLfloat) MAX_PIXEL_MAP_TABLE;
+ break;
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ *params = (GLfloat) MAX_PROJECTION_STACK_DEPTH;
+ break;
+ case GL_MAX_TEXTURE_SIZE:
+ *params = (GLfloat) (1 << (ctx->Const.MaxTextureLevels - 1));
+ break;
+ case GL_MAX_3D_TEXTURE_SIZE:
+ *params = (GLfloat) (1 << (ctx->Const.Max3DTextureLevels - 1));
+ break;
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ *params = (GLfloat) MAX_TEXTURE_STACK_DEPTH;
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ params[0] = (GLfloat) MAX_WIDTH;
+ params[1] = (GLfloat) MAX_HEIGHT;
+ break;
+ case GL_MODELVIEW_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = ctx->ModelviewMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_MODELVIEW_STACK_DEPTH:
+ *params = (GLfloat) (ctx->ModelviewMatrixStack.Depth + 1);
+ break;
+ case GL_NAME_STACK_DEPTH:
+ *params = (GLfloat) ctx->Select.NameStackDepth;
+ break;
+ case GL_NORMALIZE:
+ *params = (GLfloat) ctx->Transform.Normalize;
+ break;
+ case GL_PACK_ALIGNMENT:
+ *params = (GLfloat) ctx->Pack.Alignment;
+ break;
+ case GL_PACK_LSB_FIRST:
+ *params = (GLfloat) ctx->Pack.LsbFirst;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ *params = (GLfloat) ctx->Pack.RowLength;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ *params = (GLfloat) ctx->Pack.SkipPixels;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ *params = (GLfloat) ctx->Pack.SkipRows;
+ break;
+ case GL_PACK_SWAP_BYTES:
+ *params = (GLfloat) ctx->Pack.SwapBytes;
+ break;
+ case GL_PACK_SKIP_IMAGES_EXT:
+ *params = (GLfloat) ctx->Pack.SkipImages;
+ break;
+ case GL_PACK_IMAGE_HEIGHT_EXT:
+ *params = (GLfloat) ctx->Pack.ImageHeight;
+ break;
+ case GL_PACK_INVERT_MESA:
+ *params = (GLfloat) ctx->Pack.Invert;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ *params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
+ break;
+ case GL_PIXEL_MAP_A_TO_A_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapAtoAsize;
+ break;
+ case GL_PIXEL_MAP_B_TO_B_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapBtoBsize;
+ break;
+ case GL_PIXEL_MAP_G_TO_G_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapGtoGsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_A_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapItoAsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_B_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapItoBsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_G_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapItoGsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_I_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapItoIsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_R_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapItoRsize;
+ break;
+ case GL_PIXEL_MAP_R_TO_R_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapRtoRsize;
+ break;
+ case GL_PIXEL_MAP_S_TO_S_SIZE:
+ *params = (GLfloat) ctx->Pixel.MapStoSsize;
+ break;
+ case GL_POINT_SIZE:
+ *params = (GLfloat) ctx->Point.Size;
+ break;
+ case GL_POINT_SIZE_GRANULARITY:
+ *params = (GLfloat) ctx->Const.PointSizeGranularity;
+ break;
+ case GL_POINT_SIZE_RANGE:
+ params[0] = (GLfloat) ctx->Const.MinPointSizeAA;
+ params[1] = (GLfloat) ctx->Const.MaxPointSizeAA;
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ params[0] = (GLfloat) ctx->Const.MinPointSize;
+ params[1] = (GLfloat) ctx->Const.MaxPointSize;
+ break;
+ case GL_POINT_SMOOTH:
+ *params = (GLfloat) ctx->Point.SmoothFlag;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ *params = ENUM_TO_FLOAT(ctx->Hint.PointSmooth);
+ break;
+ case GL_POINT_SIZE_MIN_EXT:
+ *params = (GLfloat) (ctx->Point.MinSize);
+ break;
+ case GL_POINT_SIZE_MAX_EXT:
+ *params = (GLfloat) (ctx->Point.MaxSize);
+ break;
+ case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+ *params = (GLfloat) (ctx->Point.Threshold);
+ break;
+ case GL_DISTANCE_ATTENUATION_EXT:
+ params[0] = (GLfloat) (ctx->Point.Params[0]);
+ params[1] = (GLfloat) (ctx->Point.Params[1]);
+ params[2] = (GLfloat) (ctx->Point.Params[2]);
+ break;
+ case GL_POLYGON_MODE:
+ params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode);
+ params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode);
+ break;
+#ifdef GL_EXT_polygon_offset
+ case GL_POLYGON_OFFSET_BIAS_EXT:
+ *params = ctx->Polygon.OffsetUnits;
+ break;
+#endif
+ case GL_POLYGON_OFFSET_FACTOR:
+ *params = ctx->Polygon.OffsetFactor;
+ break;
+ case GL_POLYGON_OFFSET_UNITS:
+ *params = ctx->Polygon.OffsetUnits;
+ break;
+ case GL_POLYGON_SMOOTH:
+ *params = (GLfloat) ctx->Polygon.SmoothFlag;
+ break;
+ case GL_POLYGON_SMOOTH_HINT:
+ *params = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth);
+ break;
+ case GL_POLYGON_STIPPLE:
+ *params = (GLfloat) ctx->Polygon.StippleFlag;
+ break;
+ case GL_PROJECTION_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = ctx->ProjectionMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_PROJECTION_STACK_DEPTH:
+ *params = (GLfloat) (ctx->ProjectionMatrixStack.Depth + 1);
+ break;
+ case GL_READ_BUFFER:
+ *params = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer);
+ break;
+ case GL_RED_BIAS:
+ *params = ctx->Pixel.RedBias;
+ break;
+ case GL_RED_BITS:
+ *params = (GLfloat) ctx->Visual.redBits;
+ break;
+ case GL_RED_SCALE:
+ *params = ctx->Pixel.RedScale;
+ break;
+ case GL_RENDER_MODE:
+ *params = ENUM_TO_FLOAT(ctx->RenderMode);
+ break;
+ case GL_RESCALE_NORMAL:
+ *params = (GLfloat) ctx->Transform.RescaleNormals;
+ break;
+ case GL_RGBA_MODE:
+ *params = (GLfloat) ctx->Visual.rgbMode;
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = (GLfloat) ctx->Scissor.X;
+ params[1] = (GLfloat) ctx->Scissor.Y;
+ params[2] = (GLfloat) ctx->Scissor.Width;
+ params[3] = (GLfloat) ctx->Scissor.Height;
+ break;
+ case GL_SCISSOR_TEST:
+ *params = (GLfloat) ctx->Scissor.Enabled;
+ break;
+ case GL_SELECTION_BUFFER_SIZE:
+ *params = (GLfloat) ctx->Select.BufferSize;
+ break;
+ case GL_SHADE_MODEL:
+ *params = ENUM_TO_FLOAT(ctx->Light.ShadeModel);
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ *params = (GLfloat) ctx->Texture.SharedPalette;
+ break;
+ case GL_STENCIL_BITS:
+ *params = (GLfloat) ctx->Visual.stencilBits;
+ break;
+ case GL_STENCIL_CLEAR_VALUE:
+ *params = (GLfloat) ctx->Stencil.Clear;
+ break;
+ case GL_STENCIL_FAIL:
+ *params = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_FUNC:
+ *params = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *params = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *params = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);
+ break;
+ case GL_STENCIL_REF:
+ *params = (GLfloat) ctx->Stencil.Ref[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_TEST:
+ *params = (GLfloat) ctx->Stencil.Enabled;
+ break;
+ case GL_STENCIL_VALUE_MASK:
+ *params = (GLfloat) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_WRITEMASK:
+ *params = (GLfloat) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STEREO:
+ *params = (GLfloat) ctx->Visual.stereoMode;
+ break;
+ case GL_SUBPIXEL_BITS:
+ *params = (GLfloat) ctx->Const.SubPixelBits;
+ break;
+ case GL_TEXTURE_1D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0F : 0.0F;
+ break;
+ case GL_TEXTURE_2D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0F : 0.0F;
+ break;
+ case GL_TEXTURE_3D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0F : 0.0F;
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ *params = (GLfloat) textureUnit->Current1D->Name;
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ *params = (GLfloat) textureUnit->Current2D->Name;
+ break;
+ case GL_TEXTURE_BINDING_3D:
+ *params = (GLfloat) textureUnit->Current2D->Name;
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ params[0] = textureUnit->EnvColor[0];
+ params[1] = textureUnit->EnvColor[1];
+ params[2] = textureUnit->EnvColor[2];
+ params[3] = textureUnit->EnvColor[3];
+ break;
+ case GL_TEXTURE_ENV_MODE:
+ *params = ENUM_TO_FLOAT(textureUnit->EnvMode);
+ break;
+ case GL_TEXTURE_GEN_S:
+ *params = (textureUnit->TexGenEnabled & S_BIT) ? 1.0F : 0.0F;
+ break;
+ case GL_TEXTURE_GEN_T:
+ *params = (textureUnit->TexGenEnabled & T_BIT) ? 1.0F : 0.0F;
+ break;
+ case GL_TEXTURE_GEN_R:
+ *params = (textureUnit->TexGenEnabled & R_BIT) ? 1.0F : 0.0F;
+ break;
+ case GL_TEXTURE_GEN_Q:
+ *params = (textureUnit->TexGenEnabled & Q_BIT) ? 1.0F : 0.0F;
+ break;
+ case GL_TEXTURE_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = ctx->TextureMatrixStack[texUnit].Top->m[i];
+ }
+ break;
+ case GL_TEXTURE_STACK_DEPTH:
+ *params = (GLfloat) (ctx->TextureMatrixStack[texUnit].Depth + 1);
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ *params = (GLfloat) ctx->Unpack.Alignment;
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ *params = (GLfloat) ctx->Unpack.LsbFirst;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ *params = (GLfloat) ctx->Unpack.RowLength;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ *params = (GLfloat) ctx->Unpack.SkipPixels;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ *params = (GLfloat) ctx->Unpack.SkipRows;
+ break;
+ case GL_UNPACK_SWAP_BYTES:
+ *params = (GLfloat) ctx->Unpack.SwapBytes;
+ break;
+ case GL_UNPACK_SKIP_IMAGES_EXT:
+ *params = (GLfloat) ctx->Unpack.SkipImages;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT_EXT:
+ *params = (GLfloat) ctx->Unpack.ImageHeight;
+ break;
+ case GL_UNPACK_CLIENT_STORAGE_APPLE:
+ *params = (GLfloat) ctx->Unpack.ClientStorage;
+ break;
+ case GL_VIEWPORT:
+ params[0] = (GLfloat) ctx->Viewport.X;
+ params[1] = (GLfloat) ctx->Viewport.Y;
+ params[2] = (GLfloat) ctx->Viewport.Width;
+ params[3] = (GLfloat) ctx->Viewport.Height;
+ break;
+ case GL_ZOOM_X:
+ *params = (GLfloat) ctx->Pixel.ZoomX;
+ break;
+ case GL_ZOOM_Y:
+ *params = (GLfloat) ctx->Pixel.ZoomY;
+ break;
+ case GL_VERTEX_ARRAY:
+ *params = (GLfloat) ctx->Array.Vertex.Enabled;
+ break;
+ case GL_VERTEX_ARRAY_SIZE:
+ *params = (GLfloat) ctx->Array.Vertex.Size;
+ break;
+ case GL_VERTEX_ARRAY_TYPE:
+ *params = ENUM_TO_FLOAT(ctx->Array.Vertex.Type);
+ break;
+ case GL_VERTEX_ARRAY_STRIDE:
+ *params = (GLfloat) ctx->Array.Vertex.Stride;
+ break;
+ case GL_VERTEX_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_NORMAL_ARRAY:
+ *params = (GLfloat) ctx->Array.Normal.Enabled;
+ break;
+ case GL_NORMAL_ARRAY_TYPE:
+ *params = ENUM_TO_FLOAT(ctx->Array.Normal.Type);
+ break;
+ case GL_NORMAL_ARRAY_STRIDE:
+ *params = (GLfloat) ctx->Array.Normal.Stride;
+ break;
+ case GL_NORMAL_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_COLOR_ARRAY:
+ *params = (GLfloat) ctx->Array.Color.Enabled;
+ break;
+ case GL_COLOR_ARRAY_SIZE:
+ *params = (GLfloat) ctx->Array.Color.Size;
+ break;
+ case GL_COLOR_ARRAY_TYPE:
+ *params = ENUM_TO_FLOAT(ctx->Array.Color.Type);
+ break;
+ case GL_COLOR_ARRAY_STRIDE:
+ *params = (GLfloat) ctx->Array.Color.Stride;
+ break;
+ case GL_COLOR_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_INDEX_ARRAY:
+ *params = (GLfloat) ctx->Array.Index.Enabled;
+ break;
+ case GL_INDEX_ARRAY_TYPE:
+ *params = ENUM_TO_FLOAT(ctx->Array.Index.Type);
+ break;
+ case GL_INDEX_ARRAY_STRIDE:
+ *params = (GLfloat) ctx->Array.Index.Stride;
+ break;
+ case GL_INDEX_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Enabled;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Size;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ *params = ENUM_TO_FLOAT(ctx->Array.TexCoord[clientUnit].Type);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Stride;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ *params = (GLfloat) ctx->Array.EdgeFlag.Enabled;
+ break;
+ case GL_EDGE_FLAG_ARRAY_STRIDE:
+ *params = (GLfloat) ctx->Array.EdgeFlag.Stride;
+ break;
+ case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
+ *params = 0.0;
+ break;
+
+ /* GL_ARB_multitexture */
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ CHECK_EXTENSION_F(ARB_multitexture, pname);
+ *params = (GLfloat) MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
+ break;
+ case GL_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_F(ARB_multitexture, pname);
+ *params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit);
+ break;
+ case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_F(ARB_multitexture, pname);
+ *params = (GLfloat) (GL_TEXTURE0_ARB + clientUnit);
+ break;
+
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ CHECK_EXTENSION_F(ARB_texture_cube_map, pname);
+ *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ CHECK_EXTENSION_F(ARB_texture_cube_map, pname);
+ *params = (GLfloat) textureUnit->CurrentCubeMap->Name;
+ break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ CHECK_EXTENSION_F(ARB_texture_cube_map, pname);
+ *params = (GLfloat) (1 << (ctx->Const.MaxCubeTextureLevels - 1));
+ break;
+
+ /* GL_ARB_texture_compression */
+ case GL_TEXTURE_COMPRESSION_HINT_ARB:
+ CHECK_EXTENSION_F(ARB_texture_compression, pname);
+ *params = (GLfloat) ctx->Hint.TextureCompression;
+ break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_F(ARB_texture_compression, pname);
+ *params = (GLfloat) _mesa_get_compressed_formats(ctx, NULL);
+ break;
+ case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_F(ARB_texture_compression, pname);
+ {
+ GLint formats[100];
+ GLuint i, n;
+ n = _mesa_get_compressed_formats(ctx, formats);
+ for (i = 0; i < n; i++)
+ params[i] = (GLfloat) formats[i];
+ }
+ break;
+
+ /* GL_EXT_compiled_vertex_array */
+ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
+ CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname);
+ *params = (GLfloat) ctx->Array.LockFirst;
+ break;
+ case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:
+ CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname);
+ *params = (GLfloat) ctx->Array.LockCount;
+ break;
+
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ _math_transposef(params, ctx->ColorMatrixStack.Top->m);
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ _math_transposef(params, ctx->ModelviewMatrixStack.Top->m);
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ _math_transposef(params, ctx->ProjectionMatrixStack.Top->m);
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ _math_transposef(params, ctx->TextureMatrixStack[texUnit].Top->m);
+ break;
+
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ CHECK_EXTENSION_F(HP_occlusion_test, pname);
+ *params = (GLfloat) ctx->Depth.OcclusionTest;
+ break;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ CHECK_EXTENSION_F(HP_occlusion_test, pname);
+ if (ctx->Depth.OcclusionTest)
+ *params = (GLfloat) ctx->OcclusionResult;
+ else
+ *params = (GLfloat) ctx->OcclusionResultSaved;
+ /* reset flag now */
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+ break;
+
+ /* GL_SGIS_pixel_texture */
+ case GL_PIXEL_TEXTURE_SGIS:
+ *params = (GLfloat) ctx->Pixel.PixelTextureEnabled;
+ break;
+
+ /* GL_SGIX_pixel_texture */
+ case GL_PIXEL_TEX_GEN_SGIX:
+ *params = (GLfloat) ctx->Pixel.PixelTextureEnabled;
+ break;
+ case GL_PIXEL_TEX_GEN_MODE_SGIX:
+ *params = (GLfloat) pixel_texgen_mode(ctx);
+ break;
+
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ for (i=0;i<16;i++) {
+ params[i] = ctx->ColorMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLfloat) (ctx->ColorMatrixStack.Depth + 1);
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLfloat) MAX_COLOR_STACK_DEPTH;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixScale[0];
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixScale[1];
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixScale[2];
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixScale[3];
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixBias[0];
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixBias[1];
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixBias[2];
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixBias[3];
+ break;
+
+ /* GL_EXT_convolution (also in 1.2 imaging) */
+ case GL_CONVOLUTION_1D_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = (GLfloat) ctx->Pixel.Convolution1DEnabled;
+ break;
+ case GL_CONVOLUTION_2D:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = (GLfloat) ctx->Pixel.Convolution2DEnabled;
+ break;
+ case GL_SEPARABLE_2D:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = (GLfloat) ctx->Pixel.Separable2DEnabled;
+ break;
+ case GL_POST_CONVOLUTION_RED_SCALE_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionScale[0];
+ break;
+ case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionScale[1];
+ break;
+ case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionScale[2];
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionScale[3];
+ break;
+ case GL_POST_CONVOLUTION_RED_BIAS_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionBias[0];
+ break;
+ case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionBias[1];
+ break;
+ case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionBias[2];
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:
+ CHECK_EXTENSION_F(EXT_convolution, pname);
+ *params = ctx->Pixel.PostConvolutionBias[2];
+ break;
+
+ /* GL_EXT_histogram (also in 1.2 imaging) */
+ case GL_HISTOGRAM:
+ CHECK_EXTENSION_F(EXT_histogram, pname);
+ *params = (GLfloat) ctx->Pixel.HistogramEnabled;
+ break;
+ case GL_MINMAX:
+ CHECK_EXTENSION_F(EXT_histogram, pname);
+ *params = (GLfloat) ctx->Pixel.MinMaxEnabled;
+ break;
+
+ /* GL_SGI_color_table (also in 1.2 imaging */
+ case GL_COLOR_TABLE_SGI:
+ *params = (GLfloat) ctx->Pixel.ColorTableEnabled;
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ *params = (GLfloat) ctx->Pixel.PostConvolutionColorTableEnabled;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ *params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled;
+ break;
+
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_F(SGI_texture_color_table, pname);
+ *params = (GLfloat) textureUnit->ColorTableEnabled;
+ break;
+
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ CHECK_EXTENSION_F(EXT_secondary_color, pname);
+ *params = (GLfloat) ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ CHECK_EXTENSION_F(EXT_secondary_color, pname);
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0];
+ params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1];
+ params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2];
+ params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3];
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ CHECK_EXTENSION_F(EXT_secondary_color, pname);
+ *params = (GLfloat) ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_F(EXT_secondary_color, pname);
+ *params = (GLfloat) ctx->Array.SecondaryColor.Type;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_F(EXT_secondary_color, pname);
+ *params = (GLfloat) ctx->Array.SecondaryColor.Stride;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ CHECK_EXTENSION_F(EXT_secondary_color, pname);
+ *params = (GLfloat) ctx->Array.SecondaryColor.Size;
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ CHECK_EXTENSION_F(EXT_fog_coord, pname);
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ CHECK_EXTENSION_F(EXT_fog_coord, pname);
+ *params = (GLfloat) ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_F(EXT_fog_coord, pname);
+ *params = (GLfloat) ctx->Array.FogCoord.Type;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_F(EXT_fog_coord, pname);
+ *params = (GLfloat) ctx->Array.FogCoord.Stride;
+ break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_F(EXT_fog_coord, pname);
+ *params = (GLfloat) ctx->Fog.FogCoordinateSource;
+ break;
+
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = ctx->Const.MaxTextureLodBias;
+ break;
+
+ /* GL_EXT_texture_filter_anisotropic */
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ CHECK_EXTENSION_F(EXT_texture_filter_anisotropic, pname);
+ *params = ctx->Const.MaxTextureMaxAnisotropy;
+ break;
+
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = (GLfloat) ctx->Multisample.Enabled;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = (GLfloat) ctx->Multisample.SampleAlphaToCoverage;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = (GLfloat) ctx->Multisample.SampleAlphaToOne;
+ break;
+ case GL_SAMPLE_COVERAGE_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = (GLfloat) ctx->Multisample.SampleCoverage;
+ break;
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = ctx->Multisample.SampleCoverageValue;
+ break;
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = (GLfloat) ctx->Multisample.SampleCoverageInvert;
+ break;
+ case GL_SAMPLE_BUFFERS_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = 0.0; /* XXX fix someday */
+ break;
+ case GL_SAMPLES_ARB:
+ CHECK_EXTENSION_F(ARB_multisample, pname);
+ *params = 0.0; /* XXX fix someday */
+ break;
+
+ /* GL_IBM_rasterpos_clip */
+ case GL_RASTER_POSITION_UNCLIPPED_IBM:
+ CHECK_EXTENSION_F(IBM_rasterpos_clip, pname);
+ *params = (GLfloat) ctx->Transform.RasterPositionUnclipped;
+ break;
+
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION2_F(NV_point_sprite, ARB_point_sprite, pname);
+ *params = (GLfloat) ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_F(NV_point_sprite, pname);
+ *params = (GLfloat) ctx->Point.SpriteRMode;
+ break;
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_F(ARB_point_sprite, pname);
+ *params = (GLfloat) ctx->Point.SpriteOrigin;
+ break;
+
+ /* GL_SGIS_generate_mipmap */
+ case GL_GENERATE_MIPMAP_HINT_SGIS:
+ CHECK_EXTENSION_F(SGIS_generate_mipmap, pname);
+ *params = (GLfloat) ctx->Hint.GenerateMipmap;
+ break;
+
+#if FEATURE_NV_vertex_program
+ case GL_VERTEX_PROGRAM_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ *params = (GLfloat) ctx->VertexProgram.Enabled;
+ break;
+ case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ *params = (GLfloat) ctx->VertexProgram.PointSizeEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ *params = (GLfloat) ctx->VertexProgram.TwoSideEnabled;
+ break;
+ case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ *params = (GLfloat) ctx->Const.MaxProgramMatrixStackDepth;
+ break;
+ case GL_MAX_TRACK_MATRICES_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ *params = (GLfloat) ctx->Const.MaxProgramMatrices;
+ break;
+ case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ *params = (GLfloat) ctx->CurrentStack->Depth + 1;
+ break;
+ case GL_CURRENT_MATRIX_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ for (i = 0; i < 16; i++)
+ params[i] = ctx->CurrentStack->Top->m[i];
+ break;
+ case GL_VERTEX_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ if (ctx->VertexProgram.Current)
+ *params = (GLfloat) ctx->VertexProgram.Current->Base.Id;
+ else
+ *params = 0.0;
+ break;
+ case GL_PROGRAM_ERROR_POSITION_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ *params = (GLfloat) ctx->Program.ErrorPos;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY0_NV:
+ case GL_VERTEX_ATTRIB_ARRAY1_NV:
+ case GL_VERTEX_ATTRIB_ARRAY2_NV:
+ case GL_VERTEX_ATTRIB_ARRAY3_NV:
+ case GL_VERTEX_ATTRIB_ARRAY4_NV:
+ case GL_VERTEX_ATTRIB_ARRAY5_NV:
+ case GL_VERTEX_ATTRIB_ARRAY6_NV:
+ case GL_VERTEX_ATTRIB_ARRAY7_NV:
+ case GL_VERTEX_ATTRIB_ARRAY8_NV:
+ case GL_VERTEX_ATTRIB_ARRAY9_NV:
+ case GL_VERTEX_ATTRIB_ARRAY10_NV:
+ case GL_VERTEX_ATTRIB_ARRAY11_NV:
+ case GL_VERTEX_ATTRIB_ARRAY12_NV:
+ case GL_VERTEX_ATTRIB_ARRAY13_NV:
+ case GL_VERTEX_ATTRIB_ARRAY14_NV:
+ case GL_VERTEX_ATTRIB_ARRAY15_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV;
+ *params = (GLfloat) ctx->Array.VertexAttrib[n].Enabled;
+ }
+ break;
+ case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV;
+ *params = (GLfloat) ctx->Eval.Map1Attrib[n];
+ }
+ break;
+ case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_F(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV;
+ *params = (GLfloat) ctx->Eval.Map2Attrib[n];
+ }
+ break;
+#endif /* FEATURE_NV_vertex_program */
+
+#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_F(NV_fragment_program, pname);
+ *params = (GLfloat) ctx->FragmentProgram.Enabled;
+ break;
+ case GL_MAX_TEXTURE_COORDS_NV:
+ CHECK_EXTENSION_F(NV_fragment_program, pname);
+ *params = (GLfloat) ctx->Const.MaxTextureCoordUnits;
+ break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS_NV:
+ CHECK_EXTENSION_F(NV_fragment_program, pname);
+ *params = (GLfloat) ctx->Const.MaxTextureImageUnits;
+ break;
+ case GL_FRAGMENT_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_F(NV_fragment_program, pname);
+ if (ctx->FragmentProgram.Current)
+ *params = (GLfloat) ctx->FragmentProgram.Current->Base.Id;
+ else
+ *params = 0.0;
+ break;
+ case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:
+ CHECK_EXTENSION_F(NV_fragment_program, pname);
+ *params = (GLfloat) MAX_NV_FRAGMENT_PROGRAM_PARAMS;
+ break;
+#endif /* FEATURE_NV_fragment_program */
+
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_F(NV_texture_rectangle, pname);
+ *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_F(NV_texture_rectangle, pname);
+ *params = (GLfloat) textureUnit->CurrentRect->Name;
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_F(NV_texture_rectangle, pname);
+ *params = (GLfloat) ctx->Const.MaxTextureRectSize;
+ break;
+
+ /* GL_EXT_stencil_two_side */
+ case GL_STENCIL_TEST_TWO_SIDE_EXT:
+ CHECK_EXTENSION_F(EXT_stencil_two_side, pname);
+ *params = (GLfloat) ctx->Stencil.TestTwoSide;
+ break;
+ case GL_ACTIVE_STENCIL_FACE_EXT:
+ CHECK_EXTENSION_F(EXT_stencil_two_side, pname);
+ *params = (GLfloat) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
+ break;
+
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = ctx->Const.MaxShininess;
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = ctx->Const.MaxSpotExponent;
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.ArrayBufferObj->Name;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Vertex.BufferObj->Name;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Normal.BufferObj->Name;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Color.BufferObj->Name;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Index.BufferObj->Name;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.EdgeFlag.BufferObj->Name;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.SecondaryColor.BufferObj->Name;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.FogCoord.BufferObj->Name;
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.ElementArrayBufferObj->Name;
+ break;
+#endif
+#if FEATURE_EXT_pixel_buffer_object
+ case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname);
+ *params = (GLfloat) ctx->Pack.BufferObj->Name;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname);
+ *params = (GLfloat) ctx->Unpack.BufferObj->Name;
+ break;
+#endif
+
+#if FEATURE_ARB_vertex_program
+ /* GL_NV_vertex_program and GL_ARB_fragment_program define others */
+ case GL_MAX_VERTEX_ATTRIBS_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_program, pname);
+ *params = (GLfloat) ctx->Const.MaxVertexProgramAttribs;
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_F(ARB_fragment_program, pname);
+ *params = (GLfloat) ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_F(ARB_fragment_program, pname);
+ params[0] = ctx->CurrentStack->Top->m[0];
+ params[1] = ctx->CurrentStack->Top->m[4];
+ params[2] = ctx->CurrentStack->Top->m[8];
+ params[3] = ctx->CurrentStack->Top->m[12];
+ params[4] = ctx->CurrentStack->Top->m[1];
+ params[5] = ctx->CurrentStack->Top->m[5];
+ params[6] = ctx->CurrentStack->Top->m[9];
+ params[7] = ctx->CurrentStack->Top->m[13];
+ params[8] = ctx->CurrentStack->Top->m[2];
+ params[9] = ctx->CurrentStack->Top->m[6];
+ params[10] = ctx->CurrentStack->Top->m[10];
+ params[11] = ctx->CurrentStack->Top->m[14];
+ params[12] = ctx->CurrentStack->Top->m[3];
+ params[13] = ctx->CurrentStack->Top->m[7];
+ params[14] = ctx->CurrentStack->Top->m[11];
+ params[15] = ctx->CurrentStack->Top->m[15];
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+ params[0] = (GLfloat) ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsMin;
+ params[1] = ctx->Depth.BoundsMax;
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->FragmentProgram.CurrentPosition;
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->VertexProgram.CurrentPosition;
+ break;
+#endif
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname);
+ }
+}
+
+
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetIntegerv().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetIntegerv,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLinteger.
+ */
+void GLAPIENTRY
+_mesa_GetIntegerv( GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint i;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
+ const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!params)
+ return;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname));
+
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
+ if (ctx->Driver.GetIntegerv
+ && (*ctx->Driver.GetIntegerv)(ctx, pname, params))
+ return;
+
+ switch (pname) {
+ case GL_ACCUM_RED_BITS:
+ *params = (GLint) ctx->Visual.accumRedBits;
+ break;
+ case GL_ACCUM_GREEN_BITS:
+ *params = (GLint) ctx->Visual.accumGreenBits;
+ break;
+ case GL_ACCUM_BLUE_BITS:
+ *params = (GLint) ctx->Visual.accumBlueBits;
+ break;
+ case GL_ACCUM_ALPHA_BITS:
+ *params = (GLint) ctx->Visual.accumAlphaBits;
+ break;
+ case GL_ACCUM_CLEAR_VALUE:
+ params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] );
+ params[1] = FLOAT_TO_INT( ctx->Accum.ClearColor[1] );
+ params[2] = FLOAT_TO_INT( ctx->Accum.ClearColor[2] );
+ params[3] = FLOAT_TO_INT( ctx->Accum.ClearColor[3] );
+ break;
+ case GL_ALPHA_BIAS:
+ *params = (GLint) ctx->Pixel.AlphaBias;
+ break;
+ case GL_ALPHA_BITS:
+ *params = ctx->Visual.alphaBits;
+ break;
+ case GL_ALPHA_SCALE:
+ *params = (GLint) ctx->Pixel.AlphaScale;
+ break;
+ case GL_ALPHA_TEST:
+ *params = (GLint) ctx->Color.AlphaEnabled;
+ break;
+ case GL_ALPHA_TEST_REF:
+ *params = FLOAT_TO_INT(ctx->Color.AlphaRef);
+ break;
+ case GL_ALPHA_TEST_FUNC:
+ *params = (GLint) ctx->Color.AlphaFunc;
+ break;
+ case GL_ATTRIB_STACK_DEPTH:
+ *params = (GLint) (ctx->AttribStackDepth);
+ break;
+ case GL_AUTO_NORMAL:
+ *params = (GLint) ctx->Eval.AutoNormal;
+ break;
+ case GL_AUX_BUFFERS:
+ *params = (GLint) ctx->Visual.numAuxBuffers;
+ break;
+ case GL_BLEND:
+ *params = (GLint) ctx->Color.BlendEnabled;
+ break;
+ case GL_BLEND_DST:
+ *params = (GLint) ctx->Color.BlendDstRGB;
+ break;
+ case GL_BLEND_SRC:
+ *params = (GLint) ctx->Color.BlendSrcRGB;
+ break;
+ case GL_BLEND_SRC_RGB_EXT:
+ *params = (GLint) ctx->Color.BlendSrcRGB;
+ break;
+ case GL_BLEND_DST_RGB_EXT:
+ *params = (GLint) ctx->Color.BlendDstRGB;
+ break;
+ case GL_BLEND_SRC_ALPHA_EXT:
+ *params = (GLint) ctx->Color.BlendSrcA;
+ break;
+ case GL_BLEND_DST_ALPHA_EXT:
+ *params = (GLint) ctx->Color.BlendDstA;
+ break;
+ case GL_BLEND_EQUATION:
+ *params = (GLint) ctx->Color.BlendEquationRGB;
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = (GLint) ctx->Color.BlendEquationA;
+ break;
+ case GL_BLEND_COLOR_EXT:
+ params[0] = FLOAT_TO_INT( ctx->Color.BlendColor[0] );
+ params[1] = FLOAT_TO_INT( ctx->Color.BlendColor[1] );
+ params[2] = FLOAT_TO_INT( ctx->Color.BlendColor[2] );
+ params[3] = FLOAT_TO_INT( ctx->Color.BlendColor[3] );
+ break;
+ case GL_BLUE_BIAS:
+ *params = (GLint) ctx->Pixel.BlueBias;
+ break;
+ case GL_BLUE_BITS:
+ *params = (GLint) ctx->Visual.blueBits;
+ break;
+ case GL_BLUE_SCALE:
+ *params = (GLint) ctx->Pixel.BlueScale;
+ break;
+ case GL_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = (GLint) (ctx->ClientAttribStackDepth);
+ break;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = 1;
+ else
+ *params = 0;
+ break;
+ case GL_COLOR_CLEAR_VALUE:
+ params[0] = FLOAT_TO_INT( (ctx->Color.ClearColor[0]) );
+ params[1] = FLOAT_TO_INT( (ctx->Color.ClearColor[1]) );
+ params[2] = FLOAT_TO_INT( (ctx->Color.ClearColor[2]) );
+ params[3] = FLOAT_TO_INT( (ctx->Color.ClearColor[3]) );
+ break;
+ case GL_COLOR_MATERIAL:
+ *params = (GLint) ctx->Light.ColorMaterialEnabled;
+ break;
+ case GL_COLOR_MATERIAL_FACE:
+ *params = (GLint) ctx->Light.ColorMaterialFace;
+ break;
+ case GL_COLOR_MATERIAL_PARAMETER:
+ *params = (GLint) ctx->Light.ColorMaterialMode;
+ break;
+ case GL_COLOR_WRITEMASK:
+ params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0;
+ params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0;
+ params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0;
+ params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0;
+ break;
+ case GL_CULL_FACE:
+ *params = (GLint) ctx->Polygon.CullFlag;
+ break;
+ case GL_CULL_FACE_MODE:
+ *params = (GLint) ctx->Polygon.CullFaceMode;
+ break;
+ case GL_CURRENT_COLOR:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
+ params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
+ params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
+ params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
+ break;
+ case GL_CURRENT_INDEX:
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLint) ctx->Current.Index;
+ break;
+ case GL_CURRENT_NORMAL:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
+ params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
+ params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
+ break;
+ case GL_CURRENT_RASTER_COLOR:
+ params[0] = FLOAT_TO_INT( ctx->Current.RasterColor[0] );
+ params[1] = FLOAT_TO_INT( ctx->Current.RasterColor[1] );
+ params[2] = FLOAT_TO_INT( ctx->Current.RasterColor[2] );
+ params[3] = FLOAT_TO_INT( ctx->Current.RasterColor[3] );
+ break;
+ case GL_CURRENT_RASTER_DISTANCE:
+ params[0] = (GLint) ctx->Current.RasterDistance;
+ break;
+ case GL_CURRENT_RASTER_INDEX:
+ *params = (GLint) ctx->Current.RasterIndex;
+ break;
+ case GL_CURRENT_RASTER_POSITION:
+ params[0] = (GLint) ctx->Current.RasterPos[0];
+ params[1] = (GLint) ctx->Current.RasterPos[1];
+ params[2] = (GLint) ctx->Current.RasterPos[2];
+ params[3] = (GLint) ctx->Current.RasterPos[3];
+ break;
+ case GL_CURRENT_RASTER_TEXTURE_COORDS:
+ params[0] = (GLint) ctx->Current.RasterTexCoords[texUnit][0];
+ params[1] = (GLint) ctx->Current.RasterTexCoords[texUnit][1];
+ params[2] = (GLint) ctx->Current.RasterTexCoords[texUnit][2];
+ params[3] = (GLint) ctx->Current.RasterTexCoords[texUnit][3];
+ break;
+ case GL_CURRENT_RASTER_POSITION_VALID:
+ *params = (GLint) ctx->Current.RasterPosValid;
+ break;
+ case GL_CURRENT_TEXTURE_COORDS:
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0];
+ params[1] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1];
+ params[2] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2];
+ params[3] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3];
+ break;
+ case GL_DEPTH_BIAS:
+ *params = (GLint) ctx->Pixel.DepthBias;
+ break;
+ case GL_DEPTH_BITS:
+ *params = ctx->Visual.depthBits;
+ break;
+ case GL_DEPTH_CLEAR_VALUE:
+ *params = (GLint) ctx->Depth.Clear;
+ break;
+ case GL_DEPTH_FUNC:
+ *params = (GLint) ctx->Depth.Func;
+ break;
+ case GL_DEPTH_RANGE:
+ params[0] = (GLint) ctx->Viewport.Near;
+ params[1] = (GLint) ctx->Viewport.Far;
+ break;
+ case GL_DEPTH_SCALE:
+ *params = (GLint) ctx->Pixel.DepthScale;
+ break;
+ case GL_DEPTH_TEST:
+ *params = (GLint) ctx->Depth.Test;
+ break;
+ case GL_DEPTH_WRITEMASK:
+ *params = (GLint) ctx->Depth.Mask;
+ break;
+ case GL_DITHER:
+ *params = (GLint) ctx->Color.DitherFlag;
+ break;
+ case GL_DOUBLEBUFFER:
+ *params = (GLint) ctx->Visual.doubleBufferMode;
+ break;
+ case GL_DRAW_BUFFER:
+ *params = (GLint) ctx->Color.DrawBuffer;
+ break;
+ case GL_EDGE_FLAG:
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLint) ctx->Current.EdgeFlag;
+ break;
+ case GL_FEEDBACK_BUFFER_SIZE:
+ *params = ctx->Feedback.BufferSize;
+ break;
+ case GL_FEEDBACK_BUFFER_TYPE:
+ *params = ctx->Feedback.Type;
+ break;
+ case GL_FOG:
+ *params = (GLint) ctx->Fog.Enabled;
+ break;
+ case GL_FOG_COLOR:
+ params[0] = FLOAT_TO_INT( ctx->Fog.Color[0] );
+ params[1] = FLOAT_TO_INT( ctx->Fog.Color[1] );
+ params[2] = FLOAT_TO_INT( ctx->Fog.Color[2] );
+ params[3] = FLOAT_TO_INT( ctx->Fog.Color[3] );
+ break;
+ case GL_FOG_DENSITY:
+ *params = (GLint) ctx->Fog.Density;
+ break;
+ case GL_FOG_END:
+ *params = (GLint) ctx->Fog.End;
+ break;
+ case GL_FOG_HINT:
+ *params = (GLint) ctx->Hint.Fog;
+ break;
+ case GL_FOG_INDEX:
+ *params = (GLint) ctx->Fog.Index;
+ break;
+ case GL_FOG_MODE:
+ *params = (GLint) ctx->Fog.Mode;
+ break;
+ case GL_FOG_START:
+ *params = (GLint) ctx->Fog.Start;
+ break;
+ case GL_FRONT_FACE:
+ *params = (GLint) ctx->Polygon.FrontFace;
+ break;
+ case GL_GREEN_BIAS:
+ *params = (GLint) ctx->Pixel.GreenBias;
+ break;
+ case GL_GREEN_BITS:
+ *params = (GLint) ctx->Visual.greenBits;
+ break;
+ case GL_GREEN_SCALE:
+ *params = (GLint) ctx->Pixel.GreenScale;
+ break;
+ case GL_INDEX_BITS:
+ *params = (GLint) ctx->Visual.indexBits;
+ break;
+ case GL_INDEX_CLEAR_VALUE:
+ *params = (GLint) ctx->Color.ClearIndex;
+ break;
+ case GL_INDEX_MODE:
+ *params = ctx->Visual.rgbMode ? 0 : 1;
+ break;
+ case GL_INDEX_OFFSET:
+ *params = ctx->Pixel.IndexOffset;
+ break;
+ case GL_INDEX_SHIFT:
+ *params = ctx->Pixel.IndexShift;
+ break;
+ case GL_INDEX_WRITEMASK:
+ *params = (GLint) ctx->Color.IndexMask;
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ *params = (GLint) ctx->Light.Light[pname-GL_LIGHT0].Enabled;
+ break;
+ case GL_LIGHTING:
+ *params = (GLint) ctx->Light.Enabled;
+ break;
+ case GL_LIGHT_MODEL_AMBIENT:
+ params[0] = FLOAT_TO_INT( ctx->Light.Model.Ambient[0] );
+ params[1] = FLOAT_TO_INT( ctx->Light.Model.Ambient[1] );
+ params[2] = FLOAT_TO_INT( ctx->Light.Model.Ambient[2] );
+ params[3] = FLOAT_TO_INT( ctx->Light.Model.Ambient[3] );
+ break;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ params[0] = (GLint) ctx->Light.Model.ColorControl;
+ break;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ *params = (GLint) ctx->Light.Model.LocalViewer;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *params = (GLint) ctx->Light.Model.TwoSide;
+ break;
+ case GL_LINE_SMOOTH:
+ *params = (GLint) ctx->Line.SmoothFlag;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ *params = (GLint) ctx->Hint.LineSmooth;
+ break;
+ case GL_LINE_STIPPLE:
+ *params = (GLint) ctx->Line.StippleFlag;
+ break;
+ case GL_LINE_STIPPLE_PATTERN:
+ *params = (GLint) ctx->Line.StipplePattern;
+ break;
+ case GL_LINE_STIPPLE_REPEAT:
+ *params = (GLint) ctx->Line.StippleFactor;
+ break;
+ case GL_LINE_WIDTH:
+ *params = (GLint) ctx->Line.Width;
+ break;
+ case GL_LINE_WIDTH_GRANULARITY:
+ *params = (GLint) ctx->Const.LineWidthGranularity;
+ break;
+ case GL_LINE_WIDTH_RANGE:
+ params[0] = (GLint) ctx->Const.MinLineWidthAA;
+ params[1] = (GLint) ctx->Const.MaxLineWidthAA;
+ break;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ params[0] = (GLint) ctx->Const.MinLineWidth;
+ params[1] = (GLint) ctx->Const.MaxLineWidth;
+ break;
+ case GL_LIST_BASE:
+ *params = (GLint) ctx->List.ListBase;
+ break;
+ case GL_LIST_INDEX:
+ *params = (GLint) ctx->ListState.CurrentListNum;
+ break;
+ case GL_LIST_MODE:
+ if (!ctx->CompileFlag)
+ *params = 0;
+ else if (ctx->ExecuteFlag)
+ *params = (GLint) GL_COMPILE_AND_EXECUTE;
+ else
+ *params = (GLint) GL_COMPILE;
+ break;
+ case GL_INDEX_LOGIC_OP:
+ *params = (GLint) ctx->Color.IndexLogicOpEnabled;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ *params = (GLint) ctx->Color.ColorLogicOpEnabled;
+ break;
+ case GL_LOGIC_OP_MODE:
+ *params = (GLint) ctx->Color.LogicOp;
+ break;
+ case GL_MAP1_COLOR_4:
+ *params = (GLint) ctx->Eval.Map1Color4;
+ break;
+ case GL_MAP1_GRID_DOMAIN:
+ params[0] = (GLint) ctx->Eval.MapGrid1u1;
+ params[1] = (GLint) ctx->Eval.MapGrid1u2;
+ break;
+ case GL_MAP1_GRID_SEGMENTS:
+ *params = (GLint) ctx->Eval.MapGrid1un;
+ break;
+ case GL_MAP1_INDEX:
+ *params = (GLint) ctx->Eval.Map1Index;
+ break;
+ case GL_MAP1_NORMAL:
+ *params = (GLint) ctx->Eval.Map1Normal;
+ break;
+ case GL_MAP1_TEXTURE_COORD_1:
+ *params = (GLint) ctx->Eval.Map1TextureCoord1;
+ break;
+ case GL_MAP1_TEXTURE_COORD_2:
+ *params = (GLint) ctx->Eval.Map1TextureCoord2;
+ break;
+ case GL_MAP1_TEXTURE_COORD_3:
+ *params = (GLint) ctx->Eval.Map1TextureCoord3;
+ break;
+ case GL_MAP1_TEXTURE_COORD_4:
+ *params = (GLint) ctx->Eval.Map1TextureCoord4;
+ break;
+ case GL_MAP1_VERTEX_3:
+ *params = (GLint) ctx->Eval.Map1Vertex3;
+ break;
+ case GL_MAP1_VERTEX_4:
+ *params = (GLint) ctx->Eval.Map1Vertex4;
+ break;
+ case GL_MAP2_COLOR_4:
+ *params = (GLint) ctx->Eval.Map2Color4;
+ break;
+ case GL_MAP2_GRID_DOMAIN:
+ params[0] = (GLint) ctx->Eval.MapGrid2u1;
+ params[1] = (GLint) ctx->Eval.MapGrid2u2;
+ params[2] = (GLint) ctx->Eval.MapGrid2v1;
+ params[3] = (GLint) ctx->Eval.MapGrid2v2;
+ break;
+ case GL_MAP2_GRID_SEGMENTS:
+ params[0] = (GLint) ctx->Eval.MapGrid2un;
+ params[1] = (GLint) ctx->Eval.MapGrid2vn;
+ break;
+ case GL_MAP2_INDEX:
+ *params = (GLint) ctx->Eval.Map2Index;
+ break;
+ case GL_MAP2_NORMAL:
+ *params = (GLint) ctx->Eval.Map2Normal;
+ break;
+ case GL_MAP2_TEXTURE_COORD_1:
+ *params = (GLint) ctx->Eval.Map2TextureCoord1;
+ break;
+ case GL_MAP2_TEXTURE_COORD_2:
+ *params = (GLint) ctx->Eval.Map2TextureCoord2;
+ break;
+ case GL_MAP2_TEXTURE_COORD_3:
+ *params = (GLint) ctx->Eval.Map2TextureCoord3;
+ break;
+ case GL_MAP2_TEXTURE_COORD_4:
+ *params = (GLint) ctx->Eval.Map2TextureCoord4;
+ break;
+ case GL_MAP2_VERTEX_3:
+ *params = (GLint) ctx->Eval.Map2Vertex3;
+ break;
+ case GL_MAP2_VERTEX_4:
+ *params = (GLint) ctx->Eval.Map2Vertex4;
+ break;
+ case GL_MAP_COLOR:
+ *params = (GLint) ctx->Pixel.MapColorFlag;
+ break;
+ case GL_MAP_STENCIL:
+ *params = (GLint) ctx->Pixel.MapStencilFlag;
+ break;
+ case GL_MATRIX_MODE:
+ *params = (GLint) ctx->Transform.MatrixMode;
+ break;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ *params = (GLint) MAX_ATTRIB_STACK_DEPTH;
+ break;
+ case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+ *params = (GLint) MAX_CLIENT_ATTRIB_STACK_DEPTH;
+ break;
+ case GL_MAX_CLIP_PLANES:
+ *params = (GLint) ctx->Const.MaxClipPlanes;
+ break;
+ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
+ *params = (GLint) ctx->Const.MaxArrayLockSize;
+ break;
+ case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
+ *params = (GLint) ctx->Const.MaxArrayLockSize;
+ break;
+ case GL_MAX_EVAL_ORDER:
+ *params = (GLint) MAX_EVAL_ORDER;
+ break;
+ case GL_MAX_LIGHTS:
+ *params = (GLint) ctx->Const.MaxLights;
+ break;
+ case GL_MAX_LIST_NESTING:
+ *params = (GLint) MAX_LIST_NESTING;
+ break;
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ *params = (GLint) MAX_MODELVIEW_STACK_DEPTH;
+ break;
+ case GL_MAX_NAME_STACK_DEPTH:
+ *params = (GLint) MAX_NAME_STACK_DEPTH;
+ break;
+ case GL_MAX_PIXEL_MAP_TABLE:
+ *params = (GLint) MAX_PIXEL_MAP_TABLE;
+ break;
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ *params = (GLint) MAX_PROJECTION_STACK_DEPTH;
+ break;
+ case GL_MAX_TEXTURE_SIZE:
+ *params = (1 << (ctx->Const.MaxTextureLevels - 1));
+ break;
+ case GL_MAX_3D_TEXTURE_SIZE:
+ *params = (1 << (ctx->Const.Max3DTextureLevels - 1));
+ break;
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ *params = (GLint) MAX_TEXTURE_STACK_DEPTH;
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ params[0] = (GLint) MAX_WIDTH;
+ params[1] = (GLint) MAX_HEIGHT;
+ break;
+ case GL_MODELVIEW_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) ctx->ModelviewMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_MODELVIEW_STACK_DEPTH:
+ *params = (GLint) (ctx->ModelviewMatrixStack.Depth + 1);
+ break;
+ case GL_NAME_STACK_DEPTH:
+ *params = (GLint) ctx->Select.NameStackDepth;
+ break;
+ case GL_NORMALIZE:
+ *params = (GLint) ctx->Transform.Normalize;
+ break;
+ case GL_PACK_ALIGNMENT:
+ *params = ctx->Pack.Alignment;
+ break;
+ case GL_PACK_LSB_FIRST:
+ *params = (GLint) ctx->Pack.LsbFirst;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ *params = ctx->Pack.RowLength;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ *params = ctx->Pack.SkipPixels;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ *params = ctx->Pack.SkipRows;
+ break;
+ case GL_PACK_SWAP_BYTES:
+ *params = (GLint) ctx->Pack.SwapBytes;
+ break;
+ case GL_PACK_SKIP_IMAGES_EXT:
+ *params = ctx->Pack.SkipImages;
+ break;
+ case GL_PACK_IMAGE_HEIGHT_EXT:
+ *params = ctx->Pack.ImageHeight;
+ break;
+ case GL_PACK_INVERT_MESA:
+ *params = ctx->Pack.Invert;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ *params = (GLint) ctx->Hint.PerspectiveCorrection;
+ break;
+ case GL_PIXEL_MAP_A_TO_A_SIZE:
+ *params = ctx->Pixel.MapAtoAsize;
+ break;
+ case GL_PIXEL_MAP_B_TO_B_SIZE:
+ *params = ctx->Pixel.MapBtoBsize;
+ break;
+ case GL_PIXEL_MAP_G_TO_G_SIZE:
+ *params = ctx->Pixel.MapGtoGsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_A_SIZE:
+ *params = ctx->Pixel.MapItoAsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_B_SIZE:
+ *params = ctx->Pixel.MapItoBsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_G_SIZE:
+ *params = ctx->Pixel.MapItoGsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_I_SIZE:
+ *params = ctx->Pixel.MapItoIsize;
+ break;
+ case GL_PIXEL_MAP_I_TO_R_SIZE:
+ *params = ctx->Pixel.MapItoRsize;
+ break;
+ case GL_PIXEL_MAP_R_TO_R_SIZE:
+ *params = ctx->Pixel.MapRtoRsize;
+ break;
+ case GL_PIXEL_MAP_S_TO_S_SIZE:
+ *params = ctx->Pixel.MapStoSsize;
+ break;
+ case GL_POINT_SIZE:
+ *params = (GLint) ctx->Point.Size;
+ break;
+ case GL_POINT_SIZE_GRANULARITY:
+ *params = (GLint) ctx->Const.PointSizeGranularity;
+ break;
+ case GL_POINT_SIZE_RANGE:
+ params[0] = (GLint) ctx->Const.MinPointSizeAA;
+ params[1] = (GLint) ctx->Const.MaxPointSizeAA;
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ params[0] = (GLint) ctx->Const.MinPointSize;
+ params[1] = (GLint) ctx->Const.MaxPointSize;
+ break;
+ case GL_POINT_SMOOTH:
+ *params = (GLint) ctx->Point.SmoothFlag;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ *params = (GLint) ctx->Hint.PointSmooth;
+ break;
+ case GL_POINT_SIZE_MIN_EXT:
+ *params = (GLint) (ctx->Point.MinSize);
+ break;
+ case GL_POINT_SIZE_MAX_EXT:
+ *params = (GLint) (ctx->Point.MaxSize);
+ break;
+ case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+ *params = (GLint) (ctx->Point.Threshold);
+ break;
+ case GL_DISTANCE_ATTENUATION_EXT:
+ params[0] = (GLint) (ctx->Point.Params[0]);
+ params[1] = (GLint) (ctx->Point.Params[1]);
+ params[2] = (GLint) (ctx->Point.Params[2]);
+ break;
+ case GL_POLYGON_MODE:
+ params[0] = (GLint) ctx->Polygon.FrontMode;
+ params[1] = (GLint) ctx->Polygon.BackMode;
+ break;
+ case GL_POLYGON_OFFSET_BIAS_EXT: /* GL_EXT_polygon_offset */
+ *params = (GLint) ctx->Polygon.OffsetUnits;
+ break;
+ case GL_POLYGON_OFFSET_FACTOR:
+ *params = (GLint) ctx->Polygon.OffsetFactor;
+ break;
+ case GL_POLYGON_OFFSET_UNITS:
+ *params = (GLint) ctx->Polygon.OffsetUnits;
+ break;
+ case GL_POLYGON_SMOOTH:
+ *params = (GLint) ctx->Polygon.SmoothFlag;
+ break;
+ case GL_POLYGON_SMOOTH_HINT:
+ *params = (GLint) ctx->Hint.PolygonSmooth;
+ break;
+ case GL_POLYGON_STIPPLE:
+ *params = (GLint) ctx->Polygon.StippleFlag;
+ break;
+ case GL_PROJECTION_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) ctx->ProjectionMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_PROJECTION_STACK_DEPTH:
+ *params = (GLint) (ctx->ProjectionMatrixStack.Depth + 1);
+ break;
+ case GL_READ_BUFFER:
+ *params = (GLint) ctx->Pixel.ReadBuffer;
+ break;
+ case GL_RED_BIAS:
+ *params = (GLint) ctx->Pixel.RedBias;
+ break;
+ case GL_RED_BITS:
+ *params = (GLint) ctx->Visual.redBits;
+ break;
+ case GL_RED_SCALE:
+ *params = (GLint) ctx->Pixel.RedScale;
+ break;
+ case GL_RENDER_MODE:
+ *params = (GLint) ctx->RenderMode;
+ break;
+ case GL_RESCALE_NORMAL:
+ *params = (GLint) ctx->Transform.RescaleNormals;
+ break;
+ case GL_RGBA_MODE:
+ *params = (GLint) ctx->Visual.rgbMode;
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = (GLint) ctx->Scissor.X;
+ params[1] = (GLint) ctx->Scissor.Y;
+ params[2] = (GLint) ctx->Scissor.Width;
+ params[3] = (GLint) ctx->Scissor.Height;
+ break;
+ case GL_SCISSOR_TEST:
+ *params = (GLint) ctx->Scissor.Enabled;
+ break;
+ case GL_SELECTION_BUFFER_SIZE:
+ *params = (GLint) ctx->Select.BufferSize;
+ break;
+ case GL_SHADE_MODEL:
+ *params = (GLint) ctx->Light.ShadeModel;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ *params = (GLint) ctx->Texture.SharedPalette;
+ break;
+ case GL_STENCIL_BITS:
+ *params = ctx->Visual.stencilBits;
+ break;
+ case GL_STENCIL_CLEAR_VALUE:
+ *params = (GLint) ctx->Stencil.Clear;
+ break;
+ case GL_STENCIL_FAIL:
+ *params = (GLint) ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_FUNC:
+ *params = (GLint) ctx->Stencil.Function[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *params = (GLint) ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *params = (GLint) ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_REF:
+ *params = (GLint) ctx->Stencil.Ref[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_TEST:
+ *params = (GLint) ctx->Stencil.Enabled;
+ break;
+ case GL_STENCIL_VALUE_MASK:
+ *params = (GLint) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STENCIL_WRITEMASK:
+ *params = (GLint) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace];
+ break;
+ case GL_STEREO:
+ *params = (GLint) ctx->Visual.stereoMode;
+ break;
+ case GL_SUBPIXEL_BITS:
+ *params = ctx->Const.SubPixelBits;
+ break;
+ case GL_TEXTURE_1D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1 : 0;
+ break;
+ case GL_TEXTURE_2D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1 : 0;
+ break;
+ case GL_TEXTURE_3D:
+ *params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1 : 0;
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ *params = textureUnit->Current1D->Name;
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ *params = textureUnit->Current2D->Name;
+ break;
+ case GL_TEXTURE_BINDING_3D:
+ *params = textureUnit->Current3D->Name;
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ params[0] = FLOAT_TO_INT( textureUnit->EnvColor[0] );
+ params[1] = FLOAT_TO_INT( textureUnit->EnvColor[1] );
+ params[2] = FLOAT_TO_INT( textureUnit->EnvColor[2] );
+ params[3] = FLOAT_TO_INT( textureUnit->EnvColor[3] );
+ break;
+ case GL_TEXTURE_ENV_MODE:
+ *params = (GLint) textureUnit->EnvMode;
+ break;
+ case GL_TEXTURE_GEN_S:
+ *params = (textureUnit->TexGenEnabled & S_BIT) ? 1 : 0;
+ break;
+ case GL_TEXTURE_GEN_T:
+ *params = (textureUnit->TexGenEnabled & T_BIT) ? 1 : 0;
+ break;
+ case GL_TEXTURE_GEN_R:
+ *params = (textureUnit->TexGenEnabled & R_BIT) ? 1 : 0;
+ break;
+ case GL_TEXTURE_GEN_Q:
+ *params = (textureUnit->TexGenEnabled & Q_BIT) ? 1 : 0;
+ break;
+ case GL_TEXTURE_MATRIX:
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) ctx->TextureMatrixStack[texUnit].Top->m[i];
+ }
+ break;
+ case GL_TEXTURE_STACK_DEPTH:
+ *params = (GLint) (ctx->TextureMatrixStack[texUnit].Depth + 1);
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ *params = ctx->Unpack.Alignment;
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ *params = (GLint) ctx->Unpack.LsbFirst;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ *params = ctx->Unpack.RowLength;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ *params = ctx->Unpack.SkipPixels;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ *params = ctx->Unpack.SkipRows;
+ break;
+ case GL_UNPACK_SWAP_BYTES:
+ *params = (GLint) ctx->Unpack.SwapBytes;
+ break;
+ case GL_UNPACK_SKIP_IMAGES_EXT:
+ *params = ctx->Unpack.SkipImages;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT_EXT:
+ *params = ctx->Unpack.ImageHeight;
+ break;
+ case GL_UNPACK_CLIENT_STORAGE_APPLE:
+ *params = ctx->Unpack.ClientStorage;
+ break;
+ case GL_VIEWPORT:
+ params[0] = (GLint) ctx->Viewport.X;
+ params[1] = (GLint) ctx->Viewport.Y;
+ params[2] = (GLint) ctx->Viewport.Width;
+ params[3] = (GLint) ctx->Viewport.Height;
+ break;
+ case GL_ZOOM_X:
+ *params = (GLint) ctx->Pixel.ZoomX;
+ break;
+ case GL_ZOOM_Y:
+ *params = (GLint) ctx->Pixel.ZoomY;
+ break;
+ case GL_VERTEX_ARRAY:
+ *params = (GLint) ctx->Array.Vertex.Enabled;
+ break;
+ case GL_VERTEX_ARRAY_SIZE:
+ *params = ctx->Array.Vertex.Size;
+ break;
+ case GL_VERTEX_ARRAY_TYPE:
+ *params = ctx->Array.Vertex.Type;
+ break;
+ case GL_VERTEX_ARRAY_STRIDE:
+ *params = ctx->Array.Vertex.Stride;
+ break;
+ case GL_VERTEX_ARRAY_COUNT_EXT:
+ *params = 0;
+ break;
+ case GL_NORMAL_ARRAY:
+ *params = (GLint) ctx->Array.Normal.Enabled;
+ break;
+ case GL_NORMAL_ARRAY_TYPE:
+ *params = ctx->Array.Normal.Type;
+ break;
+ case GL_NORMAL_ARRAY_STRIDE:
+ *params = ctx->Array.Normal.Stride;
+ break;
+ case GL_NORMAL_ARRAY_COUNT_EXT:
+ *params = 0;
+ break;
+ case GL_COLOR_ARRAY:
+ *params = (GLint) ctx->Array.Color.Enabled;
+ break;
+ case GL_COLOR_ARRAY_SIZE:
+ *params = ctx->Array.Color.Size;
+ break;
+ case GL_COLOR_ARRAY_TYPE:
+ *params = ctx->Array.Color.Type;
+ break;
+ case GL_COLOR_ARRAY_STRIDE:
+ *params = ctx->Array.Color.Stride;
+ break;
+ case GL_COLOR_ARRAY_COUNT_EXT:
+ *params = 0;
+ break;
+ case GL_INDEX_ARRAY:
+ *params = (GLint) ctx->Array.Index.Enabled;
+ break;
+ case GL_INDEX_ARRAY_TYPE:
+ *params = ctx->Array.Index.Type;
+ break;
+ case GL_INDEX_ARRAY_STRIDE:
+ *params = ctx->Array.Index.Stride;
+ break;
+ case GL_INDEX_ARRAY_COUNT_EXT:
+ *params = 0;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ *params = (GLint) ctx->Array.TexCoord[clientUnit].Enabled;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ *params = ctx->Array.TexCoord[clientUnit].Size;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ *params = ctx->Array.TexCoord[clientUnit].Type;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ *params = ctx->Array.TexCoord[clientUnit].Stride;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
+ *params = 0;
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ *params = (GLint) ctx->Array.EdgeFlag.Enabled;
+ break;
+ case GL_EDGE_FLAG_ARRAY_STRIDE:
+ *params = ctx->Array.EdgeFlag.Stride;
+ break;
+ case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
+ *params = 0;
+ break;
+
+ /* GL_ARB_multitexture */
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ CHECK_EXTENSION_I(ARB_multitexture, pname);
+ *params = MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
+ break;
+ case GL_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_I(ARB_multitexture, pname);
+ *params = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit;
+ break;
+ case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+ CHECK_EXTENSION_I(ARB_multitexture, pname);
+ *params = GL_TEXTURE0_ARB + clientUnit;
+ break;
+
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ CHECK_EXTENSION_I(ARB_texture_cube_map, pname);
+ *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ CHECK_EXTENSION_I(ARB_texture_cube_map, pname);
+ *params = textureUnit->CurrentCubeMap->Name;
+ break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ CHECK_EXTENSION_I(ARB_texture_cube_map, pname);
+ *params = (1 << (ctx->Const.MaxCubeTextureLevels - 1));
+ break;
+
+ /* GL_ARB_texture_compression */
+ case GL_TEXTURE_COMPRESSION_HINT_ARB:
+ CHECK_EXTENSION_I(ARB_texture_compression, pname);
+ *params = (GLint) ctx->Hint.TextureCompression;
+ break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_I(ARB_texture_compression, pname);
+ *params = (GLint) _mesa_get_compressed_formats(ctx, NULL);
+ break;
+ case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
+ CHECK_EXTENSION_I(ARB_texture_compression, pname);
+ (void) _mesa_get_compressed_formats(ctx, params);
+ break;
+
+ /* GL_EXT_compiled_vertex_array */
+ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
+ CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname);
+ *params = ctx->Array.LockFirst;
+ break;
+ case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:
+ CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname);
+ *params = ctx->Array.LockCount;
+ break;
+
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ColorMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ModelviewMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->ProjectionMatrixStack.Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ _math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
+ break;
+
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ CHECK_EXTENSION_I(HP_occlusion_test, pname);
+ *params = (GLint) ctx->Depth.OcclusionTest;
+ break;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ CHECK_EXTENSION_I(HP_occlusion_test, pname);
+ if (ctx->Depth.OcclusionTest)
+ *params = (GLint) ctx->OcclusionResult;
+ else
+ *params = (GLint) ctx->OcclusionResultSaved;
+ /* reset flag now */
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+ break;
+
+ /* GL_SGIS_pixel_texture */
+ case GL_PIXEL_TEXTURE_SGIS:
+ CHECK_EXTENSION_I(SGIS_pixel_texture, pname);
+ *params = (GLint) ctx->Pixel.PixelTextureEnabled;
+ break;
+
+ /* GL_SGIX_pixel_texture */
+ case GL_PIXEL_TEX_GEN_SGIX:
+ CHECK_EXTENSION_I(SGIX_pixel_texture, pname);
+ *params = (GLint) ctx->Pixel.PixelTextureEnabled;
+ break;
+ case GL_PIXEL_TEX_GEN_MODE_SGIX:
+ CHECK_EXTENSION_I(SGIX_pixel_texture, pname);
+ *params = (GLint) pixel_texgen_mode(ctx);
+ break;
+
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) ctx->ColorMatrixStack.Top->m[i];
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = ctx->ColorMatrixStack.Depth + 1;
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = MAX_COLOR_STACK_DEPTH;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixScale[0];
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixScale[1];
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixScale[2];
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixScale[3];
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixBias[0];
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixBias[1];
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixBias[2];
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ CHECK_EXTENSION_I(SGI_color_matrix, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixBias[3];
+ break;
+
+ /* GL_EXT_convolution (also in 1.2 imaging) */
+ case GL_CONVOLUTION_1D_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.Convolution1DEnabled;
+ break;
+ case GL_CONVOLUTION_2D:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.Convolution2DEnabled;
+ break;
+ case GL_SEPARABLE_2D:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.Separable2DEnabled;
+ break;
+ case GL_POST_CONVOLUTION_RED_SCALE_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionScale[0];
+ break;
+ case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionScale[1];
+ break;
+ case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionScale[2];
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionScale[3];
+ break;
+ case GL_POST_CONVOLUTION_RED_BIAS_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionBias[0];
+ break;
+ case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionBias[1];
+ break;
+ case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionBias[2];
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:
+ CHECK_EXTENSION_I(EXT_convolution, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionBias[2];
+ break;
+
+ /* GL_EXT_histogram (also in 1.2 imaging) */
+ case GL_HISTOGRAM:
+ CHECK_EXTENSION_I(EXT_histogram, pname);
+ *params = (GLint) ctx->Pixel.HistogramEnabled;
+ break;
+ case GL_MINMAX:
+ CHECK_EXTENSION_I(EXT_histogram, pname);
+ *params = (GLint) ctx->Pixel.MinMaxEnabled;
+ break;
+
+ /* GL_SGI_color_table (also in 1.2 imaging */
+ case GL_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_I(SGI_color_table, pname);
+ *params = (GLint) ctx->Pixel.ColorTableEnabled;
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_I(SGI_color_table, pname);
+ *params = (GLint) ctx->Pixel.PostConvolutionColorTableEnabled;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_I(SGI_color_table, pname);
+ *params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled;
+ break;
+
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_I(SGI_texture_color_table, pname);
+ *params = (GLint) textureUnit->ColorTableEnabled;
+ break;
+
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ CHECK_EXTENSION_I(EXT_secondary_color, pname);
+ *params = (GLint) ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ CHECK_EXTENSION_I(EXT_secondary_color, pname);
+ FLUSH_CURRENT(ctx, 0);
+ params[0] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]) );
+ params[1] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]) );
+ params[2] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]) );
+ params[3] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]) );
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ CHECK_EXTENSION_I(EXT_secondary_color, pname);
+ *params = (GLint) ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_I(EXT_secondary_color, pname);
+ *params = (GLint) ctx->Array.SecondaryColor.Type;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_I(EXT_secondary_color, pname);
+ *params = (GLint) ctx->Array.SecondaryColor.Stride;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ CHECK_EXTENSION_I(EXT_secondary_color, pname);
+ *params = (GLint) ctx->Array.SecondaryColor.Size;
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ CHECK_EXTENSION_I(EXT_fog_coord, pname);
+ FLUSH_CURRENT(ctx, 0);
+ *params = (GLint) ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ CHECK_EXTENSION_I(EXT_fog_coord, pname);
+ *params = (GLint) ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ CHECK_EXTENSION_I(EXT_fog_coord, pname);
+ *params = (GLint) ctx->Array.FogCoord.Type;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ CHECK_EXTENSION_I(EXT_fog_coord, pname);
+ *params = (GLint) ctx->Array.FogCoord.Stride;
+ break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_I(EXT_fog_coord, pname);
+ *params = (GLint) ctx->Fog.FogCoordinateSource;
+ break;
+
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = (GLint) ctx->Const.MaxTextureLodBias;
+ break;
+
+ /* GL_EXT_texture_filter_anisotropic */
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ CHECK_EXTENSION_I(EXT_texture_filter_anisotropic, pname);
+ *params = (GLint) ctx->Const.MaxTextureMaxAnisotropy;
+ break;
+
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = (GLint) ctx->Multisample.Enabled;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = (GLint) ctx->Multisample.SampleAlphaToCoverage;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = (GLint) ctx->Multisample.SampleAlphaToOne;
+ break;
+ case GL_SAMPLE_COVERAGE_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = (GLint) ctx->Multisample.SampleCoverage;
+ break;
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = (GLint) ctx->Multisample.SampleCoverageValue;
+ break;
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = (GLint) ctx->Multisample.SampleCoverageInvert;
+ break;
+ case GL_SAMPLE_BUFFERS_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = 0; /* XXX fix someday */
+ break;
+ case GL_SAMPLES_ARB:
+ CHECK_EXTENSION_I(ARB_multisample, pname);
+ *params = 0; /* XXX fix someday */
+ break;
+
+ /* GL_IBM_rasterpos_clip */
+ case GL_RASTER_POSITION_UNCLIPPED_IBM:
+ CHECK_EXTENSION_I(IBM_rasterpos_clip, pname);
+ *params = (GLint) ctx->Transform.RasterPositionUnclipped;
+ break;
+
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION2_I(NV_point_sprite, ARB_point_sprite, pname);
+ *params = (GLint) ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_I(NV_point_sprite, pname);
+ *params = (GLint) ctx->Point.SpriteRMode;
+ break;
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_I(ARB_point_sprite, pname);
+ *params = (GLint) ctx->Point.SpriteOrigin;
+ break;
+
+ /* GL_SGIS_generate_mipmap */
+ case GL_GENERATE_MIPMAP_HINT_SGIS:
+ CHECK_EXTENSION_I(SGIS_generate_mipmap, pname);
+ *params = (GLint) ctx->Hint.GenerateMipmap;
+ break;
+
+#if FEATURE_NV_vertex_program
+ case GL_VERTEX_PROGRAM_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ *params = (GLint) ctx->VertexProgram.Enabled;
+ break;
+ case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ *params = (GLint) ctx->VertexProgram.PointSizeEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ *params = (GLint) ctx->VertexProgram.TwoSideEnabled;
+ break;
+ case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ *params = ctx->Const.MaxProgramMatrixStackDepth;
+ break;
+ case GL_MAX_TRACK_MATRICES_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ *params = ctx->Const.MaxProgramMatrices;
+ break;
+ case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ *params = ctx->CurrentStack->Depth + 1;
+ break;
+ case GL_CURRENT_MATRIX_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ for (i = 0; i < 16; i++)
+ params[i] = (GLint) ctx->CurrentStack->Top->m[i];
+ break;
+ case GL_VERTEX_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ if (ctx->VertexProgram.Current)
+ *params = (GLint) ctx->VertexProgram.Current->Base.Id;
+ else
+ *params = 0;
+ break;
+ case GL_PROGRAM_ERROR_POSITION_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ *params = (GLint) ctx->Program.ErrorPos;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY0_NV:
+ case GL_VERTEX_ATTRIB_ARRAY1_NV:
+ case GL_VERTEX_ATTRIB_ARRAY2_NV:
+ case GL_VERTEX_ATTRIB_ARRAY3_NV:
+ case GL_VERTEX_ATTRIB_ARRAY4_NV:
+ case GL_VERTEX_ATTRIB_ARRAY5_NV:
+ case GL_VERTEX_ATTRIB_ARRAY6_NV:
+ case GL_VERTEX_ATTRIB_ARRAY7_NV:
+ case GL_VERTEX_ATTRIB_ARRAY8_NV:
+ case GL_VERTEX_ATTRIB_ARRAY9_NV:
+ case GL_VERTEX_ATTRIB_ARRAY10_NV:
+ case GL_VERTEX_ATTRIB_ARRAY11_NV:
+ case GL_VERTEX_ATTRIB_ARRAY12_NV:
+ case GL_VERTEX_ATTRIB_ARRAY13_NV:
+ case GL_VERTEX_ATTRIB_ARRAY14_NV:
+ case GL_VERTEX_ATTRIB_ARRAY15_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV;
+ *params = (GLint) ctx->Array.VertexAttrib[n].Enabled;
+ }
+ break;
+ case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV;
+ *params = (GLint) ctx->Eval.Map1Attrib[n];
+ }
+ break;
+ case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+ case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ CHECK_EXTENSION_I(NV_vertex_program, pname);
+ {
+ GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV;
+ *params = (GLint) ctx->Eval.Map2Attrib[n];
+ }
+ break;
+#endif /* FEATURE_NV_vertex_program */
+
+#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_I(NV_fragment_program, pname);
+ *params = (GLint) ctx->FragmentProgram.Enabled;
+ break;
+ case GL_MAX_TEXTURE_COORDS_NV:
+ CHECK_EXTENSION_I(NV_fragment_program, pname);
+ *params = (GLint) ctx->Const.MaxTextureCoordUnits;
+ break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS_NV:
+ CHECK_EXTENSION_I(NV_fragment_program, pname);
+ *params = (GLint) ctx->Const.MaxTextureImageUnits;
+ break;
+ case GL_FRAGMENT_PROGRAM_BINDING_NV:
+ CHECK_EXTENSION_I(NV_fragment_program, pname);
+ if (ctx->FragmentProgram.Current)
+ *params = (GLint) ctx->FragmentProgram.Current->Base.Id;
+ else
+ *params = 0;
+ break;
+ case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:
+ CHECK_EXTENSION_I(NV_fragment_program, pname);
+ *params = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
+ break;
+#endif /* FEATURE_NV_fragment_program */
+
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_I(NV_texture_rectangle, pname);
+ *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_I(NV_texture_rectangle, pname);
+ *params = (GLint) textureUnit->CurrentRect->Name;
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_I(NV_texture_rectangle, pname);
+ *params = (GLint) ctx->Const.MaxTextureRectSize;
+ break;
+
+ /* GL_EXT_stencil_two_side */
+ case GL_STENCIL_TEST_TWO_SIDE_EXT:
+ CHECK_EXTENSION_I(EXT_stencil_two_side, pname);
+ *params = (GLint) ctx->Stencil.TestTwoSide;
+ break;
+ case GL_ACTIVE_STENCIL_FACE_EXT:
+ CHECK_EXTENSION_I(EXT_stencil_two_side, pname);
+ *params = (GLint) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
+ break;
+
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = (GLint) ctx->Const.MaxShininess;
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = (GLint) ctx->Const.MaxSpotExponent;
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.ArrayBufferObj->Name;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Vertex.BufferObj->Name;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Normal.BufferObj->Name;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Color.BufferObj->Name;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Index.BufferObj->Name;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.EdgeFlag.BufferObj->Name;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.SecondaryColor.BufferObj->Name;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.FogCoord.BufferObj->Name;
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.ElementArrayBufferObj->Name;
+ break;
+#endif
+#if FEATURE_EXT_pixel_buffer_object
+ case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname);
+ *params = (GLint) ctx->Pack.BufferObj->Name;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:
+ CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname);
+ *params = (GLint) ctx->Unpack.BufferObj->Name;
+ break;
+#endif
+
+#if FEATURE_ARB_vertex_program
+ /* GL_NV_vertex_program and GL_ARB_fragment_program define others */
+ case GL_MAX_VERTEX_ATTRIBS_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_program, pname);
+ *params = (GLint) ctx->Const.MaxVertexProgramAttribs;
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_I(ARB_fragment_program, pname);
+ *params = ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_I(ARB_fragment_program, pname);
+ params[0] = (GLint) ctx->CurrentStack->Top->m[0];
+ params[1] = (GLint) ctx->CurrentStack->Top->m[4];
+ params[2] = (GLint) ctx->CurrentStack->Top->m[8];
+ params[3] = (GLint) ctx->CurrentStack->Top->m[12];
+ params[4] = (GLint) ctx->CurrentStack->Top->m[1];
+ params[5] = (GLint) ctx->CurrentStack->Top->m[5];
+ params[6] = (GLint) ctx->CurrentStack->Top->m[9];
+ params[7] = (GLint) ctx->CurrentStack->Top->m[13];
+ params[8] = (GLint) ctx->CurrentStack->Top->m[2];
+ params[9] = (GLint) ctx->CurrentStack->Top->m[6];
+ params[10] = (GLint) ctx->CurrentStack->Top->m[10];
+ params[11] = (GLint) ctx->CurrentStack->Top->m[14];
+ params[12] = (GLint) ctx->CurrentStack->Top->m[3];
+ params[13] = (GLint) ctx->CurrentStack->Top->m[7];
+ params[14] = (GLint) ctx->CurrentStack->Top->m[11];
+ params[15] = (GLint) ctx->CurrentStack->Top->m[15];
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+ params[0] = (GLint) ctx->Depth.BoundsMin;
+ params[1] = (GLint) ctx->Depth.BoundsMax;
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->FragmentProgram.CurrentPosition;
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->VertexProgram.CurrentPosition;
+ break;
+#endif
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
+ }
+}
+
+
+/**
+ * Get the address of a selected pointer.
+ *
+ * \param pname array or buffer to be returned.
+ * \param params will hold the pointer speficifed by \p pname.
+ *
+ * \sa glGetPointerv().
+ *
+ * Tries to get the specified pointer via dd_function_table::GetPointerv,
+ * otherwise gets the specified pointer from the current context.
+ */
+void GLAPIENTRY
+_mesa_GetPointerv( GLenum pname, GLvoid **params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!params)
+ return;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
+
+ if (ctx->Driver.GetPointerv
+ && (*ctx->Driver.GetPointerv)(ctx, pname, params))
+ return;
+
+ switch (pname) {
+ case GL_VERTEX_ARRAY_POINTER:
+ *params = (GLvoid *) ctx->Array.Vertex.Ptr;
+ break;
+ case GL_NORMAL_ARRAY_POINTER:
+ *params = (GLvoid *) ctx->Array.Normal.Ptr;
+ break;
+ case GL_COLOR_ARRAY_POINTER:
+ *params = (GLvoid *) ctx->Array.Color.Ptr;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
+ *params = (GLvoid *) ctx->Array.SecondaryColor.Ptr;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
+ *params = (GLvoid *) ctx->Array.FogCoord.Ptr;
+ break;
+ case GL_INDEX_ARRAY_POINTER:
+ *params = (GLvoid *) ctx->Array.Index.Ptr;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_POINTER:
+ *params = (GLvoid *) ctx->Array.TexCoord[clientUnit].Ptr;
+ break;
+ case GL_EDGE_FLAG_ARRAY_POINTER:
+ *params = (GLvoid *) ctx->Array.EdgeFlag.Ptr;
+ break;
+ case GL_FEEDBACK_BUFFER_POINTER:
+ *params = ctx->Feedback.Buffer;
+ break;
+ case GL_SELECTION_BUFFER_POINTER:
+ *params = ctx->Select.Buffer;
+ break;
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = *(GLvoid **) &ctx->FragmentProgram.Callback;
+ break;
+ case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = ctx->FragmentProgram.CallbackData;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = *(GLvoid **) &ctx->VertexProgram.Callback;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = ctx->VertexProgram.CallbackData;
+ break;
+#endif
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
+ return;
+ }
+}
+
+
+/**
+ * Get a string describing the current GL connection.
+ *
+ * \param name name symbolic constant.
+ *
+ * \sa glGetString().
+ *
+ * Tries to get the string from dd_function_table::GetString, otherwise returns
+ * the hardcoded strings.
+ */
+const GLubyte * GLAPIENTRY
+_mesa_GetString( GLenum name )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ static const char *vendor = "Brian Paul";
+ static const char *renderer = "Mesa";
+ static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
+
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+ /* this is a required driver function */
+ assert(ctx->Driver.GetString);
+ {
+ const GLubyte *str = (*ctx->Driver.GetString)(ctx, name);
+ if (str)
+ return str;
+
+ switch (name) {
+ case GL_VENDOR:
+ return (const GLubyte *) vendor;
+ case GL_RENDERER:
+ return (const GLubyte *) renderer;
+ case GL_VERSION:
+ if (ctx->Extensions.ARB_multisample &&
+ ctx->Extensions.ARB_multitexture &&
+ ctx->Extensions.ARB_texture_border_clamp &&
+ ctx->Extensions.ARB_texture_compression &&
+ ctx->Extensions.ARB_texture_cube_map &&
+ ctx->Extensions.EXT_texture_env_add &&
+ ctx->Extensions.ARB_texture_env_combine &&
+ ctx->Extensions.ARB_texture_env_dot3) {
+ if (ctx->Extensions.ARB_depth_texture &&
+ ctx->Extensions.ARB_shadow &&
+ ctx->Extensions.ARB_texture_env_crossbar &&
+ ctx->Extensions.ARB_texture_mirrored_repeat &&
+ ctx->Extensions.ARB_window_pos &&
+ ctx->Extensions.EXT_blend_color &&
+ ctx->Extensions.EXT_blend_func_separate &&
+ ctx->Extensions.EXT_blend_logic_op &&
+ ctx->Extensions.EXT_blend_minmax &&
+ ctx->Extensions.EXT_blend_subtract &&
+ ctx->Extensions.EXT_fog_coord &&
+ ctx->Extensions.EXT_multi_draw_arrays &&
+ ctx->Extensions.EXT_point_parameters && /*aka ARB*/
+ ctx->Extensions.EXT_secondary_color &&
+ ctx->Extensions.EXT_stencil_wrap &&
+ ctx->Extensions.EXT_texture_lod_bias &&
+ ctx->Extensions.SGIS_generate_mipmap) {
+ if (ctx->Extensions.ARB_occlusion_query &&
+ ctx->Extensions.ARB_vertex_buffer_object &&
+ ctx->Extensions.EXT_shadow_funcs) {
+ return (const GLubyte *) version_1_5;
+ }
+ else {
+ return (const GLubyte *) version_1_4;
+ }
+ }
+ else {
+ return (const GLubyte *) version_1_3;
+ }
+ }
+ else {
+ return (const GLubyte *) version_1_2;
+ }
+ case GL_EXTENSIONS:
+ if (!ctx->Extensions.String)
+ ctx->Extensions.String = _mesa_make_extension_string(ctx);
+ return (const GLubyte *) ctx->Extensions.String;
+#if FEATURE_NV_fragment_program
+ case GL_PROGRAM_ERROR_STRING_NV:
+ if (ctx->Extensions.NV_fragment_program) {
+ return (const GLubyte *) ctx->Program.ErrorString;
+ }
+ /* FALL-THROUGH */
+#endif
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
+ return (const GLubyte *) 0;
+ }
+ }
+}
+
+
+/**
+ * Execute a glGetError() command.
+ *
+ * \return error number.
+ *
+ * Returns __GLcontextRec::ErrorValue.
+ */
+GLenum GLAPIENTRY
+_mesa_GetError( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLenum e = ctx->ErrorValue;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
+
+ ctx->ErrorValue = (GLenum) GL_NO_ERROR;
+ return e;
+}
Index: xc/extras/Mesa/src/mesa/main/get.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/get.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/get.h Thu Apr 8 05:17:44 2004
@@ -0,0 +1,59 @@
+/**
+ * \file get.h
+ * State query functions.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef GET_H
+#define GET_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_GetBooleanv( GLenum pname, GLboolean *params );
+
+extern void GLAPIENTRY
+_mesa_GetDoublev( GLenum pname, GLdouble *params );
+
+extern void GLAPIENTRY
+_mesa_GetFloatv( GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetIntegerv( GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetPointerv( GLenum pname, GLvoid **params );
+
+extern const GLubyte * GLAPIENTRY
+_mesa_GetString( GLenum name );
+
+extern GLenum GLAPIENTRY
+_mesa_GetError( void );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/glheader.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/glheader.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/glheader.h Fri Dec 10 10:05:26 2004
@@ -0,0 +1,348 @@
+/**
+ * \file glheader.h
+ * Top-most include file.
+ *
+ * This is the top-most include file of the Mesa sources.
+ * It includes gl.h and all system headers which are needed.
+ * Other Mesa source files should \e not directly include any system
+ * headers. This allows Mesa to be integrated into XFree86 and
+ * allows system-dependent hacks/workarounds to be collected in one place.
+ *
+ * \note Actually, a lot of system-dependent stuff is now in imports.[ch].
+ *
+ * If you touch this file, everything gets recompiled!
+ *
+ * This file should be included before any other header in the .c files.
+ *
+ * Put compiler/OS/assembly pragmas and macros here to avoid
+ * cluttering other source files.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef GLHEADER_H
+#define GLHEADER_H
+
+
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+#include "xf86_ansic.h"
+#else
+#include
+#include
+/* If we can use Compaq's Fast Math Library on Alpha */
+#if defined(__alpha__) && defined(CCPML)
+#include
+#else
+#include
+#endif
+#include
+#include
+#include
+#include
+#if defined(__linux__) && defined(__i386__)
+#include
+#endif
+#endif
+#include
+#include
+
+
+#ifdef HAVE_CONFIG_H
+#include "conf.h"
+#endif
+
+
+#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
+# define __WIN32__
+# define finite _finite
+#endif
+
+#if defined(__WATCOMC__)
+# define finite _finite
+#endif
+
+#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
+# if !defined(__GNUC__) /* mingw environment */
+# pragma warning( disable : 4068 ) /* unknown pragma */
+# pragma warning( disable : 4710 ) /* function 'foo' not inlined */
+# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
+# pragma warning( disable : 4127 ) /* conditional expression is constant */
+# if defined(MESA_MINWARN)
+# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
+# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
+# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
+# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
+# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
+# endif
+# endif
+# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
+# define GLAPI __declspec(dllexport)
+# define WGLAPI __declspec(dllexport)
+# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
+# define GLAPI __declspec(dllimport)
+# define WGLAPI __declspec(dllimport)
+# else /* for use with static link lib build of Win32 edition only */
+# define GLAPI extern
+# define WGLAPI __declspec(dllimport)
+# endif /* _STATIC_MESA support */
+# define GLAPIENTRY __stdcall
+# define GLAPIENTRYP GLAPIENTRY *
+# define GLCALLBACK __stdcall
+# define GLCALLBACKP GLCALLBACK *
+# if defined(__CYGWIN__)
+# define GLCALLBACKPCAST *
+# else
+# define GLCALLBACKPCAST __stdcall *
+# endif
+# define GLWINAPI __stdcall
+# define GLWINAPIV __cdecl
+#elif !defined(BUILD_FOR_SNAP)
+/* non-Windows compilation */
+# define GLAPI extern
+# define GLAPIENTRY
+# ifndef GLAPIENTRYP
+# define GLAPIENTRYP *
+# endif
+# define GLCALLBACK
+# define GLCALLBACKP *
+# define GLCALLBACKPCAST *
+# define GLWINAPI
+# define GLWINAPIV
+#endif /* WIN32 / CYGWIN bracket */
+
+/* compatibility guard so we don't need to change client code */
+
+#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
+#if 0
+# define CALLBACK GLCALLBACK
+typedef void *HGLRC;
+typedef void *HDC;
+#endif
+typedef int (GLAPIENTRY *PROC)();
+typedef unsigned long COLORREF;
+#endif
+
+
+/* Make sure we include glext.h from gl.h */
+#define GL_GLEXT_PROTOTYPES
+
+
+#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP)
+# define WGL_FONT_LINES 0
+# define WGL_FONT_POLYGONS 1
+#ifndef _GNU_H_WINDOWS32_FUNCTIONS
+# ifdef UNICODE
+# define wglUseFontBitmaps wglUseFontBitmapsW
+# define wglUseFontOutlines wglUseFontOutlinesW
+# else
+# define wglUseFontBitmaps wglUseFontBitmapsA
+# define wglUseFontOutlines wglUseFontOutlinesA
+# endif /* !UNICODE */
+#endif /* _GNU_H_WINDOWS32_FUNCTIONS */
+typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
+typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
+typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
+#if !defined(GLX_USE_MESA)
+#include
+#endif
+#endif
+
+
+/*
+ * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
+ * Do not use them unless absolutely necessary!
+ * Try to use a runtime test instead.
+ * For now, only used by some DRI hardware drivers for color/texel packing.
+ */
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+#if defined(__linux__)
+#include
+#define CPU_TO_LE32( x ) bswap_32( x )
+#else /*__linux__*/
+#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
+#endif /*__linux__*/
+#define MESA_BIG_ENDIAN 1
+#else
+#define CPU_TO_LE32( x ) ( x )
+#define MESA_LITTLE_ENDIAN 1
+#endif
+#define LE32_TO_CPU( x ) CPU_TO_LE32( x )
+
+
+/* This is a macro on IRIX */
+#ifdef _P
+#undef _P
+#endif
+
+
+
+#include "GL/gl.h"
+#include "GL/glext.h"
+
+
+#ifndef CAPI
+#if defined(WIN32) && !defined(BUILD_FOR_SNAP)
+#define CAPI _cdecl
+#else
+#define CAPI
+#endif
+#endif
+#include
+
+
+/* XXX temporary hack - remove when glext.h is updated */
+#ifndef GL_ARB_half_float_pixel
+#define GL_ARB_half_float_pixel 1
+#define GL_HALF_FLOAT_ARB 0x140B
+typedef GLushort GLhalfARB;
+#endif
+
+/* XXX temporary hack - remove when glext.h is updated */
+#ifndef GL_ARB_texture_float
+#define GL_ARB_texture_float 1
+#define GL_TEXTURE_RED_TYPE_ARB 0x9000
+#define GL_TEXTURE_GREEN_TYPE_ARB 0x9001
+#define GL_TEXTURE_BLUE_TYPE_ARB 0x9002
+#define GL_TEXTURE_ALPHA_TYPE_ARB 0x9003
+#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x9004
+#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x9005
+#define GL_TEXTURE_DEPTH_TYPE_ARB 0x9006
+#define GL_UNSIGNED_NORMALIZED_ARB 0x9007
+#define GL_RGBA32F_ARB 0x8814
+#define GL_RGB32F_ARB 0x8815
+#define GL_ALPHA32F_ARB 0x8816
+#define GL_INTENSITY32F_ARB 0x8817
+#define GL_LUMINANCE32F_ARB 0x8818
+#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
+#define GL_RGBA16F_ARB 0x881A
+#define GL_RGB16F_ARB 0x881B
+#define GL_ALPHA16F_ARB 0x881C
+#define GL_INTENSITY16F_ARB 0x881D
+#define GL_LUMINANCE16F_ARB 0x881E
+#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
+#endif
+
+/* XXX temporary hack - remove when glext.h is updated */
+#ifndef GL_POINT_SPRITE_COORD_ORIGIN
+#define GL_POINT_SPRITE_COORD_ORIGIN 0x10000
+#define GL_LOWER_LEFT 0x10001
+#define GL_UPPER_LEFT 0x10002
+#endif
+
+
+
+/* Disable unreachable code warnings for Watcom C++ */
+#ifdef __WATCOMC__
+#pragma disable_message(201)
+#endif
+
+
+/* Turn off macro checking systems used by other libraries */
+#ifdef CHECK
+#undef CHECK
+#endif
+
+
+/* Create a macro so that asm functions can be linked into compilers other
+ * than GNU C
+ */
+#ifndef _ASMAPI
+#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
+#define _ASMAPI __cdecl
+#else
+#define _ASMAPI
+#endif
+#ifdef PTR_DECL_IN_FRONT
+#define _ASMAPIP * _ASMAPI
+#else
+#define _ASMAPIP _ASMAPI *
+#endif
+#endif
+
+#ifdef USE_X86_ASM
+#define _NORMAPI _ASMAPI
+#define _NORMAPIP _ASMAPIP
+#else
+#define _NORMAPI
+#define _NORMAPIP *
+#endif
+
+
+/* Function inlining */
+#if defined(__GNUC__)
+# define INLINE __inline__
+#elif defined(__MSC__)
+# define INLINE __inline
+#elif defined(_MSC_VER)
+# define INLINE __inline
+#elif defined(__ICL)
+# define INLINE __inline
+#elif defined(__INTEL_COMPILER)
+# define INLINE inline
+#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
+# define INLINE __inline
+#else
+# define INLINE
+#endif
+
+
+/* Some compilers don't like some of Mesa's const usage */
+#ifdef NO_CONST
+# define CONST
+#else
+# define CONST const
+#endif
+
+
+#if defined(BUILD_FOR_SNAP) && defined(CHECKED)
+# define ASSERT(X) _CHECK(X)
+#elif defined(DEBUG)
+# define ASSERT(X) assert(X)
+#else
+# define ASSERT(X)
+#endif
+
+
+#if !defined __GNUC__ || __GNUC__ < 3
+# define __builtin_expect(x, y) x
+#endif
+
+
+
+/**
+ * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float
+ * as a int (thereby using integer registers instead of FP registers) is
+ * a performance win. Typically, this can be done with ordinary casts.
+ * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0)
+ * these casts generate warnings.
+ * The following union typedef is used to solve that.
+ */
+typedef union { GLfloat f; GLint i; } fi_type;
+
+
+#include "config.h"
+
+#endif /* GLHEADER_H */
Index: xc/extras/Mesa/src/mesa/main/hash.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/hash.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/hash.c Thu Apr 8 05:17:44 2004
@@ -0,0 +1,360 @@
+/**
+ * \file hash.c
+ * Generic hash table.
+ *
+ * Used for display lists and texture objects. The hash functions are
+ * thread-safe.
+ *
+ * \note key=0 is illegal.
+ *
+ * \author Brian Paul
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "glthread.h"
+#include "hash.h"
+#include "context.h"
+
+
+#define TABLE_SIZE 1023 /**< Size of lookup table/array */
+
+/**
+ * An entry in the hash table.
+ *
+ * This struct is private to this file.
+ */
+struct HashEntry {
+ GLuint Key; /**< the entry's key */
+ void *Data; /**< the entry's data */
+ struct HashEntry *Next; /**< pointer to next entry */
+};
+
+/**
+ * The hash table data structure.
+ *
+ * This is an opaque types (it's not defined in hash.h file).
+ */
+struct _mesa_HashTable {
+ struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */
+ GLuint MaxKey; /**< highest key inserted so far */
+ _glthread_Mutex Mutex; /**< mutual exclusion lock */
+};
+
+
+
+/**
+ * Create a new hash table.
+ *
+ * \return pointer to a new, empty hash table.
+ */
+struct _mesa_HashTable *_mesa_NewHashTable(void)
+{
+ struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable);
+ if (table) {
+ _glthread_INIT_MUTEX(table->Mutex);
+ }
+ return table;
+}
+
+
+
+/**
+ * Delete a hash table.
+ *
+ * \param table the hash table to delete.
+ *
+ * Frees each entry on the hash table and then the hash table structure itself.
+ */
+void _mesa_DeleteHashTable(struct _mesa_HashTable *table)
+{
+ GLuint i;
+ assert(table);
+ for (i=0;iTable[i];
+ while (entry) {
+ struct HashEntry *next = entry->Next;
+ FREE(entry);
+ entry = next;
+ }
+ }
+ _glthread_DESTROY_MUTEX(table->Mutex);
+ FREE(table);
+}
+
+
+
+/**
+ * Lookup an entry in the hash table.
+ *
+ * \param table the hash table.
+ * \param key the key.
+ *
+ * \return pointer to user's data or NULL if key not in table
+ *
+ * Walks through the hash entry until finding the matching key.
+ */
+void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
+{
+ GLuint pos;
+ const struct HashEntry *entry;
+
+ assert(table);
+ assert(key);
+
+ pos = key & (TABLE_SIZE-1);
+ entry = table->Table[pos];
+ while (entry) {
+ if (entry->Key == key) {
+ return entry->Data;
+ }
+ entry = entry->Next;
+ }
+ return NULL;
+}
+
+
+
+/**
+ * Insert into the hash table.
+ *
+ * If an entry with this key already exists we'll replace the existing entry.
+ *
+ * \param table the hash table.
+ * \param key the key (not zero).
+ * \param data pointer to user data.
+ *
+ * While holding the hash table's lock, walk through the hash entry list replacing the data if a
+ * matching key is found, or inserts a new table entry otherwise.
+ */
+void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
+{
+ /* search for existing entry with this key */
+ GLuint pos;
+ struct HashEntry *entry;
+
+ assert(table);
+ assert(key);
+
+ _glthread_LOCK_MUTEX(table->Mutex);
+
+ if (key > table->MaxKey)
+ table->MaxKey = key;
+
+ pos = key & (TABLE_SIZE-1);
+ entry = table->Table[pos];
+ while (entry) {
+ if (entry->Key == key) {
+ /* replace entry's data */
+ entry->Data = data;
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return;
+ }
+ entry = entry->Next;
+ }
+
+ /* alloc and insert new table entry */
+ entry = MALLOC_STRUCT(HashEntry);
+ entry->Key = key;
+ entry->Data = data;
+ entry->Next = table->Table[pos];
+ table->Table[pos] = entry;
+
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+}
+
+
+
+/**
+ * Remove an entry from the hash table.
+ *
+ * \param table the hash table.
+ * \param key key of entry to remove.
+ *
+ * While holding the hash table's lock, searches the entry with the matching
+ * key and unlinks it.
+ */
+void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
+{
+ GLuint pos;
+ struct HashEntry *entry, *prev;
+
+ assert(table);
+ assert(key);
+
+ _glthread_LOCK_MUTEX(table->Mutex);
+
+ pos = key & (TABLE_SIZE-1);
+ prev = NULL;
+ entry = table->Table[pos];
+ while (entry) {
+ if (entry->Key == key) {
+ /* found it! */
+ if (prev) {
+ prev->Next = entry->Next;
+ }
+ else {
+ table->Table[pos] = entry->Next;
+ }
+ FREE(entry);
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return;
+ }
+ prev = entry;
+ entry = entry->Next;
+ }
+
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+}
+
+
+
+/**
+ * Get the key of the "first" entry in the hash table.
+ *
+ * This is used in the course of deleting all display lists when
+ * a context is destroyed.
+ *
+ * \param table the hash table
+ *
+ * \return key for the "first" entry in the hash table.
+ *
+ * While holding the lock, walks through all table positions until finding
+ * the first entry of the first non-empty one.
+ */
+GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table)
+{
+ GLuint pos;
+ assert(table);
+ _glthread_LOCK_MUTEX(table->Mutex);
+ for (pos=0; pos < TABLE_SIZE; pos++) {
+ if (table->Table[pos]) {
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return table->Table[pos]->Key;
+ }
+ }
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return 0;
+}
+
+
+
+/**
+ * Dump contents of hash table for debugging.
+ *
+ * \param table the hash table.
+ */
+void _mesa_HashPrint(const struct _mesa_HashTable *table)
+{
+ GLuint i;
+ assert(table);
+ for (i=0;iTable[i];
+ while (entry) {
+ _mesa_debug(NULL, "%u %p\n", entry->Key, entry->Data);
+ entry = entry->Next;
+ }
+ }
+}
+
+
+
+/**
+ * Find a block of adjacent unused hash keys.
+ *
+ * \param table the hash table.
+ * \param numKeys number of keys needed.
+ *
+ * \return Starting key of free block or 0 if failure.
+ *
+ * If there are enough free keys between the maximum key existing in the table
+ * (_mesa_HashTable::MaxKey) and the maximum key possible, then simply return
+ * the adjacent key. Otherwise do a full search for a free key block in the
+ * allowable key range.
+ */
+GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
+{
+ GLuint maxKey = ~((GLuint) 0);
+ _glthread_LOCK_MUTEX(table->Mutex);
+ if (maxKey - numKeys > table->MaxKey) {
+ /* the quick solution */
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return table->MaxKey + 1;
+ }
+ else {
+ /* the slow solution */
+ GLuint freeCount = 0;
+ GLuint freeStart = 1;
+ GLuint key;
+ for (key=1; key!=maxKey; key++) {
+ if (_mesa_HashLookup(table, key)) {
+ /* darn, this key is already in use */
+ freeCount = 0;
+ freeStart = key+1;
+ }
+ else {
+ /* this key not in use, check if we've found enough */
+ freeCount++;
+ if (freeCount == numKeys) {
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return freeStart;
+ }
+ }
+ }
+ /* cannot allocate a block of numKeys consecutive keys */
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return 0;
+ }
+}
+
+
+
+#ifdef HASH_TEST_HARNESS
+int main(int argc, char *argv[])
+{
+ int a, b, c;
+ struct HashTable *t;
+
+ _mesa_printf("&a = %p\n", &a);
+ _mesa_printf("&b = %p\n", &b);
+
+ t = _mesa_NewHashTable();
+ _mesa_HashInsert(t, 501, &a);
+ _mesa_HashInsert(t, 10, &c);
+ _mesa_HashInsert(t, 0xfffffff8, &b);
+ _mesa_HashPrint(t);
+
+ _mesa_printf("Find 501: %p\n", _mesa_HashLookup(t,501));
+ _mesa_printf("Find 1313: %p\n", _mesa_HashLookup(t,1313));
+ _mesa_printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100));
+
+ _mesa_DeleteHashTable(t);
+
+ return 0;
+}
+#endif
Index: xc/extras/Mesa/src/mesa/main/hash.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/hash.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/hash.h Thu Apr 8 05:17:44 2004
@@ -0,0 +1,62 @@
+/**
+ * \file hash.h
+ * Generic hash table.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef HASH_H
+#define HASH_H
+
+
+#include "glheader.h"
+
+
+/**
+ * Opaque hash table type.
+ */
+struct HashTable;
+
+
+
+extern struct _mesa_HashTable *_mesa_NewHashTable(void);
+
+extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
+
+extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key);
+
+extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data);
+
+extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key);
+
+extern GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table);
+
+extern void _mesa_HashPrint(const struct _mesa_HashTable *table);
+
+extern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys);
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/hint.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/hint.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/hint.c Thu Apr 8 05:17:45 2004
@@ -0,0 +1,140 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "enums.h"
+#include "context.h"
+#include "hint.h"
+#include "imports.h"
+
+
+
+void GLAPIENTRY
+_mesa_Hint( GLenum target, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glHint %s %d\n",
+ _mesa_lookup_enum_by_nr(target), mode);
+
+ if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)");
+ return;
+ }
+
+ switch (target) {
+ case GL_FOG_HINT:
+ if (ctx->Hint.Fog == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.Fog = mode;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ if (ctx->Hint.LineSmooth == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.LineSmooth = mode;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ if (ctx->Hint.PerspectiveCorrection == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.PerspectiveCorrection = mode;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ if (ctx->Hint.PointSmooth == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.PointSmooth = mode;
+ break;
+ case GL_POLYGON_SMOOTH_HINT:
+ if (ctx->Hint.PolygonSmooth == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.PolygonSmooth = mode;
+ break;
+
+ /* GL_EXT_clip_volume_hint */
+ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
+ if (ctx->Hint.ClipVolumeClipping == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.ClipVolumeClipping = mode;
+ break;
+
+ /* GL_ARB_texture_compression */
+ case GL_TEXTURE_COMPRESSION_HINT_ARB:
+ if (!ctx->Extensions.ARB_texture_compression) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
+ return;
+ }
+ if (ctx->Hint.TextureCompression == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.TextureCompression = mode;
+ break;
+
+ /* GL_SGIS_generate_mipmap */
+ case GL_GENERATE_MIPMAP_HINT_SGIS:
+ if (!ctx->Extensions.SGIS_generate_mipmap) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
+ return;
+ }
+ if (ctx->Hint.GenerateMipmap == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.GenerateMipmap = mode;
+ break;
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
+ return;
+ }
+
+ if (ctx->Driver.Hint) {
+ (*ctx->Driver.Hint)( ctx, target, mode );
+ }
+}
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+void _mesa_init_hint( GLcontext * ctx )
+{
+ /* Hint group */
+ ctx->Hint.PerspectiveCorrection = GL_DONT_CARE;
+ ctx->Hint.PointSmooth = GL_DONT_CARE;
+ ctx->Hint.LineSmooth = GL_DONT_CARE;
+ ctx->Hint.PolygonSmooth = GL_DONT_CARE;
+ ctx->Hint.Fog = GL_DONT_CARE;
+ ctx->Hint.ClipVolumeClipping = GL_DONT_CARE;
+ ctx->Hint.TextureCompression = GL_DONT_CARE;
+ ctx->Hint.GenerateMipmap = GL_DONT_CARE;
+}
Index: xc/extras/Mesa/src/mesa/main/hint.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/hint.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/hint.h Thu Apr 8 05:17:45 2004
@@ -0,0 +1,57 @@
+/**
+ * \file hint.h
+ * Hints operations.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef HINT_H
+#define HINT_H
+
+
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_Hint( GLenum target, GLenum mode );
+
+extern void
+_mesa_init_hint( GLcontext * ctx );
+
+#else
+
+/** No-op */
+#define _mesa_init_hint( c ) ((void) 0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/histogram.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/histogram.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/histogram.c Fri Dec 10 10:05:13 2004
@@ -0,0 +1,1134 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "colormac.h"
+#include "context.h"
+#include "image.h"
+#include "histogram.h"
+
+
+/**********************************************************************
+ * Internal functions
+ */
+
+
+/*
+ * Update the min/max values from an array of fragment colors.
+ */
+void
+_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
+{
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ /* update mins */
+ if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP])
+ ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP];
+ if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP])
+ ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP];
+ if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP])
+ ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP];
+ if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP])
+ ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP];
+
+ /* update maxs */
+ if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP])
+ ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP];
+ if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP])
+ ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP];
+ if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP])
+ ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP];
+ if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP])
+ ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP];
+ }
+}
+
+
+/*
+ * Update the histogram values from an array of fragment colors.
+ */
+void
+_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
+{
+ const GLint max = ctx->Histogram.Width - 1;
+ GLfloat w = (GLfloat) max;
+ GLuint i;
+
+ if (ctx->Histogram.Width == 0)
+ return;
+
+ for (i = 0; i < n; i++) {
+ GLint ri = IROUND(rgba[i][RCOMP] * w);
+ GLint gi = IROUND(rgba[i][GCOMP] * w);
+ GLint bi = IROUND(rgba[i][BCOMP] * w);
+ GLint ai = IROUND(rgba[i][ACOMP] * w);
+ ri = CLAMP(ri, 0, max);
+ gi = CLAMP(gi, 0, max);
+ bi = CLAMP(bi, 0, max);
+ ai = CLAMP(ai, 0, max);
+ ctx->Histogram.Count[ri][RCOMP]++;
+ ctx->Histogram.Count[gi][GCOMP]++;
+ ctx->Histogram.Count[bi][BCOMP]++;
+ ctx->Histogram.Count[ai][ACOMP]++;
+ }
+}
+
+
+/*
+ * XXX the packed pixel formats haven't been tested.
+ */
+static void
+pack_histogram( GLcontext *ctx,
+ GLuint n, CONST GLuint rgba[][4],
+ GLenum format, GLenum type, GLvoid *destination,
+ const struct gl_pixelstore_attrib *packing )
+{
+ const GLint comps = _mesa_components_in_format(format);
+ GLuint luminance[MAX_WIDTH];
+
+ if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ }
+ }
+
+#define PACK_MACRO(TYPE) \
+ { \
+ GLuint i; \
+ switch (format) { \
+ case GL_RED: \
+ for (i=0;iSwapBytes) {
+ _mesa_swap2(dst, n * comps);
+ }
+ }
+ break;
+ case GL_SHORT:
+ {
+ GLshort *dst = (GLshort *) destination;
+ PACK_MACRO(GLshort);
+ if (packing->SwapBytes) {
+ _mesa_swap2((GLushort *) dst, n * comps);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ {
+ GLuint *dst = (GLuint *) destination;
+ PACK_MACRO(GLuint);
+ if (packing->SwapBytes) {
+ _mesa_swap4(dst, n * comps);
+ }
+ }
+ break;
+ case GL_INT:
+ {
+ GLint *dst = (GLint *) destination;
+ PACK_MACRO(GLint);
+ if (packing->SwapBytes) {
+ _mesa_swap4((GLuint *) dst, n * comps);
+ }
+ }
+ break;
+ case GL_FLOAT:
+ {
+ GLfloat *dst = (GLfloat *) destination;
+ PACK_MACRO(GLfloat);
+ if (packing->SwapBytes) {
+ _mesa_swap4((GLuint *) dst, n * comps);
+ }
+ }
+ break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ /* temporarily store as GLuints */
+ GLuint temp[4*HISTOGRAM_TABLE_SIZE];
+ GLhalfARB *dst = (GLhalfARB *) destination;
+ GLuint i;
+ /* get GLuint values */
+ PACK_MACRO(GLuint);
+ /* convert to GLhalf */
+ for (i = 0; i < n * comps; i++) {
+ dst[i] = _mesa_float_to_half((GLfloat) temp[i]);
+ }
+ if (packing->SwapBytes) {
+ _mesa_swap2((GLushort *) dst, n * comps);
+ }
+ }
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ if (format == GL_RGB) {
+ GLubyte *dst = (GLubyte *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x7) << 5)
+ | ((rgba[i][GCOMP] & 0x7) << 2)
+ | ((rgba[i][BCOMP] & 0x3) );
+ }
+ }
+ else {
+ GLubyte *dst = (GLubyte *) destination;
+ GLuint i;
+ ASSERT(format == GL_BGR);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0x7) << 5)
+ | ((rgba[i][GCOMP] & 0x7) << 2)
+ | ((rgba[i][RCOMP] & 0x3) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ if (format == GL_RGB) {
+ GLubyte *dst = (GLubyte *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x3) << 6)
+ | ((rgba[i][GCOMP] & 0x7) << 3)
+ | ((rgba[i][BCOMP] & 0x7) );
+ }
+ }
+ else {
+ GLubyte *dst = (GLubyte *) destination;
+ GLuint i;
+ ASSERT(format == GL_BGR);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0x3) << 6)
+ | ((rgba[i][GCOMP] & 0x7) << 3)
+ | ((rgba[i][RCOMP] & 0x7) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ if (format == GL_RGB) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x3f) << 5)
+ | ((rgba[i][BCOMP] & 0x1f) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_BGR);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x3f) << 5)
+ | ((rgba[i][RCOMP] & 0x1f) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ if (format == GL_RGB) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x3f) << 5)
+ | ((rgba[i][RCOMP] & 0x1f) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_BGR);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x3f) << 5)
+ | ((rgba[i][BCOMP] & 0x1f) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0xf) << 12)
+ | ((rgba[i][GCOMP] & 0xf) << 8)
+ | ((rgba[i][BCOMP] & 0xf) << 4)
+ | ((rgba[i][ACOMP] & 0xf) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0xf) << 12)
+ | ((rgba[i][GCOMP] & 0xf) << 8)
+ | ((rgba[i][RCOMP] & 0xf) << 4)
+ | ((rgba[i][ACOMP] & 0xf) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xf) << 12)
+ | ((rgba[i][BCOMP] & 0xf) << 8)
+ | ((rgba[i][GCOMP] & 0xf) << 4)
+ | ((rgba[i][RCOMP] & 0xf) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xf) << 12)
+ | ((rgba[i][BCOMP] & 0xf) << 8)
+ | ((rgba[i][GCOMP] & 0xf) << 4)
+ | ((rgba[i][RCOMP] & 0xf) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xf) << 12)
+ | ((rgba[i][RCOMP] & 0xf) << 8)
+ | ((rgba[i][GCOMP] & 0xf) << 4)
+ | ((rgba[i][BCOMP] & 0xf) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0xf) << 12)
+ | ((rgba[i][GCOMP] & 0xf) << 8)
+ | ((rgba[i][BCOMP] & 0xf) << 4)
+ | ((rgba[i][ACOMP] & 0xf) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x1f) << 6)
+ | ((rgba[i][BCOMP] & 0x1f) << 1)
+ | ((rgba[i][ACOMP] & 0x1) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x1f) << 6)
+ | ((rgba[i][RCOMP] & 0x1f) << 1)
+ | ((rgba[i][ACOMP] & 0x1) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11)
+ | ((rgba[i][BCOMP] & 0x1f) << 6)
+ | ((rgba[i][GCOMP] & 0x1f) << 1)
+ | ((rgba[i][RCOMP] & 0x1) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11)
+ | ((rgba[i][BCOMP] & 0x1f) << 6)
+ | ((rgba[i][GCOMP] & 0x1f) << 1)
+ | ((rgba[i][RCOMP] & 0x1) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11)
+ | ((rgba[i][RCOMP] & 0x1f) << 6)
+ | ((rgba[i][GCOMP] & 0x1f) << 1)
+ | ((rgba[i][BCOMP] & 0x1) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x1f) << 6)
+ | ((rgba[i][BCOMP] & 0x1f) << 1)
+ | ((rgba[i][ACOMP] & 0x1) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ if (format == GL_RGBA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0xff) << 24)
+ | ((rgba[i][GCOMP] & 0xff) << 16)
+ | ((rgba[i][BCOMP] & 0xff) << 8)
+ | ((rgba[i][ACOMP] & 0xff) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0xff) << 24)
+ | ((rgba[i][GCOMP] & 0xff) << 16)
+ | ((rgba[i][RCOMP] & 0xff) << 8)
+ | ((rgba[i][ACOMP] & 0xff) );
+ }
+ }
+ else {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xff) << 24)
+ | ((rgba[i][BCOMP] & 0xff) << 16)
+ | ((rgba[i][GCOMP] & 0xff) << 8)
+ | ((rgba[i][RCOMP] & 0xff) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ if (format == GL_RGBA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xff) << 24)
+ | ((rgba[i][BCOMP] & 0xff) << 16)
+ | ((rgba[i][GCOMP] & 0xff) << 8)
+ | ((rgba[i][RCOMP] & 0xff) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xff) << 24)
+ | ((rgba[i][RCOMP] & 0xff) << 16)
+ | ((rgba[i][GCOMP] & 0xff) << 8)
+ | ((rgba[i][BCOMP] & 0xff) );
+ }
+ }
+ else {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0xff) << 24)
+ | ((rgba[i][GCOMP] & 0xff) << 16)
+ | ((rgba[i][BCOMP] & 0xff) << 8)
+ | ((rgba[i][ACOMP] & 0xff) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_10_10_10_2:
+ if (format == GL_RGBA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22)
+ | ((rgba[i][GCOMP] & 0x3ff) << 12)
+ | ((rgba[i][BCOMP] & 0x3ff) << 2)
+ | ((rgba[i][ACOMP] & 0x3) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0x3ff) << 22)
+ | ((rgba[i][GCOMP] & 0x3ff) << 12)
+ | ((rgba[i][RCOMP] & 0x3ff) << 2)
+ | ((rgba[i][ACOMP] & 0x3) );
+ }
+ }
+ else {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22)
+ | ((rgba[i][BCOMP] & 0x3ff) << 12)
+ | ((rgba[i][GCOMP] & 0x3ff) << 2)
+ | ((rgba[i][RCOMP] & 0x3) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (format == GL_RGBA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22)
+ | ((rgba[i][BCOMP] & 0x3ff) << 12)
+ | ((rgba[i][GCOMP] & 0x3ff) << 2)
+ | ((rgba[i][RCOMP] & 0x3) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22)
+ | ((rgba[i][RCOMP] & 0x3ff) << 12)
+ | ((rgba[i][GCOMP] & 0x3ff) << 2)
+ | ((rgba[i][BCOMP] & 0x3) );
+ }
+ }
+ else {
+ GLuint *dst = (GLuint *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22)
+ | ((rgba[i][GCOMP] & 0x3ff) << 12)
+ | ((rgba[i][BCOMP] & 0x3ff) << 2)
+ | ((rgba[i][ACOMP] & 0x3) );
+ }
+ }
+ break;
+ default:
+ _mesa_problem(ctx, "Bad type in pack_histogram");
+ }
+
+#undef PACK_MACRO
+}
+
+
+/*
+ * Given an internalFormat token passed to glHistogram or glMinMax,
+ * return the corresponding base format.
+ * Return -1 if invalid token.
+ */
+static GLint
+base_histogram_format( GLenum format )
+{
+ switch (format) {
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return GL_ALPHA;
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ return GL_LUMINANCE;
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return GL_LUMINANCE_ALPHA;
+ case GL_RGB:
+ case GL_R3_G3_B2:
+ case GL_RGB4:
+ case GL_RGB5:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return GL_RGB;
+ case GL_RGBA:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return GL_RGBA;
+ default:
+ return -1; /* error */
+ }
+}
+
+
+
+/**********************************************************************
+ * API functions
+ */
+
+
+void GLAPIENTRY
+_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax");
+ return;
+ }
+
+ if (target != GL_MINMAX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(target)");
+ return;
+ }
+
+ if (format != GL_RED &&
+ format != GL_GREEN &&
+ format != GL_BLUE &&
+ format != GL_ALPHA &&
+ format != GL_RGB &&
+ format != GL_BGR &&
+ format != GL_RGBA &&
+ format != GL_BGRA &&
+ format != GL_ABGR_EXT &&
+ format != GL_LUMINANCE &&
+ format != GL_LUMINANCE_ALPHA) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)");
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)");
+ return;
+ }
+
+ if (!values)
+ return;
+
+ {
+ GLfloat minmax[2][4];
+ minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F);
+ minmax[0][GCOMP] = CLAMP(ctx->MinMax.Min[GCOMP], 0.0F, 1.0F);
+ minmax[0][BCOMP] = CLAMP(ctx->MinMax.Min[BCOMP], 0.0F, 1.0F);
+ minmax[0][ACOMP] = CLAMP(ctx->MinMax.Min[ACOMP], 0.0F, 1.0F);
+ minmax[1][RCOMP] = CLAMP(ctx->MinMax.Max[RCOMP], 0.0F, 1.0F);
+ minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F);
+ minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F);
+ minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F);
+ _mesa_pack_rgba_span_float(ctx, 2, (CONST GLfloat (*)[4]) minmax,
+ format, type, values, &ctx->Pack, 0);
+ }
+
+ if (reset) {
+ _mesa_ResetMinmax(GL_MINMAX);
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram");
+ return;
+ }
+
+ if (target != GL_HISTOGRAM) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)");
+ return;
+ }
+
+ if (format != GL_RED &&
+ format != GL_GREEN &&
+ format != GL_BLUE &&
+ format != GL_ALPHA &&
+ format != GL_RGB &&
+ format != GL_BGR &&
+ format != GL_RGBA &&
+ format != GL_BGRA &&
+ format != GL_ABGR_EXT &&
+ format != GL_LUMINANCE &&
+ format != GL_LUMINANCE_ALPHA) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)");
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)");
+ return;
+ }
+
+ if (!values)
+ return;
+
+ pack_histogram(ctx, ctx->Histogram.Width,
+ (CONST GLuint (*)[4]) ctx->Histogram.Count,
+ format, type, values, &ctx->Pack);
+
+ if (reset) {
+ GLuint i;
+ for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {
+ ctx->Histogram.Count[i][0] = 0;
+ ctx->Histogram.Count[i][1] = 0;
+ ctx->Histogram.Count[i][2] = 0;
+ ctx->Histogram.Count[i][3] = 0;
+ }
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv");
+ return;
+ }
+
+ if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_HISTOGRAM_WIDTH:
+ *params = (GLfloat) ctx->Histogram.Width;
+ break;
+ case GL_HISTOGRAM_FORMAT:
+ *params = (GLfloat) ctx->Histogram.Format;
+ break;
+ case GL_HISTOGRAM_RED_SIZE:
+ *params = (GLfloat) ctx->Histogram.RedSize;
+ break;
+ case GL_HISTOGRAM_GREEN_SIZE:
+ *params = (GLfloat) ctx->Histogram.GreenSize;
+ break;
+ case GL_HISTOGRAM_BLUE_SIZE:
+ *params = (GLfloat) ctx->Histogram.BlueSize;
+ break;
+ case GL_HISTOGRAM_ALPHA_SIZE:
+ *params = (GLfloat) ctx->Histogram.AlphaSize;
+ break;
+ case GL_HISTOGRAM_LUMINANCE_SIZE:
+ *params = (GLfloat) ctx->Histogram.LuminanceSize;
+ break;
+ case GL_HISTOGRAM_SINK:
+ *params = (GLfloat) ctx->Histogram.Sink;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv");
+ return;
+ }
+
+ if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_HISTOGRAM_WIDTH:
+ *params = (GLint) ctx->Histogram.Width;
+ break;
+ case GL_HISTOGRAM_FORMAT:
+ *params = (GLint) ctx->Histogram.Format;
+ break;
+ case GL_HISTOGRAM_RED_SIZE:
+ *params = (GLint) ctx->Histogram.RedSize;
+ break;
+ case GL_HISTOGRAM_GREEN_SIZE:
+ *params = (GLint) ctx->Histogram.GreenSize;
+ break;
+ case GL_HISTOGRAM_BLUE_SIZE:
+ *params = (GLint) ctx->Histogram.BlueSize;
+ break;
+ case GL_HISTOGRAM_ALPHA_SIZE:
+ *params = (GLint) ctx->Histogram.AlphaSize;
+ break;
+ case GL_HISTOGRAM_LUMINANCE_SIZE:
+ *params = (GLint) ctx->Histogram.LuminanceSize;
+ break;
+ case GL_HISTOGRAM_SINK:
+ *params = (GLint) ctx->Histogram.Sink;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv");
+ return;
+ }
+ if (target != GL_MINMAX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)");
+ return;
+ }
+ if (pname == GL_MINMAX_FORMAT) {
+ *params = (GLfloat) ctx->MinMax.Format;
+ }
+ else if (pname == GL_MINMAX_SINK) {
+ *params = (GLfloat) ctx->MinMax.Sink;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv");
+ return;
+ }
+ if (target != GL_MINMAX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)");
+ return;
+ }
+ if (pname == GL_MINMAX_FORMAT) {
+ *params = (GLint) ctx->MinMax.Format;
+ }
+ else if (pname == GL_MINMAX_SINK) {
+ *params = (GLint) ctx->MinMax.Sink;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
+{
+ GLuint i;
+ GLboolean error = GL_FALSE;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram");
+ return;
+ }
+
+ if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(target)");
+ return;
+ }
+
+ if (width < 0 || width > HISTOGRAM_TABLE_SIZE) {
+ if (target == GL_PROXY_HISTOGRAM) {
+ error = GL_TRUE;
+ }
+ else {
+ if (width < 0)
+ _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)");
+ else
+ _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)");
+ return;
+ }
+ }
+
+ if (width != 0 && _mesa_bitcount(width) != 1) {
+ if (target == GL_PROXY_HISTOGRAM) {
+ error = GL_TRUE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)");
+ return;
+ }
+ }
+
+ if (base_histogram_format(internalFormat) < 0) {
+ if (target == GL_PROXY_HISTOGRAM) {
+ error = GL_TRUE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)");
+ return;
+ }
+ }
+
+ /* reset histograms */
+ for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {
+ ctx->Histogram.Count[i][0] = 0;
+ ctx->Histogram.Count[i][1] = 0;
+ ctx->Histogram.Count[i][2] = 0;
+ ctx->Histogram.Count[i][3] = 0;
+ }
+
+ if (error) {
+ ctx->Histogram.Width = 0;
+ ctx->Histogram.Format = 0;
+ ctx->Histogram.RedSize = 0;
+ ctx->Histogram.GreenSize = 0;
+ ctx->Histogram.BlueSize = 0;
+ ctx->Histogram.AlphaSize = 0;
+ ctx->Histogram.LuminanceSize = 0;
+ }
+ else {
+ ctx->Histogram.Width = width;
+ ctx->Histogram.Format = internalFormat;
+ ctx->Histogram.Sink = sink;
+ ctx->Histogram.RedSize = 8 * sizeof(GLuint);
+ ctx->Histogram.GreenSize = 8 * sizeof(GLuint);
+ ctx->Histogram.BlueSize = 8 * sizeof(GLuint);
+ ctx->Histogram.AlphaSize = 8 * sizeof(GLuint);
+ ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint);
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax");
+ return;
+ }
+
+ if (target != GL_MINMAX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(target)");
+ return;
+ }
+
+ if (base_histogram_format(internalFormat) < 0) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)");
+ return;
+ }
+
+ if (ctx->MinMax.Sink == sink)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->MinMax.Sink = sink;
+}
+
+
+void GLAPIENTRY
+_mesa_ResetHistogram(GLenum target)
+{
+ GLuint i;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram");
+ return;
+ }
+
+ if (target != GL_HISTOGRAM) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)");
+ return;
+ }
+
+ for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {
+ ctx->Histogram.Count[i][0] = 0;
+ ctx->Histogram.Count[i][1] = 0;
+ ctx->Histogram.Count[i][2] = 0;
+ ctx->Histogram.Count[i][3] = 0;
+ }
+
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+void GLAPIENTRY
+_mesa_ResetMinmax(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax");
+ return;
+ }
+
+ if (target != GL_MINMAX) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)");
+ return;
+ }
+
+ ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000;
+ ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000;
+ ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000;
+ ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000;
+ ctx->NewState |= _NEW_PIXEL;
+}
+
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+void _mesa_init_histogram( GLcontext * ctx )
+{
+ int i;
+
+ /* Histogram group */
+ ctx->Histogram.Width = 0;
+ ctx->Histogram.Format = GL_RGBA;
+ ctx->Histogram.Sink = GL_FALSE;
+ ctx->Histogram.RedSize = 0;
+ ctx->Histogram.GreenSize = 0;
+ ctx->Histogram.BlueSize = 0;
+ ctx->Histogram.AlphaSize = 0;
+ ctx->Histogram.LuminanceSize = 0;
+ for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {
+ ctx->Histogram.Count[i][0] = 0;
+ ctx->Histogram.Count[i][1] = 0;
+ ctx->Histogram.Count[i][2] = 0;
+ ctx->Histogram.Count[i][3] = 0;
+ }
+
+ /* Min/Max group */
+ ctx->MinMax.Format = GL_RGBA;
+ ctx->MinMax.Sink = GL_FALSE;
+ ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000;
+ ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000;
+ ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000;
+ ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000;
+}
Index: xc/extras/Mesa/src/mesa/main/histogram.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/histogram.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/histogram.h Thu Apr 8 05:17:45 2004
@@ -0,0 +1,89 @@
+/**
+ * \file histogram.h
+ * Histogram.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef HISTOGRAM_H
+#define HISTOGRAM_H
+
+#include "glheader.h"
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values);
+
+extern void GLAPIENTRY
+_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+
+extern void GLAPIENTRY
+_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
+
+extern void GLAPIENTRY
+_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
+
+extern void GLAPIENTRY
+_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+
+extern void GLAPIENTRY
+_mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink);
+
+extern void GLAPIENTRY
+_mesa_ResetHistogram(GLenum target);
+
+extern void GLAPIENTRY
+_mesa_ResetMinmax(GLenum target);
+
+extern void
+_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]);
+
+extern void
+_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]);
+
+extern void _mesa_init_histogram( GLcontext * ctx );
+
+#else
+
+/** No-op */
+#define _mesa_init_histogram( c ) ((void) 0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/image.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/image.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/image.c Fri Dec 10 10:05:25 2004
@@ -0,0 +1,4059 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file image.c
+ * Image handling.
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "colormac.h"
+#include "context.h"
+#include "image.h"
+#include "imports.h"
+#include "histogram.h"
+#include "macros.h"
+#include "pixel.h"
+#include "mtypes.h"
+
+
+/** Compute ceiling of integer quotient of A divided by B. */
+#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
+
+
+/**
+ * Flip the 8 bits in each byte of the given array.
+ *
+ * \param p array.
+ * \param n number of bytes.
+ *
+ * \todo try this trick to flip bytes someday:
+ * \code
+ * v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555);
+ * v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333);
+ * v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f);
+ * \endcode
+ */
+static void
+flip_bytes( GLubyte *p, GLuint n )
+{
+ register GLuint i, a, b;
+
+ for (i=0;i> 1) |
+ ((b & 0x20) >> 3) |
+ ((b & 0x40) >> 5) |
+ ((b & 0x80) >> 7);
+ p[i] = (GLubyte) a;
+ }
+}
+
+
+/**
+ * Flip the order of the 2 bytes in each word in the given array.
+ *
+ * \param p array.
+ * \param n number of words.
+ */
+void
+_mesa_swap2( GLushort *p, GLuint n )
+{
+ register GLuint i;
+
+ for (i=0;i> 8) | ((p[i] << 8) & 0xff00);
+ }
+}
+
+
+
+/*
+ * Flip the order of the 4 bytes in each word in the given array.
+ */
+void
+_mesa_swap4( GLuint *p, GLuint n )
+{
+ register GLuint i, a, b;
+
+ for (i=0;i> 24)
+ | ((b >> 8) & 0xff00)
+ | ((b << 8) & 0xff0000)
+ | ((b << 24) & 0xff000000);
+ p[i] = a;
+ }
+}
+
+
+/**
+ * Get the size of a GL data type.
+ *
+ * \param type GL data type.
+ *
+ * \return the size, in bytes, of the given data type, 0 if a GL_BITMAP, or -1
+ * if an invalid type enum.
+ */
+GLint _mesa_sizeof_type( GLenum type )
+{
+ switch (type) {
+ case GL_BITMAP:
+ return 0;
+ case GL_UNSIGNED_BYTE:
+ return sizeof(GLubyte);
+ case GL_BYTE:
+ return sizeof(GLbyte);
+ case GL_UNSIGNED_SHORT:
+ return sizeof(GLushort);
+ case GL_SHORT:
+ return sizeof(GLshort);
+ case GL_UNSIGNED_INT:
+ return sizeof(GLuint);
+ case GL_INT:
+ return sizeof(GLint);
+ case GL_FLOAT:
+ return sizeof(GLfloat);
+ case GL_HALF_FLOAT_ARB:
+ return sizeof(GLhalfARB);
+ default:
+ return -1;
+ }
+}
+
+
+/**
+ * Same as _mesa_sizeof_type() but also accepting the packed pixel
+ * format data types.
+ */
+GLint _mesa_sizeof_packed_type( GLenum type )
+{
+ switch (type) {
+ case GL_BITMAP:
+ return 0;
+ case GL_UNSIGNED_BYTE:
+ return sizeof(GLubyte);
+ case GL_BYTE:
+ return sizeof(GLbyte);
+ case GL_UNSIGNED_SHORT:
+ return sizeof(GLushort);
+ case GL_SHORT:
+ return sizeof(GLshort);
+ case GL_UNSIGNED_INT:
+ return sizeof(GLuint);
+ case GL_INT:
+ return sizeof(GLint);
+ case GL_HALF_FLOAT_ARB:
+ return sizeof(GLhalfARB);
+ case GL_FLOAT:
+ return sizeof(GLfloat);
+ case GL_UNSIGNED_BYTE_3_3_2:
+ return sizeof(GLubyte);
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ return sizeof(GLubyte);
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_INT_8_8_8_8:
+ return sizeof(GLuint);
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ return sizeof(GLuint);
+ case GL_UNSIGNED_INT_10_10_10_2:
+ return sizeof(GLuint);
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return sizeof(GLuint);
+ case GL_UNSIGNED_SHORT_8_8_MESA:
+ case GL_UNSIGNED_SHORT_8_8_REV_MESA:
+ return sizeof(GLushort);
+ default:
+ return -1;
+ }
+}
+
+
+/**
+ * Get the number of components in a pixel format.
+ *
+ * \param format pixel format.
+ *
+ * \return the number of components in the given format, or -1 if a bad format.
+ */
+GLint _mesa_components_in_format( GLenum format )
+{
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_COLOR_INDEX1_EXT:
+ case GL_COLOR_INDEX2_EXT:
+ case GL_COLOR_INDEX4_EXT:
+ case GL_COLOR_INDEX8_EXT:
+ case GL_COLOR_INDEX12_EXT:
+ case GL_COLOR_INDEX16_EXT:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_INTENSITY:
+ return 1;
+ case GL_LUMINANCE_ALPHA:
+ return 2;
+ case GL_RGB:
+ return 3;
+ case GL_RGBA:
+ return 4;
+ case GL_BGR:
+ return 3;
+ case GL_BGRA:
+ return 4;
+ case GL_ABGR_EXT:
+ return 4;
+ case GL_YCBCR_MESA:
+ return 2;
+ default:
+ return -1;
+ }
+}
+
+
+/**
+ * Get the bytes per pixel of pixel format type pair.
+ *
+ * \param format pixel format.
+ * \param type pixel type.
+ *
+ * \return bytes per pixel, or -1 if a bad format or type was given.
+ */
+GLint _mesa_bytes_per_pixel( GLenum format, GLenum type )
+{
+ GLint comps = _mesa_components_in_format( format );
+ if (comps < 0)
+ return -1;
+
+ switch (type) {
+ case GL_BITMAP:
+ return 0; /* special case */
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ return comps * sizeof(GLubyte);
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ return comps * sizeof(GLshort);
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ return comps * sizeof(GLint);
+ case GL_FLOAT:
+ return comps * sizeof(GLfloat);
+ case GL_HALF_FLOAT_ARB:
+ return comps * sizeof(GLhalfARB);
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ if (format == GL_RGB || format == GL_BGR)
+ return sizeof(GLubyte);
+ else
+ return -1; /* error */
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ if (format == GL_RGB || format == GL_BGR)
+ return sizeof(GLushort);
+ else
+ return -1; /* error */
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT)
+ return sizeof(GLushort);
+ else
+ return -1;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT)
+ return sizeof(GLuint);
+ else
+ return -1;
+ case GL_UNSIGNED_SHORT_8_8_MESA:
+ case GL_UNSIGNED_SHORT_8_8_REV_MESA:
+ if (format == GL_YCBCR_MESA)
+ return sizeof(GLushort);
+ else
+ return -1;
+ default:
+ return -1;
+ }
+}
+
+
+/**
+ * Test for a legal pixel format and type.
+ *
+ * \param format pixel format.
+ * \param type pixel type.
+ *
+ * \return GL_TRUE if the given pixel format and type are legal, or GL_FALSE
+ * otherwise.
+ */
+GLboolean
+_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type )
+{
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ switch (type) {
+ case GL_BITMAP:
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ return GL_TRUE;
+ case GL_HALF_FLOAT_ARB:
+ return ctx->Extensions.ARB_half_float_pixel;
+ default:
+ return GL_FALSE;
+ }
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+#if 0 /* not legal! see table 3.6 of the 1.5 spec */
+ case GL_INTENSITY:
+#endif
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_DEPTH_COMPONENT:
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ return GL_TRUE;
+ case GL_HALF_FLOAT_ARB:
+ return ctx->Extensions.ARB_half_float_pixel;
+ default:
+ return GL_FALSE;
+ }
+ case GL_RGB:
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ return GL_TRUE;
+ case GL_HALF_FLOAT_ARB:
+ return ctx->Extensions.ARB_half_float_pixel;
+ default:
+ return GL_FALSE;
+ }
+ case GL_BGR:
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ return GL_TRUE;
+ case GL_HALF_FLOAT_ARB:
+ return ctx->Extensions.ARB_half_float_pixel;
+ default:
+ return GL_FALSE;
+ }
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return GL_TRUE;
+ case GL_HALF_FLOAT_ARB:
+ return ctx->Extensions.ARB_half_float_pixel;
+ default:
+ return GL_FALSE;
+ }
+ case GL_YCBCR_MESA:
+ if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
+ type == GL_UNSIGNED_SHORT_8_8_REV_MESA)
+ return GL_TRUE;
+ else
+ return GL_FALSE;
+ default:
+ ; /* fall-through */
+ }
+ return GL_FALSE;
+}
+
+
+/**
+ * Get the address of a pixel in an image (actually a volume).
+ *
+ * Pixel unpacking/packing parameters are observed according to \p packing.
+ *
+ * \param image start of image data.
+ * \param width image width.
+ * \param height image height.
+ * \param format pixel format.
+ * \param type pixel data type.
+ * \param packing the pixelstore attributes
+ * \param img which image in the volume (0 for 1D or 2D images)
+ * \param row of pixel in the image
+ * \param column of pixel in the image
+ *
+ * \return address of pixel on success, or NULL on error.
+ *
+ * According to the \p packing information calculates the number of pixel/bytes
+ * per row/image and refers it.
+ *
+ * \sa gl_pixelstore_attrib.
+ */
+GLvoid *
+_mesa_image_address( const struct gl_pixelstore_attrib *packing,
+ const GLvoid *image, GLsizei width,
+ GLsizei height, GLenum format, GLenum type,
+ GLint img, GLint row, GLint column )
+{
+ GLint alignment; /* 1, 2 or 4 */
+ GLint pixels_per_row;
+ GLint rows_per_image;
+ GLint skiprows;
+ GLint skippixels;
+ GLint skipimages; /* for 3-D volume images */
+ GLubyte *pixel_addr;
+
+ alignment = packing->Alignment;
+ if (packing->RowLength > 0) {
+ pixels_per_row = packing->RowLength;
+ }
+ else {
+ pixels_per_row = width;
+ }
+ if (packing->ImageHeight > 0) {
+ rows_per_image = packing->ImageHeight;
+ }
+ else {
+ rows_per_image = height;
+ }
+ skiprows = packing->SkipRows;
+ skippixels = packing->SkipPixels;
+ skipimages = packing->SkipImages;
+
+ if (type==GL_BITMAP) {
+ /* BITMAP data */
+ GLint comp_per_pixel; /* components per pixel */
+ GLint bytes_per_comp; /* bytes per component */
+ GLint bytes_per_row;
+ GLint bytes_per_image;
+
+ /* Compute bytes per component */
+ bytes_per_comp = _mesa_sizeof_packed_type( type );
+ if (bytes_per_comp<0) {
+ return NULL;
+ }
+
+ /* Compute number of components per pixel */
+ comp_per_pixel = _mesa_components_in_format( format );
+ if (comp_per_pixel<0 && type != GL_BITMAP) {
+ return NULL;
+ }
+
+ bytes_per_row = alignment
+ * CEILING( comp_per_pixel*pixels_per_row, 8*alignment );
+
+ bytes_per_image = bytes_per_row * rows_per_image;
+
+ pixel_addr = (GLubyte *) image
+ + (skipimages + img) * bytes_per_image
+ + (skiprows + row) * bytes_per_row
+ + (skippixels + column) / 8;
+ }
+ else {
+ /* Non-BITMAP data */
+ GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image;
+ GLint topOfImage;
+
+ bytes_per_pixel = _mesa_bytes_per_pixel( format, type );
+
+ /* The pixel type and format should have been error checked earlier */
+ assert(bytes_per_pixel > 0);
+
+ bytes_per_row = pixels_per_row * bytes_per_pixel;
+ remainder = bytes_per_row % alignment;
+ if (remainder > 0)
+ bytes_per_row += (alignment - remainder);
+
+ ASSERT(bytes_per_row % alignment == 0);
+
+ bytes_per_image = bytes_per_row * rows_per_image;
+
+ if (packing->Invert) {
+ /* set pixel_addr to the last row */
+ topOfImage = bytes_per_row * (height - 1);
+ bytes_per_row = -bytes_per_row;
+ }
+ else {
+ topOfImage = 0;
+ }
+
+ /* compute final pixel address */
+ pixel_addr = (GLubyte *) image
+ + (skipimages + img) * bytes_per_image
+ + topOfImage
+ + (skiprows + row) * bytes_per_row
+ + (skippixels + column) * bytes_per_pixel;
+ }
+
+ return (GLvoid *) pixel_addr;
+}
+
+
+/**
+ * Compute the stride between image rows.
+ *
+ * \param packing the pixelstore attributes
+ * \param width image width.
+ * \param format pixel format.
+ * \param type pixel data type.
+ *
+ * \return the stride in bytes for the given parameters.
+ *
+ * Computes the number of bytes per pixel and row and compensates for alignment.
+ *
+ * \sa gl_pixelstore_attrib.
+ */
+GLint
+_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
+ GLint width, GLenum format, GLenum type )
+{
+ ASSERT(packing);
+ if (type == GL_BITMAP) {
+ /* BITMAP data */
+ GLint bytes;
+ if (packing->RowLength == 0) {
+ bytes = (width + 7) / 8;
+ }
+ else {
+ bytes = (packing->RowLength + 7) / 8;
+ }
+ if (packing->Invert) {
+ /* negate the bytes per row (negative row stride) */
+ bytes = -bytes;
+ }
+ return bytes;
+ }
+ else {
+ /* Non-BITMAP data */
+ const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
+ GLint bytesPerRow, remainder;
+ if (bytesPerPixel <= 0)
+ return -1; /* error */
+ if (packing->RowLength == 0) {
+ bytesPerRow = bytesPerPixel * width;
+ }
+ else {
+ bytesPerRow = bytesPerPixel * packing->RowLength;
+ }
+ remainder = bytesPerRow % packing->Alignment;
+ if (remainder > 0)
+ bytesPerRow += (packing->Alignment - remainder);
+ if (packing->Invert)
+ bytesPerRow = -bytesPerRow;
+ return bytesPerRow;
+ }
+}
+
+
+#if _HAVE_FULL_GL
+
+/*
+ * Compute the stride between images in a 3D texture (in bytes) for the given
+ * pixel packing parameters and image width, format and type.
+ */
+GLint
+_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
+ GLint width, GLint height,
+ GLenum format, GLenum type )
+{
+ ASSERT(packing);
+ ASSERT(type != GL_BITMAP);
+
+ {
+ const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
+ GLint bytesPerRow, bytesPerImage, remainder;
+
+ if (bytesPerPixel <= 0)
+ return -1; /* error */
+ if (packing->RowLength == 0) {
+ bytesPerRow = bytesPerPixel * width;
+ }
+ else {
+ bytesPerRow = bytesPerPixel * packing->RowLength;
+ }
+ remainder = bytesPerRow % packing->Alignment;
+ if (remainder > 0)
+ bytesPerRow += (packing->Alignment - remainder);
+
+ if (packing->ImageHeight == 0)
+ bytesPerImage = bytesPerRow * height;
+ else
+ bytesPerImage = bytesPerRow * packing->ImageHeight;
+
+ return bytesPerImage;
+ }
+}
+
+
+/*
+ * Unpack a 32x32 pixel polygon stipple from user memory using the
+ * current pixel unpack settings.
+ */
+void
+_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
+ const struct gl_pixelstore_attrib *unpacking )
+{
+ GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap( 32, 32, pattern, unpacking );
+ if (ptrn) {
+ /* Convert pattern from GLubytes to GLuints and handle big/little
+ * endian differences
+ */
+ GLubyte *p = ptrn;
+ GLint i;
+ for (i = 0; i < 32; i++) {
+ dest[i] = (p[0] << 24)
+ | (p[1] << 16)
+ | (p[2] << 8)
+ | (p[3] );
+ p += 4;
+ }
+ FREE(ptrn);
+ }
+}
+
+
+/*
+ * Pack polygon stipple into user memory given current pixel packing
+ * settings.
+ */
+void
+_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
+ const struct gl_pixelstore_attrib *packing )
+{
+ /* Convert pattern from GLuints to GLubytes to handle big/little
+ * endian differences.
+ */
+ GLubyte ptrn[32*4];
+ GLint i;
+ for (i = 0; i < 32; i++) {
+ ptrn[i * 4 + 0] = (GLubyte) ((pattern[i] >> 24) & 0xff);
+ ptrn[i * 4 + 1] = (GLubyte) ((pattern[i] >> 16) & 0xff);
+ ptrn[i * 4 + 2] = (GLubyte) ((pattern[i] >> 8 ) & 0xff);
+ ptrn[i * 4 + 3] = (GLubyte) ((pattern[i] ) & 0xff);
+ }
+
+ _mesa_pack_bitmap(32, 32, ptrn, dest, packing);
+}
+
+
+/*
+ * Unpack bitmap data. Resulting data will be in most-significant-bit-first
+ * order with row alignment = 1 byte.
+ */
+GLvoid *
+_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
+ const struct gl_pixelstore_attrib *packing )
+{
+ GLint bytes, row, width_in_bytes;
+ GLubyte *buffer, *dst;
+
+ if (!pixels)
+ return NULL;
+
+ /* Alloc dest storage */
+ bytes = ((width + 7) / 8 * height);
+ buffer = (GLubyte *) MALLOC( bytes );
+ if (!buffer)
+ return NULL;
+
+
+ width_in_bytes = CEILING( width, 8 );
+ dst = buffer;
+ for (row = 0; row < height; row++) {
+ const GLubyte *src = (const GLubyte *)
+ _mesa_image_address(packing, pixels, width, height,
+ GL_COLOR_INDEX, GL_BITMAP, 0, row, 0);
+ if (!src) {
+ FREE(buffer);
+ return NULL;
+ }
+
+ if (packing->SkipPixels == 0) {
+ MEMCPY( dst, src, width_in_bytes );
+ if (packing->LsbFirst) {
+ flip_bytes( dst, width_in_bytes );
+ }
+ }
+ else {
+ /* handling SkipPixels is a bit tricky (no pun intended!) */
+ GLint i;
+ if (packing->LsbFirst) {
+ GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 128) {
+ srcMask = 1;
+ s++;
+ }
+ else {
+ srcMask = srcMask << 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ else {
+ GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 1) {
+ srcMask = 128;
+ s++;
+ }
+ else {
+ srcMask = srcMask >> 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ }
+ dst += width_in_bytes;
+ }
+
+ return buffer;
+}
+
+
+/*
+ * Pack bitmap data.
+ */
+void
+_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
+ GLubyte *dest, const struct gl_pixelstore_attrib *packing )
+{
+ GLint row, width_in_bytes;
+ const GLubyte *src;
+
+ if (!source)
+ return;
+
+ width_in_bytes = CEILING( width, 8 );
+ src = source;
+ for (row = 0; row < height; row++) {
+ GLubyte *dst = (GLubyte *) _mesa_image_address( packing, dest,
+ width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
+ if (!dst)
+ return;
+
+ if (packing->SkipPixels == 0) {
+ MEMCPY( dst, src, width_in_bytes );
+ if (packing->LsbFirst) {
+ flip_bytes( dst, width_in_bytes );
+ }
+ }
+ else {
+ /* handling SkipPixels is a bit tricky (no pun intended!) */
+ GLint i;
+ if (packing->LsbFirst) {
+ GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 128) {
+ srcMask = 1;
+ s++;
+ }
+ else {
+ srcMask = srcMask << 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ else {
+ GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 1) {
+ srcMask = 128;
+ s++;
+ }
+ else {
+ srcMask = srcMask >> 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ }
+ src += width_in_bytes;
+ }
+}
+
+
+/**
+ * Apply various pixel transfer operations to an array of RGBA pixels
+ * as indicated by the transferOps bitmask
+ */
+void
+_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLuint transferOps,
+ GLuint n, GLfloat rgba[][4])
+{
+ /* scale & bias */
+ if (transferOps & IMAGE_SCALE_BIAS_BIT) {
+ _mesa_scale_and_bias_rgba(ctx, n, rgba,
+ ctx->Pixel.RedScale, ctx->Pixel.GreenScale,
+ ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale,
+ ctx->Pixel.RedBias, ctx->Pixel.GreenBias,
+ ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias);
+ }
+ /* color map lookup */
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ _mesa_map_rgba( ctx, n, rgba );
+ }
+ /* GL_COLOR_TABLE lookup */
+ if (transferOps & IMAGE_COLOR_TABLE_BIT) {
+ _mesa_lookup_rgba_float(&ctx->ColorTable, n, rgba);
+ }
+ /* convolution */
+ if (transferOps & IMAGE_CONVOLUTION_BIT) {
+ /* this has to be done in the calling code */
+ _mesa_problem(ctx, "IMAGE_CONVOLUTION_BIT set in _mesa_apply_transfer_ops");
+ }
+ /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */
+ if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) {
+ _mesa_scale_and_bias_rgba(ctx, n, rgba,
+ ctx->Pixel.PostConvolutionScale[RCOMP],
+ ctx->Pixel.PostConvolutionScale[GCOMP],
+ ctx->Pixel.PostConvolutionScale[BCOMP],
+ ctx->Pixel.PostConvolutionScale[ACOMP],
+ ctx->Pixel.PostConvolutionBias[RCOMP],
+ ctx->Pixel.PostConvolutionBias[GCOMP],
+ ctx->Pixel.PostConvolutionBias[BCOMP],
+ ctx->Pixel.PostConvolutionBias[ACOMP]);
+ }
+ /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
+ if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) {
+ _mesa_lookup_rgba_float(&ctx->PostConvolutionColorTable, n, rgba);
+ }
+ /* color matrix transform */
+ if (transferOps & IMAGE_COLOR_MATRIX_BIT) {
+ _mesa_transform_rgba(ctx, n, rgba);
+ }
+ /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */
+ if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) {
+ _mesa_lookup_rgba_float(&ctx->PostColorMatrixColorTable, n, rgba);
+ }
+ /* update histogram count */
+ if (transferOps & IMAGE_HISTOGRAM_BIT) {
+ _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba);
+ }
+ /* update min/max values */
+ if (transferOps & IMAGE_MIN_MAX_BIT) {
+ _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba);
+ }
+ /* clamping to [0,1] */
+ if (transferOps & IMAGE_CLAMP_BIT) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
+ rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
+ rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F);
+ rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
+ }
+ }
+}
+
+
+
+/*
+ * Used to pack an array [][4] of RGBA GLchan colors as specified
+ * by the dstFormat, dstType and dstPacking. Used by glReadPixels,
+ * glGetConvolutionFilter(), etc.
+ */
+void
+_mesa_pack_rgba_span_float( GLcontext *ctx,
+ GLuint n, CONST GLfloat rgbaIn[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr,
+ const struct gl_pixelstore_attrib *dstPacking,
+ GLuint transferOps )
+{
+ const GLint comps = _mesa_components_in_format(dstFormat);
+ GLfloat luminance[MAX_WIDTH];
+ const GLfloat (*rgba)[4];
+ GLuint i;
+
+ if (transferOps) {
+ /* make copy of incoming data */
+ DEFMARRAY(GLfloat, rgbaCopy, MAX_WIDTH, 4); /* mac 32k limitation */
+ CHECKARRAY(rgbaCopy, return); /* mac 32k limitation */
+
+ _mesa_memcpy(rgbaCopy, rgbaIn, n * 4 * sizeof(GLfloat));
+ _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgbaCopy);
+ rgba = (const GLfloat (*)[4]) rgbaCopy;
+
+ if ((transferOps & IMAGE_MIN_MAX_BIT) && ctx->MinMax.Sink) {
+ UNDEFARRAY(rgbaCopy); /* mac 32k limitation */
+ return;
+ }
+ UNDEFARRAY(rgbaCopy); /* mac 32k limitation */
+ }
+ else {
+ /* use incoming data, not a copy */
+ rgba = (const GLfloat (*)[4]) rgbaIn;
+ }
+
+ if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
+ /* compute luminance values */
+ if (ctx->ClampFragmentColors) {
+ for (i = 0; i < n; i++) {
+ GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ luminance[i] = CLAMP(sum, 0.0F, 1.0F);
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ }
+ }
+ }
+
+ /*
+ * Pack/store the pixels. Ugh! Lots of cases!!!
+ */
+ switch (dstType) {
+ case GL_UNSIGNED_BYTE:
+ {
+ GLubyte *dst = (GLubyte *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED:
+ for (i=0;iSwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n * comps);
+ }
+ }
+ break;
+ case GL_SHORT:
+ {
+ GLshort *dst = (GLshort *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED:
+ for (i=0;iSwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n * comps );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ {
+ GLuint *dst = (GLuint *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED:
+ for (i=0;iSwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n * comps );
+ }
+ }
+ break;
+ case GL_INT:
+ {
+ GLint *dst = (GLint *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED:
+ for (i=0;iSwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n * comps );
+ }
+ }
+ break;
+ case GL_FLOAT:
+ {
+ GLfloat *dst = (GLfloat *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED:
+ for (i=0;iSwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n * comps );
+ }
+ }
+ break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ GLhalfARB *dst = (GLhalfARB *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED:
+ for (i=0;iSwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n * comps );
+ }
+ }
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ if (dstFormat == GL_RGB) {
+ GLubyte *dst = (GLubyte *) dstAddr;
+ for (i=0;iNewState & _NEW_PIXEL) == 0 || transferOps == 0);
+
+ /* Test for optimized case first */
+ if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) {
+ /* common simple case */
+ MEMCPY(dstAddr, srcRgba, n * 4 * sizeof(GLchan));
+ }
+ else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) {
+ /* common simple case */
+ GLuint i;
+ GLchan *dest = (GLchan *) dstAddr;
+ for (i = 0; i < n; i++) {
+ dest[0] = srcRgba[i][RCOMP];
+ dest[1] = srcRgba[i][GCOMP];
+ dest[2] = srcRgba[i][BCOMP];
+ dest += 3;
+ }
+ }
+ else if (transferOps == 0 && dstFormat == GL_RGBA && dstType == GL_UNSIGNED_BYTE) {
+ /* common simple case */
+ GLuint i;
+ GLubyte *dest = (GLubyte *) dstAddr;
+ for (i = 0; i < n; i++) {
+ dest[0] = CHAN_TO_UBYTE(srcRgba[i][RCOMP]);
+ dest[1] = CHAN_TO_UBYTE(srcRgba[i][GCOMP]);
+ dest[2] = CHAN_TO_UBYTE(srcRgba[i][BCOMP]);
+ dest[3] = CHAN_TO_UBYTE(srcRgba[i][ACOMP]);
+ dest += 4;
+ }
+ }
+ else {
+ /* general solution */
+ GLuint i;
+ DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */
+ CHECKARRAY(rgba, return); /* mac 32k limitation */
+
+ assert(n <= MAX_WIDTH);
+ /* convert color components to floating point */
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = CHAN_TO_FLOAT(srcRgba[i][RCOMP]);
+ rgba[i][GCOMP] = CHAN_TO_FLOAT(srcRgba[i][GCOMP]);
+ rgba[i][BCOMP] = CHAN_TO_FLOAT(srcRgba[i][BCOMP]);
+ rgba[i][ACOMP] = CHAN_TO_FLOAT(srcRgba[i][ACOMP]);
+ }
+ _mesa_pack_rgba_span_float(ctx, n, (const GLfloat (*)[4]) rgba,
+ dstFormat, dstType, dstAddr,
+ dstPacking, transferOps);
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+ }
+}
+
+
+#define SWAP2BYTE(VALUE) \
+ { \
+ GLubyte *bytes = (GLubyte *) &(VALUE); \
+ GLubyte tmp = bytes[0]; \
+ bytes[0] = bytes[1]; \
+ bytes[1] = tmp; \
+ }
+
+#define SWAP4BYTE(VALUE) \
+ { \
+ GLubyte *bytes = (GLubyte *) &(VALUE); \
+ GLubyte tmp = bytes[0]; \
+ bytes[0] = bytes[3]; \
+ bytes[3] = tmp; \
+ tmp = bytes[1]; \
+ bytes[1] = bytes[2]; \
+ bytes[2] = tmp; \
+ }
+
+
+static void
+extract_uint_indexes(GLuint n, GLuint indexes[],
+ GLenum srcFormat, GLenum srcType, const GLvoid *src,
+ const struct gl_pixelstore_attrib *unpack )
+{
+ assert(srcFormat == GL_COLOR_INDEX);
+
+ ASSERT(srcType == GL_BITMAP ||
+ srcType == GL_UNSIGNED_BYTE ||
+ srcType == GL_BYTE ||
+ srcType == GL_UNSIGNED_SHORT ||
+ srcType == GL_SHORT ||
+ srcType == GL_UNSIGNED_INT ||
+ srcType == GL_INT ||
+ srcType == GL_HALF_FLOAT_ARB ||
+ srcType == GL_FLOAT);
+
+ switch (srcType) {
+ case GL_BITMAP:
+ {
+ GLubyte *ubsrc = (GLubyte *) src;
+ if (unpack->LsbFirst) {
+ GLubyte mask = 1 << (unpack->SkipPixels & 0x7);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ indexes[i] = (*ubsrc & mask) ? 1 : 0;
+ if (mask == 128) {
+ mask = 1;
+ ubsrc++;
+ }
+ else {
+ mask = mask << 1;
+ }
+ }
+ }
+ else {
+ GLubyte mask = 128 >> (unpack->SkipPixels & 0x7);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ indexes[i] = (*ubsrc & mask) ? 1 : 0;
+ if (mask == 1) {
+ mask = 128;
+ ubsrc++;
+ }
+ else {
+ mask = mask >> 1;
+ }
+ }
+ }
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ {
+ GLuint i;
+ const GLubyte *s = (const GLubyte *) src;
+ for (i = 0; i < n; i++)
+ indexes[i] = s[i];
+ }
+ break;
+ case GL_BYTE:
+ {
+ GLuint i;
+ const GLbyte *s = (const GLbyte *) src;
+ for (i = 0; i < n; i++)
+ indexes[i] = s[i];
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ {
+ GLuint i;
+ const GLushort *s = (const GLushort *) src;
+ if (unpack->SwapBytes) {
+ for (i = 0; i < n; i++) {
+ GLushort value = s[i];
+ SWAP2BYTE(value);
+ indexes[i] = value;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++)
+ indexes[i] = s[i];
+ }
+ }
+ break;
+ case GL_SHORT:
+ {
+ GLuint i;
+ const GLshort *s = (const GLshort *) src;
+ if (unpack->SwapBytes) {
+ for (i = 0; i < n; i++) {
+ GLshort value = s[i];
+ SWAP2BYTE(value);
+ indexes[i] = value;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++)
+ indexes[i] = s[i];
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ {
+ GLuint i;
+ const GLuint *s = (const GLuint *) src;
+ if (unpack->SwapBytes) {
+ for (i = 0; i < n; i++) {
+ GLuint value = s[i];
+ SWAP4BYTE(value);
+ indexes[i] = value;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++)
+ indexes[i] = s[i];
+ }
+ }
+ break;
+ case GL_INT:
+ {
+ GLuint i;
+ const GLint *s = (const GLint *) src;
+ if (unpack->SwapBytes) {
+ for (i = 0; i < n; i++) {
+ GLint value = s[i];
+ SWAP4BYTE(value);
+ indexes[i] = value;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++)
+ indexes[i] = s[i];
+ }
+ }
+ break;
+ case GL_FLOAT:
+ {
+ GLuint i;
+ const GLfloat *s = (const GLfloat *) src;
+ if (unpack->SwapBytes) {
+ for (i = 0; i < n; i++) {
+ GLfloat value = s[i];
+ SWAP4BYTE(value);
+ indexes[i] = (GLuint) value;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++)
+ indexes[i] = (GLuint) s[i];
+ }
+ }
+ break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ GLuint i;
+ const GLhalfARB *s = (const GLhalfARB *) src;
+ if (unpack->SwapBytes) {
+ for (i = 0; i < n; i++) {
+ GLhalfARB value = s[i];
+ SWAP2BYTE(value);
+ indexes[i] = (GLuint) _mesa_half_to_float(value);
+ }
+ }
+ else {
+ for (i = 0; i < n; i++)
+ indexes[i] = (GLuint) _mesa_half_to_float(s[i]);
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "bad srcType in extract_uint_indexes");
+ return;
+ }
+}
+
+
+/*
+ * This function extracts floating point RGBA values from arbitrary
+ * image data. srcFormat and srcType are the format and type parameters
+ * passed to glDrawPixels, glTexImage[123]D, glTexSubImage[123]D, etc.
+ *
+ * Refering to section 3.6.4 of the OpenGL 1.2 spec, this function
+ * implements the "Conversion to floating point", "Conversion to RGB",
+ * and "Final Expansion to RGBA" operations.
+ *
+ * Args: n - number of pixels
+ * rgba - output colors
+ * srcFormat - format of incoming data
+ * srcType - data type of incoming data
+ * src - source data pointer
+ * swapBytes - perform byteswapping of incoming data?
+ */
+static void
+extract_float_rgba(GLuint n, GLfloat rgba[][4],
+ GLenum srcFormat, GLenum srcType, const GLvoid *src,
+ GLboolean swapBytes)
+{
+ GLint redIndex, greenIndex, blueIndex, alphaIndex;
+ GLint stride;
+ GLint rComp, bComp, gComp, aComp;
+
+ ASSERT(srcFormat == GL_RED ||
+ srcFormat == GL_GREEN ||
+ srcFormat == GL_BLUE ||
+ srcFormat == GL_ALPHA ||
+ srcFormat == GL_LUMINANCE ||
+ srcFormat == GL_LUMINANCE_ALPHA ||
+ srcFormat == GL_INTENSITY ||
+ srcFormat == GL_RGB ||
+ srcFormat == GL_BGR ||
+ srcFormat == GL_RGBA ||
+ srcFormat == GL_BGRA ||
+ srcFormat == GL_ABGR_EXT);
+
+ ASSERT(srcType == GL_UNSIGNED_BYTE ||
+ srcType == GL_BYTE ||
+ srcType == GL_UNSIGNED_SHORT ||
+ srcType == GL_SHORT ||
+ srcType == GL_UNSIGNED_INT ||
+ srcType == GL_INT ||
+ srcType == GL_HALF_FLOAT_ARB ||
+ srcType == GL_FLOAT ||
+ srcType == GL_UNSIGNED_BYTE_3_3_2 ||
+ srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
+ srcType == GL_UNSIGNED_SHORT_5_6_5 ||
+ srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+ srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
+ srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8 ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
+ srcType == GL_UNSIGNED_INT_10_10_10_2 ||
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+
+ rComp = gComp = bComp = aComp = -1;
+
+ switch (srcFormat) {
+ case GL_RED:
+ redIndex = 0;
+ greenIndex = blueIndex = alphaIndex = -1;
+ stride = 1;
+ break;
+ case GL_GREEN:
+ greenIndex = 0;
+ redIndex = blueIndex = alphaIndex = -1;
+ stride = 1;
+ break;
+ case GL_BLUE:
+ blueIndex = 0;
+ redIndex = greenIndex = alphaIndex = -1;
+ stride = 1;
+ break;
+ case GL_ALPHA:
+ redIndex = greenIndex = blueIndex = -1;
+ alphaIndex = 0;
+ stride = 1;
+ break;
+ case GL_LUMINANCE:
+ redIndex = greenIndex = blueIndex = 0;
+ alphaIndex = -1;
+ stride = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ redIndex = greenIndex = blueIndex = 0;
+ alphaIndex = 1;
+ stride = 2;
+ break;
+ case GL_INTENSITY:
+ redIndex = greenIndex = blueIndex = alphaIndex = 0;
+ stride = 1;
+ break;
+ case GL_RGB:
+ redIndex = 0;
+ greenIndex = 1;
+ blueIndex = 2;
+ alphaIndex = -1;
+ rComp = 0;
+ gComp = 1;
+ bComp = 2;
+ aComp = 3;
+ stride = 3;
+ break;
+ case GL_BGR:
+ redIndex = 2;
+ greenIndex = 1;
+ blueIndex = 0;
+ alphaIndex = -1;
+ rComp = 2;
+ gComp = 1;
+ bComp = 0;
+ aComp = 3;
+ stride = 3;
+ break;
+ case GL_RGBA:
+ redIndex = 0;
+ greenIndex = 1;
+ blueIndex = 2;
+ alphaIndex = 3;
+ rComp = 0;
+ gComp = 1;
+ bComp = 2;
+ aComp = 3;
+ stride = 4;
+ break;
+ case GL_BGRA:
+ redIndex = 2;
+ greenIndex = 1;
+ blueIndex = 0;
+ alphaIndex = 3;
+ rComp = 2;
+ gComp = 1;
+ bComp = 0;
+ aComp = 3;
+ stride = 4;
+ break;
+ case GL_ABGR_EXT:
+ redIndex = 3;
+ greenIndex = 2;
+ blueIndex = 1;
+ alphaIndex = 0;
+ rComp = 3;
+ gComp = 2;
+ bComp = 1;
+ aComp = 0;
+ stride = 4;
+ break;
+ default:
+ _mesa_problem(NULL, "bad srcFormat in extract float data");
+ return;
+ }
+
+
+#define PROCESS(INDEX, CHANNEL, DEFAULT, TYPE, CONVERSION) \
+ if ((INDEX) < 0) { \
+ GLuint i; \
+ for (i = 0; i < n; i++) { \
+ rgba[i][CHANNEL] = DEFAULT; \
+ } \
+ } \
+ else if (swapBytes) { \
+ const TYPE *s = (const TYPE *) src; \
+ GLuint i; \
+ for (i = 0; i < n; i++) { \
+ TYPE value = s[INDEX]; \
+ if (sizeof(TYPE) == 2) { \
+ SWAP2BYTE(value); \
+ } \
+ else if (sizeof(TYPE) == 4) { \
+ SWAP4BYTE(value); \
+ } \
+ rgba[i][CHANNEL] = (GLfloat) CONVERSION(value); \
+ s += stride; \
+ } \
+ } \
+ else { \
+ const TYPE *s = (const TYPE *) src; \
+ GLuint i; \
+ for (i = 0; i < n; i++) { \
+ rgba[i][CHANNEL] = (GLfloat) CONVERSION(s[INDEX]); \
+ s += stride; \
+ } \
+ }
+
+ switch (srcType) {
+ case GL_UNSIGNED_BYTE:
+ PROCESS(redIndex, RCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT);
+ PROCESS(greenIndex, GCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT);
+ PROCESS(blueIndex, BCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT);
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLubyte, UBYTE_TO_FLOAT);
+ break;
+ case GL_BYTE:
+ PROCESS(redIndex, RCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT);
+ PROCESS(greenIndex, GCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT);
+ PROCESS(blueIndex, BCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT);
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLbyte, BYTE_TO_FLOAT);
+ break;
+ case GL_UNSIGNED_SHORT:
+ PROCESS(redIndex, RCOMP, 0.0F, GLushort, USHORT_TO_FLOAT);
+ PROCESS(greenIndex, GCOMP, 0.0F, GLushort, USHORT_TO_FLOAT);
+ PROCESS(blueIndex, BCOMP, 0.0F, GLushort, USHORT_TO_FLOAT);
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLushort, USHORT_TO_FLOAT);
+ break;
+ case GL_SHORT:
+ PROCESS(redIndex, RCOMP, 0.0F, GLshort, SHORT_TO_FLOAT);
+ PROCESS(greenIndex, GCOMP, 0.0F, GLshort, SHORT_TO_FLOAT);
+ PROCESS(blueIndex, BCOMP, 0.0F, GLshort, SHORT_TO_FLOAT);
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLshort, SHORT_TO_FLOAT);
+ break;
+ case GL_UNSIGNED_INT:
+ PROCESS(redIndex, RCOMP, 0.0F, GLuint, UINT_TO_FLOAT);
+ PROCESS(greenIndex, GCOMP, 0.0F, GLuint, UINT_TO_FLOAT);
+ PROCESS(blueIndex, BCOMP, 0.0F, GLuint, UINT_TO_FLOAT);
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLuint, UINT_TO_FLOAT);
+ break;
+ case GL_INT:
+ PROCESS(redIndex, RCOMP, 0.0F, GLint, INT_TO_FLOAT);
+ PROCESS(greenIndex, GCOMP, 0.0F, GLint, INT_TO_FLOAT);
+ PROCESS(blueIndex, BCOMP, 0.0F, GLint, INT_TO_FLOAT);
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLint, INT_TO_FLOAT);
+ break;
+ case GL_FLOAT:
+ PROCESS(redIndex, RCOMP, 0.0F, GLfloat, (GLfloat));
+ PROCESS(greenIndex, GCOMP, 0.0F, GLfloat, (GLfloat));
+ PROCESS(blueIndex, BCOMP, 0.0F, GLfloat, (GLfloat));
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLfloat, (GLfloat));
+ break;
+ case GL_HALF_FLOAT_ARB:
+ PROCESS(redIndex, RCOMP, 0.0F, GLhalfARB, _mesa_half_to_float);
+ PROCESS(greenIndex, GCOMP, 0.0F, GLhalfARB, _mesa_half_to_float);
+ PROCESS(blueIndex, BCOMP, 0.0F, GLhalfARB, _mesa_half_to_float);
+ PROCESS(alphaIndex, ACOMP, 1.0F, GLhalfARB, _mesa_half_to_float);
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ {
+ const GLubyte *ubsrc = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLubyte p = ubsrc[i];
+ rgba[i][rComp] = ((p >> 5) ) * (1.0F / 7.0F);
+ rgba[i][gComp] = ((p >> 2) & 0x7) * (1.0F / 7.0F);
+ rgba[i][bComp] = ((p ) & 0x3) * (1.0F / 3.0F);
+ rgba[i][aComp] = 1.0F;
+ }
+ }
+ break;
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ {
+ const GLubyte *ubsrc = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLubyte p = ubsrc[i];
+ rgba[i][rComp] = ((p ) & 0x7) * (1.0F / 7.0F);
+ rgba[i][gComp] = ((p >> 3) & 0x7) * (1.0F / 7.0F);
+ rgba[i][bComp] = ((p >> 6) ) * (1.0F / 3.0F);
+ rgba[i][aComp] = 1.0F;
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ if (swapBytes) {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ SWAP2BYTE(p);
+ rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F);
+ rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][aComp] = 1.0F;
+ }
+ }
+ else {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F);
+ rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][aComp] = 1.0F;
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ if (swapBytes) {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ SWAP2BYTE(p);
+ rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F);
+ rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F);
+ rgba[i][aComp] = 1.0F;
+ }
+ }
+ else {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F);
+ rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F);
+ rgba[i][aComp] = 1.0F;
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ if (swapBytes) {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ SWAP2BYTE(p);
+ rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F);
+ rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F);
+ rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F);
+ rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F);
+ }
+ }
+ else {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F);
+ rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F);
+ rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F);
+ rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F);
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ if (swapBytes) {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ SWAP2BYTE(p);
+ rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F);
+ rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F);
+ rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F);
+ rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F);
+ }
+ }
+ else {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F);
+ rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F);
+ rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F);
+ rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F);
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ if (swapBytes) {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ SWAP2BYTE(p);
+ rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F);
+ }
+ }
+ else {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F);
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ if (swapBytes) {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ SWAP2BYTE(p);
+ rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F);
+ }
+ }
+ else {
+ const GLushort *ussrc = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLushort p = ussrc[i];
+ rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F);
+ rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff);
+ rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
+ rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
+ rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) );
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) );
+ rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
+ rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
+ rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) );
+ rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
+ rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
+ rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff);
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff);
+ rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
+ rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
+ rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_10_10_10_2:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ SWAP4BYTE(p);
+ rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F);
+ rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F);
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F);
+ rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ SWAP4BYTE(p);
+ rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F);
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F);
+ rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F);
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "bad srcType in extract float data");
+ break;
+ }
+}
+
+
+/*
+ * Unpack a row of color image data from a client buffer according to
+ * the pixel unpacking parameters.
+ * Return GLchan values in the specified dest image format.
+ * This is used by glDrawPixels and glTexImage?D().
+ * \param ctx - the context
+ * n - number of pixels in the span
+ * dstFormat - format of destination color array
+ * dest - the destination color array
+ * srcFormat - source image format
+ * srcType - source image data type
+ * source - source image pointer
+ * srcPacking - pixel unpacking parameters
+ * transferOps - bitmask of IMAGE_*_BIT values of operations to apply
+ *
+ * XXX perhaps expand this to process whole images someday.
+ */
+void
+_mesa_unpack_color_span_chan( GLcontext *ctx,
+ GLuint n, GLenum dstFormat, GLchan dest[],
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps )
+{
+ ASSERT(dstFormat == GL_ALPHA ||
+ dstFormat == GL_LUMINANCE ||
+ dstFormat == GL_LUMINANCE_ALPHA ||
+ dstFormat == GL_INTENSITY ||
+ dstFormat == GL_RGB ||
+ dstFormat == GL_RGBA ||
+ dstFormat == GL_COLOR_INDEX);
+
+ ASSERT(srcFormat == GL_RED ||
+ srcFormat == GL_GREEN ||
+ srcFormat == GL_BLUE ||
+ srcFormat == GL_ALPHA ||
+ srcFormat == GL_LUMINANCE ||
+ srcFormat == GL_LUMINANCE_ALPHA ||
+ srcFormat == GL_INTENSITY ||
+ srcFormat == GL_RGB ||
+ srcFormat == GL_BGR ||
+ srcFormat == GL_RGBA ||
+ srcFormat == GL_BGRA ||
+ srcFormat == GL_ABGR_EXT ||
+ srcFormat == GL_COLOR_INDEX);
+
+ ASSERT(srcType == GL_BITMAP ||
+ srcType == GL_UNSIGNED_BYTE ||
+ srcType == GL_BYTE ||
+ srcType == GL_UNSIGNED_SHORT ||
+ srcType == GL_SHORT ||
+ srcType == GL_UNSIGNED_INT ||
+ srcType == GL_INT ||
+ srcType == GL_HALF_FLOAT_ARB ||
+ srcType == GL_FLOAT ||
+ srcType == GL_UNSIGNED_BYTE_3_3_2 ||
+ srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
+ srcType == GL_UNSIGNED_SHORT_5_6_5 ||
+ srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+ srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
+ srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8 ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
+ srcType == GL_UNSIGNED_INT_10_10_10_2 ||
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+
+ /* Try simple cases first */
+ if (transferOps == 0) {
+ if (srcType == CHAN_TYPE) {
+ if (dstFormat == GL_RGBA) {
+ if (srcFormat == GL_RGBA) {
+ MEMCPY( dest, source, n * 4 * sizeof(GLchan) );
+ return;
+ }
+ else if (srcFormat == GL_RGB) {
+ GLuint i;
+ const GLchan *src = (const GLchan *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ dst[3] = CHAN_MAX;
+ src += 3;
+ dst += 4;
+ }
+ return;
+ }
+ }
+ else if (dstFormat == GL_RGB) {
+ if (srcFormat == GL_RGB) {
+ MEMCPY( dest, source, n * 3 * sizeof(GLchan) );
+ return;
+ }
+ else if (srcFormat == GL_RGBA) {
+ GLuint i;
+ const GLchan *src = (const GLchan *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ src += 4;
+ dst += 3;
+ }
+ return;
+ }
+ }
+ else if (dstFormat == srcFormat) {
+ GLint comps = _mesa_components_in_format(srcFormat);
+ assert(comps > 0);
+ MEMCPY( dest, source, n * comps * sizeof(GLchan) );
+ return;
+ }
+ }
+ /*
+ * Common situation, loading 8bit RGBA/RGB source images
+ * into 16/32 bit destination. (OSMesa16/32)
+ */
+ else if (srcType == GL_UNSIGNED_BYTE) {
+ if (dstFormat == GL_RGBA) {
+ if (srcFormat == GL_RGB) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ dst[3] = CHAN_MAX;
+ src += 3;
+ dst += 4;
+ }
+ return;
+ }
+ else if (srcFormat == GL_RGBA) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ dst[3] = UBYTE_TO_CHAN(src[3]);
+ src += 4;
+ dst += 4;
+ }
+ return;
+ }
+ }
+ else if (dstFormat == GL_RGB) {
+ if (srcFormat == GL_RGB) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ src += 3;
+ dst += 3;
+ }
+ return;
+ }
+ else if (srcFormat == GL_RGBA) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ src += 4;
+ dst += 3;
+ }
+ return;
+ }
+ }
+ }
+ }
+
+
+ /* general solution begins here */
+ {
+ GLint dstComponents;
+ GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex;
+ GLint dstLuminanceIndex, dstIntensityIndex;
+ DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */
+ CHECKARRAY(rgba, return); /* mac 32k limitation */
+
+ dstComponents = _mesa_components_in_format( dstFormat );
+ /* source & dest image formats should have been error checked by now */
+ assert(dstComponents > 0);
+
+ /*
+ * Extract image data and convert to RGBA floats
+ */
+ assert(n <= MAX_WIDTH);
+ if (srcFormat == GL_COLOR_INDEX) {
+ GLuint indexes[MAX_WIDTH];
+ extract_uint_indexes(n, indexes, srcFormat, srcType, source,
+ srcPacking);
+
+ if (dstFormat == GL_COLOR_INDEX
+ && (transferOps & IMAGE_MAP_COLOR_BIT)) {
+ _mesa_map_ci(ctx, n, indexes);
+ }
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ _mesa_shift_and_offset_ci(ctx, n, indexes);
+ }
+
+ if (dstFormat == GL_COLOR_INDEX) {
+ /* convert to GLchan and return */
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dest[i] = (GLchan) (indexes[i] & 0xff);
+ }
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+ return;
+ }
+ else {
+ /* Convert indexes to RGBA */
+ _mesa_map_ci_to_rgba(ctx, n, indexes, rgba);
+ }
+
+ /* Don't do RGBA scale/bias or RGBA->RGBA mapping if starting
+ * with color indexes.
+ */
+ transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT);
+ }
+ else {
+ /* non-color index data */
+ extract_float_rgba(n, rgba, srcFormat, srcType, source,
+ srcPacking->SwapBytes);
+ }
+
+ /* Need to clamp if returning GLubytes or GLushorts */
+#if CHAN_TYPE != GL_FLOAT
+ transferOps |= IMAGE_CLAMP_BIT;
+#endif
+
+ if (transferOps) {
+ _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba);
+ }
+
+ /* Now determine which color channels we need to produce.
+ * And determine the dest index (offset) within each color tuple.
+ */
+ switch (dstFormat) {
+ case GL_ALPHA:
+ dstAlphaIndex = 0;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = -1;
+ dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ case GL_LUMINANCE:
+ dstLuminanceIndex = 0;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1;
+ dstIntensityIndex = -1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ dstLuminanceIndex = 0;
+ dstAlphaIndex = 1;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = -1;
+ dstIntensityIndex = -1;
+ break;
+ case GL_INTENSITY:
+ dstIntensityIndex = 0;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1;
+ dstLuminanceIndex = -1;
+ break;
+ case GL_RGB:
+ dstRedIndex = 0;
+ dstGreenIndex = 1;
+ dstBlueIndex = 2;
+ dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ case GL_RGBA:
+ dstRedIndex = 0;
+ dstGreenIndex = 1;
+ dstBlueIndex = 2;
+ dstAlphaIndex = 3;
+ dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ default:
+ _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_chan_span()");
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+ return;
+ }
+
+
+ /* Now return the GLchan data in the requested dstFormat */
+
+ if (dstRedIndex >= 0) {
+ GLchan *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ CLAMPED_FLOAT_TO_CHAN(dst[dstRedIndex], rgba[i][RCOMP]);
+ dst += dstComponents;
+ }
+ }
+
+ if (dstGreenIndex >= 0) {
+ GLchan *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ CLAMPED_FLOAT_TO_CHAN(dst[dstGreenIndex], rgba[i][GCOMP]);
+ dst += dstComponents;
+ }
+ }
+
+ if (dstBlueIndex >= 0) {
+ GLchan *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ CLAMPED_FLOAT_TO_CHAN(dst[dstBlueIndex], rgba[i][BCOMP]);
+ dst += dstComponents;
+ }
+ }
+
+ if (dstAlphaIndex >= 0) {
+ GLchan *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ CLAMPED_FLOAT_TO_CHAN(dst[dstAlphaIndex], rgba[i][ACOMP]);
+ dst += dstComponents;
+ }
+ }
+
+ if (dstIntensityIndex >= 0) {
+ GLchan *dst = dest;
+ GLuint i;
+ assert(dstIntensityIndex == 0);
+ assert(dstComponents == 1);
+ for (i = 0; i < n; i++) {
+ /* Intensity comes from red channel */
+ CLAMPED_FLOAT_TO_CHAN(dst[i], rgba[i][RCOMP]);
+ }
+ }
+
+ if (dstLuminanceIndex >= 0) {
+ GLchan *dst = dest;
+ GLuint i;
+ assert(dstLuminanceIndex == 0);
+ for (i = 0; i < n; i++) {
+ /* Luminance comes from red channel */
+ CLAMPED_FLOAT_TO_CHAN(dst[0], rgba[i][RCOMP]);
+ dst += dstComponents;
+ }
+ }
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+ }
+}
+
+
+/**
+ * Same as _mesa_unpack_color_span_chan(), but return GLfloat data
+ * instead of GLchan.
+ */
+void
+_mesa_unpack_color_span_float( GLcontext *ctx,
+ GLuint n, GLenum dstFormat, GLfloat dest[],
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps )
+{
+ ASSERT(dstFormat == GL_ALPHA ||
+ dstFormat == GL_LUMINANCE ||
+ dstFormat == GL_LUMINANCE_ALPHA ||
+ dstFormat == GL_INTENSITY ||
+ dstFormat == GL_RGB ||
+ dstFormat == GL_RGBA ||
+ dstFormat == GL_COLOR_INDEX);
+
+ ASSERT(srcFormat == GL_RED ||
+ srcFormat == GL_GREEN ||
+ srcFormat == GL_BLUE ||
+ srcFormat == GL_ALPHA ||
+ srcFormat == GL_LUMINANCE ||
+ srcFormat == GL_LUMINANCE_ALPHA ||
+ srcFormat == GL_INTENSITY ||
+ srcFormat == GL_RGB ||
+ srcFormat == GL_BGR ||
+ srcFormat == GL_RGBA ||
+ srcFormat == GL_BGRA ||
+ srcFormat == GL_ABGR_EXT ||
+ srcFormat == GL_COLOR_INDEX);
+
+ ASSERT(srcType == GL_BITMAP ||
+ srcType == GL_UNSIGNED_BYTE ||
+ srcType == GL_BYTE ||
+ srcType == GL_UNSIGNED_SHORT ||
+ srcType == GL_SHORT ||
+ srcType == GL_UNSIGNED_INT ||
+ srcType == GL_INT ||
+ srcType == GL_HALF_FLOAT_ARB ||
+ srcType == GL_FLOAT ||
+ srcType == GL_UNSIGNED_BYTE_3_3_2 ||
+ srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
+ srcType == GL_UNSIGNED_SHORT_5_6_5 ||
+ srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+ srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
+ srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8 ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
+ srcType == GL_UNSIGNED_INT_10_10_10_2 ||
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+
+ /* general solution, no special cases, yet */
+ {
+ GLint dstComponents;
+ GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex;
+ GLint dstLuminanceIndex, dstIntensityIndex;
+ DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */
+ CHECKARRAY(rgba, return); /* mac 32k limitation */
+
+ dstComponents = _mesa_components_in_format( dstFormat );
+ /* source & dest image formats should have been error checked by now */
+ assert(dstComponents > 0);
+
+ /*
+ * Extract image data and convert to RGBA floats
+ */
+ assert(n <= MAX_WIDTH);
+ if (srcFormat == GL_COLOR_INDEX) {
+ GLuint indexes[MAX_WIDTH];
+ extract_uint_indexes(n, indexes, srcFormat, srcType, source,
+ srcPacking);
+
+ if (dstFormat == GL_COLOR_INDEX
+ && (transferOps & IMAGE_MAP_COLOR_BIT)) {
+ _mesa_map_ci(ctx, n, indexes);
+ }
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ _mesa_shift_and_offset_ci(ctx, n, indexes);
+ }
+
+ if (dstFormat == GL_COLOR_INDEX) {
+ /* convert to GLchan and return */
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dest[i] = (GLchan) (indexes[i] & 0xff);
+ }
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+ return;
+ }
+ else {
+ /* Convert indexes to RGBA */
+ _mesa_map_ci_to_rgba(ctx, n, indexes, rgba);
+ }
+
+ /* Don't do RGBA scale/bias or RGBA->RGBA mapping if starting
+ * with color indexes.
+ */
+ transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT);
+ }
+ else {
+ /* non-color index data */
+ extract_float_rgba(n, rgba, srcFormat, srcType, source,
+ srcPacking->SwapBytes);
+ }
+
+ if (transferOps) {
+ _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba);
+ }
+
+ /* Now determine which color channels we need to produce.
+ * And determine the dest index (offset) within each color tuple.
+ */
+ switch (dstFormat) {
+ case GL_ALPHA:
+ dstAlphaIndex = 0;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = -1;
+ dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ case GL_LUMINANCE:
+ dstLuminanceIndex = 0;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1;
+ dstIntensityIndex = -1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ dstLuminanceIndex = 0;
+ dstAlphaIndex = 1;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = -1;
+ dstIntensityIndex = -1;
+ break;
+ case GL_INTENSITY:
+ dstIntensityIndex = 0;
+ dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1;
+ dstLuminanceIndex = -1;
+ break;
+ case GL_RGB:
+ dstRedIndex = 0;
+ dstGreenIndex = 1;
+ dstBlueIndex = 2;
+ dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ case GL_RGBA:
+ dstRedIndex = 0;
+ dstGreenIndex = 1;
+ dstBlueIndex = 2;
+ dstAlphaIndex = 3;
+ dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ default:
+ _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_color_span_float()");
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+ return;
+ }
+
+ /* Now pack results in the requested dstFormat */
+ if (dstRedIndex >= 0) {
+ GLfloat *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[dstRedIndex] = rgba[i][RCOMP];
+ dst += dstComponents;
+ }
+ }
+
+ if (dstGreenIndex >= 0) {
+ GLfloat *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[dstGreenIndex] = rgba[i][GCOMP];
+ dst += dstComponents;
+ }
+ }
+
+ if (dstBlueIndex >= 0) {
+ GLfloat *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[dstBlueIndex] = rgba[i][BCOMP];
+ dst += dstComponents;
+ }
+ }
+
+ if (dstAlphaIndex >= 0) {
+ GLfloat *dst = dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[dstAlphaIndex] = rgba[i][ACOMP];
+ dst += dstComponents;
+ }
+ }
+
+ if (dstIntensityIndex >= 0) {
+ GLfloat *dst = dest;
+ GLuint i;
+ assert(dstIntensityIndex == 0);
+ assert(dstComponents == 1);
+ for (i = 0; i < n; i++) {
+ /* Intensity comes from red channel */
+ dst[i] = rgba[i][RCOMP];
+ }
+ }
+
+ if (dstLuminanceIndex >= 0) {
+ GLfloat *dst = dest;
+ GLuint i;
+ assert(dstLuminanceIndex == 0);
+ for (i = 0; i < n; i++) {
+ /* Luminance comes from red channel */
+ dst[0] = rgba[i][RCOMP];
+ dst += dstComponents;
+ }
+ }
+ UNDEFARRAY(rgba); /* mac 32k limitation */
+ }
+}
+
+
+/*
+ * Unpack a row of color index data from a client buffer according to
+ * the pixel unpacking parameters.
+ * This is (or will be) used by glDrawPixels, glTexImage[123]D, etc.
+ *
+ * Args: ctx - the context
+ * n - number of pixels
+ * dstType - destination data type
+ * dest - destination array
+ * srcType - source pixel type
+ * source - source data pointer
+ * srcPacking - pixel unpacking parameters
+ * transferOps - the pixel transfer operations to apply
+ */
+void
+_mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest,
+ GLenum srcType, const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps )
+{
+ ASSERT(srcType == GL_BITMAP ||
+ srcType == GL_UNSIGNED_BYTE ||
+ srcType == GL_BYTE ||
+ srcType == GL_UNSIGNED_SHORT ||
+ srcType == GL_SHORT ||
+ srcType == GL_UNSIGNED_INT ||
+ srcType == GL_INT ||
+ srcType == GL_HALF_FLOAT_ARB ||
+ srcType == GL_FLOAT);
+
+ ASSERT(dstType == GL_UNSIGNED_BYTE ||
+ dstType == GL_UNSIGNED_SHORT ||
+ dstType == GL_UNSIGNED_INT);
+
+
+ transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
+
+ /*
+ * Try simple cases first
+ */
+ if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE
+ && dstType == GL_UNSIGNED_BYTE) {
+ MEMCPY(dest, source, n * sizeof(GLubyte));
+ }
+ else if (transferOps == 0 && srcType == GL_UNSIGNED_INT
+ && dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) {
+ MEMCPY(dest, source, n * sizeof(GLuint));
+ }
+ else {
+ /*
+ * general solution
+ */
+ GLuint indexes[MAX_WIDTH];
+ assert(n <= MAX_WIDTH);
+
+ extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source,
+ srcPacking);
+
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ /* shift and offset indexes */
+ _mesa_shift_and_offset_ci(ctx, n, indexes);
+ }
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ /* Apply lookup table */
+ _mesa_map_ci(ctx, n, indexes);
+ }
+
+ /* convert to dest type */
+ switch (dstType) {
+ case GL_UNSIGNED_BYTE:
+ {
+ GLubyte *dst = (GLubyte *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLubyte) (indexes[i] & 0xff);
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ {
+ GLuint *dst = (GLuint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLushort) (indexes[i] & 0xffff);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ MEMCPY(dest, indexes, n * sizeof(GLuint));
+ break;
+ default:
+ _mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span");
+ }
+ }
+}
+
+
+void
+_mesa_pack_index_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest, const GLuint *source,
+ const struct gl_pixelstore_attrib *dstPacking,
+ GLuint transferOps )
+{
+ GLuint indexes[MAX_WIDTH];
+
+ ASSERT(n <= MAX_WIDTH);
+
+ transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
+
+ if (transferOps & (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT)) {
+ /* make a copy of input */
+ MEMCPY(indexes, source, n * sizeof(GLuint));
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ _mesa_shift_and_offset_ci( ctx, n, indexes);
+ }
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ _mesa_map_ci(ctx, n, indexes);
+ }
+ source = indexes;
+ }
+
+ switch (dstType) {
+ case GL_UNSIGNED_BYTE:
+ {
+ GLubyte *dst = (GLubyte *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ *dst++ = (GLubyte) source[i];
+ }
+ }
+ break;
+ case GL_BYTE:
+ {
+ GLbyte *dst = (GLbyte *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLbyte) source[i];
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ {
+ GLushort *dst = (GLushort *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLushort) source[i];
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ case GL_SHORT:
+ {
+ GLshort *dst = (GLshort *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLshort) source[i];
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ {
+ GLuint *dst = (GLuint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLuint) source[i];
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_INT:
+ {
+ GLint *dst = (GLint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLint) source[i];
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_FLOAT:
+ {
+ GLfloat *dst = (GLfloat *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLfloat) source[i];
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ GLhalfARB *dst = (GLhalfARB *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = _mesa_float_to_half((GLfloat) source[i]);
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ default:
+ _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
+ }
+}
+
+
+/*
+ * Unpack a row of stencil data from a client buffer according to
+ * the pixel unpacking parameters.
+ * This is (or will be) used by glDrawPixels
+ *
+ * Args: ctx - the context
+ * n - number of pixels
+ * dstType - destination data type
+ * dest - destination array
+ * srcType - source pixel type
+ * source - source data pointer
+ * srcPacking - pixel unpacking parameters
+ * transferOps - apply offset/bias/lookup ops?
+ */
+void
+_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest,
+ GLenum srcType, const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps )
+{
+ ASSERT(srcType == GL_BITMAP ||
+ srcType == GL_UNSIGNED_BYTE ||
+ srcType == GL_BYTE ||
+ srcType == GL_UNSIGNED_SHORT ||
+ srcType == GL_SHORT ||
+ srcType == GL_UNSIGNED_INT ||
+ srcType == GL_INT ||
+ srcType == GL_HALF_FLOAT_ARB ||
+ srcType == GL_FLOAT);
+
+ ASSERT(dstType == GL_UNSIGNED_BYTE ||
+ dstType == GL_UNSIGNED_SHORT ||
+ dstType == GL_UNSIGNED_INT);
+
+ /* only shift and offset apply to stencil */
+ transferOps &= IMAGE_SHIFT_OFFSET_BIT;
+
+ /*
+ * Try simple cases first
+ */
+ if (transferOps == 0 &&
+ srcType == GL_UNSIGNED_BYTE &&
+ dstType == GL_UNSIGNED_BYTE) {
+ MEMCPY(dest, source, n * sizeof(GLubyte));
+ }
+ else if (transferOps == 0 &&
+ srcType == GL_UNSIGNED_INT &&
+ dstType == GL_UNSIGNED_INT &&
+ !srcPacking->SwapBytes) {
+ MEMCPY(dest, source, n * sizeof(GLuint));
+ }
+ else {
+ /*
+ * general solution
+ */
+ GLuint indexes[MAX_WIDTH];
+ assert(n <= MAX_WIDTH);
+
+ extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source,
+ srcPacking);
+
+ if (transferOps) {
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ /* shift and offset indexes */
+ _mesa_shift_and_offset_ci(ctx, n, indexes);
+ }
+
+ if (ctx->Pixel.MapStencilFlag) {
+ /* Apply stencil lookup table */
+ GLuint mask = ctx->Pixel.MapStoSsize - 1;
+ GLuint i;
+ for (i=0;iPixel.MapStoS[ indexes[i] & mask ];
+ }
+ }
+ }
+
+ /* convert to dest type */
+ switch (dstType) {
+ case GL_UNSIGNED_BYTE:
+ {
+ GLubyte *dst = (GLubyte *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLubyte) (indexes[i] & 0xff);
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ {
+ GLuint *dst = (GLuint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (GLushort) (indexes[i] & 0xffff);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ MEMCPY(dest, indexes, n * sizeof(GLuint));
+ break;
+ default:
+ _mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
+ }
+ }
+}
+
+
+void
+_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest, const GLstencil *source,
+ const struct gl_pixelstore_attrib *dstPacking )
+{
+ GLstencil stencil[MAX_WIDTH];
+
+ ASSERT(n <= MAX_WIDTH);
+
+ if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset ||
+ ctx->Pixel.MapStencilFlag) {
+ /* make a copy of input */
+ MEMCPY(stencil, source, n * sizeof(GLstencil));
+ if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) {
+ _mesa_shift_and_offset_stencil( ctx, n, stencil );
+ }
+ if (ctx->Pixel.MapStencilFlag) {
+ _mesa_map_stencil( ctx, n, stencil );
+ }
+ source = stencil;
+ }
+
+ switch (dstType) {
+ case GL_UNSIGNED_BYTE:
+ if (sizeof(GLstencil) == 8) {
+ MEMCPY( dest, source, n );
+ }
+ else {
+ GLubyte *dst = (GLubyte *) dest;
+ GLuint i;
+ for (i=0;iSwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ case GL_SHORT:
+ {
+ GLshort *dst = (GLshort *) dest;
+ GLuint i;
+ for (i=0;iSwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ {
+ GLuint *dst = (GLuint *) dest;
+ GLuint i;
+ for (i=0;iSwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_INT:
+ {
+ GLint *dst = (GLint *) dest;
+ GLuint i;
+ for (i=0;iSwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_FLOAT:
+ {
+ GLfloat *dst = (GLfloat *) dest;
+ GLuint i;
+ for (i=0;iSwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ GLhalfARB *dst = (GLhalfARB *) dest;
+ GLuint i;
+ for (i=0;iSwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ case GL_BITMAP:
+ if (dstPacking->LsbFirst) {
+ GLubyte *dst = (GLubyte *) dest;
+ GLint shift = 0;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ if (shift == 0)
+ *dst = 0;
+ *dst |= ((source[i] != 0) << shift);
+ shift++;
+ if (shift == 8) {
+ shift = 0;
+ dst++;
+ }
+ }
+ }
+ else {
+ GLubyte *dst = (GLubyte *) dest;
+ GLint shift = 7;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ if (shift == 7)
+ *dst = 0;
+ *dst |= ((source[i] != 0) << shift);
+ shift--;
+ if (shift < 0) {
+ shift = 7;
+ dst++;
+ }
+ }
+ }
+ break;
+ default:
+ _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
+ }
+}
+
+
+void
+_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
+ GLenum srcType, const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking )
+{
+ (void) srcPacking;
+
+ switch (srcType) {
+ case GL_BYTE:
+ {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ for (i = 0; i < n; i++) {
+ dest[i] = BYTE_TO_FLOAT(src[i]);
+ }
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ for (i = 0; i < n; i++) {
+ dest[i] = UBYTE_TO_FLOAT(src[i]);
+ }
+ }
+ break;
+ case GL_SHORT:
+ {
+ GLuint i;
+ const GLshort *src = (const GLshort *) source;
+ for (i = 0; i < n; i++) {
+ dest[i] = SHORT_TO_FLOAT(src[i]);
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ {
+ GLuint i;
+ const GLushort *src = (const GLushort *) source;
+ for (i = 0; i < n; i++) {
+ dest[i] = USHORT_TO_FLOAT(src[i]);
+ }
+ }
+ break;
+ case GL_INT:
+ {
+ GLuint i;
+ const GLint *src = (const GLint *) source;
+ for (i = 0; i < n; i++) {
+ dest[i] = INT_TO_FLOAT(src[i]);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ {
+ GLuint i;
+ const GLuint *src = (const GLuint *) source;
+ for (i = 0; i < n; i++) {
+ dest[i] = UINT_TO_FLOAT(src[i]);
+ }
+ }
+ break;
+ case GL_FLOAT:
+ MEMCPY(dest, source, n * sizeof(GLfloat));
+ break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ GLuint i;
+ const GLhalfARB *src = (const GLhalfARB *) source;
+ for (i = 0; i < n; i++) {
+ dest[i] = _mesa_half_to_float(src[i]);
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()");
+ return;
+ }
+
+
+ /* apply depth scale and bias and clamp to [0,1] */
+ if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLfloat d = dest[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
+ dest[i] = CLAMP(d, 0.0F, 1.0F);
+ }
+ }
+}
+
+
+/*
+ * Pack an array of depth values. The values are floats in [0,1].
+ */
+void
+_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
+ GLenum dstType, const GLfloat *depthSpan,
+ const struct gl_pixelstore_attrib *dstPacking )
+{
+ GLfloat depthCopy[MAX_WIDTH];
+ const GLboolean bias_or_scale = ctx->Pixel.DepthBias != 0.0 ||
+ ctx->Pixel.DepthScale != 1.0;
+
+ ASSERT(n <= MAX_WIDTH);
+
+ if (bias_or_scale) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLfloat d;
+ d = depthSpan[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
+ depthCopy[i] = CLAMP(d, 0.0F, 1.0F);
+ }
+ depthSpan = depthCopy;
+ }
+
+ switch (dstType) {
+ case GL_UNSIGNED_BYTE:
+ {
+ GLubyte *dst = (GLubyte *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = FLOAT_TO_UBYTE( depthSpan[i] );
+ }
+ }
+ break;
+ case GL_BYTE:
+ {
+ GLbyte *dst = (GLbyte *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = FLOAT_TO_BYTE( depthSpan[i] );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ {
+ GLushort *dst = (GLushort *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = FLOAT_TO_USHORT( depthSpan[i] );
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ case GL_SHORT:
+ {
+ GLshort *dst = (GLshort *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = FLOAT_TO_SHORT( depthSpan[i] );
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ {
+ GLuint *dst = (GLuint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = FLOAT_TO_UINT( depthSpan[i] );
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_INT:
+ {
+ GLint *dst = (GLint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = FLOAT_TO_INT( depthSpan[i] );
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_FLOAT:
+ {
+ GLfloat *dst = (GLfloat *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = depthSpan[i];
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ }
+ break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ GLhalfARB *dst = (GLhalfARB *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = _mesa_float_to_half(depthSpan[i]);
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap2( (GLushort *) dst, n );
+ }
+ }
+ break;
+ default:
+ _mesa_problem(ctx, "bad type in _mesa_pack_depth_span");
+ }
+}
+
+
+/**
+ * Unpack image data. Apply byte swapping, byte flipping (bitmap).
+ * Return all image data in a contiguous block. This is used when we
+ * compile glDrawPixels, glTexImage, etc into a display list. We
+ * need a copy of the data in a standard format.
+ */
+void *
+_mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *unpack )
+{
+ GLint bytesPerRow, compsPerRow;
+ GLboolean flipBytes, swap2, swap4;
+
+ if (!pixels)
+ return NULL; /* not necessarily an error */
+
+ if (width <= 0 || height <= 0 || depth <= 0)
+ return NULL; /* generate error later */
+
+ if (format == GL_BITMAP) {
+ bytesPerRow = (width + 7) >> 3;
+ flipBytes = !unpack->LsbFirst;
+ swap2 = swap4 = GL_FALSE;
+ compsPerRow = 0;
+ }
+ else {
+ const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
+ const GLint components = _mesa_components_in_format(format);
+ GLint bytesPerComp;
+ if (bytesPerPixel <= 0 || components <= 0)
+ return NULL; /* bad format or type. generate error later */
+ bytesPerRow = bytesPerPixel * width;
+ bytesPerComp = bytesPerPixel / components;
+ flipBytes = GL_FALSE;
+ swap2 = (bytesPerComp == 2) && unpack->SwapBytes;
+ swap4 = (bytesPerComp == 4) && unpack->SwapBytes;
+ compsPerRow = components * width;
+ assert(compsPerRow >= width);
+ }
+
+ {
+ GLubyte *destBuffer = (GLubyte *) MALLOC(bytesPerRow * height * depth);
+ GLubyte *dst;
+ GLint img, row;
+ if (!destBuffer)
+ return NULL; /* generate GL_OUT_OF_MEMORY later */
+
+ dst = destBuffer;
+ for (img = 0; img < depth; img++) {
+ for (row = 0; row < height; row++) {
+ const GLvoid *src = _mesa_image_address(unpack, pixels,
+ width, height, format, type, img, row, 0);
+ MEMCPY(dst, src, bytesPerRow);
+ /* byte flipping/swapping */
+ if (flipBytes) {
+ flip_bytes((GLubyte *) dst, bytesPerRow);
+ }
+ else if (swap2) {
+ _mesa_swap2((GLushort*) dst, compsPerRow);
+ }
+ else if (swap4) {
+ _mesa_swap4((GLuint*) dst, compsPerRow);
+ }
+ dst += bytesPerRow;
+ }
+ }
+ return destBuffer;
+ }
+}
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/image.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/image.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/image.h Fri Dec 10 10:05:25 2004
@@ -0,0 +1,179 @@
+/**
+ * \file image.h
+ * Image handling.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef IMAGE_H
+#define IMAGE_H
+
+
+#include "mtypes.h"
+
+
+extern void
+_mesa_swap2( GLushort *p, GLuint n );
+
+extern void
+_mesa_swap4( GLuint *p, GLuint n );
+
+extern GLint
+_mesa_sizeof_type( GLenum type );
+
+extern GLint
+_mesa_sizeof_packed_type( GLenum type );
+
+extern GLint
+_mesa_components_in_format( GLenum format );
+
+extern GLint
+_mesa_bytes_per_pixel( GLenum format, GLenum type );
+
+extern GLboolean
+_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type );
+
+
+extern GLvoid *
+_mesa_image_address( const struct gl_pixelstore_attrib *packing,
+ const GLvoid *image, GLsizei width,
+ GLsizei height, GLenum format, GLenum type,
+ GLint img, GLint row, GLint column );
+
+
+extern GLint
+_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
+ GLint width, GLenum format, GLenum type );
+
+
+extern GLint
+_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
+ GLint width, GLint height,
+ GLenum format, GLenum type );
+
+extern void
+_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
+ const struct gl_pixelstore_attrib *unpacking );
+
+
+extern void
+_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
+ const struct gl_pixelstore_attrib *packing );
+
+
+extern GLvoid *
+_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
+ const struct gl_pixelstore_attrib *packing );
+
+extern void
+_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
+ GLubyte *dest, const struct gl_pixelstore_attrib *packing );
+
+
+extern void
+_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLuint transferOps,
+ GLuint n, GLfloat rgba[][4]);
+
+extern void
+_mesa_pack_rgba_span_float( GLcontext *ctx,
+ GLuint n, CONST GLfloat rgba[][4],
+ GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
+ const struct gl_pixelstore_attrib *dstPacking,
+ GLuint transferOps );
+
+
+extern void
+_mesa_pack_rgba_span_chan( GLcontext *ctx,
+ GLuint n, CONST GLchan rgba[][4],
+ GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
+ const struct gl_pixelstore_attrib *dstPacking,
+ GLuint transferOps );
+
+
+extern void
+_mesa_unpack_color_span_chan( GLcontext *ctx,
+ GLuint n, GLenum dstFormat, GLchan dest[],
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps );
+
+
+extern void
+_mesa_unpack_color_span_float( GLcontext *ctx,
+ GLuint n, GLenum dstFormat, GLfloat dest[],
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps );
+
+
+extern void
+_mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest,
+ GLenum srcType, const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps );
+
+
+extern void
+_mesa_pack_index_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest, const GLuint *source,
+ const struct gl_pixelstore_attrib *dstPacking,
+ GLuint transferOps );
+
+
+extern void
+_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest,
+ GLenum srcType, const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps );
+
+extern void
+_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
+ GLenum dstType, GLvoid *dest, const GLstencil *source,
+ const struct gl_pixelstore_attrib *dstPacking );
+
+
+extern void
+_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
+ GLenum srcType, const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking );
+
+extern void
+_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
+ GLenum dstType, const GLfloat *depthSpan,
+ const struct gl_pixelstore_attrib *dstPacking );
+
+
+extern void *
+_mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *unpack );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/imports.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/imports.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/imports.c Fri Dec 10 10:32:28 2004
@@ -0,0 +1,1197 @@
+/**
+ * \file imports.c
+ * Standard C library function wrappers.
+ *
+ * Imports are services which the device driver or window system or
+ * operating system provides to the core renderer. The core renderer (Mesa)
+ * will call these functions in order to do memory allocation, simple I/O,
+ * etc.
+ *
+ * Some drivers will want to override/replace this file with something
+ * specialized, but that'll be rare.
+ *
+ * Eventually, I want to move roll the glheader.h file into this.
+ *
+ * The OpenGL SI's __GLimports structure allows per-context specification of
+ * replacements for the standard C lib functions. In practice that's probably
+ * never needed; compile-time replacements are far more likely.
+ *
+ * The _mesa_*() functions defined here don't in general take a context
+ * parameter. I guess we can change that someday, if need be.
+ * So for now, the __GLimports stuff really isn't used.
+ *
+ * \todo Functions still needed:
+ * - scanf
+ * - qsort
+ * - bsearch
+ * - rand and RAND_MAX
+ *
+ * \note When compiled into a XFree86 module these functions wrap around
+ * XFree86 own wrappers.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#include "imports.h"
+#include "context.h"
+#include "version.h"
+
+
+#define MAXSTRING 4000 /* for vsnprintf() */
+
+#ifdef WIN32
+#define vsnprintf _vsnprintf
+#elif defined(__IBMC__) || defined(__IBMCPP__) || ( defined(__VMS) && __CRTL_VER < 70312000 )
+extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
+#ifdef __VMS
+#include "vsnprintf.c"
+#endif
+#endif
+
+
+/**********************************************************************/
+/** \name Memory */
+/*@{*/
+
+/** Wrapper around either malloc() or xf86malloc() */
+void *
+_mesa_malloc(size_t bytes)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86malloc(bytes);
+#else
+ return malloc(bytes);
+#endif
+}
+
+/** Wrapper around either calloc() or xf86calloc() */
+void *
+_mesa_calloc(size_t bytes)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86calloc(1, bytes);
+#else
+ return calloc(1, bytes);
+#endif
+}
+
+/** Wrapper around either free() or xf86free() */
+void
+_mesa_free(void *ptr)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86free(ptr);
+#else
+ free(ptr);
+#endif
+}
+
+/**
+ * Allocate aligned memory.
+ *
+ * \param bytes number of bytes to allocate.
+ * \param alignment alignment (must be greater than zero).
+ *
+ * Allocates extra memory to accommodate rounding up the address for
+ * alignment and to record the real malloc address.
+ *
+ * \sa _mesa_align_free().
+ */
+void *
+_mesa_align_malloc(size_t bytes, unsigned long alignment)
+{
+ unsigned long ptr, buf;
+
+ ASSERT( alignment > 0 );
+
+ ptr = (unsigned long) _mesa_malloc(bytes + alignment + sizeof(void *));
+ if (!ptr)
+ return NULL;
+
+ buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1);
+ *(unsigned long *)(buf - sizeof(void *)) = ptr;
+
+#ifdef DEBUG
+ /* mark the non-aligned area */
+ while ( ptr < buf - sizeof(void *) ) {
+ *(unsigned long *)ptr = 0xcdcdcdcd;
+ ptr += sizeof(unsigned long);
+ }
+#endif
+
+ return (void *) buf;
+}
+
+/** Same as _mesa_align_malloc(), but using _mesa_calloc() instead of
+ * _mesa_malloc() */
+void *
+_mesa_align_calloc(size_t bytes, unsigned long alignment)
+{
+ unsigned long ptr, buf;
+
+ ASSERT( alignment > 0 );
+
+ ptr = (unsigned long) _mesa_calloc(bytes + alignment + sizeof(void *));
+ if (!ptr)
+ return NULL;
+
+ buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1);
+ *(unsigned long *)(buf - sizeof(void *)) = ptr;
+
+#ifdef DEBUG
+ /* mark the non-aligned area */
+ while ( ptr < buf - sizeof(void *) ) {
+ *(unsigned long *)ptr = 0xcdcdcdcd;
+ ptr += sizeof(unsigned long);
+ }
+#endif
+
+ return (void *)buf;
+}
+
+/**
+ * Free memory allocated with _mesa_align_malloc() or _mesa_align_calloc().
+ *
+ * \param ptr pointer to the memory to be freed.
+ *
+ * The actual address to free is stored in the word immediately before the
+ * address the client sees.
+ */
+void
+_mesa_align_free(void *ptr)
+{
+#if 0
+ _mesa_free( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) );
+#else
+ void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
+ void *realAddr = *cubbyHole;
+ _mesa_free(realAddr);
+#endif
+}
+
+/** Wrapper around either memcpy() or xf86memcpy() */
+void *
+_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
+{
+ const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
+ void *newBuffer = _mesa_malloc(newSize);
+ if (newBuffer && copySize > 0)
+ _mesa_memcpy(newBuffer, oldBuffer, copySize);
+ if (oldBuffer)
+ _mesa_free(oldBuffer);
+ return newBuffer;
+}
+
+
+void *
+_mesa_memcpy(void *dest, const void *src, size_t n)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86memcpy(dest, src, n);
+#elif defined(SUNOS4)
+ return memcpy((char *) dest, (char *) src, (int) n);
+#else
+ return memcpy(dest, src, n);
+#endif
+}
+
+/** Wrapper around either memset() or xf86memset() */
+void
+_mesa_memset( void *dst, int val, size_t n )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86memset( dst, val, n );
+#elif defined(SUNOS4)
+ memset( (char *) dst, (int) val, (int) n );
+#else
+ memset(dst, val, n);
+#endif
+}
+
+/** Fill memory with a constant 16bit word.
+ *
+ * \param dst destination pointer.
+ * \param val value.
+ * \param n number of words.
+ */
+void
+_mesa_memset16( unsigned short *dst, unsigned short val, size_t n )
+{
+ while (n-- > 0)
+ *dst++ = val;
+}
+
+/** Wrapper around either memcpy() or xf86memcpy() or bzero() */
+void
+_mesa_bzero( void *dst, size_t n )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86memset( dst, 0, n );
+#elif defined(__FreeBSD__)
+ bzero( dst, n );
+#else
+ memset( dst, 0, n );
+#endif
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Math */
+/*@{*/
+
+/** Wrapper around either sin() or xf86sin() */
+double
+_mesa_sin(double a)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86sin(a);
+#else
+ return sin(a);
+#endif
+}
+
+/** Wrapper around either cos() or xf86cos() */
+double
+_mesa_cos(double a)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86cos(a);
+#else
+ return cos(a);
+#endif
+}
+
+/** Wrapper around either sqrt() or xf86sqrt() */
+double
+_mesa_sqrtd(double x)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86sqrt(x);
+#else
+ return sqrt(x);
+#endif
+}
+
+
+/*
+ * A High Speed, Low Precision Square Root
+ * by Paul Lalonde and Robert Dawson
+ * from "Graphics Gems", Academic Press, 1990
+ *
+ * SPARC implementation of a fast square root by table
+ * lookup.
+ * SPARC floating point format is as follows:
+ *
+ * BIT 31 30 23 22 0
+ * sign exponent mantissa
+ */
+static short sqrttab[0x100]; /* declare table of square roots */
+
+static void init_sqrt_table(void)
+{
+#if defined(USE_IEEE) && !defined(DEBUG)
+ unsigned short i;
+ fi_type fi; /* to access the bits of a float in C quickly */
+ /* we use a union defined in glheader.h */
+
+ for(i=0; i<= 0x7f; i++) {
+ fi.i = 0;
+
+ /*
+ * Build a float with the bit pattern i as mantissa
+ * and an exponent of 0, stored as 127
+ */
+
+ fi.i = (i << 16) | (127 << 23);
+ fi.f = _mesa_sqrtd(fi.f);
+
+ /*
+ * Take the square root then strip the first 7 bits of
+ * the mantissa into the table
+ */
+
+ sqrttab[i] = (fi.i & 0x7fffff) >> 16;
+
+ /*
+ * Repeat the process, this time with an exponent of
+ * 1, stored as 128
+ */
+
+ fi.i = 0;
+ fi.i = (i << 16) | (128 << 23);
+ fi.f = sqrt(fi.f);
+ sqrttab[i+0x80] = (fi.i & 0x7fffff) >> 16;
+ }
+#else
+ (void) sqrttab; /* silence compiler warnings */
+#endif /*HAVE_FAST_MATH*/
+}
+
+
+/**
+ * Single precision square root.
+ */
+float
+_mesa_sqrtf( float x )
+{
+#if defined(USE_IEEE) && !defined(DEBUG)
+ fi_type num;
+ /* to access the bits of a float in C
+ * we use a union from glheader.h */
+
+ short e; /* the exponent */
+ if (x == 0.0F) return 0.0F; /* check for square root of 0 */
+ num.f = x;
+ e = (num.i >> 23) - 127; /* get the exponent - on a SPARC the */
+ /* exponent is stored with 127 added */
+ num.i &= 0x7fffff; /* leave only the mantissa */
+ if (e & 0x01) num.i |= 0x800000;
+ /* the exponent is odd so we have to */
+ /* look it up in the second half of */
+ /* the lookup table, so we set the */
+ /* high bit */
+ e >>= 1; /* divide the exponent by two */
+ /* note that in C the shift */
+ /* operators are sign preserving */
+ /* for signed operands */
+ /* Do the table lookup, based on the quaternary mantissa,
+ * then reconstruct the result back into a float
+ */
+ num.i = ((sqrttab[num.i >> 16]) << 16) | ((e + 127) << 23);
+
+ return num.f;
+#else
+ return (float) _mesa_sqrtd((double) x);
+#endif
+}
+
+
+/**
+ inv_sqrt - A single precision 1/sqrt routine for IEEE format floats.
+ written by Josh Vanderhoof, based on newsgroup posts by James Van Buskirk
+ and Vesa Karvonen.
+*/
+float
+_mesa_inv_sqrtf(float n)
+{
+#if defined(USE_IEEE) && !defined(DEBUG)
+ float r0, x0, y0;
+ float r1, x1, y1;
+ float r2, x2, y2;
+#if 0 /* not used, see below -BP */
+ float r3, x3, y3;
+#endif
+ union { float f; unsigned int i; } u;
+ unsigned int magic;
+
+ /*
+ Exponent part of the magic number -
+
+ We want to:
+ 1. subtract the bias from the exponent,
+ 2. negate it
+ 3. divide by two (rounding towards -inf)
+ 4. add the bias back
+
+ Which is the same as subtracting the exponent from 381 and dividing
+ by 2.
+
+ floor(-(x - 127) / 2) + 127 = floor((381 - x) / 2)
+ */
+
+ magic = 381 << 23;
+
+ /*
+ Significand part of magic number -
+
+ With the current magic number, "(magic - u.i) >> 1" will give you:
+
+ for 1 <= u.f <= 2: 1.25 - u.f / 4
+ for 2 <= u.f <= 4: 1.00 - u.f / 8
+
+ This isn't a bad approximation of 1/sqrt. The maximum difference from
+ 1/sqrt will be around .06. After three Newton-Raphson iterations, the
+ maximum difference is less than 4.5e-8. (Which is actually close
+ enough to make the following bias academic...)
+
+ To get a better approximation you can add a bias to the magic
+ number. For example, if you subtract 1/2 of the maximum difference in
+ the first approximation (.03), you will get the following function:
+
+ for 1 <= u.f <= 2: 1.22 - u.f / 4
+ for 2 <= u.f <= 3.76: 0.97 - u.f / 8
+ for 3.76 <= u.f <= 4: 0.72 - u.f / 16
+ (The 3.76 to 4 range is where the result is < .5.)
+
+ This is the closest possible initial approximation, but with a maximum
+ error of 8e-11 after three NR iterations, it is still not perfect. If
+ you subtract 0.0332281 instead of .03, the maximum error will be
+ 2.5e-11 after three NR iterations, which should be about as close as
+ is possible.
+
+ for 1 <= u.f <= 2: 1.2167719 - u.f / 4
+ for 2 <= u.f <= 3.73: 0.9667719 - u.f / 8
+ for 3.73 <= u.f <= 4: 0.7167719 - u.f / 16
+
+ */
+
+ magic -= (int)(0.0332281 * (1 << 25));
+
+ u.f = n;
+ u.i = (magic - u.i) >> 1;
+
+ /*
+ Instead of Newton-Raphson, we use Goldschmidt's algorithm, which
+ allows more parallelism. From what I understand, the parallelism
+ comes at the cost of less precision, because it lets error
+ accumulate across iterations.
+ */
+ x0 = 1.0f;
+ y0 = 0.5f * n;
+ r0 = u.f;
+
+ x1 = x0 * r0;
+ y1 = y0 * r0 * r0;
+ r1 = 1.5f - y1;
+
+ x2 = x1 * r1;
+ y2 = y1 * r1 * r1;
+ r2 = 1.5f - y2;
+
+#if 1
+ return x2 * r2; /* we can stop here, and be conformant -BP */
+#else
+ x3 = x2 * r2;
+ y3 = y2 * r2 * r2;
+ r3 = 1.5f - y3;
+
+ return x3 * r3;
+#endif
+#elif defined(XFree86LOADER) && defined(IN_MODULE)
+ return 1.0F / xf86sqrt(n);
+#else
+ return (float) (1.0 / sqrt(n));
+#endif
+}
+
+
+/**
+ * Wrapper around either pow() or xf86pow().
+ */
+double
+_mesa_pow(double x, double y)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86pow(x, y);
+#else
+ return pow(x, y);
+#endif
+}
+
+
+/**
+ * Return number of bits set in given GLuint.
+ */
+unsigned int
+_mesa_bitcount(unsigned int n)
+{
+ unsigned int bits;
+ for (bits = 0; n > 0; n = n >> 1) {
+ bits += (n & 1);
+ }
+ return bits;
+}
+
+
+/**
+ * Convert a 4-byte float to a 2-byte half float.
+ * Based on code from:
+ * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
+ */
+GLhalfARB
+_mesa_float_to_half(float val)
+{
+ const int flt = *((int *) (void *) &val);
+ const int flt_m = flt & 0x7fffff;
+ const int flt_e = (flt >> 23) & 0xff;
+ const int flt_s = (flt >> 31) & 0x1;
+ int s, e, m = 0;
+ GLhalfARB result;
+
+ /* sign bit */
+ s = flt_s;
+
+ /* handle special cases */
+ if ((flt_e == 0) && (flt_m == 0)) {
+ /* zero */
+ /* m = 0; - already set */
+ e = 0;
+ }
+ else if ((flt_e == 0) && (flt_m != 0)) {
+ /* denorm -- denorm float maps to 0 half */
+ /* m = 0; - already set */
+ e = 0;
+ }
+ else if ((flt_e == 0xff) && (flt_m == 0)) {
+ /* infinity */
+ /* m = 0; - already set */
+ e = 31;
+ }
+ else if ((flt_e == 0xff) && (flt_m != 0)) {
+ /* NaN */
+ m = 1;
+ e = 31;
+ }
+ else {
+ /* regular number */
+ const int new_exp = flt_e - 127;
+ if (new_exp < -24) {
+ /* this maps to 0 */
+ /* m = 0; - already set */
+ e = 0;
+ }
+ else if (new_exp < -14) {
+ /* this maps to a denorm */
+ unsigned int exp_val = (unsigned int) (-14 - new_exp); /* 2^-exp_val*/
+ e = 0;
+ switch (exp_val) {
+ case 0:
+ _mesa_warning(NULL,
+ "float_to_half: logical error in denorm creation!\n");
+ /* m = 0; - already set */
+ break;
+ case 1: m = 512 + (flt_m >> 14); break;
+ case 2: m = 256 + (flt_m >> 15); break;
+ case 3: m = 128 + (flt_m >> 16); break;
+ case 4: m = 64 + (flt_m >> 17); break;
+ case 5: m = 32 + (flt_m >> 18); break;
+ case 6: m = 16 + (flt_m >> 19); break;
+ case 7: m = 8 + (flt_m >> 20); break;
+ case 8: m = 4 + (flt_m >> 21); break;
+ case 9: m = 2 + (flt_m >> 22); break;
+ case 10: m = 1; break;
+ }
+ }
+ else if (new_exp > 15) {
+ /* map this value to infinity */
+ /* m = 0; - already set */
+ e = 31;
+ }
+ else {
+ /* regular */
+ e = new_exp + 15;
+ m = flt_m >> 13;
+ }
+ }
+
+ result = (s << 15) | (e << 10) | m;
+ return result;
+}
+
+
+/**
+ * Convert a 2-byte half float to a 4-byte float.
+ * Based on code from:
+ * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
+ */
+float
+_mesa_half_to_float(GLhalfARB val)
+{
+ /* XXX could also use a 64K-entry lookup table */
+ const int m = val & 0x3ff;
+ const int e = (val >> 10) & 0x1f;
+ const int s = (val >> 15) & 0x1;
+ int flt_m, flt_e, flt_s, flt;
+ float result;
+
+ /* sign bit */
+ flt_s = s;
+
+ /* handle special cases */
+ if ((e == 0) && (m == 0)) {
+ /* zero */
+ flt_m = 0;
+ flt_e = 0;
+ }
+ else if ((e == 0) && (m != 0)) {
+ /* denorm -- denorm half will fit in non-denorm single */
+ const float half_denorm = 1.0f / 16384.0f; /* 2^-14 */
+ float mantissa = ((float) (m)) / 1024.0f;
+ float sign = s ? -1.0f : 1.0f;
+ return sign * mantissa * half_denorm;
+ }
+ else if ((e == 31) && (m == 0)) {
+ /* infinity */
+ flt_e = 0xff;
+ flt_m = 0;
+ }
+ else if ((e == 31) && (m != 0)) {
+ /* NaN */
+ flt_e = 0xff;
+ flt_m = 1;
+ }
+ else {
+ /* regular */
+ flt_e = e + 112;
+ flt_m = m << 13;
+ }
+
+ flt = (flt_s << 31) | (flt_e << 23) | flt_m;
+ result = *((float *) (void *) &flt);
+ return result;
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Environment vars */
+/*@{*/
+
+/**
+ * Wrapper for getenv().
+ */
+char *
+_mesa_getenv( const char *var )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86getenv(var);
+#else
+ return getenv(var);
+#endif
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name String */
+/*@{*/
+
+/** Wrapper around either strstr() or xf86strstr() */
+char *
+_mesa_strstr( const char *haystack, const char *needle )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strstr(haystack, needle);
+#else
+ return strstr(haystack, needle);
+#endif
+}
+
+/** Wrapper around either strncat() or xf86strncat() */
+char *
+_mesa_strncat( char *dest, const char *src, size_t n )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strncat(dest, src, n);
+#else
+ return strncat(dest, src, n);
+#endif
+}
+
+/** Wrapper around either strcpy() or xf86strcpy() */
+char *
+_mesa_strcpy( char *dest, const char *src )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strcpy(dest, src);
+#else
+ return strcpy(dest, src);
+#endif
+}
+
+/** Wrapper around either strncpy() or xf86strncpy() */
+char *
+_mesa_strncpy( char *dest, const char *src, size_t n )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strncpy(dest, src, n);
+#else
+ return strncpy(dest, src, n);
+#endif
+}
+
+/** Wrapper around either strlen() or xf86strlen() */
+size_t
+_mesa_strlen( const char *s )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strlen(s);
+#else
+ return strlen(s);
+#endif
+}
+
+/** Wrapper around either strcmp() or xf86strcmp() */
+int
+_mesa_strcmp( const char *s1, const char *s2 )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strcmp(s1, s2);
+#else
+ return strcmp(s1, s2);
+#endif
+}
+
+/** Wrapper around either strncmp() or xf86strncmp() */
+int
+_mesa_strncmp( const char *s1, const char *s2, size_t n )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strncmp(s1, s2, n);
+#else
+ return strncmp(s1, s2, n);
+#endif
+}
+
+/** Implemented using _mesa_malloc() and _mesa_strcpy */
+char *
+_mesa_strdup( const char *s )
+{
+ int l = _mesa_strlen(s);
+ char *s2 = (char *) _mesa_malloc(l + 1);
+ if (s2)
+ _mesa_strcpy(s2, s);
+ return s2;
+}
+
+/** Wrapper around either atoi() or xf86atoi() */
+int
+_mesa_atoi(const char *s)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86atoi(s);
+#else
+ return atoi(s);
+#endif
+}
+
+/** Wrapper around either strtod() or xf86strtod() */
+double
+_mesa_strtod( const char *s, char **end )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86strtod(s, end);
+#else
+ return strtod(s, end);
+#endif
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name I/O */
+/*@{*/
+
+/** Wrapper around either vsprintf() or xf86vsprintf() */
+int
+_mesa_sprintf( char *str, const char *fmt, ... )
+{
+ int r;
+ va_list args;
+ va_start( args, fmt );
+ va_end( args );
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ r = xf86vsprintf( str, fmt, args );
+#else
+ r = vsprintf( str, fmt, args );
+#endif
+ return r;
+}
+
+/** Wrapper around either printf() or xf86printf(), using vsprintf() for
+ * the formatting. */
+void
+_mesa_printf( const char *fmtString, ... )
+{
+ char s[MAXSTRING];
+ va_list args;
+ va_start( args, fmtString );
+ vsnprintf(s, MAXSTRING, fmtString, args);
+ va_end( args );
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86printf("%s", s);
+#else
+ printf("%s", s);
+#endif
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Diagnostics */
+/*@{*/
+
+/**
+ * Display a warning.
+ *
+ * \param ctx GL context.
+ * \param fmtString printf() alike format string.
+ *
+ * If debugging is enabled (either at compile-time via the DEBUG macro, or
+ * run-time via the MESA_DEBUG environment variable), prints the warning to
+ * stderr, either via fprintf() or xf86printf().
+ */
+void
+_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
+{
+ GLboolean debug;
+ char str[MAXSTRING];
+ va_list args;
+ (void) ctx;
+ va_start( args, fmtString );
+ (void) vsnprintf( str, MAXSTRING, fmtString, args );
+ va_end( args );
+#ifdef DEBUG
+ debug = GL_TRUE; /* always print warning */
+#else
+ debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE;
+#endif
+ if (debug) {
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86fprintf(stderr, "Mesa warning: %s\n", str);
+#else
+ fprintf(stderr, "Mesa warning: %s\n", str);
+#endif
+ }
+}
+
+/**
+ * This function is called when the Mesa user has stumbled into a code
+ * path which may not be implemented fully or correctly.
+ *
+ * \param ctx GL context.
+ * \param s problem description string.
+ *
+ * Prints the message to stderr, either via fprintf() or xf86fprintf().
+ */
+void
+_mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
+{
+ va_list args;
+ char str[MAXSTRING];
+ (void) ctx;
+
+ va_start( args, fmtString );
+ vsnprintf( str, MAXSTRING, fmtString, args );
+ va_end( args );
+
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
+ xf86fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
+#else
+ fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
+ fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
+#endif
+}
+
+/**
+ * Display an error message.
+ *
+ * If in debug mode, print error message.
+ * Also, record the error code by calling _mesa_record_error().
+ *
+ * \param ctx the GL context.
+ * \param error the error value.
+ * \param fmtString printf() style format string, followed by optional args
+ *
+ * If debugging is enabled (either at compile-time via the DEBUG macro, or
+ * run-time via the MESA_DEBUG environment variable), interperts the error code and
+ * prints the error message via _mesa_debug().
+ */
+void
+_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
+{
+ const char *debugEnv;
+ GLboolean debug;
+
+ debugEnv = _mesa_getenv("MESA_DEBUG");
+
+#ifdef DEBUG
+ if (debugEnv && _mesa_strstr(debugEnv, "silent"))
+ debug = GL_FALSE;
+ else
+ debug = GL_TRUE;
+#else
+ if (debugEnv)
+ debug = GL_TRUE;
+ else
+ debug = GL_FALSE;
+#endif
+
+ if (debug) {
+ va_list args;
+ char where[MAXSTRING];
+ const char *errstr;
+
+ va_start( args, fmtString );
+ vsnprintf( where, MAXSTRING, fmtString, args );
+ va_end( args );
+
+ switch (error) {
+ case GL_NO_ERROR:
+ errstr = "GL_NO_ERROR";
+ break;
+ case GL_INVALID_VALUE:
+ errstr = "GL_INVALID_VALUE";
+ break;
+ case GL_INVALID_ENUM:
+ errstr = "GL_INVALID_ENUM";
+ break;
+ case GL_INVALID_OPERATION:
+ errstr = "GL_INVALID_OPERATION";
+ break;
+ case GL_STACK_OVERFLOW:
+ errstr = "GL_STACK_OVERFLOW";
+ break;
+ case GL_STACK_UNDERFLOW:
+ errstr = "GL_STACK_UNDERFLOW";
+ break;
+ case GL_OUT_OF_MEMORY:
+ errstr = "GL_OUT_OF_MEMORY";
+ break;
+ case GL_TABLE_TOO_LARGE:
+ errstr = "GL_TABLE_TOO_LARGE";
+ break;
+ default:
+ errstr = "unknown";
+ break;
+ }
+ _mesa_debug(ctx, "User error: %s in %s\n", errstr, where);
+ }
+
+ _mesa_record_error(ctx, error);
+}
+
+/**
+ * Report debug information.
+ *
+ * \param ctx GL context.
+ * \param fmtString printf() alike format string.
+ *
+ * Prints the message to stderr, either via fprintf() or xf86printf().
+ */
+void
+_mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
+{
+ char s[MAXSTRING];
+ va_list args;
+ (void) ctx;
+ va_start(args, fmtString);
+ vsnprintf(s, MAXSTRING, fmtString, args);
+ va_end(args);
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86fprintf(stderr, "Mesa: %s", s);
+#else
+ fprintf(stderr, "Mesa: %s", s);
+#endif
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Default Imports Wrapper */
+/*@{*/
+
+/** Wrapper around _mesa_malloc() */
+static void *
+default_malloc(__GLcontext *gc, size_t size)
+{
+ (void) gc;
+ return _mesa_malloc(size);
+}
+
+/** Wrapper around _mesa_malloc() */
+static void *
+default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize)
+{
+ (void) gc;
+ return _mesa_calloc(numElem * elemSize);
+}
+
+/** Wrapper around either realloc() or xf86realloc() */
+static void *
+default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize)
+{
+ (void) gc;
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86realloc(oldAddr, newSize);
+#else
+ return realloc(oldAddr, newSize);
+#endif
+}
+
+/** Wrapper around _mesa_free() */
+static void
+default_free(__GLcontext *gc, void *addr)
+{
+ (void) gc;
+ _mesa_free(addr);
+}
+
+/** Wrapper around _mesa_getenv() */
+static char * CAPI
+default_getenv( __GLcontext *gc, const char *var )
+{
+ (void) gc;
+ return _mesa_getenv(var);
+}
+
+/** Wrapper around _mesa_warning() */
+static void
+default_warning(__GLcontext *gc, char *str)
+{
+ _mesa_warning(gc, str);
+}
+
+/** Wrapper around _mesa_problem() */
+static void
+default_fatal(__GLcontext *gc, char *str)
+{
+ _mesa_problem(gc, str);
+ abort();
+}
+
+/** Wrapper around atoi() */
+static int CAPI
+default_atoi(__GLcontext *gc, const char *str)
+{
+ (void) gc;
+ return atoi(str);
+}
+
+/** Wrapper around vsprintf() */
+static int CAPI
+default_sprintf(__GLcontext *gc, char *str, const char *fmt, ...)
+{
+ int r;
+ va_list args;
+ (void) gc;
+ va_start( args, fmt );
+ r = vsprintf( str, fmt, args );
+ va_end( args );
+ return r;
+}
+
+/** Wrapper around fopen() */
+static void * CAPI
+default_fopen(__GLcontext *gc, const char *path, const char *mode)
+{
+ (void) gc;
+ return fopen(path, mode);
+}
+
+/** Wrapper around fclose() */
+static int CAPI
+default_fclose(__GLcontext *gc, void *stream)
+{
+ (void) gc;
+ return fclose((FILE *) stream);
+}
+
+/** Wrapper around vfprintf() */
+static int CAPI
+default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
+{
+ int r;
+ va_list args;
+ (void) gc;
+ va_start( args, fmt );
+ r = vfprintf( (FILE *) stream, fmt, args );
+ va_end( args );
+ return r;
+}
+
+/**
+ * \todo this really is driver-specific and can't be here
+ */
+static __GLdrawablePrivate *
+default_GetDrawablePrivate(__GLcontext *gc)
+{
+ (void) gc;
+ return NULL;
+}
+
+/*@}*/
+
+
+/**
+ * Initialize a __GLimports object to point to the functions in this
+ * file.
+ *
+ * This is to be called from device drivers.
+ *
+ * Also, do some one-time initializations.
+ *
+ * \param imports the object to initialize.
+ * \param driverCtx pointer to device driver-specific data.
+ */
+void
+_mesa_init_default_imports(__GLimports *imports, void *driverCtx)
+{
+ /* XXX maybe move this one-time init stuff into context.c */
+ static GLboolean initialized = GL_FALSE;
+ if (!initialized) {
+ init_sqrt_table();
+
+#if defined(_FPU_GETCW) && defined(_FPU_SETCW)
+ {
+ const char *debug = _mesa_getenv("MESA_DEBUG");
+ if (debug && _mesa_strcmp(debug, "FP")==0) {
+ /* die on FP exceptions */
+ fpu_control_t mask;
+ _FPU_GETCW(mask);
+ mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM
+ | _FPU_MASK_OM | _FPU_MASK_UM);
+ _FPU_SETCW(mask);
+ }
+ }
+#endif
+ initialized = GL_TRUE;
+ }
+
+ imports->malloc = default_malloc;
+ imports->calloc = default_calloc;
+ imports->realloc = default_realloc;
+ imports->free = default_free;
+ imports->warning = default_warning;
+ imports->fatal = default_fatal;
+ imports->getenv = default_getenv; /* not used for now */
+ imports->atoi = default_atoi;
+ imports->sprintf = default_sprintf;
+ imports->fopen = default_fopen;
+ imports->fclose = default_fclose;
+ imports->fprintf = default_fprintf;
+ imports->getDrawablePrivate = default_GetDrawablePrivate;
+ imports->other = driverCtx;
+}
Index: xc/extras/Mesa/src/mesa/main/imports.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/imports.h:1.7
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/imports.h Fri Dec 10 10:41:02 2004
@@ -0,0 +1,783 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/* $XFree86: xc/extras/Mesa/src/mesa/main/imports.h,v 1.7 2004/12/10 15:41:02 alanh Exp $ */
+
+/**
+ * \file imports.h
+ * Standard C library function wrappers.
+ *
+ * This file provides wrappers for all the standard C library functions
+ * like malloc(), free(), printf(), getenv(), etc.
+ */
+
+
+#ifndef IMPORTS_H
+#define IMPORTS_H
+
+
+/* XXX some of the stuff in glheader.h should be moved into this file.
+ */
+#include "glheader.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**********************************************************************/
+/** \name General macros */
+/*@{*/
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/*@}*/
+
+
+/**********************************************************************/
+/** Memory macros */
+/*@{*/
+
+/** Allocate \p BYTES bytes */
+#define MALLOC(BYTES) _mesa_malloc(BYTES)
+/** Allocate and zero \p BYTES bytes */
+#define CALLOC(BYTES) _mesa_calloc(BYTES)
+/** Allocate a structure of type \p T */
+#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T))
+/** Allocate and zero a structure of type \p T */
+#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T))
+/** Free memory */
+#define FREE(PTR) _mesa_free(PTR)
+
+/** Allocate \p BYTES aligned at \p N bytes */
+#define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N)
+/** Allocate and zero \p BYTES bytes aligned at \p N bytes */
+#define ALIGN_CALLOC(BYTES, N) _mesa_align_calloc(BYTES, N)
+/** Allocate a structure of type \p T aligned at \p N bytes */
+#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N)
+/** Allocate and zero a structure of type \p T aligned at \p N bytes */
+#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N)
+/** Free aligned memory */
+#define ALIGN_FREE(PTR) _mesa_align_free(PTR)
+
+/** Copy \p BYTES bytes from \p SRC into \p DST */
+#define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES)
+/** Set \p N bytes in \p DST to \p VAL */
+#define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N)
+
+#define MEMSET16( DST, VAL, N ) _mesa_memset16( (DST), (VAL), (size_t) (N) )
+
+/*@}*/
+
+
+/*
+ * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
+ * as offsets into buffer stores. Since the vertex array pointer and
+ * buffer store pointer are both pointers and we need to add them, we use
+ * this macro.
+ * Both pointers/offsets are expressed in bytes.
+ */
+#define ADD_POINTERS(A, B) ( (A) + (unsigned long) (B) )
+
+
+/**********************************************************************/
+/** \name [Pseudo] static array declaration.
+ *
+ * MACs and BeOS don't support static larger than 32kb, so ...
+ */
+/*@{*/
+
+/**
+ * \def DEFARRAY
+ * Define a [static] unidimensional array
+ */
+
+/**
+ * \def DEFMARRAY
+ * Define a [static] bi-dimensional array
+ */
+
+/**
+ * \def DEFMNARRAY
+ * Define a [static] tri-dimensional array
+ */
+
+/**
+ * \def CHECKARRAY
+ * Verifies a [static] array was properly allocated.
+ */
+
+/**
+ * \def UNDEFARRAY
+ * Undefine (free) a [static] array.
+ */
+
+#if defined(macintosh) && !defined(__MRC__)
+/*extern char *AGLAlloc(int size);*/
+/*extern void AGLFree(char* ptr);*/
+# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_alloc(sizeof(TYPE)*(SIZE))
+# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2))
+# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3))
+# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0)
+# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0)
+#elif defined(__BEOS__)
+# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_malloc(sizeof(TYPE)*(SIZE))
+# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2))
+# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3))
+# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0)
+# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0)
+#else
+# define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE]
+# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2]
+# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE NAME[SIZE1][SIZE2][SIZE3]
+# define CHECKARRAY(NAME,CMD) do {} while(0)
+# define UNDEFARRAY(NAME)
+#endif
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name External pixel buffer allocation.
+ *
+ * If you want Mesa's depth/stencil/accum/etc buffers to be allocated with a
+ * specialized allocator you can define MESA_EXTERNAL_BUFFERALLOC and implement
+ * _ext_mesa_alloc_pixelbuffer() _ext_mesa_free_pixelbuffer() in your
+ * application.
+ *
+ * \author
+ * Contributed by Gerk Huisma (gerk@five-d.demon.nl).
+ */
+/*@{*/
+
+/**
+ * \def MESA_PBUFFER_ALLOC
+ * Allocate a pixel buffer.
+ */
+
+/**
+ * \def MESA_PBUFFER_FREE
+ * Free a pixel buffer.
+ */
+
+#ifdef MESA_EXTERNAL_BUFFERALLOC
+extern void *_ext_mesa_alloc_pixelbuffer( unsigned int size );
+extern void _ext_mesa_free_pixelbuffer( void *pb );
+
+#define MESA_PBUFFER_ALLOC(BYTES) (void *) _ext_mesa_alloc_pixelbuffer(BYTES)
+#define MESA_PBUFFER_FREE(PTR) _ext_mesa_free_pixelbuffer(PTR)
+#else
+/* Default buffer allocation uses the aligned allocation routines: */
+#define MESA_PBUFFER_ALLOC(BYTES) (void *) _mesa_align_malloc(BYTES, 512)
+#define MESA_PBUFFER_FREE(PTR) _mesa_align_free(PTR)
+#endif
+
+/*@}*/
+
+
+
+/**********************************************************************
+ * Math macros
+ */
+
+#define MAX_GLUSHORT 0xffff
+#define MAX_GLUINT 0xffffffff
+
+#ifndef M_PI
+#define M_PI (3.1415926536)
+#endif
+
+/* XXX this is a bit of a hack needed for compilation within XFree86 */
+#ifndef FLT_MIN
+#define FLT_MIN (1.0e-37)
+#endif
+
+/* Degrees to radians conversion: */
+#define DEG2RAD (M_PI/180.0)
+
+
+/***
+ *** USE_IEEE: Determine if we're using IEEE floating point
+ ***/
+#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
+ defined(__s390x__) || defined(__powerpc__) || \
+ defined(__amd64__) || \
+ defined(ia64) || defined(__ia64__) || \
+ defined(__hppa__) || defined(hpux) || \
+ defined(__mips) || defined(_MIPS_ARCH) || \
+ defined(__arm__) || \
+ (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS)))
+#define USE_IEEE
+#define IEEE_ONE 0x3f800000
+#endif
+
+
+/***
+ *** SQRTF: single-precision square root
+ ***/
+#if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
+# define SQRTF(X) _mesa_sqrtf(X)
+#elif defined(XFree86LOADER) && defined(IN_MODULE)
+# define SQRTF(X) (float) xf86sqrt((float) (X))
+#else
+# define SQRTF(X) (float) sqrt((float) (X))
+#endif
+
+
+/***
+ *** INV_SQRTF: single-precision inverse square root
+ ***/
+#if 0
+#define INV_SQRTF(X) _mesa_inv_sqrt(X)
+#else
+#define INV_SQRTF(X) (1.0F / SQRTF(X)) /* this is faster on a P4 */
+#endif
+
+
+/***
+ *** LOG2: Log base 2 of float
+ ***/
+#ifdef USE_IEEE
+#if 0
+/* This is pretty fast, but not accurate enough (only 2 fractional bits).
+ * Based on code from http://www.stereopsis.com/log2.html
+ */
+static INLINE GLfloat LOG2(GLfloat x)
+{
+ const GLfloat y = x * x * x * x;
+ const GLuint ix = *((GLuint *) &y);
+ const GLuint exp = (ix >> 23) & 0xFF;
+ const GLint log2 = ((GLint) exp) - 127;
+ return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */
+}
+#endif
+/* Pretty fast, and accurate.
+ * Based on code from http://www.flipcode.com/totd/
+ */
+static INLINE GLfloat LOG2(GLfloat val)
+{
+ fi_type num;
+ GLint log_2;
+ num.f = val;
+ log_2 = ((num.i >> 23) & 255) - 128;
+ num.i &= ~(255 << 23);
+ num.i += 127 << 23;
+ num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
+ return num.f + log_2;
+}
+#elif defined(XFree86LOADER) && defined(IN_MODULE)
+#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695))
+#else
+/*
+ * NOTE: log_base_2(x) = log(x) / log(2)
+ * NOTE: 1.442695 = 1/log(2).
+ */
+#define LOG2(x) ((GLfloat) (log(x) * 1.442695F))
+#endif
+
+
+/***
+ *** IS_INF_OR_NAN: test if float is infinite or NaN
+ ***/
+#ifdef USE_IEEE
+static INLINE int IS_INF_OR_NAN( float x )
+{
+ fi_type tmp;
+ tmp.f = x;
+ return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
+}
+#elif defined(isfinite)
+#define IS_INF_OR_NAN(x) (!isfinite(x))
+#elif defined(finite)
+#define IS_INF_OR_NAN(x) (!finite(x))
+#elif defined(__VMS)
+#define IS_INF_OR_NAN(x) (!finite(x))
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define IS_INF_OR_NAN(x) (!isfinite(x))
+#else
+#define IS_INF_OR_NAN(x) (!finite(x))
+#endif
+
+
+/***
+ *** IS_NEGATIVE: test if float is negative
+ ***/
+#if defined(USE_IEEE)
+#define GET_FLOAT_BITS(x) ((fi_type *) &(x))->i
+#define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
+#else
+#define IS_NEGATIVE(x) (x < 0.0F)
+#endif
+
+
+/***
+ *** DIFFERENT_SIGNS: test if two floats have opposite signs
+ ***/
+#if defined(USE_IEEE)
+#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
+#else
+/* Could just use (x*y<0) except for the flatshading requirements.
+ * Maybe there's a better way?
+ */
+#define DIFFERENT_SIGNS(x,y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F)
+#endif
+
+
+/***
+ *** CEILF: ceiling of float
+ *** FLOORF: floor of float
+ *** FABSF: absolute value of float
+ ***/
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+#define CEILF(x) ((GLfloat) xf86ceil(x))
+#define FLOORF(x) ((GLfloat) xf86floor(x))
+#define FABSF(x) ((GLfloat) xf86fabs(x))
+#elif defined(__gnu_linux__)
+/* C99 functions */
+#define CEILF(x) ceilf(x)
+#define FLOORF(x) floorf(x)
+#define FABSF(x) fabsf(x)
+#else
+#define CEILF(x) ((GLfloat) ceil(x))
+#define FLOORF(x) ((GLfloat) floor(x))
+#define FABSF(x) ((GLfloat) fabs(x))
+#endif
+
+
+/***
+ *** IROUND: return (as an integer) float rounded to nearest integer
+ ***/
+#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__)
+static INLINE int iround(float f)
+{
+ int r;
+ __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f));
+ return r;
+}
+#define IROUND(x) iround(x)
+#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \
+ (!defined(__BEOS__) || (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
+static INLINE int iround(float f)
+{
+ int r;
+ __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
+ return r;
+}
+#define IROUND(x) iround(x)
+#elif defined(USE_X86_ASM) && defined(__MSC__) && defined(__WIN32__)
+static INLINE int iround(float f)
+{
+ int r;
+ _asm {
+ fld f
+ fistp r
+ }
+ return r;
+}
+#define IROUND(x) iround(x)
+#elif defined(__WATCOMC__) && defined(__386__)
+long iround(float f);
+#pragma aux iround = \
+ "push eax" \
+ "fistp dword ptr [esp]" \
+ "pop eax" \
+ parm [8087] \
+ value [eax] \
+ modify exact [eax];
+#define IROUND(x) iround(x)
+#else
+#define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F)))
+#endif
+
+
+/***
+ *** IROUND_POS: return (as an integer) positive float rounded to nearest int
+ ***/
+#ifdef DEBUG
+#define IROUND_POS(f) (assert((f) >= 0.0F), IROUND(f))
+#else
+#define IROUND_POS(f) (IROUND(f))
+#endif
+
+
+/***
+ *** IFLOOR: return (as an integer) floor of float
+ ***/
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+/*
+ * IEEE floor for computers that round to nearest or even.
+ * 'f' must be between -4194304 and 4194303.
+ * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
+ * but uses some IEEE specific tricks for better speed.
+ * Contributed by Josh Vanderhoof
+ */
+static INLINE int ifloor(float f)
+{
+ int ai, bi;
+ double af, bf;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ /* GCC generates an extra fstp/fld without this. */
+ __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
+ __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
+ return (ai - bi) >> 1;
+}
+#define IFLOOR(x) ifloor(x)
+#elif defined(USE_IEEE)
+static INLINE int ifloor(float f)
+{
+ int ai, bi;
+ double af, bf;
+ fi_type u;
+
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ u.f = (float) af; ai = u.i;
+ u.f = (float) bf; bi = u.i;
+ return (ai - bi) >> 1;
+}
+#define IFLOOR(x) ifloor(x)
+#else
+static INLINE int ifloor(float f)
+{
+ int i = IROUND(f);
+ return (i > f) ? i - 1 : i;
+}
+#define IFLOOR(x) ifloor(x)
+#endif
+
+
+/***
+ *** ICEIL: return (as an integer) ceiling of float
+ ***/
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+/*
+ * IEEE ceil for computers that round to nearest or even.
+ * 'f' must be between -4194304 and 4194303.
+ * This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1",
+ * but uses some IEEE specific tricks for better speed.
+ * Contributed by Josh Vanderhoof
+ */
+static INLINE int iceil(float f)
+{
+ int ai, bi;
+ double af, bf;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ /* GCC generates an extra fstp/fld without this. */
+ __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
+ __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
+ return (ai - bi + 1) >> 1;
+}
+#define ICEIL(x) iceil(x)
+#elif defined(USE_IEEE)
+static INLINE int iceil(float f)
+{
+ int ai, bi;
+ double af, bf;
+ fi_type u;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ u.f = (float) af; ai = u.i;
+ u.f = (float) bf; bi = u.i;
+ return (ai - bi + 1) >> 1;
+}
+#define ICEIL(x) iceil(x)
+#else
+static INLINE int iceil(float f)
+{
+ int i = IROUND(f);
+ return (i < f) ? i + 1 : i;
+}
+#define ICEIL(x) iceil(x)
+#endif
+
+
+/***
+ *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255]
+ *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255]
+ ***/
+#if defined(USE_IEEE) && !defined(DEBUG)
+#define IEEE_0996 0x3f7f0000 /* 0.996 or so */
+/* This function/macro is sensitive to precision. Test very carefully
+ * if you change it!
+ */
+#define UNCLAMPED_FLOAT_TO_UBYTE(UB, F) \
+ do { \
+ fi_type __tmp; \
+ __tmp.f = (F); \
+ if (__tmp.i < 0) \
+ UB = (GLubyte) 0; \
+ else if (__tmp.i >= IEEE_0996) \
+ UB = (GLubyte) 255; \
+ else { \
+ __tmp.f = __tmp.f * (255.0F/256.0F) + 32768.0F; \
+ UB = (GLubyte) __tmp.i; \
+ } \
+ } while (0)
+#define CLAMPED_FLOAT_TO_UBYTE(UB, F) \
+ do { \
+ fi_type __tmp; \
+ __tmp.f = (F) * (255.0F/256.0F) + 32768.0F; \
+ UB = (GLubyte) __tmp.i; \
+ } while (0)
+#else
+#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \
+ ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F))
+#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \
+ ub = ((GLubyte) IROUND((f) * 255.0F))
+#endif
+
+
+/***
+ *** COPY_FLOAT: copy a float from src to dest, avoid slow FP regs if possible
+ ***/
+#if defined(USE_IEEE) && !defined(DEBUG)
+#define COPY_FLOAT( dst, src ) \
+ ((fi_type *) &(dst))->i = ((fi_type *) (void *) &(src))->i
+#else
+#define COPY_FLOAT( dst, src ) (dst) = (src)
+#endif
+
+
+/***
+ *** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save
+ *** original mode to a temporary).
+ *** END_FAST_MATH: Restore x86 FPU to original mode.
+ ***/
+#if defined(__GNUC__) && defined(__i386__)
+/*
+ * Set the x86 FPU control word to guarentee only 32 bits of precision
+ * are stored in registers. Allowing the FPU to store more introduces
+ * differences between situations where numbers are pulled out of memory
+ * vs. situations where the compiler is able to optimize register usage.
+ *
+ * In the worst case, we force the compiler to use a memory access to
+ * truncate the float, by specifying the 'volatile' keyword.
+ */
+/* Hardware default: All exceptions masked, extended double precision,
+ * round to nearest (IEEE compliant):
+ */
+#define DEFAULT_X86_FPU 0x037f
+/* All exceptions masked, single precision, round to nearest:
+ */
+#define FAST_X86_FPU 0x003f
+/* The fldcw instruction will cause any pending FP exceptions to be
+ * raised prior to entering the block, and we clear any pending
+ * exceptions before exiting the block. Hence, asm code has free
+ * reign over the FPU while in the fast math block.
+ */
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x) \
+do { \
+ static GLuint mask = DEFAULT_X86_FPU; \
+ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \
+ __asm__ ( "fldcw %0" : : "m" (mask) ); \
+} while (0)
+#else
+#define START_FAST_MATH(x) \
+do { \
+ static GLuint mask = FAST_X86_FPU; \
+ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \
+ __asm__ ( "fldcw %0" : : "m" (mask) ); \
+} while (0)
+#endif
+/* Restore original FPU mode, and clear any exceptions that may have
+ * occurred in the FAST_MATH block.
+ */
+#define END_FAST_MATH(x) \
+do { \
+ __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \
+} while (0)
+
+#elif defined(__WATCOMC__) && defined(__386__)
+#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */
+#define FAST_X86_FPU 0x003f /* See GCC comments above */
+void _watcom_start_fast_math(unsigned short *x,unsigned short *mask);
+#pragma aux _watcom_start_fast_math = \
+ "fnstcw word ptr [eax]" \
+ "fldcw word ptr [ecx]" \
+ parm [eax] [ecx] \
+ modify exact [];
+void _watcom_end_fast_math(unsigned short *x);
+#pragma aux _watcom_end_fast_math = \
+ "fnclex" \
+ "fldcw word ptr [eax]" \
+ parm [eax] \
+ modify exact [];
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x) \
+do { \
+ static GLushort mask = DEFAULT_X86_FPU; \
+ _watcom_start_fast_math(&x,&mask); \
+} while (0)
+#else
+#define START_FAST_MATH(x) \
+do { \
+ static GLushort mask = FAST_X86_FPU; \
+ _watcom_start_fast_math(&x,&mask); \
+} while (0)
+#endif
+#define END_FAST_MATH(x) _watcom_end_fast_math(&x)
+#else
+#define START_FAST_MATH(x) x = 0
+#define END_FAST_MATH(x) (void)(x)
+#endif
+
+
+
+/**********************************************************************
+ * Functions
+ */
+
+extern void *
+_mesa_malloc( size_t bytes );
+
+extern void *
+_mesa_calloc( size_t bytes );
+
+extern void
+_mesa_free( void *ptr );
+
+extern void *
+_mesa_align_malloc( size_t bytes, unsigned long alignment );
+
+extern void *
+_mesa_align_calloc( size_t bytes, unsigned long alignment );
+
+extern void
+_mesa_align_free( void *ptr );
+
+extern void *
+_mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize );
+
+extern void *
+_mesa_memcpy( void *dest, const void *src, size_t n );
+
+extern void
+_mesa_memset( void *dst, int val, size_t n );
+
+extern void
+_mesa_memset16( unsigned short *dst, unsigned short val, size_t n );
+
+extern void
+_mesa_bzero( void *dst, size_t n );
+
+
+extern double
+_mesa_sin(double a);
+
+extern double
+_mesa_cos(double a);
+
+extern double
+_mesa_sqrtd(double x);
+
+extern float
+_mesa_sqrtf(float x);
+
+extern float
+_mesa_inv_sqrtf(float x);
+
+extern double
+_mesa_pow(double x, double y);
+
+extern float
+_mesa_log2(float x);
+
+extern unsigned int
+_mesa_bitcount(unsigned int n);
+
+extern GLhalfARB
+_mesa_float_to_half(float f);
+
+extern float
+_mesa_half_to_float(GLhalfARB h);
+
+
+extern char *
+_mesa_getenv( const char *var );
+
+extern char *
+_mesa_strstr( const char *haystack, const char *needle );
+
+extern char *
+_mesa_strncat( char *dest, const char *src, size_t n );
+
+extern char *
+_mesa_strcpy( char *dest, const char *src );
+
+extern char *
+_mesa_strncpy( char *dest, const char *src, size_t n );
+
+extern size_t
+_mesa_strlen( const char *s );
+
+extern int
+_mesa_strcmp( const char *s1, const char *s2 );
+
+extern int
+_mesa_strncmp( const char *s1, const char *s2, size_t n );
+
+extern char *
+_mesa_strdup( const char *s );
+
+extern int
+_mesa_atoi( const char *s );
+
+extern double
+_mesa_strtod( const char *s, char **end );
+
+extern int
+_mesa_sprintf( char *str, const char *fmt, ... );
+
+extern void
+_mesa_printf( const char *fmtString, ... );
+
+
+extern void
+_mesa_warning( __GLcontext *gc, const char *fmtString, ... );
+
+extern void
+_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... );
+
+extern void
+_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... );
+
+extern void
+_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... );
+
+
+extern void
+_mesa_init_default_imports( __GLimports *imports, void *driverCtx );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* IMPORTS_H */
Index: xc/extras/Mesa/src/mesa/main/light.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/light.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/light.c Fri Dec 10 10:05:18 2004
@@ -0,0 +1,1316 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "enums.h"
+#include "light.h"
+#include "macros.h"
+#include "simple_list.h"
+#include "mtypes.h"
+#include "math/m_matrix.h"
+
+
+void GLAPIENTRY
+_mesa_ShadeModel( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
+
+ if (mode != GL_FLAT && mode != GL_SMOOTH) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
+ return;
+ }
+
+ if (ctx->Light.ShadeModel == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.ShadeModel = mode;
+ ctx->_TriangleCaps ^= DD_FLATSHADE;
+ if (ctx->Driver.ShadeModel)
+ (*ctx->Driver.ShadeModel)( ctx, mode );
+}
+
+
+void GLAPIENTRY
+_mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
+{
+ _mesa_Lightfv( light, pname, ¶m );
+}
+
+
+void GLAPIENTRY
+_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i = (GLint) (light - GL_LIGHT0);
+ struct gl_light *l = &ctx->Light.Light[i];
+
+ if (i < 0 || i >= (GLint) ctx->Const.MaxLights) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light );
+ return;
+ }
+
+ switch (pname) {
+ case GL_AMBIENT:
+ if (TEST_EQ_4V(l->Ambient, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V( l->Ambient, params );
+ break;
+ case GL_DIFFUSE:
+ if (TEST_EQ_4V(l->Diffuse, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V( l->Diffuse, params );
+ break;
+ case GL_SPECULAR:
+ if (TEST_EQ_4V(l->Specular, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V( l->Specular, params );
+ break;
+ case GL_POSITION: {
+ GLfloat tmp[4];
+ /* transform position by ModelView matrix */
+ TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, params );
+ if (TEST_EQ_4V(l->EyePosition, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V(l->EyePosition, tmp);
+ if (l->EyePosition[3] != 0.0F)
+ l->_Flags |= LIGHT_POSITIONAL;
+ else
+ l->_Flags &= ~LIGHT_POSITIONAL;
+ break;
+ }
+ case GL_SPOT_DIRECTION: {
+ GLfloat tmp[4];
+ /* transform direction by inverse modelview */
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ TRANSFORM_NORMAL( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_3V(l->EyeDirection, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_3V(l->EyeDirection, tmp);
+ break;
+ }
+ case GL_SPOT_EXPONENT:
+ if (params[0]<0.0 || params[0]>ctx->Const.MaxSpotExponent) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->SpotExponent == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->SpotExponent = params[0];
+ _mesa_invalidate_spot_exp_table( l );
+ break;
+ case GL_SPOT_CUTOFF:
+ if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->SpotCutoff == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->SpotCutoff = params[0];
+ l->_CosCutoff = (GLfloat) _mesa_cos(params[0]*DEG2RAD);
+ if (l->_CosCutoff < 0)
+ l->_CosCutoff = 0;
+ if (l->SpotCutoff != 180.0F)
+ l->_Flags |= LIGHT_SPOT;
+ else
+ l->_Flags &= ~LIGHT_SPOT;
+ break;
+ case GL_CONSTANT_ATTENUATION:
+ if (params[0]<0.0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->ConstantAttenuation == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->ConstantAttenuation = params[0];
+ break;
+ case GL_LINEAR_ATTENUATION:
+ if (params[0]<0.0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->LinearAttenuation == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->LinearAttenuation = params[0];
+ break;
+ case GL_QUADRATIC_ATTENUATION:
+ if (params[0]<0.0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->QuadraticAttenuation == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->QuadraticAttenuation = params[0];
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLight(pname=0x%x)", pname );
+ return;
+ }
+
+ if (ctx->Driver.Lightfv)
+ ctx->Driver.Lightfv( ctx, light, pname, params );
+}
+
+
+void GLAPIENTRY
+_mesa_Lighti( GLenum light, GLenum pname, GLint param )
+{
+ _mesa_Lightiv( light, pname, ¶m );
+}
+
+
+void GLAPIENTRY
+_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+
+ switch (pname) {
+ case GL_AMBIENT:
+ case GL_DIFFUSE:
+ case GL_SPECULAR:
+ fparam[0] = INT_TO_FLOAT( params[0] );
+ fparam[1] = INT_TO_FLOAT( params[1] );
+ fparam[2] = INT_TO_FLOAT( params[2] );
+ fparam[3] = INT_TO_FLOAT( params[3] );
+ break;
+ case GL_POSITION:
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = (GLfloat) params[1];
+ fparam[2] = (GLfloat) params[2];
+ fparam[3] = (GLfloat) params[3];
+ break;
+ case GL_SPOT_DIRECTION:
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = (GLfloat) params[1];
+ fparam[2] = (GLfloat) params[2];
+ break;
+ case GL_SPOT_EXPONENT:
+ case GL_SPOT_CUTOFF:
+ case GL_CONSTANT_ATTENUATION:
+ case GL_LINEAR_ATTENUATION:
+ case GL_QUADRATIC_ATTENUATION:
+ fparam[0] = (GLfloat) params[0];
+ break;
+ default:
+ /* error will be caught later in gl_Lightfv */
+ ;
+ }
+
+ _mesa_Lightfv( light, pname, fparam );
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint l = (GLint) (light - GL_LIGHT0);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (l < 0 || l >= (GLint) ctx->Const.MaxLights) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_AMBIENT:
+ COPY_4V( params, ctx->Light.Light[l].Ambient );
+ break;
+ case GL_DIFFUSE:
+ COPY_4V( params, ctx->Light.Light[l].Diffuse );
+ break;
+ case GL_SPECULAR:
+ COPY_4V( params, ctx->Light.Light[l].Specular );
+ break;
+ case GL_POSITION:
+ COPY_4V( params, ctx->Light.Light[l].EyePosition );
+ break;
+ case GL_SPOT_DIRECTION:
+ COPY_3V( params, ctx->Light.Light[l].EyeDirection );
+ break;
+ case GL_SPOT_EXPONENT:
+ params[0] = ctx->Light.Light[l].SpotExponent;
+ break;
+ case GL_SPOT_CUTOFF:
+ params[0] = ctx->Light.Light[l].SpotCutoff;
+ break;
+ case GL_CONSTANT_ATTENUATION:
+ params[0] = ctx->Light.Light[l].ConstantAttenuation;
+ break;
+ case GL_LINEAR_ATTENUATION:
+ params[0] = ctx->Light.Light[l].LinearAttenuation;
+ break;
+ case GL_QUADRATIC_ATTENUATION:
+ params[0] = ctx->Light.Light[l].QuadraticAttenuation;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
+ break;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint l = (GLint) (light - GL_LIGHT0);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (l < 0 || l >= (GLint) ctx->Const.MaxLights) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_AMBIENT:
+ params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[0]);
+ params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[1]);
+ params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[2]);
+ params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[3]);
+ break;
+ case GL_DIFFUSE:
+ params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[0]);
+ params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[1]);
+ params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[2]);
+ params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[3]);
+ break;
+ case GL_SPECULAR:
+ params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[0]);
+ params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[1]);
+ params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[2]);
+ params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[3]);
+ break;
+ case GL_POSITION:
+ params[0] = (GLint) ctx->Light.Light[l].EyePosition[0];
+ params[1] = (GLint) ctx->Light.Light[l].EyePosition[1];
+ params[2] = (GLint) ctx->Light.Light[l].EyePosition[2];
+ params[3] = (GLint) ctx->Light.Light[l].EyePosition[3];
+ break;
+ case GL_SPOT_DIRECTION:
+ params[0] = (GLint) ctx->Light.Light[l].EyeDirection[0];
+ params[1] = (GLint) ctx->Light.Light[l].EyeDirection[1];
+ params[2] = (GLint) ctx->Light.Light[l].EyeDirection[2];
+ break;
+ case GL_SPOT_EXPONENT:
+ params[0] = (GLint) ctx->Light.Light[l].SpotExponent;
+ break;
+ case GL_SPOT_CUTOFF:
+ params[0] = (GLint) ctx->Light.Light[l].SpotCutoff;
+ break;
+ case GL_CONSTANT_ATTENUATION:
+ params[0] = (GLint) ctx->Light.Light[l].ConstantAttenuation;
+ break;
+ case GL_LINEAR_ATTENUATION:
+ params[0] = (GLint) ctx->Light.Light[l].LinearAttenuation;
+ break;
+ case GL_QUADRATIC_ATTENUATION:
+ params[0] = (GLint) ctx->Light.Light[l].QuadraticAttenuation;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
+ break;
+ }
+}
+
+
+
+/**********************************************************************/
+/*** Light Model ***/
+/**********************************************************************/
+
+
+void GLAPIENTRY
+_mesa_LightModelfv( GLenum pname, const GLfloat *params )
+{
+ GLenum newenum;
+ GLboolean newbool;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (pname) {
+ case GL_LIGHT_MODEL_AMBIENT:
+ if (TEST_EQ_4V( ctx->Light.Model.Ambient, params ))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V( ctx->Light.Model.Ambient, params );
+ break;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ newbool = (params[0]!=0.0);
+ if (ctx->Light.Model.LocalViewer == newbool)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Model.LocalViewer = newbool;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ newbool = (params[0]!=0.0);
+ if (ctx->Light.Model.TwoSide == newbool)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Model.TwoSide = newbool;
+
+ if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+ ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
+ else
+ ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
+ break;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ if (params[0] == (GLfloat) GL_SINGLE_COLOR)
+ newenum = GL_SINGLE_COLOR;
+ else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
+ newenum = GL_SEPARATE_SPECULAR_COLOR;
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param=0x0%x)",
+ (GLint) params[0] );
+ return;
+ }
+ if (ctx->Light.Model.ColorControl == newenum)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Model.ColorControl = newenum;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
+ break;
+ }
+
+ if (ctx->Driver.LightModelfv)
+ ctx->Driver.LightModelfv( ctx, pname, params );
+}
+
+
+void GLAPIENTRY
+_mesa_LightModeliv( GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+
+ switch (pname) {
+ case GL_LIGHT_MODEL_AMBIENT:
+ fparam[0] = INT_TO_FLOAT( params[0] );
+ fparam[1] = INT_TO_FLOAT( params[1] );
+ fparam[2] = INT_TO_FLOAT( params[2] );
+ fparam[3] = INT_TO_FLOAT( params[3] );
+ break;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ fparam[0] = (GLfloat) params[0];
+ break;
+ default:
+ /* Error will be caught later in gl_LightModelfv */
+ ;
+ }
+ _mesa_LightModelfv( pname, fparam );
+}
+
+
+void GLAPIENTRY
+_mesa_LightModeli( GLenum pname, GLint param )
+{
+ _mesa_LightModeliv( pname, ¶m );
+}
+
+
+void GLAPIENTRY
+_mesa_LightModelf( GLenum pname, GLfloat param )
+{
+ _mesa_LightModelfv( pname, ¶m );
+}
+
+
+
+/********** MATERIAL **********/
+
+
+/*
+ * Given a face and pname value (ala glColorMaterial), compute a bitmask
+ * of the targeted material values.
+ */
+GLuint
+_mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
+ GLuint legal, const char *where )
+{
+ GLuint bitmask = 0;
+
+ /* Make a bitmask indicating what material attribute(s) we're updating */
+ switch (pname) {
+ case GL_EMISSION:
+ bitmask |= MAT_BIT_FRONT_EMISSION | MAT_BIT_BACK_EMISSION;
+ break;
+ case GL_AMBIENT:
+ bitmask |= MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT;
+ break;
+ case GL_DIFFUSE:
+ bitmask |= MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE;
+ break;
+ case GL_SPECULAR:
+ bitmask |= MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR;
+ break;
+ case GL_SHININESS:
+ bitmask |= MAT_BIT_FRONT_SHININESS | MAT_BIT_BACK_SHININESS;
+ break;
+ case GL_AMBIENT_AND_DIFFUSE:
+ bitmask |= MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT;
+ bitmask |= MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE;
+ break;
+ case GL_COLOR_INDEXES:
+ bitmask |= MAT_BIT_FRONT_INDEXES | MAT_BIT_BACK_INDEXES;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, where );
+ return 0;
+ }
+
+ if (face==GL_FRONT) {
+ bitmask &= FRONT_MATERIAL_BITS;
+ }
+ else if (face==GL_BACK) {
+ bitmask &= BACK_MATERIAL_BITS;
+ }
+ else if (face != GL_FRONT_AND_BACK) {
+ _mesa_error( ctx, GL_INVALID_ENUM, where );
+ return 0;
+ }
+
+ if (bitmask & ~legal) {
+ _mesa_error( ctx, GL_INVALID_ENUM, where );
+ return 0;
+ }
+
+ return bitmask;
+}
+
+
+
+/* Perform a straight copy between materials.
+ */
+void
+_mesa_copy_materials( struct gl_material *dst,
+ const struct gl_material *src,
+ GLuint bitmask )
+{
+ int i;
+
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (bitmask & (1<Attrib[i], src->Attrib[i] );
+}
+
+
+
+/* Update derived values following a change in ctx->Light.Material
+ */
+void
+_mesa_update_material( GLcontext *ctx, GLuint bitmask )
+{
+ struct gl_light *light, *list = &ctx->Light.EnabledList;
+ GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
+
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask);
+
+ if (!bitmask)
+ return;
+
+ /* update material ambience */
+ if (bitmask & MAT_BIT_FRONT_AMBIENT) {
+ foreach (light, list) {
+ SCALE_3V( light->_MatAmbient[0], light->Ambient,
+ mat[MAT_ATTRIB_FRONT_AMBIENT]);
+ }
+ }
+
+ if (bitmask & MAT_BIT_BACK_AMBIENT) {
+ foreach (light, list) {
+ SCALE_3V( light->_MatAmbient[1], light->Ambient,
+ mat[MAT_ATTRIB_BACK_AMBIENT]);
+ }
+ }
+
+ /* update BaseColor = emission + scene's ambience * material's ambience */
+ if (bitmask & (MAT_BIT_FRONT_EMISSION | MAT_BIT_FRONT_AMBIENT)) {
+ COPY_3V( ctx->Light._BaseColor[0], mat[MAT_ATTRIB_FRONT_EMISSION] );
+ ACC_SCALE_3V( ctx->Light._BaseColor[0], mat[MAT_ATTRIB_FRONT_AMBIENT],
+ ctx->Light.Model.Ambient );
+ }
+
+ if (bitmask & (MAT_BIT_BACK_EMISSION | MAT_BIT_BACK_AMBIENT)) {
+ COPY_3V( ctx->Light._BaseColor[1], mat[MAT_ATTRIB_BACK_EMISSION] );
+ ACC_SCALE_3V( ctx->Light._BaseColor[1], mat[MAT_ATTRIB_BACK_AMBIENT],
+ ctx->Light.Model.Ambient );
+ }
+
+ /* update material diffuse values */
+ if (bitmask & MAT_BIT_FRONT_DIFFUSE) {
+ foreach (light, list) {
+ SCALE_3V( light->_MatDiffuse[0], light->Diffuse,
+ mat[MAT_ATTRIB_FRONT_DIFFUSE] );
+ }
+ }
+
+ if (bitmask & MAT_BIT_BACK_DIFFUSE) {
+ foreach (light, list) {
+ SCALE_3V( light->_MatDiffuse[1], light->Diffuse,
+ mat[MAT_ATTRIB_BACK_DIFFUSE] );
+ }
+ }
+
+ /* update material specular values */
+ if (bitmask & MAT_BIT_FRONT_SPECULAR) {
+ foreach (light, list) {
+ SCALE_3V( light->_MatSpecular[0], light->Specular,
+ mat[MAT_ATTRIB_FRONT_SPECULAR]);
+ }
+ }
+
+ if (bitmask & MAT_BIT_BACK_SPECULAR) {
+ foreach (light, list) {
+ SCALE_3V( light->_MatSpecular[1], light->Specular,
+ mat[MAT_ATTRIB_BACK_SPECULAR]);
+ }
+ }
+
+ if (bitmask & MAT_BIT_FRONT_SHININESS) {
+ _mesa_invalidate_shine_table( ctx, 0 );
+ }
+
+ if (bitmask & MAT_BIT_BACK_SHININESS) {
+ _mesa_invalidate_shine_table( ctx, 1 );
+ }
+}
+
+
+/*
+ * Update the current materials from the given rgba color
+ * according to the bitmask in ColorMaterialBitmask, which is
+ * set by glColorMaterial().
+ */
+void
+_mesa_update_color_material( GLcontext *ctx, const GLfloat color[4] )
+{
+ GLuint bitmask = ctx->Light.ColorMaterialBitmask;
+ struct gl_material *mat = &ctx->Light.Material;
+ int i;
+
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (bitmask & (1<Attrib[i], color );
+
+ _mesa_update_material( ctx, bitmask );
+}
+
+
+void GLAPIENTRY
+_mesa_ColorMaterial( GLenum face, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint bitmask;
+ GLuint legal = (MAT_BIT_FRONT_EMISSION | MAT_BIT_BACK_EMISSION |
+ MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR |
+ MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE |
+ MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glColorMaterial %s %s\n",
+ _mesa_lookup_enum_by_nr(face),
+ _mesa_lookup_enum_by_nr(mode));
+
+ bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial");
+
+ if (ctx->Light.ColorMaterialBitmask == bitmask &&
+ ctx->Light.ColorMaterialFace == face &&
+ ctx->Light.ColorMaterialMode == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.ColorMaterialBitmask = bitmask;
+ ctx->Light.ColorMaterialFace = face;
+ ctx->Light.ColorMaterialMode = mode;
+
+ if (ctx->Light.ColorMaterialEnabled) {
+ FLUSH_CURRENT( ctx, 0 );
+ _mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ }
+
+ if (ctx->Driver.ColorMaterial)
+ (*ctx->Driver.ColorMaterial)( ctx, face, mode );
+}
+
+
+void GLAPIENTRY
+_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint f;
+ GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
+
+ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
+
+ if (face==GL_FRONT) {
+ f = 0;
+ }
+ else if (face==GL_BACK) {
+ f = 1;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(face)" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_AMBIENT:
+ COPY_4FV( params, mat[MAT_ATTRIB_AMBIENT(f)] );
+ break;
+ case GL_DIFFUSE:
+ COPY_4FV( params, mat[MAT_ATTRIB_DIFFUSE(f)] );
+ break;
+ case GL_SPECULAR:
+ COPY_4FV( params, mat[MAT_ATTRIB_SPECULAR(f)] );
+ break;
+ case GL_EMISSION:
+ COPY_4FV( params, mat[MAT_ATTRIB_EMISSION(f)] );
+ break;
+ case GL_SHININESS:
+ *params = mat[MAT_ATTRIB_SHININESS(f)][0];
+ break;
+ case GL_COLOR_INDEXES:
+ params[0] = mat[MAT_ATTRIB_INDEXES(f)][0];
+ params[1] = mat[MAT_ATTRIB_INDEXES(f)][1];
+ params[2] = mat[MAT_ATTRIB_INDEXES(f)][2];
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint f;
+ GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
+
+ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
+
+ if (face==GL_FRONT) {
+ f = 0;
+ }
+ else if (face==GL_BACK) {
+ f = 1;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialiv(face)" );
+ return;
+ }
+ switch (pname) {
+ case GL_AMBIENT:
+ params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][0] );
+ params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][1] );
+ params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][2] );
+ params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][3] );
+ break;
+ case GL_DIFFUSE:
+ params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][0] );
+ params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][1] );
+ params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][2] );
+ params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][3] );
+ break;
+ case GL_SPECULAR:
+ params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][0] );
+ params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][1] );
+ params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][2] );
+ params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][3] );
+ break;
+ case GL_EMISSION:
+ params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][0] );
+ params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][1] );
+ params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][2] );
+ params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][3] );
+ break;
+ case GL_SHININESS:
+ *params = IROUND( mat[MAT_ATTRIB_SHININESS(f)][0] );
+ break;
+ case GL_COLOR_INDEXES:
+ params[0] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][0] );
+ params[1] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][1] );
+ params[2] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][2] );
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
+ }
+}
+
+
+
+/**********************************************************************/
+/***** Lighting computation *****/
+/**********************************************************************/
+
+
+/*
+ * Notes:
+ * When two-sided lighting is enabled we compute the color (or index)
+ * for both the front and back side of the primitive. Then, when the
+ * orientation of the facet is later learned, we can determine which
+ * color (or index) to use for rendering.
+ *
+ * KW: We now know orientation in advance and only shade for
+ * the side or sides which are actually required.
+ *
+ * Variables:
+ * n = normal vector
+ * V = vertex position
+ * P = light source position
+ * Pe = (0,0,0,1)
+ *
+ * Precomputed:
+ * IF P[3]==0 THEN
+ * // light at infinity
+ * IF local_viewer THEN
+ * _VP_inf_norm = unit vector from V to P // Precompute
+ * ELSE
+ * // eye at infinity
+ * _h_inf_norm = Normalize( VP + <0,0,1> ) // Precompute
+ * ENDIF
+ * ENDIF
+ *
+ * Functions:
+ * Normalize( v ) = normalized vector v
+ * Magnitude( v ) = length of vector v
+ */
+
+
+
+/*
+ * Whenever the spotlight exponent for a light changes we must call
+ * this function to recompute the exponent lookup table.
+ */
+void
+_mesa_invalidate_spot_exp_table( struct gl_light *l )
+{
+ l->_SpotExpTable[0][0] = -1;
+}
+
+
+static void
+validate_spot_exp_table( struct gl_light *l )
+{
+ GLint i;
+ GLdouble exponent = l->SpotExponent;
+ GLdouble tmp = 0;
+ GLint clamp = 0;
+
+ l->_SpotExpTable[0][0] = 0.0;
+
+ for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) {
+ if (clamp == 0) {
+ tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
+ if (tmp < FLT_MIN * 100.0) {
+ tmp = 0.0;
+ clamp = 1;
+ }
+ }
+ l->_SpotExpTable[i][0] = (GLfloat) tmp;
+ }
+ for (i = 0; i < EXP_TABLE_SIZE - 1; i++) {
+ l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] -
+ l->_SpotExpTable[i][0]);
+ }
+ l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0;
+}
+
+
+
+/* Calculate a new shine table. Doing this here saves a branch in
+ * lighting, and the cost of doing it early may be partially offset
+ * by keeping a MRU cache of shine tables for various shine values.
+ */
+void
+_mesa_invalidate_shine_table( GLcontext *ctx, GLuint side )
+{
+ ASSERT(side < 2);
+ if (ctx->_ShineTable[side])
+ ctx->_ShineTable[side]->refcount--;
+ ctx->_ShineTable[side] = 0;
+}
+
+
+static void
+validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess )
+{
+ struct gl_shine_tab *list = ctx->_ShineTabList;
+ struct gl_shine_tab *s;
+
+ ASSERT(side < 2);
+
+ foreach(s, list)
+ if ( s->shininess == shininess )
+ break;
+
+ if (s == list) {
+ GLint j;
+ GLfloat *m;
+
+ foreach(s, list)
+ if (s->refcount == 0)
+ break;
+
+ m = s->tab;
+ m[0] = 0.0;
+ if (shininess == 0.0) {
+ for (j = 1 ; j <= SHINE_TABLE_SIZE ; j++)
+ m[j] = 1.0;
+ }
+ else {
+ for (j = 1 ; j < SHINE_TABLE_SIZE ; j++) {
+ GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1);
+ if (x < 0.005) /* underflow check */
+ x = 0.005;
+ t = _mesa_pow(x, shininess);
+ if (t > 1e-20)
+ m[j] = (GLfloat) t;
+ else
+ m[j] = 0.0;
+ }
+ m[SHINE_TABLE_SIZE] = 1.0;
+ }
+
+ s->shininess = shininess;
+ }
+
+ if (ctx->_ShineTable[side])
+ ctx->_ShineTable[side]->refcount--;
+
+ ctx->_ShineTable[side] = s;
+ move_to_tail( list, s );
+ s->refcount++;
+}
+
+
+void
+_mesa_validate_all_lighting_tables( GLcontext *ctx )
+{
+ GLuint i;
+ GLfloat shininess;
+
+ shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0];
+ if (!ctx->_ShineTable[0] || ctx->_ShineTable[0]->shininess != shininess)
+ validate_shine_table( ctx, 0, shininess );
+
+ shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][0];
+ if (!ctx->_ShineTable[1] || ctx->_ShineTable[1]->shininess != shininess)
+ validate_shine_table( ctx, 1, shininess );
+
+ for (i = 0 ; i < MAX_LIGHTS ; i++)
+ if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1)
+ validate_spot_exp_table( &ctx->Light.Light[i] );
+}
+
+
+
+/*
+ * Examine current lighting parameters to determine if the optimized lighting
+ * function can be used.
+ * Also, precompute some lighting values such as the products of light
+ * source and material ambient, diffuse and specular coefficients.
+ */
+void
+_mesa_update_lighting( GLcontext *ctx )
+{
+ struct gl_light *light;
+ ctx->Light._NeedEyeCoords = 0;
+ ctx->Light._Flags = 0;
+
+ if (!ctx->Light.Enabled)
+ return;
+
+ foreach(light, &ctx->Light.EnabledList) {
+ ctx->Light._Flags |= light->_Flags;
+ }
+
+ ctx->Light._NeedVertices =
+ ((ctx->Light._Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) ||
+ ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ||
+ ctx->Light.Model.LocalViewer);
+
+ ctx->Light._NeedEyeCoords = ((ctx->Light._Flags & LIGHT_POSITIONAL) ||
+ ctx->Light.Model.LocalViewer);
+
+
+
+ /* XXX: This test is overkill & needs to be fixed both for software and
+ * hardware t&l drivers. The above should be sufficient & should
+ * be tested to verify this.
+ */
+ if (ctx->Light._NeedVertices)
+ ctx->Light._NeedEyeCoords = GL_TRUE;
+
+
+ /* Precompute some shading values. Although we reference
+ * Light.Material here, we can get away without flushing
+ * FLUSH_UPDATE_CURRENT, as when any outstanding material changes
+ * are flushed, they will update the derived state at that time.
+ */
+ if (ctx->Visual.rgbMode) {
+ if (ctx->Light.Model.TwoSide)
+ _mesa_update_material( ctx,
+ MAT_BIT_FRONT_EMISSION |
+ MAT_BIT_FRONT_AMBIENT |
+ MAT_BIT_FRONT_DIFFUSE |
+ MAT_BIT_FRONT_SPECULAR |
+ MAT_BIT_BACK_EMISSION |
+ MAT_BIT_BACK_AMBIENT |
+ MAT_BIT_BACK_DIFFUSE |
+ MAT_BIT_BACK_SPECULAR);
+ else
+ _mesa_update_material( ctx,
+ MAT_BIT_FRONT_EMISSION |
+ MAT_BIT_FRONT_AMBIENT |
+ MAT_BIT_FRONT_DIFFUSE |
+ MAT_BIT_FRONT_SPECULAR);
+ }
+ else {
+ static const GLfloat ci[3] = { .30F, .59F, .11F };
+ foreach(light, &ctx->Light.EnabledList) {
+ light->_dli = DOT3(ci, light->Diffuse);
+ light->_sli = DOT3(ci, light->Specular);
+ }
+ }
+}
+
+
+/* _NEW_MODELVIEW
+ * _NEW_LIGHT
+ * _TNL_NEW_NEED_EYE_COORDS
+ *
+ * Update on (_NEW_MODELVIEW | _NEW_LIGHT) when lighting is enabled.
+ * Also update on lighting space changes.
+ */
+static void
+compute_light_positions( GLcontext *ctx )
+{
+ struct gl_light *light;
+ static const GLfloat eye_z[3] = { 0, 0, 1 };
+
+ if (!ctx->Light.Enabled)
+ return;
+
+ if (ctx->_NeedEyeCoords) {
+ COPY_3V( ctx->_EyeZDir, eye_z );
+ }
+ else {
+ TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelviewMatrixStack.Top->m );
+ }
+
+ foreach (light, &ctx->Light.EnabledList) {
+
+ if (ctx->_NeedEyeCoords) {
+ COPY_4FV( light->_Position, light->EyePosition );
+ }
+ else {
+ TRANSFORM_POINT( light->_Position, ctx->ModelviewMatrixStack.Top->inv,
+ light->EyePosition );
+ }
+
+ if (!(light->_Flags & LIGHT_POSITIONAL)) {
+ /* VP (VP) = Normalize( Position ) */
+ COPY_3V( light->_VP_inf_norm, light->_Position );
+ NORMALIZE_3FV( light->_VP_inf_norm );
+
+ if (!ctx->Light.Model.LocalViewer) {
+ /* _h_inf_norm = Normalize( V_to_P + <0,0,1> ) */
+ ADD_3V( light->_h_inf_norm, light->_VP_inf_norm, ctx->_EyeZDir);
+ NORMALIZE_3FV( light->_h_inf_norm );
+ }
+ light->_VP_inf_spot_attenuation = 1.0;
+ }
+
+ if (light->_Flags & LIGHT_SPOT) {
+ if (ctx->_NeedEyeCoords) {
+ COPY_3V( light->_NormDirection, light->EyeDirection );
+ }
+ else {
+ TRANSFORM_NORMAL( light->_NormDirection,
+ light->EyeDirection,
+ ctx->ModelviewMatrixStack.Top->m);
+ }
+
+ NORMALIZE_3FV( light->_NormDirection );
+
+ if (!(light->_Flags & LIGHT_POSITIONAL)) {
+ GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm,
+ light->_NormDirection);
+
+ if (PV_dot_dir > light->_CosCutoff) {
+ double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
+ int k = (int) x;
+ light->_VP_inf_spot_attenuation =
+ (GLfloat) (light->_SpotExpTable[k][0] +
+ (x-k)*light->_SpotExpTable[k][1]);
+ }
+ else {
+ light->_VP_inf_spot_attenuation = 0;
+ }
+ }
+ }
+ }
+}
+
+
+
+static void
+update_modelview_scale( GLcontext *ctx )
+{
+ ctx->_ModelViewInvScale = 1.0F;
+ if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_UNIFORM_SCALE |
+ MAT_FLAG_GENERAL_SCALE |
+ MAT_FLAG_GENERAL_3D |
+ MAT_FLAG_GENERAL) ) {
+ const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv;
+ GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
+ if (f < 1e-12) f = 1.0;
+ if (ctx->_NeedEyeCoords)
+ ctx->_ModelViewInvScale = (GLfloat) INV_SQRTF(f);
+ else
+ ctx->_ModelViewInvScale = (GLfloat) SQRTF(f);
+ }
+}
+
+
+/* Bring uptodate any state that relies on _NeedEyeCoords.
+ */
+void
+_mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state )
+{
+ const GLuint oldneedeyecoords = ctx->_NeedEyeCoords;
+
+ (void) new_state;
+ ctx->_NeedEyeCoords = 0;
+
+ if (ctx->_ForceEyeCoords ||
+ (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) ||
+ ctx->Point._Attenuated ||
+ ctx->Light._NeedEyeCoords)
+ ctx->_NeedEyeCoords = 1;
+
+ if (ctx->Light.Enabled &&
+ !TEST_MAT_FLAGS( ctx->ModelviewMatrixStack.Top,
+ MAT_FLAGS_LENGTH_PRESERVING))
+ ctx->_NeedEyeCoords = 1;
+
+
+ /* Check if the truth-value interpretations of the bitfields have
+ * changed:
+ */
+ if (oldneedeyecoords != ctx->_NeedEyeCoords) {
+ /* Recalculate all state that depends on _NeedEyeCoords.
+ */
+ update_modelview_scale(ctx);
+ compute_light_positions( ctx );
+
+ if (ctx->Driver.LightingSpaceChange)
+ ctx->Driver.LightingSpaceChange( ctx );
+ }
+ else {
+ GLuint new_state = ctx->NewState;
+
+ /* Recalculate that same state only if it has been invalidated
+ * by other statechanges.
+ */
+ if (new_state & _NEW_MODELVIEW)
+ update_modelview_scale(ctx);
+
+ if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW))
+ compute_light_positions( ctx );
+ }
+}
+
+
+/* Drivers may need this if the hardware tnl unit doesn't support the
+ * light-in-modelspace optimization. It's also useful for debugging.
+ */
+void
+_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag )
+{
+ ctx->_ForceEyeCoords = !flag;
+ ctx->NewState |= _NEW_POINT; /* one of the bits from
+ * _MESA_NEW_NEED_EYE_COORDS.
+ */
+}
+
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+/**
+ * Initialize the n-th light data structure.
+ *
+ * \param l pointer to the gl_light structure to be initialized.
+ * \param n number of the light.
+ * \note The defaults for light 0 are different than the other lights.
+ */
+static void
+init_light( struct gl_light *l, GLuint n )
+{
+ make_empty_list( l );
+
+ ASSIGN_4V( l->Ambient, 0.0, 0.0, 0.0, 1.0 );
+ if (n==0) {
+ ASSIGN_4V( l->Diffuse, 1.0, 1.0, 1.0, 1.0 );
+ ASSIGN_4V( l->Specular, 1.0, 1.0, 1.0, 1.0 );
+ }
+ else {
+ ASSIGN_4V( l->Diffuse, 0.0, 0.0, 0.0, 1.0 );
+ ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 );
+ }
+ ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 );
+ ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 );
+ l->SpotExponent = 0.0;
+ _mesa_invalidate_spot_exp_table( l );
+ l->SpotCutoff = 180.0;
+ l->_CosCutoff = 0.0; /* KW: -ve values not admitted */
+ l->ConstantAttenuation = 1.0;
+ l->LinearAttenuation = 0.0;
+ l->QuadraticAttenuation = 0.0;
+ l->Enabled = GL_FALSE;
+}
+
+
+/**
+ * Initialize the light model data structure.
+ *
+ * \param lm pointer to the gl_lightmodel structure to be initialized.
+ */
+static void
+init_lightmodel( struct gl_lightmodel *lm )
+{
+ ASSIGN_4V( lm->Ambient, 0.2F, 0.2F, 0.2F, 1.0F );
+ lm->LocalViewer = GL_FALSE;
+ lm->TwoSide = GL_FALSE;
+ lm->ColorControl = GL_SINGLE_COLOR;
+}
+
+
+/**
+ * Initialize the material data structure.
+ *
+ * \param m pointer to the gl_material structure to be initialized.
+ */
+static void
+init_material( struct gl_material *m )
+{
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_AMBIENT], 0.2F, 0.2F, 0.2F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_DIFFUSE], 0.8F, 0.8F, 0.8F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_SPECULAR], 0.0F, 0.0F, 0.0F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_EMISSION], 0.0F, 0.0F, 0.0F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_SHININESS], 0.0F, 0.0F, 0.0F, 0.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_INDEXES], 0.0F, 1.0F, 1.0F, 0.0F );
+
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_AMBIENT], 0.2F, 0.2F, 0.2F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_DIFFUSE], 0.8F, 0.8F, 0.8F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_SPECULAR], 0.0F, 0.0F, 0.0F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_EMISSION], 0.0F, 0.0F, 0.0F, 1.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_SHININESS], 0.0F, 0.0F, 0.0F, 0.0F );
+ ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_INDEXES], 0.0F, 1.0F, 1.0F, 0.0F );
+}
+
+
+void
+_mesa_init_lighting( GLcontext *ctx )
+{
+ GLuint i;
+
+ /* Lighting group */
+ for (i = 0; i < MAX_LIGHTS; i++) {
+ init_light( &ctx->Light.Light[i], i );
+ }
+ make_empty_list( &ctx->Light.EnabledList );
+
+ init_lightmodel( &ctx->Light.Model );
+ init_material( &ctx->Light.Material );
+ ctx->Light.ShadeModel = GL_SMOOTH;
+ ctx->Light.Enabled = GL_FALSE;
+ ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK;
+ ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE;
+ ctx->Light.ColorMaterialBitmask = _mesa_material_bitmask( ctx,
+ GL_FRONT_AND_BACK,
+ GL_AMBIENT_AND_DIFFUSE, ~0, 0 );
+
+ ctx->Light.ColorMaterialEnabled = GL_FALSE;
+
+ /* Lighting miscellaneous */
+ ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab );
+ make_empty_list( ctx->_ShineTabList );
+ /* Allocate 10 (arbitrary) shininess lookup tables */
+ for (i = 0 ; i < 10 ; i++) {
+ struct gl_shine_tab *s = MALLOC_STRUCT( gl_shine_tab );
+ s->shininess = -1;
+ s->refcount = 0;
+ insert_at_tail( ctx->_ShineTabList, s );
+ }
+
+ /* Miscellaneous */
+ ctx->Light._NeedEyeCoords = 0;
+ ctx->_NeedEyeCoords = 0;
+ ctx->_ModelViewInvScale = 1.0;
+}
+
+
+void
+_mesa_free_lighting_data( GLcontext *ctx )
+{
+ struct gl_shine_tab *s, *tmps;
+
+ /* Free lighting shininess exponentiation table */
+ foreach_s( s, tmps, ctx->_ShineTabList ) {
+ FREE( s );
+ }
+ FREE( ctx->_ShineTabList );
+}
Index: xc/extras/Mesa/src/mesa/main/light.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/light.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/light.h Thu Apr 8 05:17:46 2004
@@ -0,0 +1,141 @@
+/**
+ * \file light.h
+ * Lighting.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef LIGHT_H
+#define LIGHT_H
+
+
+#include "mtypes.h"
+
+extern void GLAPIENTRY
+_mesa_ShadeModel( GLenum mode );
+
+#if _HAVE_FULL_GL
+extern void GLAPIENTRY
+_mesa_ColorMaterial( GLenum face, GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_Lightf( GLenum light, GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params );
+
+extern void GLAPIENTRY
+_mesa_Lighti( GLenum light, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_LightModelf( GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_LightModelfv( GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_LightModeli( GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_LightModeliv( GLenum pname, const GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params );
+
+
+/* Lerp between adjacent values in the f(x) lookup table, giving a
+ * continuous function, with adequeate overall accuracy. (Though
+ * still pretty good compared to a straight lookup).
+ * Result should be a GLfloat.
+ */
+#define GET_SHINE_TAB_ENTRY( table, dp, result ) \
+do { \
+ struct gl_shine_tab *_tab = table; \
+ float f = (dp * (SHINE_TABLE_SIZE-1)); \
+ int k = (int) f; \
+ if (k > SHINE_TABLE_SIZE-2) \
+ result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \
+ else \
+ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \
+} while (0)
+
+
+extern GLuint _mesa_material_bitmask( GLcontext *ctx,
+ GLenum face, GLenum pname,
+ GLuint legal,
+ const char * );
+
+extern void _mesa_invalidate_spot_exp_table( struct gl_light *l );
+
+extern void _mesa_invalidate_shine_table( GLcontext *ctx, GLuint i );
+
+extern void _mesa_validate_all_lighting_tables( GLcontext *ctx );
+
+extern void _mesa_update_lighting( GLcontext *ctx );
+
+extern void _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state );
+
+extern void _mesa_update_material( GLcontext *ctx,
+ GLuint bitmask );
+
+extern void _mesa_copy_materials( struct gl_material *dst,
+ const struct gl_material *src,
+ GLuint bitmask );
+
+extern void _mesa_update_color_material( GLcontext *ctx,
+ const GLfloat rgba[4] );
+
+extern void _mesa_init_lighting( GLcontext *ctx );
+
+extern void _mesa_free_lighting_data( GLcontext *ctx );
+
+extern void _mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag );
+
+#else
+#define _mesa_update_color_material( c, r ) ((void)0)
+#define _mesa_validate_all_lighting_tables( c ) ((void)0)
+#define _mesa_invalidate_spot_exp_table( l ) ((void)0)
+#define _mesa_material_bitmask( c, f, p, l, s ) 0
+#define _mesa_init_lighting( c ) ((void)0)
+#define _mesa_free_lighting_data( c ) ((void)0)
+#define _mesa_update_lighting( c ) ((void)0)
+#define _mesa_update_tnl_spaces( c, n ) ((void)0)
+#define GET_SHINE_TAB_ENTRY( table, dp, result ) ((result)=0)
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/lines.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/lines.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/lines.c Thu Apr 8 05:17:46 2004
@@ -0,0 +1,134 @@
+/**
+ * \file lines.c
+ * Line operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "context.h"
+#include "depth.h"
+#include "lines.h"
+#include "macros.h"
+#include "texstate.h"
+#include "mtypes.h"
+
+
+/**
+ * Set the line width.
+ *
+ * \param width line width in pixels.
+ *
+ * \sa glLineWidth().
+ *
+ * Verifies the parameter and updates gl_line_attrib::Width. On a change,
+ * flushes the vertices, updates the clamped line width and marks the
+ * DD_LINE_WIDTH flag in __GLcontextRec::_TriangleCaps for the drivers if the
+ * width is different from one. Notifies the driver via the
+ * dd_function_table::LineWidth callback.
+ */
+void GLAPIENTRY
+_mesa_LineWidth( GLfloat width )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (width<=0.0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
+ return;
+ }
+
+ if (ctx->Line.Width == width)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_LINE);
+ ctx->Line.Width = width;
+ ctx->Line._Width = CLAMP(width,
+ ctx->Const.MinLineWidth,
+ ctx->Const.MaxLineWidth);
+
+
+ if (width != 1.0)
+ ctx->_TriangleCaps |= DD_LINE_WIDTH;
+ else
+ ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
+
+ if (ctx->Driver.LineWidth)
+ (*ctx->Driver.LineWidth)(ctx, width);
+}
+
+
+/**
+ * Set the line stipple pattern.
+ *
+ * \param factor pattern scale factor.
+ * \param pattern bit pattern.
+ *
+ * \sa glLineStipple().
+ *
+ * Updates gl_line_attrib::StippleFactor and gl_line_attrib::StipplePattern. On
+ * change flushes the vertices and notifies the driver via
+ * the dd_function_table::LineStipple callback.
+ */
+void GLAPIENTRY
+_mesa_LineStipple( GLint factor, GLushort pattern )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ factor = CLAMP( factor, 1, 256 );
+
+ if (ctx->Line.StippleFactor == factor &&
+ ctx->Line.StipplePattern == pattern)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_LINE);
+ ctx->Line.StippleFactor = factor;
+ ctx->Line.StipplePattern = pattern;
+
+ if (ctx->Driver.LineStipple)
+ ctx->Driver.LineStipple( ctx, factor, pattern );
+}
+
+
+/**
+ * Initialize the context line state.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes __GLcontextRec::Line and line related constants in
+ * __GLcontextRec::Const.
+ */
+void GLAPIENTRY _mesa_init_line( GLcontext * ctx )
+{
+ /* Line group */
+ ctx->Line.SmoothFlag = GL_FALSE;
+ ctx->Line.StippleFlag = GL_FALSE;
+ ctx->Line.Width = 1.0;
+ ctx->Line._Width = 1.0;
+ ctx->Line.StipplePattern = 0xffff;
+ ctx->Line.StippleFactor = 1;
+}
Index: xc/extras/Mesa/src/mesa/main/lines.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/lines.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/lines.h Thu Apr 8 05:17:46 2004
@@ -0,0 +1,48 @@
+/**
+ * \file lines.h
+ * Line operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef LINES_H
+#define LINES_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_LineWidth( GLfloat width );
+
+extern void GLAPIENTRY
+_mesa_LineStipple( GLint factor, GLushort pattern );
+
+extern void GLAPIENTRY
+_mesa_init_line( GLcontext * ctx );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/macros.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/macros.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/macros.h Fri Dec 10 10:05:18 2004
@@ -0,0 +1,657 @@
+/**
+ * \file macros.h
+ * A collection of useful macros.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.0
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef MACROS_H
+#define MACROS_H
+
+#include "imports.h"
+
+
+/**
+ * \name Integer / float conversion for colors, normals, etc.
+ */
+/*@{*/
+
+/** Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */
+extern GLfloat _mesa_ubyte_to_float_color_tab[256];
+#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)(u)]
+
+/** Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */
+#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F))
+
+
+/** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0] */
+#define BYTE_TO_FLOAT(B) ((2.0F * (B) + 1.0F) * (1.0F/255.0F))
+
+/** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127] */
+#define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 )
+
+
+/** Convert GLushort in [0,65536] to GLfloat in [0.0,1.0] */
+#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F))
+
+/** Convert GLfloat in [0.0,1.0] to GLushort in [0,65536] */
+#define FLOAT_TO_USHORT(X) ((GLushort) (GLint) ((X) * 65535.0F))
+
+/** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */
+#define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F))
+
+/** Convert GLfloat in [0.0,1.0] to GLshort in [-32768,32767] */
+#define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 )
+
+
+/** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */
+#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F))
+
+/** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */
+#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0))
+
+
+/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */
+#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F))
+
+/** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */
+/* causes overflow:
+#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 )
+*/
+/* a close approximation: */
+#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) )
+
+
+#define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b)))
+#define SHORT_TO_UBYTE(s) ((GLubyte) ((s) < 0 ? 0 : (GLubyte) ((s) >> 7)))
+#define USHORT_TO_UBYTE(s) ((GLubyte) ((s) >> 8))
+#define INT_TO_UBYTE(i) ((GLubyte) ((i) < 0 ? 0 : (GLubyte) ((i) >> 23)))
+#define UINT_TO_UBYTE(i) ((GLubyte) ((i) >> 24))
+
+
+#define BYTE_TO_USHORT(b) ((b) < 0 ? 0 : ((GLushort) (((b) * 65535) / 255)))
+#define UBYTE_TO_USHORT(b) (((GLushort) (b) << 8) | (GLushort) (b))
+#define SHORT_TO_USHORT(s) ((s) < 0 ? 0 : ((GLushort) (((s) * 65535 / 32767))))
+#define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15)))
+#define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16)))
+#define UNCLAMPED_FLOAT_TO_USHORT(us, f) \
+ us = ( (GLushort) IROUND( CLAMP((f), 0.0, 1.0) * 65535.0F) )
+#define CLAMPED_FLOAT_TO_USHORT(us, f) \
+ us = ( (GLushort) IROUND( (f) * 65535.0F) )
+
+/*@}*/
+
+
+/** Stepping a GLfloat pointer by a byte stride */
+#define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i))
+/** Stepping a GLuint pointer by a byte stride */
+#define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i))
+/** Stepping a GLubyte[4] pointer by a byte stride */
+#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i))
+/** Stepping a GLfloat[4] pointer by a byte stride */
+#define STRIDE_4F(p, i) (p = (GLfloat (*)[4])((GLubyte *)p + i))
+/** Stepping a GLchan[4] pointer by a byte stride */
+#define STRIDE_4CHAN(p, i) (p = (GLchan (*)[4])((GLubyte *)p + i))
+/** Stepping a GLchan pointer by a byte stride */
+#define STRIDE_CHAN(p, i) (p = (GLchan *)((GLubyte *)p + i))
+/** Stepping a \p t pointer by a byte stride */
+#define STRIDE_T(p, t, i) (p = (t)((GLubyte *)p + i))
+
+
+/**********************************************************************/
+/** \name 4-element vector operations */
+/*@{*/
+
+/** Zero */
+#define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0
+
+/** Test for equality */
+#define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \
+ (a)[1] == (b)[1] && \
+ (a)[2] == (b)[2] && \
+ (a)[3] == (b)[3])
+
+/** Test for equality (unsigned bytes) */
+#if defined(__i386__)
+#define TEST_EQ_4UBV(DST, SRC) *((GLuint*)(DST)) == *((GLuint*)(SRC))
+#else
+#define TEST_EQ_4UBV(DST, SRC) TEST_EQ_4V(DST, SRC)
+#endif
+
+/** Copy a 4-element vector */
+#define COPY_4V( DST, SRC ) \
+do { \
+ (DST)[0] = (SRC)[0]; \
+ (DST)[1] = (SRC)[1]; \
+ (DST)[2] = (SRC)[2]; \
+ (DST)[3] = (SRC)[3]; \
+} while (0)
+
+/** Copy a 4-element vector with cast */
+#define COPY_4V_CAST( DST, SRC, CAST ) \
+do { \
+ (DST)[0] = (CAST)(SRC)[0]; \
+ (DST)[1] = (CAST)(SRC)[1]; \
+ (DST)[2] = (CAST)(SRC)[2]; \
+ (DST)[3] = (CAST)(SRC)[3]; \
+} while (0)
+
+/** Copy a 4-element unsigned byte vector */
+#if defined(__i386__)
+#define COPY_4UBV(DST, SRC) \
+do { \
+ *((GLuint*)(DST)) = *((GLuint*)(SRC)); \
+} while (0)
+#else
+/* The GLuint cast might fail if DST or SRC are not dword-aligned (RISC) */
+#define COPY_4UBV(DST, SRC) \
+do { \
+ (DST)[0] = (SRC)[0]; \
+ (DST)[1] = (SRC)[1]; \
+ (DST)[2] = (SRC)[2]; \
+ (DST)[3] = (SRC)[3]; \
+} while (0)
+#endif
+
+/** Copy a 4-element float vector (Use COPY_FLOAT to avoid loading FPU) */
+#define COPY_4FV( DST, SRC ) \
+do { \
+ COPY_FLOAT((DST)[0], (SRC)[0]); \
+ COPY_FLOAT((DST)[1], (SRC)[1]); \
+ COPY_FLOAT((DST)[2], (SRC)[2]); \
+ COPY_FLOAT((DST)[3], (SRC)[3]); \
+} while (0)
+
+
+/** Copy \p SZ elements into a 4-element vector */
+#define COPY_SZ_4V(DST, SZ, SRC) \
+do { \
+ switch (SZ) { \
+ case 4: (DST)[3] = (SRC)[3]; \
+ case 3: (DST)[2] = (SRC)[2]; \
+ case 2: (DST)[1] = (SRC)[1]; \
+ case 1: (DST)[0] = (SRC)[0]; \
+ } \
+} while(0)
+
+/** Copy \p SZ elements into a homegeneous (4-element) vector, giving
+ * default values to the remaining */
+#define COPY_CLEAN_4V(DST, SZ, SRC) \
+do { \
+ ASSIGN_4V( DST, 0, 0, 0, 1 ); \
+ COPY_SZ_4V( DST, SZ, SRC ); \
+} while (0)
+
+/** Subtraction */
+#define SUB_4V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] - (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] - (SRCB)[1]; \
+ (DST)[2] = (SRCA)[2] - (SRCB)[2]; \
+ (DST)[3] = (SRCA)[3] - (SRCB)[3]; \
+} while (0)
+
+/** Addition */
+#define ADD_4V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] + (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] + (SRCB)[1]; \
+ (DST)[2] = (SRCA)[2] + (SRCB)[2]; \
+ (DST)[3] = (SRCA)[3] + (SRCB)[3]; \
+} while (0)
+
+/** Element-wise multiplication */
+#define SCALE_4V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] * (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] * (SRCB)[1]; \
+ (DST)[2] = (SRCA)[2] * (SRCB)[2]; \
+ (DST)[3] = (SRCA)[3] * (SRCB)[3]; \
+} while (0)
+
+/** In-place addition */
+#define ACC_4V( DST, SRC ) \
+do { \
+ (DST)[0] += (SRC)[0]; \
+ (DST)[1] += (SRC)[1]; \
+ (DST)[2] += (SRC)[2]; \
+ (DST)[3] += (SRC)[3]; \
+} while (0)
+
+/** Element-wise multiplication and addition */
+#define ACC_SCALE_4V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] += (SRCA)[0] * (SRCB)[0]; \
+ (DST)[1] += (SRCA)[1] * (SRCB)[1]; \
+ (DST)[2] += (SRCA)[2] * (SRCB)[2]; \
+ (DST)[3] += (SRCA)[3] * (SRCB)[3]; \
+} while (0)
+
+/** In-place scalar multiplication and addition */
+#define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \
+do { \
+ (DST)[0] += S * (SRCB)[0]; \
+ (DST)[1] += S * (SRCB)[1]; \
+ (DST)[2] += S * (SRCB)[2]; \
+ (DST)[3] += S * (SRCB)[3]; \
+} while (0)
+
+/** Scalar multiplication */
+#define SCALE_SCALAR_4V( DST, S, SRCB ) \
+do { \
+ (DST)[0] = S * (SRCB)[0]; \
+ (DST)[1] = S * (SRCB)[1]; \
+ (DST)[2] = S * (SRCB)[2]; \
+ (DST)[3] = S * (SRCB)[3]; \
+} while (0)
+
+/** In-place scalar multiplication */
+#define SELF_SCALE_SCALAR_4V( DST, S ) \
+do { \
+ (DST)[0] *= S; \
+ (DST)[1] *= S; \
+ (DST)[2] *= S; \
+ (DST)[3] *= S; \
+} while (0)
+
+/** Assignment */
+#define ASSIGN_4V( V, V0, V1, V2, V3 ) \
+do { \
+ V[0] = V0; \
+ V[1] = V1; \
+ V[2] = V2; \
+ V[3] = V3; \
+} while(0)
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name 3-element vector operations*/
+/*@{*/
+
+/** Zero */
+#define ZERO_3V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = 0
+
+/** Test for equality */
+#define TEST_EQ_3V(a,b) \
+ ((a)[0] == (b)[0] && \
+ (a)[1] == (b)[1] && \
+ (a)[2] == (b)[2])
+
+/** Copy a 3-element vector */
+#define COPY_3V( DST, SRC ) \
+do { \
+ (DST)[0] = (SRC)[0]; \
+ (DST)[1] = (SRC)[1]; \
+ (DST)[2] = (SRC)[2]; \
+} while (0)
+
+/** Copy a 3-element vector with cast */
+#define COPY_3V_CAST( DST, SRC, CAST ) \
+do { \
+ (DST)[0] = (CAST)(SRC)[0]; \
+ (DST)[1] = (CAST)(SRC)[1]; \
+ (DST)[2] = (CAST)(SRC)[2]; \
+} while (0)
+
+/** Copy a 3-element float vector */
+#define COPY_3FV( DST, SRC ) \
+do { \
+ const GLfloat *_tmp = (SRC); \
+ (DST)[0] = _tmp[0]; \
+ (DST)[1] = _tmp[1]; \
+ (DST)[2] = _tmp[2]; \
+} while (0)
+
+/** Subtraction */
+#define SUB_3V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] - (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] - (SRCB)[1]; \
+ (DST)[2] = (SRCA)[2] - (SRCB)[2]; \
+} while (0)
+
+/** Addition */
+#define ADD_3V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] + (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] + (SRCB)[1]; \
+ (DST)[2] = (SRCA)[2] + (SRCB)[2]; \
+} while (0)
+
+/** In-place scalar multiplication */
+#define SCALE_3V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] * (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] * (SRCB)[1]; \
+ (DST)[2] = (SRCA)[2] * (SRCB)[2]; \
+} while (0)
+
+/** In-place element-wise multiplication */
+#define SELF_SCALE_3V( DST, SRC ) \
+do { \
+ (DST)[0] *= (SRC)[0]; \
+ (DST)[1] *= (SRC)[1]; \
+ (DST)[2] *= (SRC)[2]; \
+} while (0)
+
+/** In-place addition */
+#define ACC_3V( DST, SRC ) \
+do { \
+ (DST)[0] += (SRC)[0]; \
+ (DST)[1] += (SRC)[1]; \
+ (DST)[2] += (SRC)[2]; \
+} while (0)
+
+/** Element-wise multiplication and addition */
+#define ACC_SCALE_3V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] += (SRCA)[0] * (SRCB)[0]; \
+ (DST)[1] += (SRCA)[1] * (SRCB)[1]; \
+ (DST)[2] += (SRCA)[2] * (SRCB)[2]; \
+} while (0)
+
+/** Scalar multiplication */
+#define SCALE_SCALAR_3V( DST, S, SRCB ) \
+do { \
+ (DST)[0] = S * (SRCB)[0]; \
+ (DST)[1] = S * (SRCB)[1]; \
+ (DST)[2] = S * (SRCB)[2]; \
+} while (0)
+
+/** In-place scalar multiplication and addition */
+#define ACC_SCALE_SCALAR_3V( DST, S, SRCB ) \
+do { \
+ (DST)[0] += S * (SRCB)[0]; \
+ (DST)[1] += S * (SRCB)[1]; \
+ (DST)[2] += S * (SRCB)[2]; \
+} while (0)
+
+/** In-place scalar multiplication */
+#define SELF_SCALE_SCALAR_3V( DST, S ) \
+do { \
+ (DST)[0] *= S; \
+ (DST)[1] *= S; \
+ (DST)[2] *= S; \
+} while (0)
+
+/** In-place scalar addition */
+#define ACC_SCALAR_3V( DST, S ) \
+do { \
+ (DST)[0] += S; \
+ (DST)[1] += S; \
+ (DST)[2] += S; \
+} while (0)
+
+/** Assignment */
+#define ASSIGN_3V( V, V0, V1, V2 ) \
+do { \
+ V[0] = V0; \
+ V[1] = V1; \
+ V[2] = V2; \
+} while(0)
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name 2-element vector operations*/
+/*@{*/
+
+/** Zero */
+#define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0
+
+/** Copy a 2-element vector */
+#define COPY_2V( DST, SRC ) \
+do { \
+ (DST)[0] = (SRC)[0]; \
+ (DST)[1] = (SRC)[1]; \
+} while (0)
+
+/** Copy a 2-element vector with cast */
+#define COPY_2V_CAST( DST, SRC, CAST ) \
+do { \
+ (DST)[0] = (CAST)(SRC)[0]; \
+ (DST)[1] = (CAST)(SRC)[1]; \
+} while (0)
+
+/** Copy a 2-element float vector */
+#define COPY_2FV( DST, SRC ) \
+do { \
+ const GLfloat *_tmp = (SRC); \
+ (DST)[0] = _tmp[0]; \
+ (DST)[1] = _tmp[1]; \
+} while (0)
+
+/** Subtraction */
+#define SUB_2V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] - (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] - (SRCB)[1]; \
+} while (0)
+
+/** Addition */
+#define ADD_2V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] + (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] + (SRCB)[1]; \
+} while (0)
+
+/** In-place scalar multiplication */
+#define SCALE_2V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] = (SRCA)[0] * (SRCB)[0]; \
+ (DST)[1] = (SRCA)[1] * (SRCB)[1]; \
+} while (0)
+
+/** In-place addition */
+#define ACC_2V( DST, SRC ) \
+do { \
+ (DST)[0] += (SRC)[0]; \
+ (DST)[1] += (SRC)[1]; \
+} while (0)
+
+/** Element-wise multiplication and addition */
+#define ACC_SCALE_2V( DST, SRCA, SRCB ) \
+do { \
+ (DST)[0] += (SRCA)[0] * (SRCB)[0]; \
+ (DST)[1] += (SRCA)[1] * (SRCB)[1]; \
+} while (0)
+
+/** Scalar multiplication */
+#define SCALE_SCALAR_2V( DST, S, SRCB ) \
+do { \
+ (DST)[0] = S * (SRCB)[0]; \
+ (DST)[1] = S * (SRCB)[1]; \
+} while (0)
+
+/** In-place scalar multiplication and addition */
+#define ACC_SCALE_SCALAR_2V( DST, S, SRCB ) \
+do { \
+ (DST)[0] += S * (SRCB)[0]; \
+ (DST)[1] += S * (SRCB)[1]; \
+} while (0)
+
+/** In-place scalar multiplication */
+#define SELF_SCALE_SCALAR_2V( DST, S ) \
+do { \
+ (DST)[0] *= S; \
+ (DST)[1] *= S; \
+} while (0)
+
+/** In-place scalar addition */
+#define ACC_SCALAR_2V( DST, S ) \
+do { \
+ (DST)[0] += S; \
+ (DST)[1] += S; \
+} while (0)
+
+
+
+/**
+ * Linear interpolation
+ *
+ * \note \p OUT argument is evaluated twice!
+ * \note Be wary of using *coord++ as an argument to any of these macros!
+ */
+#define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT)))
+
+/* Can do better with integer math
+ */
+#define INTERP_UB( t, dstub, outub, inub ) \
+do { \
+ GLfloat inf = UBYTE_TO_FLOAT( inub ); \
+ GLfloat outf = UBYTE_TO_FLOAT( outub ); \
+ GLfloat dstf = LINTERP( t, outf, inf ); \
+ UNCLAMPED_FLOAT_TO_UBYTE( dstub, dstf ); \
+} while (0)
+
+#define INTERP_CHAN( t, dstc, outc, inc ) \
+do { \
+ GLfloat inf = CHAN_TO_FLOAT( inc ); \
+ GLfloat outf = CHAN_TO_FLOAT( outc ); \
+ GLfloat dstf = LINTERP( t, outf, inf ); \
+ UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \
+} while (0)
+
+#define INTERP_UI( t, dstui, outui, inui ) \
+ dstui = (GLuint) (GLint) LINTERP( (t), (GLfloat) (outui), (GLfloat) (inui) )
+
+#define INTERP_F( t, dstf, outf, inf ) \
+ dstf = LINTERP( t, outf, inf )
+
+#define INTERP_4F( t, dst, out, in ) \
+do { \
+ dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \
+ dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \
+ dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \
+ dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \
+} while (0)
+
+#define INTERP_3F( t, dst, out, in ) \
+do { \
+ dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \
+ dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \
+ dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \
+} while (0)
+
+#define INTERP_4CHAN( t, dst, out, in ) \
+do { \
+ INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \
+ INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \
+ INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \
+ INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \
+} while (0)
+
+#define INTERP_3CHAN( t, dst, out, in ) \
+do { \
+ INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \
+ INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \
+ INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \
+} while (0)
+
+#define INTERP_SZ( t, vec, to, out, in, sz ) \
+do { \
+ switch (sz) { \
+ case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \
+ case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \
+ case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \
+ case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \
+ } \
+} while(0)
+
+
+
+/** Assign scalers to short vectors */
+#define ASSIGN_2V( V, V0, V1 ) \
+do { \
+ V[0] = V0; \
+ V[1] = V1; \
+} while(0)
+
+/*@}*/
+
+
+
+/** Clamp X to [MIN,MAX] */
+#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
+
+/** Assign X to CLAMP(X, MIN, MAX) */
+#define CLAMP_SELF(x, mn, mx) \
+ ( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) )
+
+
+
+/** Minimum of two values: */
+#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
+
+/** Maximum of two values: */
+#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
+
+/** Dot product of two 2-element vectors */
+#define DOT2( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] )
+
+/** Dot product of two 3-element vectors */
+#define DOT3( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + (a)[2]*(b)[2] )
+
+/** Dot product of two 4-element vectors */
+#define DOT4( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + \
+ (a)[2]*(b)[2] + (a)[3]*(b)[3] )
+
+/** Dot product of two 4-element vectors */
+#define DOT4V(v,a,b,c,d) (v[0]*(a) + v[1]*(b) + v[2]*(c) + v[3]*(d))
+
+
+/** Cross product of two 3-element vectors */
+#define CROSS3(n, u, v) \
+do { \
+ (n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \
+ (n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \
+ (n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]; \
+} while (0)
+
+
+/* Normalize a 3-element vector to unit length. */
+#define NORMALIZE_3FV( V ) \
+do { \
+ GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \
+ if (len) { \
+ len = INV_SQRTF(len); \
+ (V)[0] = (GLfloat) ((V)[0] * len); \
+ (V)[1] = (GLfloat) ((V)[1] * len); \
+ (V)[2] = (GLfloat) ((V)[2] * len); \
+ } \
+} while(0)
+
+#define LEN_3FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]))
+#define LEN_2FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]))
+
+#define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])
+#define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1])
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/matrix.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/matrix.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/matrix.c Fri Dec 10 10:05:22 2004
@@ -0,0 +1,957 @@
+/**
+ * \file matrix.c
+ * Matrix operations.
+ *
+ * \note
+ * -# 4x4 transformation matrices are stored in memory in column major order.
+ * -# Points/vertices are to be thought of as column vectors.
+ * -# Transformation of a point p by a matrix M is: p' = M * p
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "buffers.h"
+#include "context.h"
+#include "enums.h"
+#include "macros.h"
+#include "matrix.h"
+#include "mtypes.h"
+#include "math/m_matrix.h"
+#include "math/m_xform.h"
+
+
+/**
+ * Apply a perspective projection matrix.
+ *
+ * \param left left clipping plane coordinate.
+ * \param right right clipping plane coordinate.
+ * \param bottom bottom clipping plane coordinate.
+ * \param top top clipping plane coordinate.
+ * \param nearval distance to the near clipping plane.
+ * \param farval distance to the far clipping plane.
+ *
+ * \sa glFrustum().
+ *
+ * Flushes vertices and validates parameters. Calls _math_matrix_frustum() with
+ * the top matrix of the current matrix stack and sets
+ * __GLcontextRec::NewState.
+ */
+void GLAPIENTRY
+_mesa_Frustum( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble nearval, GLdouble farval )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (nearval <= 0.0 ||
+ farval <= 0.0 ||
+ nearval == farval ||
+ left == right ||
+ top == bottom)
+ {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glFrustum" );
+ return;
+ }
+
+ _math_matrix_frustum( ctx->CurrentStack->Top,
+ (GLfloat) left, (GLfloat) right,
+ (GLfloat) bottom, (GLfloat) top,
+ (GLfloat) nearval, (GLfloat) farval );
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+}
+
+
+/**
+ * Apply an orthographic projection matrix.
+ *
+ * \param left left clipping plane coordinate.
+ * \param right right clipping plane coordinate.
+ * \param bottom bottom clipping plane coordinate.
+ * \param top top clipping plane coordinate.
+ * \param nearval distance to the near clipping plane.
+ * \param farval distance to the far clipping plane.
+ *
+ * \sa glOrtho().
+ *
+ * Flushes vertices and validates parameters. Calls _math_matrix_ortho() with
+ * the top matrix of the current matrix stack and sets
+ * __GLcontextRec::NewState.
+ */
+void GLAPIENTRY
+_mesa_Ortho( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble nearval, GLdouble farval )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glOrtho(%f, %f, %f, %f, %f, %f)\n",
+ left, right, bottom, top, nearval, farval);
+
+ if (left == right ||
+ bottom == top ||
+ nearval == farval)
+ {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glOrtho" );
+ return;
+ }
+
+ _math_matrix_ortho( ctx->CurrentStack->Top,
+ (GLfloat) left, (GLfloat) right,
+ (GLfloat) bottom, (GLfloat) top,
+ (GLfloat) nearval, (GLfloat) farval );
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+}
+
+
+/**
+ * Set the current matrix stack.
+ *
+ * \param mode matrix stack.
+ *
+ * \sa glMatrixMode().
+ *
+ * Flushes the vertices, validates the parameter and updates
+ * __GLcontextRec::CurrentStack and gl_transform_attrib::MatrixMode with the
+ * specified matrix stack.
+ */
+void GLAPIENTRY
+_mesa_MatrixMode( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Transform.MatrixMode == mode && mode != GL_TEXTURE)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+
+ switch (mode) {
+ case GL_MODELVIEW:
+ ctx->CurrentStack = &ctx->ModelviewMatrixStack;
+ break;
+ case GL_PROJECTION:
+ ctx->CurrentStack = &ctx->ProjectionMatrixStack;
+ break;
+ case GL_TEXTURE:
+ ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
+ break;
+ case GL_COLOR:
+ ctx->CurrentStack = &ctx->ColorMatrixStack;
+ break;
+ case GL_MATRIX0_NV:
+ case GL_MATRIX1_NV:
+ case GL_MATRIX2_NV:
+ case GL_MATRIX3_NV:
+ case GL_MATRIX4_NV:
+ case GL_MATRIX5_NV:
+ case GL_MATRIX6_NV:
+ case GL_MATRIX7_NV:
+ if (ctx->Extensions.NV_vertex_program) {
+ ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
+ return;
+ }
+ break;
+ case GL_MATRIX0_ARB:
+ case GL_MATRIX1_ARB:
+ case GL_MATRIX2_ARB:
+ case GL_MATRIX3_ARB:
+ case GL_MATRIX4_ARB:
+ case GL_MATRIX5_ARB:
+ case GL_MATRIX6_ARB:
+ case GL_MATRIX7_ARB:
+ if (ctx->Extensions.ARB_vertex_program ||
+ ctx->Extensions.ARB_fragment_program) {
+ const GLuint m = mode - GL_MATRIX0_ARB;
+ if (m > ctx->Const.MaxProgramMatrices) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glMatrixMode(GL_MATRIX%d_ARB)", m);
+ return;
+ }
+ ctx->CurrentStack = &ctx->ProgramMatrixStack[m];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
+ return;
+ }
+
+ ctx->Transform.MatrixMode = mode;
+}
+
+
+/**
+ * Push the current matrix stack.
+ *
+ * \sa glPushMatrix().
+ *
+ * Verifies the current matrix stack is not full, and duplicates the top-most
+ * matrix in the stack. Marks __GLcontextRec::NewState with the stack dirty
+ * flag.
+ */
+void GLAPIENTRY
+_mesa_PushMatrix( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct matrix_stack *stack = ctx->CurrentStack;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glPushMatrix %s\n",
+ _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
+
+ if (stack->Depth + 1 >= stack->MaxDepth) {
+ if (ctx->Transform.MatrixMode == GL_TEXTURE) {
+ _mesa_error(ctx, GL_STACK_OVERFLOW,
+ "glPushMatrix(mode=GL_TEXTURE, unit=%d)",
+ ctx->Texture.CurrentUnit);
+ }
+ else {
+ _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushMatrix(mode=%s)",
+ _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
+ }
+ return;
+ }
+ _math_matrix_copy( &stack->Stack[stack->Depth + 1],
+ &stack->Stack[stack->Depth] );
+ stack->Depth++;
+ stack->Top = &(stack->Stack[stack->Depth]);
+ ctx->NewState |= stack->DirtyFlag;
+}
+
+
+/**
+ * Pop the current matrix stack.
+ *
+ * \sa glPopMatrix().
+ *
+ * Flushes the vertices, verifies the current matrix stack is not empty, and
+ * moves the stack head down. Marks __GLcontextRec::NewState with the dirty
+ * stack flag.
+ */
+void GLAPIENTRY
+_mesa_PopMatrix( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct matrix_stack *stack = ctx->CurrentStack;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glPopMatrix %s\n",
+ _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
+
+ if (stack->Depth == 0) {
+ if (ctx->Transform.MatrixMode == GL_TEXTURE) {
+ _mesa_error(ctx, GL_STACK_UNDERFLOW,
+ "glPopMatrix(mode=GL_TEXTURE, unit=%d)",
+ ctx->Texture.CurrentUnit);
+ }
+ else {
+ _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopMatrix(mode=%s)",
+ _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
+ }
+ return;
+ }
+ stack->Depth--;
+ stack->Top = &(stack->Stack[stack->Depth]);
+ ctx->NewState |= stack->DirtyFlag;
+}
+
+
+/**
+ * Replace the current matrix with the identity matrix.
+ *
+ * \sa glLoadIdentity().
+ *
+ * Flushes the vertices and calls _math_matrix_set_identity() with the top-most
+ * matrix in the current stack. Marks __GLcontextRec::NewState with the stack
+ * dirty flag.
+ */
+void GLAPIENTRY
+_mesa_LoadIdentity( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glLoadIdentity()");
+
+ _math_matrix_set_identity( ctx->CurrentStack->Top );
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+}
+
+
+/**
+ * Replace the current matrix with a given matrix.
+ *
+ * \param m matrix.
+ *
+ * \sa glLoadMatrixf().
+ *
+ * Flushes the vertices and calls _math_matrix_loadf() with the top-most matrix
+ * in the current stack and the given matrix. Marks __GLcontextRec::NewState
+ * with the dirty stack flag.
+ */
+void GLAPIENTRY
+_mesa_LoadMatrixf( const GLfloat *m )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (!m) return;
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx,
+ "glLoadMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n",
+ m[0], m[4], m[8], m[12],
+ m[1], m[5], m[9], m[13],
+ m[2], m[6], m[10], m[14],
+ m[3], m[7], m[11], m[15]);
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ _math_matrix_loadf( ctx->CurrentStack->Top, m );
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+}
+
+
+/**
+ * Multiply the current matrix with a given matrix.
+ *
+ * \param m matrix.
+ *
+ * \sa glMultMatrixf().
+ *
+ * Flushes the vertices and calls _math_matrix_mul_floats() with the top-most
+ * matrix in the current stack and the given matrix. Marks
+ * __GLcontextRec::NewState with the dirty stack flag.
+ */
+void GLAPIENTRY
+_mesa_MultMatrixf( const GLfloat *m )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (!m) return;
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx,
+ "glMultMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n",
+ m[0], m[4], m[8], m[12],
+ m[1], m[5], m[9], m[13],
+ m[2], m[6], m[10], m[14],
+ m[3], m[7], m[11], m[15]);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ _math_matrix_mul_floats( ctx->CurrentStack->Top, m );
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+}
+
+
+/**
+ * Multiply the current matrix with a rotation matrix.
+ *
+ * \param angle angle of rotation, in degrees.
+ * \param x rotation vector x coordinate.
+ * \param y rotation vector y coordinate.
+ * \param z rotation vector z coordinate.
+ *
+ * \sa glRotatef().
+ *
+ * Flushes the vertices and calls _math_matrix_rotate() with the top-most
+ * matrix in the current stack and the given parameters. Marks
+ * __GLcontextRec::NewState with the dirty stack flag.
+ */
+void GLAPIENTRY
+_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ if (angle != 0.0F) {
+ _math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z);
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+ }
+}
+
+
+/**
+ * Multiply the current matrix with a general scaling matrix.
+ *
+ * \param x x axis scale factor.
+ * \param y y axis scale factor.
+ * \param z z axis scale factor.
+ *
+ * \sa glScalef().
+ *
+ * Flushes the vertices and calls _math_matrix_scale() with the top-most
+ * matrix in the current stack and the given parameters. Marks
+ * __GLcontextRec::NewState with the dirty stack flag.
+ */
+void GLAPIENTRY
+_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ _math_matrix_scale( ctx->CurrentStack->Top, x, y, z);
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+}
+
+
+/**
+ * Multiply the current matrix with a general scaling matrix.
+ *
+ * \param x translation vector x coordinate.
+ * \param y translation vector y coordinate.
+ * \param z translation vector z coordinate.
+ *
+ * \sa glTranslatef().
+ *
+ * Flushes the vertices and calls _math_matrix_translate() with the top-most
+ * matrix in the current stack and the given parameters. Marks
+ * __GLcontextRec::NewState with the dirty stack flag.
+ */
+void GLAPIENTRY
+_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ _math_matrix_translate( ctx->CurrentStack->Top, x, y, z);
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+}
+
+
+#if _HAVE_FULL_GL
+void GLAPIENTRY
+_mesa_LoadMatrixd( const GLdouble *m )
+{
+ GLint i;
+ GLfloat f[16];
+ if (!m) return;
+ for (i = 0; i < 16; i++)
+ f[i] = (GLfloat) m[i];
+ _mesa_LoadMatrixf(f);
+}
+
+void GLAPIENTRY
+_mesa_MultMatrixd( const GLdouble *m )
+{
+ GLint i;
+ GLfloat f[16];
+ if (!m) return;
+ for (i = 0; i < 16; i++)
+ f[i] = (GLfloat) m[i];
+ _mesa_MultMatrixf( f );
+}
+
+
+void GLAPIENTRY
+_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z )
+{
+ _mesa_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+void GLAPIENTRY
+_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z )
+{
+ _mesa_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+void GLAPIENTRY
+_mesa_Translated( GLdouble x, GLdouble y, GLdouble z )
+{
+ _mesa_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+#endif
+
+
+#if _HAVE_FULL_GL
+void GLAPIENTRY
+_mesa_LoadTransposeMatrixfARB( const GLfloat *m )
+{
+ GLfloat tm[16];
+ if (!m) return;
+ _math_transposef(tm, m);
+ _mesa_LoadMatrixf(tm);
+}
+
+
+void GLAPIENTRY
+_mesa_LoadTransposeMatrixdARB( const GLdouble *m )
+{
+ GLfloat tm[16];
+ if (!m) return;
+ _math_transposefd(tm, m);
+ _mesa_LoadMatrixf(tm);
+}
+
+
+void GLAPIENTRY
+_mesa_MultTransposeMatrixfARB( const GLfloat *m )
+{
+ GLfloat tm[16];
+ if (!m) return;
+ _math_transposef(tm, m);
+ _mesa_MultMatrixf(tm);
+}
+
+
+void GLAPIENTRY
+_mesa_MultTransposeMatrixdARB( const GLdouble *m )
+{
+ GLfloat tm[16];
+ if (!m) return;
+ _math_transposefd(tm, m);
+ _mesa_MultMatrixf(tm);
+}
+#endif
+
+/**
+ * Set the viewport.
+ *
+ * \param x, y coordinates of the lower-left corner of the viewport rectangle.
+ * \param width width of the viewport rectangle.
+ * \param height height of the viewport rectangle.
+ *
+ * \sa Called via glViewport() or display list execution.
+ *
+ * Flushes the vertices and calls _mesa_set_viewport() with the given
+ * parameters.
+ */
+void GLAPIENTRY
+_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ _mesa_set_viewport(ctx, x, y, width, height);
+}
+
+/**
+ * Set new viewport parameters and update derived state (the _WindowMap
+ * matrix). Usually called from _mesa_Viewport().
+ *
+ * \note We also call _mesa_ResizeBuffersMESA() because this is a good
+ * time to check if the window has been resized. Many device drivers
+ * can't get direct notification from the window system of size changes
+ * so this is an ad-hoc solution to that problem.
+ *
+ * \param ctx GL context.
+ * \param x, y coordinates of the lower left corner of the viewport rectangle.
+ * \param width width of the viewport rectangle.
+ * \param height height of the viewport rectangle.
+ *
+ * Verifies the parameters, clamps them to the implementation dependent range
+ * and updates __GLcontextRec::Viewport. Computes the scale and bias values for
+ * the drivers and notifies the driver via the dd_function_table::Viewport
+ * callback.
+ */
+void
+_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
+ GLsizei width, GLsizei height )
+{
+ const GLfloat n = ctx->Viewport.Near;
+ const GLfloat f = ctx->Viewport.Far;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glViewport(%d, %d, %d, %d)", x, y, width, height );
+ return;
+ }
+
+ /* clamp width, and height to implementation dependent range */
+ width = CLAMP( width, 1, MAX_WIDTH );
+ height = CLAMP( height, 1, MAX_HEIGHT );
+
+ /* Save viewport */
+ ctx->Viewport.X = x;
+ ctx->Viewport.Width = width;
+ ctx->Viewport.Y = y;
+ ctx->Viewport.Height = height;
+
+ /* XXX send transposed width/height to Driver.Viewport() below??? */
+ if (ctx->_RotateMode) {
+ GLint tmp, tmps;
+ tmp = x; x = y; y = tmp;
+ tmps = width; width = height; height = tmps;
+ }
+
+ /* compute scale and bias values :: This is really driver-specific
+ * and should be maintained elsewhere if at all. NOTE: RasterPos
+ * uses this.
+ */
+ ctx->Viewport._WindowMap.m[MAT_SX] = (GLfloat) width / 2.0F;
+ ctx->Viewport._WindowMap.m[MAT_TX] = ctx->Viewport._WindowMap.m[MAT_SX] + x;
+ ctx->Viewport._WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F;
+ ctx->Viewport._WindowMap.m[MAT_TY] = ctx->Viewport._WindowMap.m[MAT_SY] + y;
+ ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->DepthMaxF * ((f - n) / 2.0F);
+ ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->DepthMaxF * ((f - n) / 2.0F + n);
+ ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION;
+ ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT;
+ ctx->NewState |= _NEW_VIEWPORT;
+
+ /* Check if window/buffer has been resized and if so, reallocate the
+ * ancillary buffers. This is an ad-hoc solution to detecting window
+ * size changes. 99% of all GL apps call glViewport when a window is
+ * resized so this is a good time to check for new window dims and
+ * reallocate color buffers and ancilliary buffers.
+ */
+ _mesa_ResizeBuffersMESA();
+
+ if (ctx->Driver.Viewport) {
+ (*ctx->Driver.Viewport)( ctx, x, y, width, height );
+ }
+}
+
+
+#if _HAVE_FULL_GL
+void GLAPIENTRY
+_mesa_DepthRange( GLclampd nearval, GLclampd farval )
+{
+ /*
+ * nearval - specifies mapping of the near clipping plane to window
+ * coordinates, default is 0
+ * farval - specifies mapping of the far clipping plane to window
+ * coordinates, default is 1
+ *
+ * After clipping and div by w, z coords are in -1.0 to 1.0,
+ * corresponding to near and far clipping planes. glDepthRange
+ * specifies a linear mapping of the normalized z coords in
+ * this range to window z coords.
+ */
+ GLfloat n, f;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
+
+ n = (GLfloat) CLAMP( nearval, 0.0, 1.0 );
+ f = (GLfloat) CLAMP( farval, 0.0, 1.0 );
+
+ ctx->Viewport.Near = n;
+ ctx->Viewport.Far = f;
+ ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->DepthMaxF * ((f - n) / 2.0F);
+ ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->DepthMaxF * ((f - n) / 2.0F + n);
+ ctx->NewState |= _NEW_VIEWPORT;
+
+ if (ctx->Driver.DepthRange) {
+ (*ctx->Driver.DepthRange)( ctx, nearval, farval );
+ }
+}
+#endif
+
+
+
+/**********************************************************************/
+/** \name State management */
+/*@{*/
+
+
+/**
+ * Update the projection matrix stack.
+ *
+ * \param ctx GL context.
+ *
+ * Calls _math_matrix_analyse() with the top-matrix of the projection matrix
+ * stack, and recomputes user clip positions if necessary.
+ *
+ * \note This routine references __GLcontextRec::Tranform attribute values to
+ * compute userclip positions in clip space, but is only called on
+ * _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values up to
+ * date across changes to the __GLcontextRec::Transform attributes.
+ */
+static void
+update_projection( GLcontext *ctx )
+{
+ _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
+
+#if FEATURE_userclip
+ /* Recompute clip plane positions in clipspace. This is also done
+ * in _mesa_ClipPlane().
+ */
+ if (ctx->Transform.ClipPlanesEnabled) {
+ GLuint p;
+ for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
+ ctx->Transform.EyeUserPlane[p],
+ ctx->ProjectionMatrixStack.Top->inv );
+ }
+ }
+ }
+#endif
+}
+
+
+/**
+ * Calculate the combined modelview-projection matrix.
+ *
+ * \param ctx GL context.
+ *
+ * Multiplies the top matrices of the projection and model view stacks into
+ * __GLcontextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and
+ * analyzes the resulting matrix via _math_matrix_analyse().
+ */
+static void
+calculate_model_project_matrix( GLcontext *ctx )
+{
+ _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
+ ctx->ProjectionMatrixStack.Top,
+ ctx->ModelviewMatrixStack.Top );
+
+ _math_matrix_analyse( &ctx->_ModelProjectMatrix );
+}
+
+
+/**
+ * Updates the combined modelview-projection matrix.
+ *
+ * \param ctx GL context.
+ * \param new_state new state bit mask.
+ *
+ * If there is a new model view matrix then analyzes it. If there is a new
+ * projection matrix, updates it. Finally calls
+ * calculate_model_project_matrix() to recalculate the modelview-projection
+ * matrix.
+ */
+void _mesa_update_modelview_project( GLcontext *ctx, GLuint new_state )
+{
+ if (new_state & _NEW_MODELVIEW) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+
+ /* Bring cull position uptodate.
+ */
+ TRANSFORM_POINT3( ctx->Transform.CullObjPos,
+ ctx->ModelviewMatrixStack.Top->inv,
+ ctx->Transform.CullEyePos );
+ }
+
+
+ if (new_state & _NEW_PROJECTION)
+ update_projection( ctx );
+
+ /* Keep ModelviewProject uptodate always to allow tnl
+ * implementations that go model->clip even when eye is required.
+ */
+ calculate_model_project_matrix(ctx);
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** Matrix stack initialization */
+/*@{*/
+
+
+/**
+ * Initialize a matrix stack.
+ *
+ * \param stack matrix stack.
+ * \param maxDepth maximum stack depth.
+ * \param dirtyFlag dirty flag.
+ *
+ * Allocates an array of \p maxDepth elements for the matrix stack and calls
+ * _math_matrix_ctr() and _math_matrix_alloc_inv() for each element to
+ * initialize it.
+ */
+static void
+init_matrix_stack( struct matrix_stack *stack,
+ GLuint maxDepth, GLuint dirtyFlag )
+{
+ GLuint i;
+
+ stack->Depth = 0;
+ stack->MaxDepth = maxDepth;
+ stack->DirtyFlag = dirtyFlag;
+ /* The stack */
+ stack->Stack = (GLmatrix *) CALLOC(maxDepth * sizeof(GLmatrix));
+ for (i = 0; i < maxDepth; i++) {
+ _math_matrix_ctr(&stack->Stack[i]);
+ _math_matrix_alloc_inv(&stack->Stack[i]);
+ }
+ stack->Top = stack->Stack;
+}
+
+/**
+ * Free matrix stack.
+ *
+ * \param stack matrix stack.
+ *
+ * Calls _math_matrix_dtr() for each element of the matrix stack and
+ * frees the array.
+ */
+static void
+free_matrix_stack( struct matrix_stack *stack )
+{
+ GLuint i;
+ for (i = 0; i < stack->MaxDepth; i++) {
+ _math_matrix_dtr(&stack->Stack[i]);
+ }
+ FREE(stack->Stack);
+ stack->Stack = stack->Top = NULL;
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Initialization */
+/*@{*/
+
+
+/**
+ * Initialize the context matrix data.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes each of the matrix stacks and the combined modelview-projection
+ * matrix.
+ */
+void _mesa_init_matrix( GLcontext * ctx )
+{
+ GLint i;
+
+ /* Initialize matrix stacks */
+ init_matrix_stack(&ctx->ModelviewMatrixStack, MAX_MODELVIEW_STACK_DEPTH,
+ _NEW_MODELVIEW);
+ init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH,
+ _NEW_PROJECTION);
+ init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH,
+ _NEW_COLOR_MATRIX);
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++)
+ init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH,
+ _NEW_TEXTURE_MATRIX);
+ for (i = 0; i < MAX_PROGRAM_MATRICES; i++)
+ init_matrix_stack(&ctx->ProgramMatrixStack[i],
+ MAX_PROGRAM_MATRIX_STACK_DEPTH, _NEW_TRACK_MATRIX);
+ ctx->CurrentStack = &ctx->ModelviewMatrixStack;
+
+ /* Init combined Modelview*Projection matrix */
+ _math_matrix_ctr( &ctx->_ModelProjectMatrix );
+}
+
+
+/**
+ * Free the context matrix data.
+ *
+ * \param ctx GL context.
+ *
+ * Frees each of the matrix stacks and the combined modelview-projection
+ * matrix.
+ */
+void _mesa_free_matrix_data( GLcontext *ctx )
+{
+ GLint i;
+
+ free_matrix_stack(&ctx->ModelviewMatrixStack);
+ free_matrix_stack(&ctx->ProjectionMatrixStack);
+ free_matrix_stack(&ctx->ColorMatrixStack);
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++)
+ free_matrix_stack(&ctx->TextureMatrixStack[i]);
+ for (i = 0; i < MAX_PROGRAM_MATRICES; i++)
+ free_matrix_stack(&ctx->ProgramMatrixStack[i]);
+ /* combined Modelview*Projection matrix */
+ _math_matrix_dtr( &ctx->_ModelProjectMatrix );
+
+}
+
+
+/**
+ * Initialize the context transform attribute group.
+ *
+ * \param ctx GL context.
+ *
+ * \todo Move this to a new file with other 'transform' routines.
+ */
+void _mesa_init_transform( GLcontext *ctx )
+{
+ GLint i;
+
+ /* Transformation group */
+ ctx->Transform.MatrixMode = GL_MODELVIEW;
+ ctx->Transform.Normalize = GL_FALSE;
+ ctx->Transform.RescaleNormals = GL_FALSE;
+ ctx->Transform.RasterPositionUnclipped = GL_FALSE;
+ for (i=0;iTransform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 );
+ }
+ ctx->Transform.ClipPlanesEnabled = 0;
+
+ ASSIGN_4V( ctx->Transform.CullObjPos, 0.0, 0.0, 1.0, 0.0 );
+ ASSIGN_4V( ctx->Transform.CullEyePos, 0.0, 0.0, 1.0, 0.0 );
+}
+
+
+/**
+ * Initialize the context viewport attribute group.
+ *
+ * \param ctx GL context.
+ *
+ * \todo Move this to a new file with other 'viewport' routines.
+ */
+void _mesa_init_viewport( GLcontext *ctx )
+{
+ /* Viewport group */
+ ctx->Viewport.X = 0;
+ ctx->Viewport.Y = 0;
+ ctx->Viewport.Width = 0;
+ ctx->Viewport.Height = 0;
+ ctx->Viewport.Near = 0.0;
+ ctx->Viewport.Far = 1.0;
+ _math_matrix_ctr(&ctx->Viewport._WindowMap);
+
+#define Sz 10
+#define Tz 14
+ ctx->Viewport._WindowMap.m[Sz] = 0.5F * ctx->DepthMaxF;
+ ctx->Viewport._WindowMap.m[Tz] = 0.5F * ctx->DepthMaxF;
+#undef Sz
+#undef Tz
+
+ ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION;
+ ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT;
+}
+
+
+/**
+ * Free the context viewport attribute group data.
+ *
+ * \param ctx GL context.
+ *
+ * \todo Move this to a new file with other 'viewport' routines.
+ */
+void _mesa_free_viewport_data( GLcontext *ctx )
+{
+ _math_matrix_dtr(&ctx->Viewport._WindowMap);
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/matrix.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/matrix.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/matrix.h Thu Apr 8 05:17:47 2004
@@ -0,0 +1,131 @@
+/**
+ * \file matrix.h
+ * Matrix operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef MATRIX_H
+#define MATRIX_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_Frustum( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble nearval, GLdouble farval );
+
+extern void GLAPIENTRY
+_mesa_Ortho( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble nearval, GLdouble farval );
+
+extern void GLAPIENTRY
+_mesa_PushMatrix( void );
+
+extern void GLAPIENTRY
+_mesa_PopMatrix( void );
+
+extern void GLAPIENTRY
+_mesa_LoadIdentity( void );
+
+extern void GLAPIENTRY
+_mesa_LoadMatrixf( const GLfloat *m );
+
+extern void GLAPIENTRY
+_mesa_LoadMatrixd( const GLdouble *m );
+
+extern void GLAPIENTRY
+_mesa_MatrixMode( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_MultMatrixf( const GLfloat *m );
+
+extern void GLAPIENTRY
+_mesa_MultMatrixd( const GLdouble *m );
+
+extern void GLAPIENTRY
+_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
+
+extern void GLAPIENTRY
+_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
+
+extern void GLAPIENTRY
+_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z );
+
+extern void GLAPIENTRY
+_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z );
+
+extern void GLAPIENTRY
+_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z );
+
+extern void GLAPIENTRY
+_mesa_Translated( GLdouble x, GLdouble y, GLdouble z );
+
+extern void GLAPIENTRY
+_mesa_LoadTransposeMatrixfARB( const GLfloat *m );
+
+extern void GLAPIENTRY
+_mesa_LoadTransposeMatrixdARB( const GLdouble *m );
+
+extern void GLAPIENTRY
+_mesa_MultTransposeMatrixfARB( const GLfloat *m );
+
+extern void GLAPIENTRY
+_mesa_MultTransposeMatrixdARB( const GLdouble *m );
+
+extern void GLAPIENTRY
+_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height );
+
+extern void
+_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height );
+
+extern void GLAPIENTRY
+_mesa_DepthRange( GLclampd nearval, GLclampd farval );
+
+
+extern void
+_mesa_init_matrix( GLcontext * ctx );
+
+extern void
+_mesa_init_transform( GLcontext *ctx );
+
+extern void
+_mesa_init_viewport( GLcontext *ctx );
+
+extern void
+_mesa_free_matrix_data( GLcontext *ctx );
+
+extern void
+_mesa_free_viewport_data( GLcontext *ctx );
+
+extern void
+_mesa_update_modelview_project( GLcontext *ctx, GLuint newstate );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/mesa.def
diff -u /dev/null xc/extras/Mesa/src/mesa/main/mesa.def:1.1.1.2
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/mesa.def Fri Dec 10 10:05:12 2004
@@ -0,0 +1,491 @@
+DESCRIPTION 'Mesa (OpenGL work-alike) for Win32'
+VERSION 4.1
+
+EXPORTS
+ glAccum
+ glAlphaFunc
+ glAreTexturesResident
+ glAreTexturesResidentEXT
+ glArrayElement
+ glArrayElementEXT
+ glBegin
+ glBindTexture
+ glBindTextureEXT
+ glBitmap
+ glBlendColorEXT
+ glBlendEquationEXT
+ glBlendFunc
+ glCallList
+ glCallLists
+ glClear
+ glClearAccum
+ glClearColor
+ glClearDepth
+ glClearIndex
+ glClearStencil
+ glClipPlane
+ glColor3b
+ glColor3bv
+ glColor3d
+ glColor3dv
+ glColor3f
+ glColor3fv
+ glColor3i
+ glColor3iv
+ glColor3s
+ glColor3sv
+ glColor3ub
+ glColor3ubv
+ glColor3ui
+ glColor3uiv
+ glColor3us
+ glColor3usv
+ glColor4b
+ glColor4bv
+ glColor4d
+ glColor4dv
+ glColor4f
+ glColor4fv
+ glColor4i
+ glColor4iv
+ glColor4s
+ glColor4sv
+ glColor4ub
+ glColor4ubv
+ glColor4ui
+ glColor4uiv
+ glColor4us
+ glColor4usv
+ glColorMask
+ glColorMaterial
+ glColorPointer
+ glColorPointerEXT
+ glColorSubTableEXT
+ glColorTableEXT
+ glCopyPixels
+ glCopyTexImage1D
+ glCopyTexImage2D
+ glCopyTexSubImage1D
+ glCopyTexSubImage2D
+ glCopyTexSubImage3DEXT
+ glCullFace
+ glDeleteLists
+ glDeleteTextures
+ glDeleteTexturesEXT
+ glDepthFunc
+ glDepthMask
+ glDepthRange
+ glDisable
+ glDisableClientState
+ glDrawArrays
+ glDrawArraysEXT
+ glDrawBuffer
+ glDrawElements
+ glDrawPixels
+ glEdgeFlag
+ glEdgeFlagPointer
+ glEdgeFlagPointerEXT
+ glEdgeFlagv
+ glEnable
+ glEnableClientState
+ glEnd
+ glEndList
+ glEvalCoord1d
+ glEvalCoord1dv
+ glEvalCoord1f
+ glEvalCoord1fv
+ glEvalCoord2d
+ glEvalCoord2dv
+ glEvalCoord2f
+ glEvalCoord2fv
+ glEvalMesh1
+ glEvalMesh2
+ glEvalPoint1
+ glEvalPoint2
+ glFeedbackBuffer
+ glFinish
+ glFlush
+ glFogf
+ glFogfv
+ glFogi
+ glFogiv
+ glFrontFace
+ glFrustum
+ glGenLists
+ glGenTextures
+ glGenTexturesEXT
+ glGetBooleanv
+ glGetClipPlane
+ glGetColorTableEXT
+ glGetColorTableParameterfvEXT
+ glGetColorTableParameterivEXT
+ glGetDoublev
+ glGetError
+ glGetFloatv
+ glGetIntegerv
+ glGetLightfv
+ glGetLightiv
+ glGetMapdv
+ glGetMapfv
+ glGetMapiv
+ glGetMaterialfv
+ glGetMaterialiv
+ glGetPixelMapfv
+ glGetPixelMapuiv
+ glGetPixelMapusv
+ glGetPointerv
+ glGetPointervEXT
+ glGetPolygonStipple
+ glGetString
+ glGetTexEnvfv
+ glGetTexEnviv
+ glGetTexGendv
+ glGetTexGenfv
+ glGetTexGeniv
+ glGetTexImage
+ glGetTexLevelParameterfv
+ glGetTexLevelParameteriv
+ glGetTexParameterfv
+ glGetTexParameteriv
+ glHint
+ glIndexd
+ glIndexdv
+ glIndexf
+ glIndexfv
+ glIndexi
+ glIndexiv
+ glIndexMask
+ glIndexPointer
+ glIndexPointerEXT
+ glIndexs
+ glIndexsv
+ glIndexub
+ glIndexubv
+ glInitNames
+ glInterleavedArrays
+ glIsEnabled
+ glIsList
+ glIsTexture
+ glIsTextureEXT
+ glLightf
+ glLightfv
+ glLighti
+ glLightiv
+ glLightModelf
+ glLightModelfv
+ glLightModeli
+ glLightModeliv
+ glLineStipple
+ glLineWidth
+ glListBase
+ glLoadIdentity
+ glLoadMatrixd
+ glLoadMatrixf
+ glLoadName
+ glLogicOp
+ glMap1d
+ glMap1f
+ glMap2d
+ glMap2f
+ glMapGrid1d
+ glMapGrid1f
+ glMapGrid2d
+ glMapGrid2f
+ glMaterialf
+ glMaterialfv
+ glMateriali
+ glMaterialiv
+ glMatrixMode
+ glMultMatrixd
+ glMultMatrixf
+ glNewList
+ glNormal3b
+ glNormal3bv
+ glNormal3d
+ glNormal3dv
+ glNormal3f
+ glNormal3fv
+ glNormal3i
+ glNormal3iv
+ glNormal3s
+ glNormal3sv
+ glNormalPointer
+ glNormalPointerEXT
+ glOrtho
+ glPassThrough
+ glPixelMapfv
+ glPixelMapuiv
+ glPixelMapusv
+ glPixelStoref
+ glPixelStorei
+ glPixelTransferf
+ glPixelTransferi
+ glPixelZoom
+ glPointParameterfEXT
+ glPointParameterfvEXT
+ glPointSize
+ glPolygonMode
+ glPolygonOffset
+ glPolygonOffsetEXT
+ glPolygonStipple
+ glPopAttrib
+ glPopClientAttrib
+ glPopMatrix
+ glPopName
+ glPrioritizeTextures
+ glPrioritizeTexturesEXT
+ glPushAttrib
+ glPushClientAttrib
+ glPushMatrix
+ glPushName
+ glRasterPos2d
+ glRasterPos2dv
+ glRasterPos2f
+ glRasterPos2fv
+ glRasterPos2i
+ glRasterPos2iv
+ glRasterPos2s
+ glRasterPos2sv
+ glRasterPos3d
+ glRasterPos3dv
+ glRasterPos3f
+ glRasterPos3fv
+ glRasterPos3i
+ glRasterPos3iv
+ glRasterPos3s
+ glRasterPos3sv
+ glRasterPos4d
+ glRasterPos4dv
+ glRasterPos4f
+ glRasterPos4fv
+ glRasterPos4i
+ glRasterPos4iv
+ glRasterPos4s
+ glRasterPos4sv
+ glReadBuffer
+ glReadPixels
+ glRectd
+ glRectdv
+ glRectf
+ glRectfv
+ glRecti
+ glRectiv
+ glRects
+ glRectsv
+ glRenderMode
+ glResizeBuffersMESA
+ glRotated
+ glRotatef
+ glScaled
+ glScalef
+ glScissor
+ glSelectBuffer
+ glShadeModel
+ glStencilFunc
+ glStencilMask
+ glStencilOp
+ glTexCoord1d
+ glTexCoord1dv
+ glTexCoord1f
+ glTexCoord1fv
+ glTexCoord1i
+ glTexCoord1iv
+ glTexCoord1s
+ glTexCoord1sv
+ glTexCoord2d
+ glTexCoord2dv
+ glTexCoord2f
+ glTexCoord2fv
+ glTexCoord2i
+ glTexCoord2iv
+ glTexCoord2s
+ glTexCoord2sv
+ glTexCoord3d
+ glTexCoord3dv
+ glTexCoord3f
+ glTexCoord3fv
+ glTexCoord3i
+ glTexCoord3iv
+ glTexCoord3s
+ glTexCoord3sv
+ glTexCoord4d
+ glTexCoord4dv
+ glTexCoord4f
+ glTexCoord4fv
+ glTexCoord4i
+ glTexCoord4iv
+ glTexCoord4s
+ glTexCoord4sv
+ glTexCoordPointer
+ glTexCoordPointerEXT
+ glTexEnvf
+ glTexEnvfv
+ glTexEnvi
+ glTexEnviv
+ glTexGend
+ glTexGendv
+ glTexGenf
+ glTexGenfv
+ glTexGeni
+ glTexGeniv
+ glTexImage1D
+ glTexImage2D
+ glTexImage3DEXT
+ glTexParameterf
+ glTexParameterfv
+ glTexParameteri
+ glTexParameteriv
+ glTexSubImage1D
+ glTexSubImage2D
+ glTexSubImage3DEXT
+ glTranslated
+ glTranslatef
+ glVertex2d
+ glVertex2dv
+ glVertex2f
+ glVertex2fv
+ glVertex2i
+ glVertex2iv
+ glVertex2s
+ glVertex2sv
+ glVertex3d
+ glVertex3dv
+ glVertex3f
+ glVertex3fv
+ glVertex3i
+ glVertex3iv
+ glVertex3s
+ glVertex3sv
+ glVertex4d
+ glVertex4dv
+ glVertex4f
+ glVertex4fv
+ glVertex4i
+ glVertex4iv
+ glVertex4s
+ glVertex4sv
+ glVertexPointer
+ glVertexPointerEXT
+ glViewport
+ glWindowPos2dMESA
+ glWindowPos2dvMESA
+ glWindowPos2fMESA
+ glWindowPos2fvMESA
+ glWindowPos2iMESA
+ glWindowPos2ivMESA
+ glWindowPos2sMESA
+ glWindowPos2svMESA
+ glWindowPos3dMESA
+ glWindowPos3dvMESA
+ glWindowPos3fMESA
+ glWindowPos3fvMESA
+ glWindowPos3iMESA
+ glWindowPos3ivMESA
+ glWindowPos3sMESA
+ glWindowPos3svMESA
+ glWindowPos4dMESA
+ glWindowPos4dvMESA
+ glWindowPos4fMESA
+ glWindowPos4fvMESA
+ glWindowPos4iMESA
+ glWindowPos4ivMESA
+ glWindowPos4sMESA
+ glWindowPos4svMESA
+ _swsetup_Wakeup
+ _swsetup_CreateContext
+ _tnl_CreateContext
+ _ac_CreateContext
+ _swrast_CreateContext
+ _mesa_free_context_data
+ _mesa_create_framebuffer
+ _mesa_enable_1_3_extensions
+ _mesa_enable_1_4_extensions
+ _mesa_enable_sw_extensions
+ _mesa_destroy_visual
+ _mesa_initialize_context
+ _mesa_create_visual
+ _mesa_destroy_framebuffer
+ _swrast_DestroyContext
+ _ac_DestroyContext
+ _tnl_DestroyContext
+ _swsetup_DestroyContext
+ _mesa_Viewport
+ _mesa_make_current
+ _mesa_get_current_context
+ _mesa_error
+ _swrast_choose_triangle
+ _mesa_zbuffer_address
+ _swrast_choose_line
+ _tnl_InvalidateState
+ _ac_InvalidateState
+ _swsetup_InvalidateState
+ _swrast_InvalidateState
+ _tnl_run_pipeline
+ _swrast_CopyConvolutionFilter2D
+ _swrast_CopyConvolutionFilter1D
+ _swrast_CopyColorSubTable
+ _swrast_CopyColorTable
+ _swrast_copy_texsubimage3d
+ _swrast_copy_texsubimage2d
+ _swrast_copy_texsubimage1d
+ _swrast_copy_teximage2d
+ _swrast_copy_teximage1d
+ _mesa_test_proxy_teximage
+ _mesa_store_texsubimage3d
+ _mesa_store_texsubimage2d
+ _mesa_store_texsubimage1d
+ _mesa_store_teximage3d
+ _mesa_store_teximage2d
+ _mesa_store_teximage1d
+ _mesa_store_compressed_texsubimage3d
+ _mesa_store_compressed_texsubimage2d
+ _mesa_store_compressed_texsubimage1d
+ _mesa_store_compressed_teximage3d
+ _mesa_store_compressed_teximage2d
+ _mesa_store_compressed_teximage1d
+ _mesa_choose_tex_format
+ _mesa_compressed_texture_size
+ _swrast_ReadPixels
+ _swrast_DrawPixels
+ _swrast_CopyPixels
+ _swrast_Bitmap
+ _swrast_Accum
+ _swrast_alloc_buffers
+ _swrast_GetDeviceDriverReference
+ _swrast_Clear
+ _glapi_get_context
+ _mesa_ResizeBuffersMESA
+ _glapi_get_proc_address
+ _mesa_init_default_imports
+ _tnl_MakeCurrent
+ _swrast_DrawBuffer
+ _mesa_free
+ _mesa_calloc
+ _mesa_strcmp
+ _mesa_bzero
+ _mesa_memset
+ _mesa_memcpy
+ _mesa_problem
+ wglCopyContext
+ wglCreateContext
+ wglDeleteContext
+ wglCreateLayerContext
+ wglGetCurrentContext
+ wglGetCurrentDC
+ wglMakeCurrent
+ wglShareLists
+ wglUseFontBitmapsA
+ wglUseFontBitmapsW
+ wglUseFontOutlinesA
+ wglUseFontOutlinesW
+ wglDescribeLayerPlane
+ wglSetLayerPaletteEntries
+ wglGetLayerPaletteEntries
+ wglRealizeLayerPalette
+ wglSwapLayerBuffers
+ wglChoosePixelFormat
+ wglDescribePixelFormat
+ wglGetProcAddress
+ wglGetPixelFormat
+ wglSetPixelFormat
+ wglSwapBuffers
Index: xc/extras/Mesa/src/mesa/main/mtypes.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/mtypes.h:1.1.1.4
--- /dev/null Wed Mar 16 21:01:27 2005
+++ xc/extras/Mesa/src/mesa/main/mtypes.h Fri Dec 10 10:05:19 2004
@@ -0,0 +1,2453 @@
+/**
+ * \file mtypes.h
+ * Main Mesa data structures.
+ *
+ * Please try to mark derived values with a leading underscore ('_').
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#ifndef TYPES_H
+#define TYPES_H
+
+
+#include "glheader.h"
+#include "config.h" /* Hardwired parameters */
+#include "glapitable.h"
+#include "glthread.h"
+#include "math/m_matrix.h" /* GLmatrix */
+
+
+/**
+ * Color channel data type.
+ */
+#if CHAN_BITS == 8
+ typedef GLubyte GLchan;
+#define CHAN_MAX 255
+#define CHAN_MAXF 255.0F
+#define CHAN_TYPE GL_UNSIGNED_BYTE
+#elif CHAN_BITS == 16
+ typedef GLushort GLchan;
+#define CHAN_MAX 65535
+#define CHAN_MAXF 65535.0F
+#define CHAN_TYPE GL_UNSIGNED_SHORT
+#elif CHAN_BITS == 32
+ typedef GLfloat GLchan;
+#define CHAN_MAX 1.0
+#define CHAN_MAXF 1.0F
+#define CHAN_TYPE GL_FLOAT
+#else
+#error "illegal number of color channel bits"
+#endif
+
+
+/**
+ * Accumulation buffer data type.
+ */
+#if ACCUM_BITS==8
+ typedef GLbyte GLaccum;
+#elif ACCUM_BITS==16
+ typedef GLshort GLaccum;
+#elif ACCUM_BITS==32
+ typedef GLfloat GLaccum;
+#else
+# error "illegal number of accumulation bits"
+#endif
+
+
+/**
+ * Stencil buffer data type.
+ */
+#if STENCIL_BITS==8
+ typedef GLubyte GLstencil;
+# define STENCIL_MAX 0xff
+#elif STENCIL_BITS==16
+ typedef GLushort GLstencil;
+# define STENCIL_MAX 0xffff
+#else
+# error "illegal number of stencil bits"
+#endif
+
+
+/**
+ * Depth buffer data type.
+ *
+ * \note Must be 32-bits!
+ */
+typedef GLuint GLdepth;
+
+
+/**
+ * Fixed point data type.
+ */
+typedef int GLfixed;
+/*
+ * Fixed point arithmetic macros
+ */
+#ifndef FIXED_FRAC_BITS
+#define FIXED_FRAC_BITS 11
+#endif
+
+#define FIXED_SHIFT FIXED_FRAC_BITS
+#define FIXED_ONE (1 << FIXED_SHIFT)
+#define FIXED_HALF (1 << (FIXED_SHIFT-1))
+#define FIXED_FRAC_MASK (FIXED_ONE - 1)
+#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
+#define FIXED_EPSILON 1
+#define FIXED_SCALE ((float) FIXED_ONE)
+#define FIXED_DBL_SCALE ((double) FIXED_ONE)
+#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
+#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
+#define IntToFixed(I) ((I) << FIXED_SHIFT)
+#define FixedToInt(X) ((X) >> FIXED_SHIFT)
+#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
+#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
+#define FixedFloor(X) ((X) & FIXED_INT_MASK)
+#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
+#define PosFloatToFixed(X) FloatToFixed(X)
+#define SignedFloatToFixed(X) FloatToFixed(X)
+
+
+
+/**
+ * \name Some forward type declarations
+ */
+/*@{*/
+struct _mesa_HashTable;
+struct gl_texture_image;
+struct gl_texture_object;
+typedef struct __GLcontextRec GLcontext;
+typedef struct __GLcontextModesRec GLvisual;
+typedef struct gl_frame_buffer GLframebuffer;
+struct gl_pixelstore_attrib;
+struct gl_texture_format;
+/*@}*/
+
+
+
+/**
+ * These define the aliases between numbered vertex attributes and
+ * conventional OpenGL vertex attributes. We use these values in
+ * quite a few places.
+ *
+ * New in Mesa 4.1.
+ */
+enum {
+ VERT_ATTRIB_POS = 0,
+ VERT_ATTRIB_WEIGHT = 1,
+ VERT_ATTRIB_NORMAL = 2,
+ VERT_ATTRIB_COLOR0 = 3,
+ VERT_ATTRIB_COLOR1 = 4,
+ VERT_ATTRIB_FOG = 5,
+ VERT_ATTRIB_SIX = 6,
+ VERT_ATTRIB_SEVEN = 7,
+ VERT_ATTRIB_TEX0 = 8,
+ VERT_ATTRIB_TEX1 = 9,
+ VERT_ATTRIB_TEX2 = 10,
+ VERT_ATTRIB_TEX3 = 11,
+ VERT_ATTRIB_TEX4 = 12,
+ VERT_ATTRIB_TEX5 = 13,
+ VERT_ATTRIB_TEX6 = 14,
+ VERT_ATTRIB_TEX7 = 15,
+ VERT_ATTRIB_MAX = 16
+} ;
+
+/* These are used in bitfields in many places */
+#define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
+#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
+#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
+#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
+#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
+#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
+#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
+#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
+#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
+#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
+#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
+#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
+#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
+#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
+#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
+
+#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
+
+
+/* Fragment programs use a different but related set of attributes:
+ */
+
+/* Fragment input registers / attributes */
+#define FRAG_ATTRIB_WPOS 0
+#define FRAG_ATTRIB_COL0 1
+#define FRAG_ATTRIB_COL1 2
+#define FRAG_ATTRIB_FOGC 3
+#define FRAG_ATTRIB_TEX0 4
+#define FRAG_ATTRIB_TEX1 5
+#define FRAG_ATTRIB_TEX2 6
+#define FRAG_ATTRIB_TEX3 7
+#define FRAG_ATTRIB_TEX4 8
+#define FRAG_ATTRIB_TEX5 9
+#define FRAG_ATTRIB_TEX6 10
+#define FRAG_ATTRIB_TEX7 11
+
+/* Bitmasks for the above */
+#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
+#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
+#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
+#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
+#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0)
+#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1)
+#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2)
+#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3)
+#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4)
+#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5)
+#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6)
+#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7)
+
+#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \
+ FRAG_BIT_TEX1| \
+ FRAG_BIT_TEX2| \
+ FRAG_BIT_TEX3| \
+ FRAG_BIT_TEX4| \
+ FRAG_BIT_TEX5| \
+ FRAG_BIT_TEX6| \
+ FRAG_BIT_TEX7)
+
+
+/**
+ * Bits for each basic buffer in a complete framebuffer.
+ * When glDrawBuffer(GL_FRONT_AND_BACK) is called (non-stereo),
+ * _DrawDestMask will be set to (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT),
+ * for example. Also passed to ctx->Driver.Clear() to indicate which
+ * buffers to clear.
+ */
+/*@{*/
+#define DD_FRONT_LEFT_BIT 0x1
+#define DD_FRONT_RIGHT_BIT 0x2
+#define DD_BACK_LEFT_BIT 0x4
+#define DD_BACK_RIGHT_BIT 0x8
+#define DD_AUX0_BIT 0x10
+#define DD_AUX1_BIT 0x20
+#define DD_AUX2_BIT 0x40
+#define DD_AUX3_BIT 0x80
+#define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
+#define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
+#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
+/*@}*/
+
+
+/**
+ * Maximum number of temporary vertices required for clipping.
+ *
+ * Used in array_cache and tnl modules.
+ */
+#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
+
+
+/**
+ * Data structure for color tables
+ */
+struct gl_color_table {
+ GLenum Format; /**< GL_ALPHA, GL_RGB, GL_RGB, etc */
+ GLenum IntFormat;
+ GLuint Size; /**< number of entries (rows) in table */
+ GLvoid *Table; /**< points to data of */
+ GLenum Type; /**< GL_UNSIGNED_BYTE or GL_FLOAT */
+ GLubyte RedSize;
+ GLubyte GreenSize;
+ GLubyte BlueSize;
+ GLubyte AlphaSize;
+ GLubyte LuminanceSize;
+ GLubyte IntensitySize;
+};
+
+
+/**
+ * \name Bit flags used for updating material values.
+ */
+/*@{*/
+#define MAT_ATTRIB_FRONT_AMBIENT 0
+#define MAT_ATTRIB_BACK_AMBIENT 1
+#define MAT_ATTRIB_FRONT_DIFFUSE 2
+#define MAT_ATTRIB_BACK_DIFFUSE 3
+#define MAT_ATTRIB_FRONT_SPECULAR 4
+#define MAT_ATTRIB_BACK_SPECULAR 5
+#define MAT_ATTRIB_FRONT_EMISSION 6
+#define MAT_ATTRIB_BACK_EMISSION 7
+#define MAT_ATTRIB_FRONT_SHININESS 8
+#define MAT_ATTRIB_BACK_SHININESS 9
+#define MAT_ATTRIB_FRONT_INDEXES 10
+#define MAT_ATTRIB_BACK_INDEXES 11
+#define MAT_ATTRIB_MAX 12
+
+#define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f))
+#define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f))
+#define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f))
+#define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f))
+#define MAT_ATTRIB_SHININESS(f)(MAT_ATTRIB_FRONT_SHININESS+(f))
+#define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f))
+
+#define MAT_INDEX_AMBIENT 0
+#define MAT_INDEX_DIFFUSE 1
+#define MAT_INDEX_SPECULAR 2
+
+#define MAT_BIT_FRONT_AMBIENT (1< ) */
+ GLfloat _NormDirection[4]; /**< normalized spotlight direction */
+ GLfloat _VP_inf_spot_attenuation;
+
+ GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /**< to replace a pow() call */
+ GLfloat _MatAmbient[2][3]; /**< material ambient * light ambient */
+ GLfloat _MatDiffuse[2][3]; /**< material diffuse * light diffuse */
+ GLfloat _MatSpecular[2][3]; /**< material spec * light specular */
+ GLfloat _dli; /**< CI diffuse light intensity */
+ GLfloat _sli; /**< CI specular light intensity */
+ /*@}*/
+};
+
+
+/**
+ * Light model.
+ */
+struct gl_lightmodel {
+ GLfloat Ambient[4]; /**< ambient color */
+ GLboolean LocalViewer; /**< Local (or infinite) view point? */
+ GLboolean TwoSide; /**< Two (or one) sided lighting? */
+ GLenum ColorControl; /**< either GL_SINGLE_COLOR
+ * or GL_SEPARATE_SPECULAR_COLOR */
+};
+
+
+/**
+ * Material.
+ */
+struct gl_material
+{
+ GLfloat Attrib[MAT_ATTRIB_MAX][4];
+};
+
+
+/**
+ * Accumulation buffer attributes.
+ */
+struct gl_accum_attrib {
+ GLfloat ClearColor[4]; /**< Accumulation buffer clear color */
+};
+
+
+/**
+ * Color buffers attributes.
+ */
+struct gl_colorbuffer_attrib {
+ GLuint ClearIndex; /**< Index to use for glClear */
+ GLclampf ClearColor[4]; /**< Color to use for glClear */
+
+ GLuint IndexMask; /**< Color index write mask */
+ GLubyte ColorMask[4]; /**< Each flag is 0xff or 0x0 */
+
+ GLenum DrawBuffer; /**< Which buffer to draw into */
+ GLbitfield _DrawDestMask; /**< bitmask of DD_*_BIT bits */
+
+ /**
+ * \name alpha testing
+ */
+ /*@{*/
+ GLboolean AlphaEnabled; /**< Alpha test enabled flag */
+ GLenum AlphaFunc; /**< Alpha test function */
+ GLclampf AlphaRef; /**< Alpha reference value */
+ /*@}*/
+
+ /**
+ * \name Blending
+ */
+ /*@{*/
+ GLboolean BlendEnabled; /**< Blending enabled flag */
+ GLenum BlendSrcRGB; /**< Blending source operator */
+ GLenum BlendDstRGB; /**< Blending destination operator */
+ GLenum BlendSrcA; /**< GL_INGR_blend_func_separate */
+ GLenum BlendDstA; /**< GL_INGR_blend_func_separate */
+ GLenum BlendEquationRGB; /**< Blending equation */
+ GLenum BlendEquationA; /**< GL_EXT_blend_equation_separate */
+ GLfloat BlendColor[4]; /**< Blending color */
+ /*@}*/
+
+ /**
+ * \name Logic op
+ */
+ /*@{*/
+ GLenum LogicOp; /**< Logic operator */
+ GLboolean IndexLogicOpEnabled; /**< Color index logic op enabled flag */
+ GLboolean ColorLogicOpEnabled; /**< RGBA logic op enabled flag */
+ GLboolean _LogicOpEnabled; /**< RGBA logic op + EXT_blend_logic_op enabled flag */
+ /*@}*/
+
+ GLboolean DitherFlag; /**< Dither enable flag */
+};
+
+
+/**
+ * Current attributes.
+ */
+struct gl_current_attrib {
+ /**
+ * \name Values valid only when FLUSH_VERTICES has been called.
+ */
+ /*@{*/
+ GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Current vertex attributes
+ * indexed by VERT_ATTRIB_* */
+ GLfloat Index; /**< Current color index */
+ GLboolean EdgeFlag; /**< Current edge flag */
+ /*@}*/
+
+ /**
+ * \name Values are always valid.
+ *
+ * \note BTW, note how similar this set of attributes is to the SWvertex
+ * data type in the software rasterizer...
+ */
+ /*@{*/
+ GLfloat RasterPos[4]; /**< Current raster position */
+ GLfloat RasterDistance; /**< Current raster distance */
+ GLfloat RasterColor[4]; /**< Current raster color */
+ GLfloat RasterSecondaryColor[4]; /**< Current raster secondary color */
+ GLfloat RasterIndex; /**< Current raster index */
+ GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/**< Current raster texcoords */
+ GLboolean RasterPosValid; /**< Raster pos valid flag */
+ /*@}*/
+};
+
+
+/**
+ * Depth buffer attributes.
+ */
+struct gl_depthbuffer_attrib {
+ GLenum Func; /**< Function for depth buffer compare */
+ GLclampd Clear; /**< Value to clear depth buffer to */
+ GLboolean Test; /**< Depth buffering enabled flag */
+ GLboolean Mask; /**< Depth buffer writable? */
+ GLboolean OcclusionTest; /**< GL_HP_occlusion_test */
+ GLboolean BoundsTest; /**< GL_EXT_depth_bounds_test */
+ GLfloat BoundsMin, BoundsMax;/**< GL_EXT_depth_bounds_test */
+};
+
+
+/**
+ * glEnable()/glDisable() attributes.
+ */
+struct gl_enable_attrib {
+ GLboolean AlphaTest;
+ GLboolean AutoNormal;
+ GLboolean Blend;
+ GLuint ClipPlanes;
+ GLboolean ColorMaterial;
+ GLboolean ColorTable; /* SGI_color_table */
+ GLboolean PostColorMatrixColorTable; /* SGI_color_table */
+ GLboolean PostConvolutionColorTable; /* SGI_color_table */
+ GLboolean Convolution1D;
+ GLboolean Convolution2D;
+ GLboolean Separable2D;
+ GLboolean CullFace;
+ GLboolean DepthTest;
+ GLboolean Dither;
+ GLboolean Fog;
+ GLboolean Histogram;
+ GLboolean Light[MAX_LIGHTS];
+ GLboolean Lighting;
+ GLboolean LineSmooth;
+ GLboolean LineStipple;
+ GLboolean IndexLogicOp;
+ GLboolean ColorLogicOp;
+ GLboolean Map1Color4;
+ GLboolean Map1Index;
+ GLboolean Map1Normal;
+ GLboolean Map1TextureCoord1;
+ GLboolean Map1TextureCoord2;
+ GLboolean Map1TextureCoord3;
+ GLboolean Map1TextureCoord4;
+ GLboolean Map1Vertex3;
+ GLboolean Map1Vertex4;
+ GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */
+ GLboolean Map2Color4;
+ GLboolean Map2Index;
+ GLboolean Map2Normal;
+ GLboolean Map2TextureCoord1;
+ GLboolean Map2TextureCoord2;
+ GLboolean Map2TextureCoord3;
+ GLboolean Map2TextureCoord4;
+ GLboolean Map2Vertex3;
+ GLboolean Map2Vertex4;
+ GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */
+ GLboolean MinMax;
+ GLboolean Normalize;
+ GLboolean PixelTexture;
+ GLboolean PointSmooth;
+ GLboolean PolygonOffsetPoint;
+ GLboolean PolygonOffsetLine;
+ GLboolean PolygonOffsetFill;
+ GLboolean PolygonSmooth;
+ GLboolean PolygonStipple;
+ GLboolean RescaleNormals;
+ GLboolean Scissor;
+ GLboolean Stencil;
+ GLboolean MultisampleEnabled; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToOne; /* GL_ARB_multisample */
+ GLboolean SampleCoverage; /* GL_ARB_multisample */
+ GLboolean SampleCoverageInvert; /* GL_ARB_multisample */
+ GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
+ GLuint Texture[MAX_TEXTURE_IMAGE_UNITS];
+ GLuint TexGen[MAX_TEXTURE_COORD_UNITS];
+ /* SGI_texture_color_table */
+ GLboolean TextureColorTable[MAX_TEXTURE_IMAGE_UNITS];
+ /* GL_NV_vertex_program */
+ GLboolean VertexProgram;
+ GLboolean VertexProgramPointSize;
+ GLboolean VertexProgramTwoSide;
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ GLboolean PointSprite;
+};
+
+
+/**
+ * Eval attributes.
+ */
+struct gl_eval_attrib {
+ /**
+ * \name Enable bits
+ */
+ /*@{*/
+ GLboolean Map1Color4;
+ GLboolean Map1Index;
+ GLboolean Map1Normal;
+ GLboolean Map1TextureCoord1;
+ GLboolean Map1TextureCoord2;
+ GLboolean Map1TextureCoord3;
+ GLboolean Map1TextureCoord4;
+ GLboolean Map1Vertex3;
+ GLboolean Map1Vertex4;
+ GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */
+ GLboolean Map2Color4;
+ GLboolean Map2Index;
+ GLboolean Map2Normal;
+ GLboolean Map2TextureCoord1;
+ GLboolean Map2TextureCoord2;
+ GLboolean Map2TextureCoord3;
+ GLboolean Map2TextureCoord4;
+ GLboolean Map2Vertex3;
+ GLboolean Map2Vertex4;
+ GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */
+ GLboolean AutoNormal;
+ /*@}*/
+
+ /**
+ * \name Map Grid endpoints and divisions and calculated du values
+ */
+ /*@{*/
+ GLint MapGrid1un;
+ GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du;
+ GLint MapGrid2un, MapGrid2vn;
+ GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du;
+ GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv;
+ /*@}*/
+};
+
+
+/**
+ * Fog attributes.
+ */
+struct gl_fog_attrib {
+ GLboolean Enabled; /**< Fog enabled flag */
+ GLfloat Color[4]; /**< Fog color */
+ GLfloat Density; /**< Density >= 0.0 */
+ GLfloat Start; /**< Start distance in eye coords */
+ GLfloat End; /**< End distance in eye coords */
+ GLfloat Index; /**< Fog index */
+ GLenum Mode; /**< Fog mode */
+ GLboolean ColorSumEnabled;
+ GLenum FogCoordinateSource; /**< GL_EXT_fog_coord */
+};
+
+
+/**
+ * Hint attributes.
+ *
+ * Values are always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE.
+ */
+struct gl_hint_attrib {
+ GLenum PerspectiveCorrection;
+ GLenum PointSmooth;
+ GLenum LineSmooth;
+ GLenum PolygonSmooth;
+ GLenum Fog;
+ GLenum ClipVolumeClipping; /**< GL_EXT_clip_volume_hint */
+ GLenum TextureCompression; /**< GL_ARB_texture_compression */
+ GLenum GenerateMipmap; /**< GL_SGIS_generate_mipmap */
+};
+
+
+/**
+ * Histogram attributes.
+ */
+struct gl_histogram_attrib {
+ GLuint Width; /**< number of table entries */
+ GLint Format; /**< GL_ALPHA, GL_RGB, etc */
+ GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */
+ GLboolean Sink; /**< terminate image transfer? */
+ GLubyte RedSize; /**< Bits per counter */
+ GLubyte GreenSize;
+ GLubyte BlueSize;
+ GLubyte AlphaSize;
+ GLubyte LuminanceSize;
+};
+
+
+struct gl_minmax_attrib {
+ GLenum Format;
+ GLboolean Sink;
+ GLfloat Min[4], Max[4]; /**< RGBA */
+};
+
+
+struct gl_convolution_attrib {
+ GLenum Format;
+ GLenum InternalFormat;
+ GLuint Width;
+ GLuint Height;
+ GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4];
+};
+
+
+#define LIGHT_SPOT 0x1
+#define LIGHT_LOCAL_VIEWER 0x2
+#define LIGHT_POSITIONAL 0x4
+#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
+
+/**
+ * Lighting attributes.
+ */
+struct gl_light_attrib {
+ struct gl_light Light[MAX_LIGHTS]; /**< Array of lights */
+ struct gl_lightmodel Model; /**< Lighting model */
+
+ /**
+ * Must flush FLUSH_VERTICES before referencing:
+ */
+ /*@{*/
+ struct gl_material Material; /**< Includes front & back values */
+ /*@}*/
+
+ GLboolean Enabled; /**< Lighting enabled flag */
+ GLenum ShadeModel; /**< GL_FLAT or GL_SMOOTH */
+ GLenum ColorMaterialFace; /**< GL_FRONT, BACK or FRONT_AND_BACK */
+ GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */
+ GLuint ColorMaterialBitmask; /**< bitmask formed from Face and Mode */
+ GLboolean ColorMaterialEnabled;
+
+ struct gl_light EnabledList; /**< List sentinel */
+
+ /**
+ * Derived for optimizations:
+ */
+ /*@{*/
+ GLboolean _NeedEyeCoords;
+ GLboolean _NeedVertices; /**< Use fast shader? */
+ GLuint _Flags; /**< LIGHT_* flags, see above */
+ GLfloat _BaseColor[2][3];
+ /*@}*/
+};
+
+
+/**
+ * Line attributes.
+ */
+struct gl_line_attrib {
+ GLboolean SmoothFlag; /**< GL_LINE_SMOOTH enabled? */
+ GLboolean StippleFlag; /**< GL_LINE_STIPPLE enabled? */
+ GLushort StipplePattern; /**< Stipple pattern */
+ GLint StippleFactor; /**< Stipple repeat factor */
+ GLfloat Width; /**< Line width */
+ GLfloat _Width; /**< Clamped Line width */
+};
+
+
+struct gl_list_attrib {
+ GLuint ListBase;
+};
+
+
+struct gl_list_instruction {
+ GLuint Size;
+ void (*Execute)( GLcontext *ctx, void *data );
+ void (*Destroy)( GLcontext *ctx, void *data );
+ void (*Print)( GLcontext *ctx, void *data );
+};
+
+#define MAX_DLIST_EXT_OPCODES 16
+
+struct gl_list_extensions {
+ struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
+ GLuint NumOpcodes;
+};
+
+
+struct gl_multisample_attrib {
+ GLboolean Enabled;
+ GLboolean SampleAlphaToCoverage;
+ GLboolean SampleAlphaToOne;
+ GLboolean SampleCoverage;
+ GLfloat SampleCoverageValue;
+ GLboolean SampleCoverageInvert;
+};
+
+
+/**
+ * Pixel attributes.
+ */
+struct gl_pixel_attrib {
+ GLenum ReadBuffer; /**< source buffer for glReadPixels()/glCopyPixels() */
+ GLubyte _ReadSrcMask; /**< Not really a mask, but like _DrawDestMask
+ *
+ * May be: FRONT_LEFT_BIT, BACK_LEFT_BIT,
+ * FRONT_RIGHT_BIT or BACK_RIGHT_BIT. */
+ GLfloat RedBias, RedScale;
+ GLfloat GreenBias, GreenScale;
+ GLfloat BlueBias, BlueScale;
+ GLfloat AlphaBias, AlphaScale;
+ GLfloat DepthBias, DepthScale;
+ GLint IndexShift, IndexOffset;
+ GLboolean MapColorFlag;
+ GLboolean MapStencilFlag;
+ GLfloat ZoomX, ZoomY;
+ /* XXX move these out of gl_pixel_attrib */
+ GLint MapStoSsize; /**< Size of each pixel map */
+ GLint MapItoIsize;
+ GLint MapItoRsize;
+ GLint MapItoGsize;
+ GLint MapItoBsize;
+ GLint MapItoAsize;
+ GLint MapRtoRsize;
+ GLint MapGtoGsize;
+ GLint MapBtoBsize;
+ GLint MapAtoAsize;
+ GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /**< Pixel map tables */
+ GLint MapItoI[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapItoR[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapItoG[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapItoB[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapItoA[MAX_PIXEL_MAP_TABLE];
+ GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */
+ GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE];
+ GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE];
+ GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE];
+ /** GL_EXT_histogram */
+ GLboolean HistogramEnabled;
+ GLboolean MinMaxEnabled;
+ /** GL_SGIS_pixel_texture */
+ GLboolean PixelTextureEnabled;
+ GLenum FragmentRgbSource;
+ GLenum FragmentAlphaSource;
+ /** GL_SGI_color_matrix */
+ GLfloat PostColorMatrixScale[4]; /**< RGBA */
+ GLfloat PostColorMatrixBias[4]; /**< RGBA */
+ /** GL_SGI_color_table */
+ GLfloat ColorTableScale[4];
+ GLfloat ColorTableBias[4];
+ GLboolean ColorTableEnabled;
+ GLfloat PCCTscale[4];
+ GLfloat PCCTbias[4];
+ GLboolean PostConvolutionColorTableEnabled;
+ GLfloat PCMCTscale[4];
+ GLfloat PCMCTbias[4];
+ GLboolean PostColorMatrixColorTableEnabled;
+ /** GL_SGI_texture_color_table */
+ GLfloat TextureColorTableScale[4];
+ GLfloat TextureColorTableBias[4];
+ /** Convolution */
+ GLboolean Convolution1DEnabled;
+ GLboolean Convolution2DEnabled;
+ GLboolean Separable2DEnabled;
+ GLfloat ConvolutionBorderColor[3][4];
+ GLenum ConvolutionBorderMode[3];
+ GLfloat ConvolutionFilterScale[3][4];
+ GLfloat ConvolutionFilterBias[3][4];
+ GLfloat PostConvolutionScale[4]; /**< RGBA */
+ GLfloat PostConvolutionBias[4]; /**< RGBA */
+};
+
+
+/**
+ * Point attributes.
+ */
+struct gl_point_attrib {
+ GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */
+ GLfloat Size; /**< User-specified point size */
+ GLfloat _Size; /**< Size clamped to Const.Min/MaxPointSize */
+ GLfloat Params[3]; /**< GL_EXT_point_parameters */
+ GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */
+ GLfloat Threshold; /**< GL_EXT_point_parameters */
+ GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */
+ GLboolean PointSprite; /**< GL_NV_point_sprite / GL_NV_point_sprite */
+ GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /**< GL_NV_point_sprite / GL_NV_point_sprite */
+ GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */
+ GLenum SpriteOrigin; /**< GL_ARB_point_sprite */
+};
+
+
+/**
+ * Polygon attributes.
+ */
+struct gl_polygon_attrib {
+ GLenum FrontFace; /**< Either GL_CW or GL_CCW */
+ GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
+ GLenum BackMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
+ GLboolean _FrontBit; /**< 0=GL_CCW, 1=GL_CW */
+ GLboolean CullFlag; /**< Culling on/off flag */
+ GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */
+ GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */
+ GLenum CullFaceMode; /**< Culling mode GL_FRONT or GL_BACK */
+ GLfloat OffsetFactor; /**< Polygon offset factor, from user */
+ GLfloat OffsetUnits; /**< Polygon offset units, from user */
+ GLboolean OffsetPoint; /**< Offset in GL_POINT mode */
+ GLboolean OffsetLine; /**< Offset in GL_LINE mode */
+ GLboolean OffsetFill; /**< Offset in GL_FILL mode */
+};
+
+
+/**
+ * Scissor attributes.
+ */
+struct gl_scissor_attrib {
+ GLboolean Enabled; /**< Scissor test enabled? */
+ GLint X, Y; /**< Lower left corner of box */
+ GLsizei Width, Height; /**< Size of box */
+};
+
+
+/**
+ * Stencil attributes.
+ */
+struct gl_stencil_attrib {
+ GLboolean Enabled; /**< Enabled flag */
+ GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */
+ GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 1) */
+ GLenum Function[2]; /**< Stencil function */
+ GLenum FailFunc[2]; /**< Fail function */
+ GLenum ZPassFunc[2]; /**< Depth buffer pass function */
+ GLenum ZFailFunc[2]; /**< Depth buffer fail function */
+ GLstencil Ref[2]; /**< Reference value */
+ GLstencil ValueMask[2]; /**< Value mask */
+ GLstencil WriteMask[2]; /**< Write mask */
+ GLstencil Clear; /**< Clear value */
+};
+
+
+#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */
+
+#define TEXTURE_1D_INDEX 0
+#define TEXTURE_2D_INDEX 1
+#define TEXTURE_3D_INDEX 2
+#define TEXTURE_CUBE_INDEX 3
+#define TEXTURE_RECT_INDEX 4
+
+/* Texture.Unit[]._ReallyEnabled flags: */
+#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
+#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
+#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
+#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
+#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX)
+
+
+/* TexGenEnabled flags */
+#define S_BIT 1
+#define T_BIT 2
+#define R_BIT 4
+#define Q_BIT 8
+
+/* Bitmap versions of the GL_ constants. */
+#define TEXGEN_SPHERE_MAP 0x1
+#define TEXGEN_OBJ_LINEAR 0x2
+#define TEXGEN_EYE_LINEAR 0x4
+#define TEXGEN_REFLECTION_MAP_NV 0x8
+#define TEXGEN_NORMAL_MAP_NV 0x10
+
+#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
+ TEXGEN_REFLECTION_MAP_NV | \
+ TEXGEN_NORMAL_MAP_NV)
+#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
+ TEXGEN_REFLECTION_MAP_NV | \
+ TEXGEN_NORMAL_MAP_NV | \
+ TEXGEN_EYE_LINEAR)
+
+/* A selection of state flags to make driver and module's lives easier. */
+#define ENABLE_TEXGEN0 0x1
+#define ENABLE_TEXGEN1 0x2
+#define ENABLE_TEXGEN2 0x4
+#define ENABLE_TEXGEN3 0x8
+#define ENABLE_TEXGEN4 0x10
+#define ENABLE_TEXGEN5 0x20
+#define ENABLE_TEXGEN6 0x40
+#define ENABLE_TEXGEN7 0x80
+
+#define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */
+#define ENABLE_TEXMAT1 0x2
+#define ENABLE_TEXMAT2 0x4
+#define ENABLE_TEXMAT3 0x8
+#define ENABLE_TEXMAT4 0x10
+#define ENABLE_TEXMAT5 0x20
+#define ENABLE_TEXMAT6 0x40
+#define ENABLE_TEXMAT7 0x80
+
+#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
+#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
+
+
+/**
+ * Texel fetch function prototype. We use texel fetch functions to
+ * extract RGBA, color indexes and depth components out of 1D, 2D and 3D
+ * texture images. These functions help to isolate us from the gritty
+ * details of all the various texture image encodings.
+ *
+ * \param texImage texture image.
+ * \param col texel column.
+ * \param row texel row.
+ * \param img texel image level/layer.
+ * \param texelOut output texel (up to 4 GLchans)
+ */
+typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLchan *texelOut );
+
+/**
+ * As above, but returns floats.
+ * Used for depth component images and for upcoming signed/float
+ * texture images.
+ */
+typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLfloat *texelOut );
+
+
+/**
+ * TexImage store function. This is called by the glTex[Sub]Image
+ * functions and is responsible for converting the user-specified texture
+ * image into a specific (hardware) image format.
+ */
+typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims,
+ GLenum baseInternalFormat,
+ const struct gl_texture_format *dstFormat,
+ GLvoid *dstAddr,
+ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
+ GLint dstRowStride, GLint dstImageStride,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *srcAddr,
+ const struct gl_pixelstore_attrib *srcPacking);
+
+
+
+/**
+ * Texture format record
+ */
+struct gl_texture_format {
+ GLint MesaFormat; /**< One of the MESA_FORMAT_* values */
+
+ GLenum BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
+ * GL_LUMINANCE, GL_LUMINANCE_ALPHA,
+ * GL_INTENSITY, GL_COLOR_INDEX or
+ * GL_DEPTH_COMPONENT.
+ */
+ GLenum DataType; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */
+ GLubyte RedBits; /**< Bits per texel component */
+ GLubyte GreenBits; /**< These are just rough approximations for */
+ GLubyte BlueBits; /**< compressed texture formats. */
+ GLubyte AlphaBits;
+ GLubyte LuminanceBits;
+ GLubyte IntensityBits;
+ GLubyte IndexBits;
+ GLubyte DepthBits;
+
+ GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */
+
+ StoreTexImageFunc StoreImage;
+
+ /**
+ * \name Texel fetch function pointers
+ */
+ /*@{*/
+ FetchTexelFuncC FetchTexel1D;
+ FetchTexelFuncC FetchTexel2D;
+ FetchTexelFuncC FetchTexel3D;
+ FetchTexelFuncF FetchTexel1Df;
+ FetchTexelFuncF FetchTexel2Df;
+ FetchTexelFuncF FetchTexel3Df;
+ /*@}*/
+};
+
+
+/**
+ * Texture image record
+ */
+struct gl_texture_image {
+ GLenum Format; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
+ * GL_LUMINANCE, GL_LUMINANCE_ALPHA,
+ * GL_INTENSITY, GL_COLOR_INDEX or
+ * GL_DEPTH_COMPONENT only.
+ * Used for choosing TexEnv arithmetic.
+ */
+ GLint IntFormat; /**< Internal format as given by the user */
+ GLuint Border; /**< 0 or 1 */
+ GLuint Width; /**< = 2^WidthLog2 + 2*Border */
+ GLuint Height; /**< = 2^HeightLog2 + 2*Border */
+ GLuint Depth; /**< = 2^DepthLog2 + 2*Border */
+ GLuint RowStride; /**< == Width unless IsClientData and padded */
+ GLuint Width2; /**< = Width - 2*Border */
+ GLuint Height2; /**< = Height - 2*Border */
+ GLuint Depth2; /**< = Depth - 2*Border */
+ GLuint WidthLog2; /**< = log2(Width2) */
+ GLuint HeightLog2; /**< = log2(Height2) */
+ GLuint DepthLog2; /**< = log2(Depth2) */
+ GLuint MaxLog2; /**< = MAX(WidthLog2, HeightLog2) */
+ GLfloat WidthScale; /**< used for mipmap LOD computation */
+ GLfloat HeightScale; /**< used for mipmap LOD computation */
+ GLfloat DepthScale; /**< used for mipmap LOD computation */
+ GLvoid *Data; /**< Image data, accessed via FetchTexel() */
+ GLboolean IsClientData; /**< Data owned by client? */
+ GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
+
+ const struct gl_texture_format *TexFormat;
+
+ struct gl_texture_object *TexObject; /**< Pointer back to parent object */
+
+ FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */
+ FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */
+
+ GLboolean IsCompressed; /**< GL_ARB_texture_compression */
+ GLuint CompressedSize; /**< GL_ARB_texture_compression */
+
+ /**
+ * \name For device driver:
+ */
+ /*@{*/
+ void *DriverData; /**< Arbitrary device driver data */
+ /*@}*/
+};
+
+#define FACE_POS_X 0
+#define FACE_NEG_X 1
+#define FACE_POS_Y 2
+#define FACE_NEG_Y 3
+#define FACE_POS_Z 4
+#define FACE_NEG_Z 5
+#define MAX_FACES 6
+
+/**
+ * Texture object record
+ */
+struct gl_texture_object {
+ _glthread_Mutex Mutex; /**< for thread safety */
+ GLint RefCount; /**< reference count */
+ GLboolean DeletePending; /**< Has glDeleteTexture been called? */
+ GLuint Name; /**< an unsigned integer */
+ GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
+ GLfloat Priority; /**< in [0,1] */
+ GLfloat BorderColor[4]; /**< unclamped */
+ GLchan _BorderChan[4]; /**< clamped, as GLchan */
+ /** \name Wrap modes
+ * Are GL_CLAMP, REPEAT, GL_CLAMP_TO_EDGE, and GL_CLAMP_TO_BORDER_ARB. */
+ /*@{*/
+ GLenum WrapS;
+ GLenum WrapT;
+ GLenum WrapR;
+ /*@}*/
+ GLenum MinFilter; /**< minification filter */
+ GLenum MagFilter; /**< magnification filter */
+ GLfloat MinLod; /**< min lambda, OpenGL 1.2 */
+ GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */
+ GLfloat LodBias; /**< OpenGL 1.4 */
+ GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
+ GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
+ GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
+ GLboolean CompareFlag; /**< GL_SGIX_shadow */
+ GLenum CompareOperator; /**< GL_SGIX_shadow */
+ GLfloat ShadowAmbient;
+ GLenum CompareMode; /**< GL_ARB_shadow */
+ GLenum CompareFunc; /**< GL_ARB_shadow */
+ GLenum DepthMode; /**< GL_ARB_depth_texture */
+ GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */
+ GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */
+ GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
+ GLboolean _IsPowerOfTwo; /**< Are all image dimensions powers of two? */
+
+ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
+
+ /** GL_EXT_paletted_texture */
+ struct gl_color_table Palette;
+
+ GLboolean Complete; /**< Is texture object complete? */
+ struct gl_texture_object *Next; /**< Next in linked list */
+
+ /**
+ * \name For device driver
+ */
+ /*@{*/
+ void *DriverData; /**< Arbitrary device driver data */
+ /*@}*/
+};
+
+/**
+ * Texture combine environment state.
+ *
+ * \todo
+ * If GL_NV_texture_env_combine4 is ever supported, the arrays in this
+ * structure will need to be expanded for 4 elements.
+ */
+struct gl_tex_env_combine_state {
+ GLenum ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
+ GLenum ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
+ GLenum SourceRGB[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
+ GLenum SourceA[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
+ GLenum OperandRGB[3]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */
+ GLenum OperandA[3]; /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */
+ GLuint ScaleShiftRGB; /**< 0, 1 or 2 */
+ GLuint ScaleShiftA; /**< 0, 1 or 2 */
+ GLuint _NumArgsRGB; /**< Number of inputs used for the combine mode. */
+ GLuint _NumArgsA; /**< Number of inputs used for the combine mode. */
+};
+
+/**
+ * Texture unit record
+ */
+struct gl_texture_unit {
+ GLuint Enabled; /**< bitmask of TEXTURE_*_BIT flags */
+ GLuint _ReallyEnabled; /**< 0 or exactly one of TEXTURE_*_BIT flags */
+
+ GLenum EnvMode; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
+ GLfloat EnvColor[4];
+ GLuint TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */
+ /** \name Tex coord generation mode
+ * Either GL_OBJECT_LINEAR, GL_EYE_LINEAR or GL_SPHERE_MAP. */
+ /*@{*/
+ GLenum GenModeS;
+ GLenum GenModeT;
+ GLenum GenModeR;
+ GLenum GenModeQ;
+ /*@}*/
+ GLuint _GenBitS;
+ GLuint _GenBitT;
+ GLuint _GenBitR;
+ GLuint _GenBitQ;
+ GLuint _GenFlags; /**< bitwise or of GenBit[STRQ] */
+ GLfloat ObjectPlaneS[4];
+ GLfloat ObjectPlaneT[4];
+ GLfloat ObjectPlaneR[4];
+ GLfloat ObjectPlaneQ[4];
+ GLfloat EyePlaneS[4];
+ GLfloat EyePlaneT[4];
+ GLfloat EyePlaneR[4];
+ GLfloat EyePlaneQ[4];
+ GLfloat LodBias; /**< for biasing mipmap levels */
+
+ /**
+ * \name GL_EXT_texture_env_combine
+ */
+ struct gl_tex_env_combine_state Combine;
+
+ /**
+ * Derived state based on \c EnvMode and the \c BaseFormat of the
+ * currently enabled texture.
+ */
+ struct gl_tex_env_combine_state _EnvMode;
+
+ /**
+ * Currently enabled combiner state. This will point to either
+ * \c Combine or \c _EnvMode.
+ */
+ struct gl_tex_env_combine_state *_CurrentCombine;
+
+ struct gl_texture_object *Current1D;
+ struct gl_texture_object *Current2D;
+ struct gl_texture_object *Current3D;
+ struct gl_texture_object *CurrentCubeMap; /**< GL_ARB_texture_cube_map */
+ struct gl_texture_object *CurrentRect; /**< GL_NV_texture_rectangle */
+
+ struct gl_texture_object *_Current; /**< Points to really enabled tex obj */
+
+ struct gl_texture_object Saved1D; /**< only used by glPush/PopAttrib */
+ struct gl_texture_object Saved2D;
+ struct gl_texture_object Saved3D;
+ struct gl_texture_object SavedCubeMap;
+ struct gl_texture_object SavedRect;
+
+ /* GL_SGI_texture_color_table */
+ struct gl_color_table ColorTable;
+ struct gl_color_table ProxyColorTable;
+ GLboolean ColorTableEnabled;
+};
+
+
+/**
+ * Texture attributes
+ */
+struct gl_texture_attrib {
+ /**
+ * name multitexture
+ */
+ /**@{*/
+ GLuint CurrentUnit; /**< Active texture unit */
+ GLuint _EnabledUnits; /**< one bit set for each really-enabled unit */
+ GLuint _EnabledCoordUnits; /**< one bit per enabled coordinate unit */
+ GLuint _GenFlags; /**< for texgen */
+ GLuint _TexGenEnabled;
+ GLuint _TexMatEnabled;
+ /**@}*/
+
+ struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
+
+ struct gl_texture_object *Proxy1D;
+ struct gl_texture_object *Proxy2D;
+ struct gl_texture_object *Proxy3D;
+ struct gl_texture_object *ProxyCubeMap;
+ struct gl_texture_object *ProxyRect;
+
+ /** GL_EXT_shared_texture_palette */
+ GLboolean SharedPalette;
+ struct gl_color_table Palette;
+};
+
+
+/**
+ * Transformation attributes.
+ */
+struct gl_transform_attrib {
+ GLenum MatrixMode; /**< Matrix mode */
+ GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; /**< User clip planes */
+ GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /**< derived */
+ GLuint ClipPlanesEnabled; /**< on/off bitmask */
+ GLboolean Normalize; /**< Normalize all normals? */
+ GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */
+ GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */
+
+ GLboolean CullVertexFlag; /**< True if GL_CULL_VERTEX_EXT is enabled */
+ GLfloat CullEyePos[4];
+ GLfloat CullObjPos[4];
+};
+
+
+/**
+ * Viewport attributes.
+ */
+struct gl_viewport_attrib {
+ GLint X, Y; /**< position */
+ GLsizei Width, Height; /**< size */
+ GLfloat Near, Far; /**< Depth buffer range */
+ GLmatrix _WindowMap; /**< Mapping transformation as a matrix. */
+};
+
+
+/**
+ * Node for the attribute stack
+ */
+struct gl_attrib_node {
+ GLbitfield kind;
+ void *data;
+ struct gl_attrib_node *next;
+};
+
+
+/**
+ * GL_ARB_vertex/pixel_buffer_object buffer object
+ */
+struct gl_buffer_object {
+ GLint RefCount;
+ GLuint Name;
+ GLenum Usage;
+ GLenum Access;
+ GLvoid *Pointer; /**< Only valid while buffer is mapped */
+ GLuint Size; /**< Size of storage in bytes */
+ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */
+ GLboolean OnCard; /**< Is buffer in VRAM? (hardware drivers) */
+ GLboolean DeletePending; /**< Deleted by user but RefCount > 0? */
+};
+
+
+
+/**
+ * Client pixel packing/unpacking attributes
+ */
+struct gl_pixelstore_attrib {
+ GLint Alignment;
+ GLint RowLength;
+ GLint SkipPixels;
+ GLint SkipRows;
+ GLint ImageHeight; /**< for GL_EXT_texture3D */
+ GLint SkipImages; /**< for GL_EXT_texture3D */
+ GLboolean SwapBytes;
+ GLboolean LsbFirst;
+ GLboolean ClientStorage; /**< GL_APPLE_client_storage */
+ GLboolean Invert; /**< GL_MESA_pack_invert */
+ struct gl_buffer_object *BufferObj; /**< GL_ARB_pixel_buffer_object */
+};
+
+
+#define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */
+
+
+/**
+ * Client vertex array attributes
+ */
+struct gl_client_array {
+ GLint Size; /**< components per element (1,2,3,4) */
+ GLenum Type; /**< datatype: GL_FLOAT, GL_INT, etc */
+ GLsizei Stride; /**< user-specified stride */
+ GLsizei StrideB; /**< actual stride in bytes */
+ const GLubyte *Ptr; /**< Points to array data */
+ GLuint Enabled; /**< one of the _NEW_ARRAY_ bits */
+ GLboolean Normalized; /**< GL_ARB_vertex_program */
+
+ /**< GL_ARB_vertex_buffer_object */
+ struct gl_buffer_object *BufferObj;
+ GLuint _MaxElement;
+
+ GLuint Flags;
+};
+
+
+/**
+ * Array attributes.
+ */
+struct gl_array_attrib {
+ struct gl_client_array Vertex; /**< client data descriptors */
+ struct gl_client_array Normal;
+ struct gl_client_array Color;
+ struct gl_client_array SecondaryColor;
+ struct gl_client_array FogCoord;
+ struct gl_client_array Index;
+ struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
+ struct gl_client_array EdgeFlag;
+
+ struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; /**< GL_NV_vertex_program */
+
+ GLint ActiveTexture; /**< Client Active Texture */
+ GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
+ GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
+
+ GLuint _Enabled; /**< _NEW_ARRAY_* - bit set if array enabled */
+ GLuint NewState; /**< _NEW_ARRAY_* */
+
+#if FEATURE_ARB_vertex_buffer_object
+ struct gl_buffer_object *NullBufferObj;
+ struct gl_buffer_object *ArrayBufferObj;
+ struct gl_buffer_object *ElementArrayBufferObj;
+#endif
+ GLuint _MaxElement; /* Min of all enabled array's maxes */
+};
+
+
+struct gl_feedback {
+ GLenum Type;
+ GLuint _Mask; /* FB_* bits */
+ GLfloat *Buffer;
+ GLuint BufferSize;
+ GLuint Count;
+};
+
+
+/**
+ * Selection attributes.
+ */
+struct gl_selection {
+ GLuint *Buffer; /**< selection buffer */
+ GLuint BufferSize; /**< size of the selection buffer */
+ GLuint BufferCount; /**< number of values in the selection buffer */
+ GLuint Hits; /**< number of records in the selection buffer */
+ GLuint NameStackDepth; /**< name stack depth */
+ GLuint NameStack[MAX_NAME_STACK_DEPTH]; /**< name stack */
+ GLboolean HitFlag; /**< hit flag */
+ GLfloat HitMinZ; /**< minimum hit depth */
+ GLfloat HitMaxZ; /**< maximum hit depth */
+};
+
+
+/**
+ * 1-D Evaluator control points
+ */
+struct gl_1d_map
+{
+ GLuint Order; /**< Number of control points */
+ GLfloat u1, u2, du; /**< u1, u2, 1.0/(u2-u1) */
+ GLfloat *Points; /**< Points to contiguous control points */
+};
+
+
+/**
+ * 2-D Evaluator control points
+ */
+struct gl_2d_map
+{
+ GLuint Uorder; /**< Number of control points in U dimension */
+ GLuint Vorder; /**< Number of control points in V dimension */
+ GLfloat u1, u2, du;
+ GLfloat v1, v2, dv;
+ GLfloat *Points; /**< Points to contiguous control points */
+};
+
+
+/**
+ * All evaluator control points
+ */
+struct gl_evaluators
+{
+ /**
+ * \name 1-D maps
+ */
+ /*@{*/
+ struct gl_1d_map Map1Vertex3;
+ struct gl_1d_map Map1Vertex4;
+ struct gl_1d_map Map1Index;
+ struct gl_1d_map Map1Color4;
+ struct gl_1d_map Map1Normal;
+ struct gl_1d_map Map1Texture1;
+ struct gl_1d_map Map1Texture2;
+ struct gl_1d_map Map1Texture3;
+ struct gl_1d_map Map1Texture4;
+ struct gl_1d_map Map1Attrib[16]; /**< GL_NV_vertex_program */
+ /*@}*/
+
+ /**
+ * \name 2-D maps
+ */
+ /*@{*/
+ struct gl_2d_map Map2Vertex3;
+ struct gl_2d_map Map2Vertex4;
+ struct gl_2d_map Map2Index;
+ struct gl_2d_map Map2Color4;
+ struct gl_2d_map Map2Normal;
+ struct gl_2d_map Map2Texture1;
+ struct gl_2d_map Map2Texture2;
+ struct gl_2d_map Map2Texture3;
+ struct gl_2d_map Map2Texture4;
+ struct gl_2d_map Map2Attrib[16]; /**< GL_NV_vertex_program */
+ /*@}*/
+};
+
+
+/**
+ * NV_fragment_program runtime state
+ */
+struct fp_machine
+{
+ GLfloat Temporaries[MAX_NV_FRAGMENT_PROGRAM_TEMPS][4];
+ GLfloat Inputs[MAX_NV_FRAGMENT_PROGRAM_INPUTS][4];
+ GLfloat Outputs[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS][4];
+ GLuint CondCodes[4];
+};
+
+
+/**
+ * Names of the various vertex/fragment register files
+ */
+enum register_file
+{
+ PROGRAM_TEMPORARY = 10,
+ PROGRAM_INPUT,
+ PROGRAM_OUTPUT,
+ PROGRAM_LOCAL_PARAM,
+ PROGRAM_ENV_PARAM,
+ PROGRAM_NAMED_PARAM,
+ PROGRAM_STATE_VAR,
+ PROGRAM_WRITE_ONLY,
+ PROGRAM_ADDRESS
+};
+
+
+/* Vertex and fragment instructions */
+struct vp_instruction;
+struct fp_instruction;
+
+struct program_parameter_list;
+
+
+/**
+ * Base class for any kind of program object
+ */
+struct program
+{
+ GLuint Id;
+ GLubyte *String; /**< Null-terminated program text */
+ GLboolean DeletePending; /**< User called glDeletePrograms? */
+ GLint RefCount;
+ GLenum Target;
+ GLenum Format; /**< String encoding format */
+ GLboolean Resident;
+ GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4];
+ GLuint NumInstructions; /* GL_ARB_vertex/fragment_program */
+ GLuint NumTemporaries;
+ GLuint NumParameters;
+ GLuint NumAttributes;
+ GLuint NumAddressRegs;
+};
+
+
+/** Vertex program object */
+struct vertex_program
+{
+ struct program Base; /* base class */
+ struct vp_instruction *Instructions; /* Compiled instructions */
+ GLboolean IsNVProgram; /* GL_NV_vertex_program ? */
+ GLboolean IsPositionInvariant; /* GL_NV_vertex_program1_1 */
+ GLuint InputsRead; /* Bitmask of which input regs are read */
+ GLuint OutputsWritten; /* Bitmask of which output regs are written to */
+ struct program_parameter_list *Parameters; /**< array [NumParameters] */
+};
+
+
+/** Fragment program object */
+struct fragment_program
+{
+ struct program Base; /**< base class */
+ struct fp_instruction *Instructions; /**< Compiled instructions */
+ GLuint InputsRead; /**< Bitmask of which input regs are read */
+ GLuint OutputsWritten; /**< Bitmask of which output regs are written to */
+ GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_INDEX bitmask */
+ GLuint NumAluInstructions; /**< GL_ARB_fragment_program */
+ GLuint NumTexInstructions;
+ GLuint NumTexIndirections;
+ GLenum FogOption;
+ struct program_parameter_list *Parameters; /**< array [NumParameters] */
+
+#ifdef USE_TCC
+ char c_str[4096]; /* experimental... */
+ int c_strlen;
+#endif
+};
+
+
+/**
+ * State common to vertex and fragment programs.
+ */
+struct program_state {
+ GLint ErrorPos; /* GL_PROGRAM_ERROR_POSITION_NV */
+ const char *ErrorString; /* GL_PROGRAM_ERROR_STRING_NV */
+};
+
+
+/**
+ * State vars for GL_NV_vertex_program
+ */
+struct vertex_program_state
+{
+ GLboolean Enabled; /**< GL_VERTEX_PROGRAM_NV */
+ GLboolean _Enabled; /**< Really enabled? */
+ GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+ struct vertex_program *Current; /**< ptr to currently bound program */
+
+ GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
+ GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
+
+ GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /* Env params */
+ /* Only used during program execution (may be moved someday): */
+ GLfloat Temporaries[MAX_NV_VERTEX_PROGRAM_TEMPS][4];
+ GLfloat Inputs[MAX_NV_VERTEX_PROGRAM_INPUTS][4];
+ GLfloat Outputs[MAX_NV_VERTEX_PROGRAM_OUTPUTS][4];
+ GLint AddressReg[4];
+
+#if FEATURE_MESA_program_debug
+ GLprogramcallbackMESA Callback;
+ GLvoid *CallbackData;
+ GLboolean CallbackEnabled;
+ GLuint CurrentPosition;
+#endif
+};
+
+
+/*
+ * State for GL_ARB/NV_fragment_program
+ */
+struct fragment_program_state
+{
+ GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */
+ GLboolean _Enabled; /* Really enabled? */
+ struct fragment_program *Current; /* ptr to currently bound program */
+ struct fp_machine Machine; /* machine state */
+ GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */
+
+#if FEATURE_MESA_program_debug
+ GLprogramcallbackMESA Callback;
+ GLvoid *CallbackData;
+ GLboolean CallbackEnabled;
+ GLuint CurrentPosition;
+#endif
+};
+
+
+/*
+ * State for GL_ARB_occlusion_query
+ */
+struct occlusion_state
+{
+ GLboolean Active;
+ GLuint CurrentQueryObject;
+ GLuint PassedCounter;
+ struct _mesa_HashTable *QueryObjects;
+};
+
+
+/**
+ * State which can be shared by multiple contexts:
+ */
+struct gl_shared_state
+{
+ _glthread_Mutex Mutex; /**< for thread safety */
+ GLint RefCount; /**< Reference count */
+ struct _mesa_HashTable *DisplayList; /**< Display lists hash table */
+ struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */
+ struct gl_texture_object *TexObjectList;/**< Linked list of texture objects */
+
+ /**
+ * \name Default texture objects (shared by all multi-texture units)
+ */
+ /*@{*/
+ struct gl_texture_object *Default1D;
+ struct gl_texture_object *Default2D;
+ struct gl_texture_object *Default3D;
+ struct gl_texture_object *DefaultCubeMap;
+ struct gl_texture_object *DefaultRect;
+ /*@}*/
+
+ /**
+ * \name GL_NV_vertex/_program
+ */
+ /*@{*/
+ struct _mesa_HashTable *Programs;
+#if FEATURE_ARB_vertex_program
+ struct program *DefaultVertexProgram;
+#endif
+#if FEATURE_ARB_fragment_program
+ struct program *DefaultFragmentProgram;
+#endif
+ /*@}*/
+
+#if FEATURE_ARB_vertex_buffer_object
+ struct _mesa_HashTable *BufferObjects;
+#endif
+
+ void *DriverData; /**< Device driver shared state */
+};
+
+
+/**
+ * Frame buffer.
+ *
+ * A "frame buffer" is a color buffer and its optional ancillary buffers:
+ * depth, accum, stencil, and software-simulated alpha buffers.
+ * In C++ terms, think of this as a base class from which device drivers
+ * will make derived classes.
+ */
+struct gl_frame_buffer
+{
+ GLvisual Visual; /**< The corresponding visual */
+
+ GLuint Width, Height; /**< size of frame buffer in pixels */
+
+ GLboolean UseSoftwareDepthBuffer;
+ GLboolean UseSoftwareAccumBuffer;
+ GLboolean UseSoftwareStencilBuffer;
+ GLboolean UseSoftwareAlphaBuffers;
+ GLboolean UseSoftwareAuxBuffers;
+
+ /** \name Software depth (aka Z) buffer */
+ /*@{*/
+ GLvoid *DepthBuffer; /**< array [Width*Height] of GLushort or GLuint*/
+ /*@}*/
+
+ /** \name Software stencil buffer */
+ /*@{*/
+ GLstencil *Stencil; /**< array [Width*Height] of GLstencil values */
+ /*@}*/
+
+ /** \name Software accumulation buffer */
+ /*@{*/
+ GLaccum *Accum; /**< array [4*Width*Height] of GLaccum values */
+ /*@}*/
+
+ /** \name Software alpha planes */
+ /*@{*/
+ GLchan *FrontLeftAlpha; /**< array [Width*Height] of GLchan */
+ GLchan *BackLeftAlpha; /**< array [Width*Height] of GLchan */
+ GLchan *FrontRightAlpha; /**< array [Width*Height] of GLchan */
+ GLchan *BackRightAlpha; /**< array [Width*Height] of GLchan */
+ /*@}*/
+
+ GLchan *AuxBuffers[MAX_AUX_BUFFERS];
+
+ /**
+ * \name Drawing bounds
+ *
+ * Intersection of window size and scissor box
+ */
+ /*@{*/
+ GLint _Xmin; /**< inclusive */
+ GLint _Ymin; /**< inclusive */
+ GLint _Xmax; /**< exclusive */
+ GLint _Ymax; /**< exclusive */
+ /*@}*/
+};
+
+
+/**
+ * Constants which may be overridden by device driver during context creation
+ * but are never changed after that.
+ */
+struct gl_constants
+{
+ GLint MaxTextureLevels; /**< Maximum number of allowed mipmap levels. */
+ GLint Max3DTextureLevels; /**< Maximum number of allowed mipmap levels for 3D texture targets. */
+ GLint MaxCubeTextureLevels; /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */
+ GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */
+ GLuint MaxTextureCoordUnits;
+ GLuint MaxTextureImageUnits;
+ GLuint MaxTextureUnits; /* = MAX(CoordUnits, ImageUnits) */
+ GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */
+ GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */
+ GLuint MaxArrayLockSize;
+ GLint SubPixelBits;
+ GLfloat MinPointSize, MaxPointSize; /* aliased */
+ GLfloat MinPointSizeAA, MaxPointSizeAA; /* antialiased */
+ GLfloat PointSizeGranularity;
+ GLfloat MinLineWidth, MaxLineWidth; /* aliased */
+ GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */
+ GLfloat LineWidthGranularity;
+ GLuint MaxColorTableSize;
+ GLuint MaxConvolutionWidth;
+ GLuint MaxConvolutionHeight;
+ GLuint MaxClipPlanes;
+ GLuint MaxLights;
+ GLfloat MaxShininess; /* GL_NV_light_max_exponent */
+ GLfloat MaxSpotExponent; /* GL_NV_light_max_exponent */
+ /* GL_ARB_vertex_program */
+ GLuint MaxVertexProgramInstructions;
+ GLuint MaxVertexProgramAttribs;
+ GLuint MaxVertexProgramTemps;
+ GLuint MaxVertexProgramLocalParams;
+ GLuint MaxVertexProgramEnvParams;
+ GLuint MaxVertexProgramAddressRegs;
+ /* GL_ARB_fragment_program */
+ GLuint MaxFragmentProgramInstructions;
+ GLuint MaxFragmentProgramAttribs;
+ GLuint MaxFragmentProgramTemps;
+ GLuint MaxFragmentProgramLocalParams;
+ GLuint MaxFragmentProgramEnvParams;
+ GLuint MaxFragmentProgramAddressRegs;
+ GLuint MaxFragmentProgramAluInstructions;
+ GLuint MaxFragmentProgramTexInstructions;
+ GLuint MaxFragmentProgramTexIndirections;
+ /* vertex or fragment program */
+ GLuint MaxProgramMatrices;
+ GLuint MaxProgramMatrixStackDepth;
+ /* vertex array / buffer object bounds checking */
+ GLboolean CheckArrayBounds;
+};
+
+
+/**
+ * List of extensions.
+ */
+struct gl_extensions
+{
+ /**
+ * \name Flags to quickly test if certain extensions are available.
+ *
+ * Not every extension needs to have such a flag, but it's encouraged.
+ */
+ /*@{*/
+ GLboolean dummy; /* don't remove this! */
+ GLboolean ARB_depth_texture;
+ GLboolean ARB_fragment_program;
+ GLboolean ARB_half_float_pixel;
+ GLboolean ARB_imaging;
+ GLboolean ARB_multisample;
+ GLboolean ARB_multitexture;
+ GLboolean ARB_occlusion_query;
+ GLboolean ARB_point_sprite;
+ GLboolean ARB_shadow;
+ GLboolean ARB_texture_border_clamp;
+ GLboolean ARB_texture_compression;
+ GLboolean ARB_texture_cube_map;
+ GLboolean ARB_texture_env_combine;
+ GLboolean ARB_texture_env_crossbar;
+ GLboolean ARB_texture_env_dot3;
+ GLboolean ARB_texture_float;
+ GLboolean ARB_texture_mirrored_repeat;
+ GLboolean ARB_texture_non_power_of_two;
+ GLboolean ARB_transpose_matrix;
+ GLboolean ARB_vertex_buffer_object;
+ GLboolean ARB_vertex_program;
+ GLboolean ARB_window_pos;
+ GLboolean EXT_abgr;
+ GLboolean EXT_bgra;
+ GLboolean EXT_blend_color;
+ GLboolean EXT_blend_equation_separate;
+ GLboolean EXT_blend_func_separate;
+ GLboolean EXT_blend_logic_op;
+ GLboolean EXT_blend_minmax;
+ GLboolean EXT_blend_subtract;
+ GLboolean EXT_clip_volume_hint;
+ GLboolean EXT_cull_vertex;
+ GLboolean EXT_convolution;
+ GLboolean EXT_compiled_vertex_array;
+ GLboolean EXT_copy_texture;
+ GLboolean EXT_depth_bounds_test;
+ GLboolean EXT_draw_range_elements;
+ GLboolean EXT_fog_coord;
+ GLboolean EXT_histogram;
+ GLboolean EXT_multi_draw_arrays;
+ GLboolean EXT_paletted_texture;
+ GLboolean EXT_packed_pixels;
+ GLboolean EXT_pixel_buffer_object;
+ GLboolean EXT_point_parameters;
+ GLboolean EXT_polygon_offset;
+ GLboolean EXT_rescale_normal;
+ GLboolean EXT_shadow_funcs;
+ GLboolean EXT_secondary_color;
+ GLboolean EXT_separate_specular_color;
+ GLboolean EXT_shared_texture_palette;
+ GLboolean EXT_stencil_wrap;
+ GLboolean EXT_stencil_two_side;
+ GLboolean EXT_subtexture;
+ GLboolean EXT_texture;
+ GLboolean EXT_texture_object;
+ GLboolean EXT_texture3D;
+ GLboolean EXT_texture_compression_s3tc;
+ GLboolean EXT_texture_env_add;
+ GLboolean EXT_texture_env_combine;
+ GLboolean EXT_texture_env_dot3;
+ GLboolean EXT_texture_filter_anisotropic;
+ GLboolean EXT_texture_lod_bias;
+ GLboolean EXT_texture_mirror_clamp;
+ GLboolean EXT_vertex_array;
+ GLboolean EXT_vertex_array_set;
+ /* vendor extensions */
+ GLboolean APPLE_client_storage;
+ GLboolean APPLE_packed_pixels;
+ GLboolean ATI_texture_mirror_once;
+ GLboolean ATI_texture_env_combine3;
+ GLboolean HP_occlusion_test;
+ GLboolean IBM_rasterpos_clip;
+ GLboolean IBM_multimode_draw_arrays;
+ GLboolean MESA_pack_invert;
+ GLboolean MESA_packed_depth_stencil;
+ GLboolean MESA_program_debug;
+ GLboolean MESA_resize_buffers;
+ GLboolean MESA_ycbcr_texture;
+ GLboolean NV_blend_square;
+ GLboolean NV_fragment_program;
+ GLboolean NV_light_max_exponent;
+ GLboolean NV_point_sprite;
+ GLboolean NV_texgen_reflection;
+ GLboolean NV_texture_rectangle;
+ GLboolean NV_vertex_program;
+ GLboolean NV_vertex_program1_1;
+ GLboolean SGI_color_matrix;
+ GLboolean SGI_color_table;
+ GLboolean SGI_texture_color_table;
+ GLboolean SGIS_generate_mipmap;
+ GLboolean SGIS_pixel_texture;
+ GLboolean SGIS_texture_edge_clamp;
+ GLboolean SGIS_texture_lod;
+ GLboolean SGIX_depth_texture;
+ GLboolean SGIX_pixel_texture;
+ GLboolean SGIX_shadow;
+ GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */
+ GLboolean TDFX_texture_compression_FXT1;
+ GLboolean S3_s3tc;
+ /*@}*/
+ /* The extension string */
+ const GLubyte *String;
+};
+
+
+/**
+ * A stack of matrices (projection, modelview, color, texture, etc).
+ */
+struct matrix_stack
+{
+ GLmatrix *Top; /**< points into Stack */
+ GLmatrix *Stack; /**< array [MaxDepth] of GLmatrix */
+ GLuint Depth; /**< 0 <= Depth < MaxDepth */
+ GLuint MaxDepth; /**< size of Stack[] array */
+ GLuint DirtyFlag; /**< _NEW_MODELVIEW or _NEW_PROJECTION, for example */
+};
+
+
+/**
+ * \name Bits for image transfer operations
+ *
+ * \sa __GLcontextRec::ImageTransferState.
+ */
+/*@{*/
+#define IMAGE_SCALE_BIAS_BIT 0x1
+#define IMAGE_SHIFT_OFFSET_BIT 0x2
+#define IMAGE_MAP_COLOR_BIT 0x4
+#define IMAGE_COLOR_TABLE_BIT 0x8
+#define IMAGE_CONVOLUTION_BIT 0x10
+#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
+#define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40
+#define IMAGE_COLOR_MATRIX_BIT 0x80
+#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
+#define IMAGE_HISTOGRAM_BIT 0x200
+#define IMAGE_MIN_MAX_BIT 0x400
+#define IMAGE_CLAMP_BIT 0x800 /* extra */
+
+
+/** Transfer ops up to convolution */
+#define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
+ IMAGE_SHIFT_OFFSET_BIT | \
+ IMAGE_MAP_COLOR_BIT | \
+ IMAGE_COLOR_TABLE_BIT)
+
+/** Transfer ops after convolution */
+#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
+ IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
+ IMAGE_COLOR_MATRIX_BIT | \
+ IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\
+ IMAGE_HISTOGRAM_BIT | \
+ IMAGE_MIN_MAX_BIT)
+/*@}*/
+
+
+/**
+ * \name Bits to indicate what state has changed.
+ *
+ * 4 unused flags.
+ */
+/*@{*/
+#define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */
+#define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */
+#define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */
+#define _NEW_COLOR_MATRIX 0x8 /**< __GLcontextRec::ColorMatrix */
+#define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */
+#define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */
+#define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */
+#define _NEW_EVAL 0x80 /**< __GLcontextRec::Eval, __GLcontextRec::EvalMap */
+#define _NEW_FOG 0x100 /**< __GLcontextRec::Fog */
+#define _NEW_HINT 0x200 /**< __GLcontextRec::Hint */
+#define _NEW_LIGHT 0x400 /**< __GLcontextRec::Light */
+#define _NEW_LINE 0x800 /**< __GLcontextRec::Line */
+#define _NEW_PIXEL 0x1000 /**< __GLcontextRec::Pixel */
+#define _NEW_POINT 0x2000 /**< __GLcontextRec::Point */
+#define _NEW_POLYGON 0x4000 /**< __GLcontextRec::Polygon */
+#define _NEW_POLYGONSTIPPLE 0x8000 /**< __GLcontextRec::PolygonStipple */
+#define _NEW_SCISSOR 0x10000 /**< __GLcontextRec::Scissor */
+#define _NEW_STENCIL 0x20000 /**< __GLcontextRec::Stencil */
+#define _NEW_TEXTURE 0x40000 /**< __GLcontextRec::Texture */
+#define _NEW_TRANSFORM 0x80000 /**< __GLcontextRec::Transform */
+#define _NEW_VIEWPORT 0x100000 /**< __GLcontextRec::Viewport */
+#define _NEW_PACKUNPACK 0x200000 /**< __GLcontextRec::Pack, __GLcontextRec::Unpack */
+#define _NEW_ARRAY 0x400000 /**< __GLcontextRec::Array */
+#define _NEW_RENDERMODE 0x800000 /**< __GLcontextRec::RenderMode, __GLcontextRec::Feedback, __GLcontextRec::Select */
+#define _NEW_BUFFERS 0x1000000 /**< __GLcontextRec::Visual, __GLcontextRec::DrawBuffer, */
+#define _NEW_MULTISAMPLE 0x2000000 /**< __GLcontextRec::Multisample */
+#define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */
+#define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */
+#define _NEW_ALL ~0
+/*@}*/
+
+
+/**
+ * \name Bits to track array state changes
+ *
+ * Also used to summarize array enabled.
+ */
+/*@{*/
+#define _NEW_ARRAY_VERTEX VERT_BIT_POS
+#define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT
+#define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL
+#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
+#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
+#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
+#define _NEW_ARRAY_INDEX VERT_BIT_SIX
+#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
+#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
+#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
+#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
+#define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3
+#define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4
+#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
+#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
+#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
+#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
+#define _NEW_ARRAY_ALL 0xffffffff
+
+
+#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i))
+#define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i))
+/*@}*/
+
+
+/**
+ * \name A bunch of flags that we think might be useful to drivers.
+ *
+ * Set in the __GLcontextRec::_TriangleCaps bitfield.
+ */
+/*@{*/
+#define DD_FLATSHADE 0x1
+#define DD_SEPARATE_SPECULAR 0x2
+#define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */
+#define DD_TRI_LIGHT_TWOSIDE 0x8
+#define DD_TRI_UNFILLED 0x10
+#define DD_TRI_SMOOTH 0x20
+#define DD_TRI_STIPPLE 0x40
+#define DD_TRI_OFFSET 0x80
+#define DD_LINE_SMOOTH 0x100
+#define DD_LINE_STIPPLE 0x200
+#define DD_LINE_WIDTH 0x400
+#define DD_POINT_SMOOTH 0x800
+#define DD_POINT_SIZE 0x1000
+#define DD_POINT_ATTEN 0x2000
+/*@}*/
+
+
+/**
+ * \name Define the state changes under which each of these bits might change
+ */
+/*@{*/
+#define _DD_NEW_FLATSHADE _NEW_LIGHT
+#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG | _NEW_PROGRAM)
+#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
+#define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
+#define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
+#define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
+#define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
+#define _DD_NEW_TRI_OFFSET _NEW_POLYGON
+#define _DD_NEW_LINE_SMOOTH _NEW_LINE
+#define _DD_NEW_LINE_STIPPLE _NEW_LINE
+#define _DD_NEW_LINE_WIDTH _NEW_LINE
+#define _DD_NEW_POINT_SMOOTH _NEW_POINT
+#define _DD_NEW_POINT_SIZE _NEW_POINT
+#define _DD_NEW_POINT_ATTEN _NEW_POINT
+/*@}*/
+
+
+#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
+ _NEW_TEXTURE | \
+ _NEW_POINT | \
+ _NEW_MODELVIEW)
+
+#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
+ _NEW_TEXTURE)
+
+#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX)
+
+
+
+
+/*
+ * Forward declaration of display list data types:
+ */
+union node;
+typedef union node Node;
+
+
+/* This has to be included here. */
+#include "dd.h"
+
+
+#define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *))
+
+/**
+ * Core Mesa's support for tnl modules:
+ */
+struct gl_tnl_module {
+ /**
+ * Vertex format to be lazily swapped into current dispatch.
+ */
+ const GLvertexformat *Current;
+
+ /**
+ * \name Record of functions swapped out.
+ * On restore, only need to swap these functions back in.
+ */
+ /*@{*/
+ void *Swapped[NUM_VERTEX_FORMAT_ENTRIES][2];
+ GLuint SwapCount;
+ /*@}*/
+};
+
+struct mesa_list_state {
+ GLuint CallDepth; /**< Current recursion calling depth */
+ Node *CurrentListPtr; /**< Head of list being compiled */
+ GLuint CurrentListNum; /**< Number of the list being compiled */
+ Node *CurrentBlock; /**< Pointer to current block of nodes */
+ GLuint CurrentPos; /**< Index into current block of nodes */
+ GLvertexformat ListVtxfmt;
+
+ GLubyte ActiveAttribSize[VERT_ATTRIB_MAX];
+ GLfloat CurrentAttrib[VERT_ATTRIB_MAX][4];
+
+ GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX];
+ GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4];
+
+ GLubyte ActiveIndex;
+ GLfloat CurrentIndex;
+
+ GLubyte ActiveEdgeFlag;
+ GLboolean CurrentEdgeFlag;
+};
+
+
+/**
+ * Mesa context
+ *
+ * This is the central context data structure for Mesa. Almost all
+ * OpenGL state is contained in this structure.
+ * Think of this as a base class from which device drivers will derive
+ * sub classes.
+ */
+struct __GLcontextRec {
+ /**
+ * \name OS related interfaces.
+ *
+ * These \b must be the first members of this structure, because they are
+ * exposed to the outside world (i.e. GLX extension).
+ */
+ /*@{*/
+ __GLimports imports;
+ __GLexports exports;
+ /*@}*/
+
+ /** State possibly shared with other contexts in the address space */
+ struct gl_shared_state *Shared;
+
+ /** \name API function pointer tables */
+ /*@{*/
+ struct _glapi_table *Save; /**< Display list save functions */
+ struct _glapi_table *Exec; /**< Execute functions */
+ struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */
+ /*@}*/
+
+ GLvisual Visual;
+ GLframebuffer *DrawBuffer; /**< buffer for writing */
+ GLframebuffer *ReadBuffer; /**< buffer for reading */
+
+ /**
+ * Device driver function pointer table
+ */
+ struct dd_function_table Driver;
+
+ void *DriverCtx; /**< Points to device driver context/state */
+ void *DriverMgrCtx; /**< Points to device driver manager (optional)*/
+
+ /** Core/Driver constants */
+ struct gl_constants Const;
+
+ /** \name The various 4x4 matrix stacks */
+ /*@{*/
+ struct matrix_stack ModelviewMatrixStack;
+ struct matrix_stack ProjectionMatrixStack;
+ struct matrix_stack ColorMatrixStack;
+ struct matrix_stack TextureMatrixStack[MAX_TEXTURE_COORD_UNITS];
+ struct matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES];
+ struct matrix_stack *CurrentStack; /**< Points to one of the above stacks */
+ /*@}*/
+
+ /** Combined modelview and projection matrix */
+ GLmatrix _ModelProjectMatrix;
+
+ /** \name Display lists */
+ struct mesa_list_state ListState;
+
+ GLboolean ExecuteFlag; /**< Execute GL commands? */
+ GLboolean CompileFlag; /**< Compile GL commands into display list? */
+
+ /** Extensions */
+ struct gl_extensions Extensions;
+
+ /** \name Renderer attribute stack */
+ /*@{*/
+ GLuint AttribStackDepth;
+ struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
+ /*@}*/
+
+ /** \name Renderer attribute groups
+ *
+ * We define a struct for each attribute group to make pushing and popping
+ * attributes easy. Also it's a good organization.
+ */
+ /*@{*/
+ struct gl_accum_attrib Accum; /**< Accumulation buffer attributes */
+ struct gl_colorbuffer_attrib Color; /**< Color buffers attributes */
+ struct gl_current_attrib Current; /**< Current attributes */
+ struct gl_depthbuffer_attrib Depth; /**< Depth buffer attributes */
+ struct gl_eval_attrib Eval; /**< Eval attributes */
+ struct gl_fog_attrib Fog; /**< Fog attributes */
+ struct gl_hint_attrib Hint; /**< Hint attributes */
+ struct gl_light_attrib Light; /**< Light attributes */
+ struct gl_line_attrib Line; /**< Line attributes */
+ struct gl_list_attrib List; /**< List attributes */
+ struct gl_multisample_attrib Multisample;
+ struct gl_pixel_attrib Pixel; /**< Pixel attributes */
+ struct gl_point_attrib Point; /**< Point attributes */
+ struct gl_polygon_attrib Polygon; /**< Polygon attributes */
+ GLuint PolygonStipple[32]; /**< Polygon stipple */
+ struct gl_scissor_attrib Scissor; /**< Scissor attributes */
+ struct gl_stencil_attrib Stencil; /**< Stencil buffer attributes */
+ struct gl_texture_attrib Texture; /**< Texture attributes */
+ struct gl_transform_attrib Transform; /**< Transformation attributes */
+ struct gl_viewport_attrib Viewport; /**< Viewport attributes */
+ /*@}*/
+
+ /** \name Other attribute groups */
+ /*@{*/
+ struct gl_histogram_attrib Histogram;
+ struct gl_minmax_attrib MinMax;
+ struct gl_convolution_attrib Convolution1D;
+ struct gl_convolution_attrib Convolution2D;
+ struct gl_convolution_attrib Separable2D;
+ /*@}*/
+
+ /** \name Client attribute stack */
+ /*@{*/
+ GLuint ClientAttribStackDepth;
+ struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
+ /*@}*/
+
+ /** \name Client attribute groups */
+ /*@{*/
+ struct gl_array_attrib Array; /**< Vertex arrays */
+ struct gl_pixelstore_attrib Pack; /**< Pixel packing */
+ struct gl_pixelstore_attrib Unpack; /**< Pixel unpacking */
+ struct gl_pixelstore_attrib DefaultPacking; /**< Default params */
+
+ struct gl_evaluators EvalMap; /**< All evaluators */
+ struct gl_feedback Feedback; /**< Feedback */
+ struct gl_selection Select; /**< Selection */
+
+ struct gl_color_table ColorTable; /**< Pre-convolution */
+ struct gl_color_table ProxyColorTable; /**< Pre-convolution */
+ struct gl_color_table PostConvolutionColorTable;
+ struct gl_color_table ProxyPostConvolutionColorTable;
+ struct gl_color_table PostColorMatrixColorTable;
+ struct gl_color_table ProxyPostColorMatrixColorTable;
+
+ struct program_state Program; /**< for vertex or fragment progs */
+ struct vertex_program_state VertexProgram; /**< GL_NV_vertex_program */
+ struct fragment_program_state FragmentProgram; /**< GL_NV_fragment_program */
+
+ struct occlusion_state Occlusion; /**< GL_ARB_occlusion_query */
+
+ GLenum ErrorValue; /**< Last error code */
+ GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
+ GLuint NewState; /**< bitwise-or of _NEW_* flags */
+ /*@}*/
+
+ /** \name Derived */
+ /*@{*/
+ GLuint _TriangleCaps; /**< bitwise-or of DD_* flags */
+ GLuint _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */
+ GLfloat _EyeZDir[3];
+ GLfloat _ModelViewInvScale;
+ GLuint _NeedEyeCoords;
+ GLuint _ForceEyeCoords;
+ GLboolean _RotateMode;
+ GLenum _CurrentProgram; /* currently executing program */
+
+ struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */
+ struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */
+ /**@}*/
+
+ struct gl_list_extensions ListExt; /**< driver dlist extensions */
+
+
+ GLboolean OcclusionResult; /**< for GL_HP_occlusion_test */
+ GLboolean OcclusionResultSaved; /**< for GL_HP_occlusion_test */
+ GLuint _Facing; /**< This is a hack for 2-sided stencil test.
+ *
+ * We don't have a better way to communicate this value from
+ * swrast_setup to swrast. */
+
+
+ /** \name Z buffer stuff */
+ /*@{*/
+ GLuint DepthMax; /**< Max depth buffer value */
+ GLfloat DepthMaxF; /**< Float max depth buffer value */
+ GLfloat MRD; /**< minimum resolvable difference in Z values */
+ /*@}*/
+
+ /** \name Color clamping (tentative part of GL_ARB_color_clamp_control) */
+ /*@{*/
+ GLboolean ClampFragmentColors;
+ GLboolean ClampVertexColors;
+ /*@}*/
+
+ /** \name For debugging/development only */
+ /*@{*/
+ GLboolean FirstTimeCurrent;
+ /*@}*/
+
+ /** Dither disable via MESA_NO_DITHER env var */
+ GLboolean NoDither;
+
+ /** Core tnl module support */
+ struct gl_tnl_module TnlModule;
+
+ /**
+ * \name Hooks for module contexts.
+ *
+ * These will eventually live in the driver or elsewhere.
+ */
+ /*@{*/
+ void *swrast_context;
+ void *swsetup_context;
+ void *swtnl_context;
+ void *swtnl_im;
+ void *acache_context;
+ void *aelt_context;
+ /*@}*/
+};
+
+
+/** The string names for GL_POINT, GL_LINE_LOOP, etc */
+extern const char *_mesa_prim_name[GL_POLYGON+4];
+
+
+#ifdef MESA_DEBUG
+extern int MESA_VERBOSE;
+extern int MESA_DEBUG_FLAGS;
+# define MESA_FUNCTION __FUNCTION__
+#else
+# define MESA_VERBOSE 0
+# define MESA_DEBUG_FLAGS 0
+# define MESA_FUNCTION "a function"
+# ifndef NDEBUG
+# define NDEBUG
+# endif
+#endif
+
+
+enum _verbose {
+ VERBOSE_VARRAY = 0x0001,
+ VERBOSE_TEXTURE = 0x0002,
+ VERBOSE_IMMEDIATE = 0x0004,
+ VERBOSE_PIPELINE = 0x0008,
+ VERBOSE_DRIVER = 0x0010,
+ VERBOSE_STATE = 0x0020,
+ VERBOSE_API = 0x0040,
+ VERBOSE_DISPLAY_LIST = 0x0100,
+ VERBOSE_LIGHTING = 0x0200,
+ VERBOSE_PRIMS = 0x0400,
+ VERBOSE_VERTS = 0x0800
+};
+
+
+enum _debug {
+ DEBUG_ALWAYS_FLUSH = 0x1
+};
+
+
+
+#define Elements(x) sizeof(x)/sizeof(*(x))
+
+
+#endif /* TYPES_H */
Index: xc/extras/Mesa/src/mesa/main/occlude.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/occlude.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/occlude.c Fri Dec 10 10:05:20 2004
@@ -0,0 +1,353 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.0.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Functions to implement the GL_ARB_occlusion_query extension.
+ */
+
+
+#include "glheader.h"
+#include "context.h"
+#include "hash.h"
+#include "imports.h"
+#include "occlude.h"
+#include "mtypes.h"
+
+
+struct occlusion_query
+{
+ GLenum Target;
+ GLuint Id;
+ GLuint PassedCounter;
+ GLboolean Active;
+};
+
+
+/**
+ * Allocate a new occlusion query object.
+ * \param target - must be GL_SAMPLES_PASSED_ARB at this time
+ * \param id - the object's ID
+ * \return pointer to new occlusion_query object or NULL if out of memory.
+ */
+static struct occlusion_query *
+new_query_object(GLenum target, GLuint id)
+{
+ struct occlusion_query *q = MALLOC_STRUCT(occlusion_query);
+ if (q) {
+ q->Target = target;
+ q->Id = id;
+ q->PassedCounter = 0;
+ q->Active = GL_FALSE;
+ }
+ return q;
+}
+
+
+/**
+ * Delete an occlusion query object.
+ */
+static void
+delete_query_object(struct occlusion_query *q)
+{
+ FREE(q);
+}
+
+
+void GLAPIENTRY
+_mesa_GenQueriesARB(GLsizei n, GLuint *ids)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint first;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGenQueriesARB(n < 0)");
+ return;
+ }
+
+ if (ctx->Occlusion.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGenQueriesARB");
+ return;
+ }
+
+ first = _mesa_HashFindFreeKeyBlock(ctx->Occlusion.QueryObjects, n);
+ if (first) {
+ GLsizei i;
+ for (i = 0; i < n; i++) {
+ struct occlusion_query *q = new_query_object(GL_SAMPLES_PASSED_ARB,
+ first + i);
+ if (!q) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenQueriesARB");
+ return;
+ }
+ ids[i] = first + i;
+ _mesa_HashInsert(ctx->Occlusion.QueryObjects, first + i, q);
+ }
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)");
+ return;
+ }
+
+ if (ctx->Occlusion.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteQueriesARB");
+ return;
+ }
+
+ for (i = 0; i < n; i++) {
+ if (ids[i] > 0) {
+ struct occlusion_query *q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects, ids[i]);
+ if (q) {
+ _mesa_HashRemove(ctx->Occlusion.QueryObjects, ids[i]);
+ delete_query_object(q);
+ }
+ }
+ }
+}
+
+
+GLboolean GLAPIENTRY
+_mesa_IsQueryARB(GLuint id)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (id && _mesa_HashLookup(ctx->Occlusion.QueryObjects, id))
+ return GL_TRUE;
+ else
+ return GL_FALSE;
+}
+
+
+void GLAPIENTRY
+_mesa_BeginQueryARB(GLenum target, GLuint id)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct occlusion_query *q;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+
+ if (target != GL_SAMPLES_PASSED_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
+ return;
+ }
+
+ if (id == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(id==0)");
+ return;
+ }
+
+ if (ctx->Occlusion.CurrentQueryObject) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(target)");
+ return;
+ }
+
+ q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
+ if (q && q->Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB");
+ return;
+ }
+ else if (!q) {
+ q = new_query_object(target, id);
+ if (!q) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQueryARB");
+ return;
+ }
+ _mesa_HashInsert(ctx->Occlusion.QueryObjects, id, q);
+ }
+
+ q->Active = GL_TRUE;
+ q->PassedCounter = 0;
+ ctx->Occlusion.Active = GL_TRUE;
+ ctx->Occlusion.CurrentQueryObject = id;
+ ctx->Occlusion.PassedCounter = 0;
+}
+
+
+void GLAPIENTRY
+_mesa_EndQueryARB(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct occlusion_query *q = NULL;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+
+ if (target != GL_SAMPLES_PASSED_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
+ return;
+ }
+
+ if (ctx->Occlusion.CurrentQueryObject)
+ q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects,
+ ctx->Occlusion.CurrentQueryObject);
+ if (!q || !q->Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glEndQuery with no glBeginQuery");
+ return;
+ }
+
+ q->PassedCounter = ctx->Occlusion.PassedCounter;
+ q->Active = GL_FALSE;
+ ctx->Occlusion.Active = GL_FALSE;
+ ctx->Occlusion.CurrentQueryObject = 0;
+}
+
+
+void GLAPIENTRY
+_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target != GL_SAMPLES_PASSED_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_QUERY_COUNTER_BITS_ARB:
+ *params = 8 * sizeof(GLuint);
+ break;
+ case GL_CURRENT_QUERY_ARB:
+ *params = ctx->Occlusion.CurrentQueryObject;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(pname)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct occlusion_query *q = NULL;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (id)
+ q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
+
+ if (!q || q->Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectivARB(id=%d)", id);
+ return;
+ }
+
+ switch (pname) {
+ case GL_QUERY_RESULT_ARB:
+ *params = q->PassedCounter;
+ break;
+ case GL_QUERY_RESULT_AVAILABLE_ARB:
+ /* XXX revisit when we have a hardware implementation! */
+ *params = GL_TRUE;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectivARB(pname)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct occlusion_query *q = NULL;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (id)
+ q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
+ if (!q || q->Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectuivARB(id=%d", id);
+ return;
+ }
+
+ switch (pname) {
+ case GL_QUERY_RESULT_ARB:
+ *params = q->PassedCounter;
+ break;
+ case GL_QUERY_RESULT_AVAILABLE_ARB:
+ /* XXX revisit when we have a hardware implementation! */
+ *params = GL_TRUE;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectuivARB(pname)");
+ return;
+ }
+}
+
+
+
+/**
+ * Allocate/init the context state related to occlusion query objects.
+ */
+void
+_mesa_init_occlude(GLcontext *ctx)
+{
+#if FEATURE_ARB_occlusion_query
+ ctx->Occlusion.QueryObjects = _mesa_NewHashTable();
+#endif
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+}
+
+
+/**
+ * Free the context state related to occlusion query objects.
+ */
+void
+_mesa_free_occlude_data(GLcontext *ctx)
+{
+ while (1) {
+ GLuint query = _mesa_HashFirstEntry(ctx->Occlusion.QueryObjects);
+ if (query) {
+ struct occlusion_query *q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects, query);
+ ASSERT(q);
+ delete_query_object(q);
+ _mesa_HashRemove(ctx->Occlusion.QueryObjects, query);
+ }
+ else {
+ break;
+ }
+ }
+ _mesa_DeleteHashTable(ctx->Occlusion.QueryObjects);
+}
Index: xc/extras/Mesa/src/mesa/main/occlude.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/occlude.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/occlude.h Fri Dec 10 10:05:20 2004
@@ -0,0 +1,61 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.0.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef OCCLUDE_H
+#define OCCLUDE_H
+
+
+extern void
+_mesa_init_occlude(GLcontext *ctx);
+
+extern void
+_mesa_free_occlude_data(GLcontext *ctx);
+
+extern void GLAPIENTRY
+_mesa_GenQueriesARB(GLsizei n, GLuint *ids);
+
+extern void GLAPIENTRY
+_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids);
+
+extern GLboolean GLAPIENTRY
+_mesa_IsQueryARB(GLuint id);
+
+extern void GLAPIENTRY
+_mesa_BeginQueryARB(GLenum target, GLuint id);
+
+extern void GLAPIENTRY
+_mesa_EndQueryARB(GLenum target);
+
+extern void GLAPIENTRY
+_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params);
+
+
+#endif /* OCCLUDE_H */
Index: xc/extras/Mesa/src/mesa/main/pixel.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/pixel.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/pixel.c Fri Dec 10 10:05:26 2004
@@ -0,0 +1,1833 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "image.h"
+#include "colormac.h"
+#include "context.h"
+#include "macros.h"
+#include "pixel.h"
+#include "mtypes.h"
+
+
+/**********************************************************************/
+/***** glPixelZoom *****/
+/**********************************************************************/
+
+
+
+void GLAPIENTRY
+_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->Pixel.ZoomX == xfactor &&
+ ctx->Pixel.ZoomY == yfactor)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.ZoomX = xfactor;
+ ctx->Pixel.ZoomY = yfactor;
+}
+
+
+
+/**********************************************************************/
+/***** glPixelStore *****/
+/**********************************************************************/
+
+
+void GLAPIENTRY
+_mesa_PixelStorei( GLenum pname, GLint param )
+{
+ /* NOTE: this call can't be compiled into the display list */
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (pname) {
+ case GL_PACK_SWAP_BYTES:
+ if (param == (GLint)ctx->Pack.SwapBytes)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_PACK_LSB_FIRST:
+ if (param == (GLint)ctx->Pack.LsbFirst)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.RowLength == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.RowLength = param;
+ break;
+ case GL_PACK_IMAGE_HEIGHT:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.ImageHeight == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.ImageHeight = param;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.SkipPixels == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipPixels = param;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.SkipRows == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipRows = param;
+ break;
+ case GL_PACK_SKIP_IMAGES:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.SkipImages == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipImages = param;
+ break;
+ case GL_PACK_ALIGNMENT:
+ if (param!=1 && param!=2 && param!=4 && param!=8) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.Alignment == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.Alignment = param;
+ break;
+ case GL_PACK_INVERT_MESA:
+ if (!ctx->Extensions.MESA_pack_invert) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
+ return;
+ }
+ if (ctx->Pack.Invert == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.Invert = param;
+ break;
+
+ case GL_UNPACK_SWAP_BYTES:
+ if (param == (GLint)ctx->Unpack.SwapBytes)
+ return;
+ if ((GLint)ctx->Unpack.SwapBytes == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ if (param == (GLint)ctx->Unpack.LsbFirst)
+ return;
+ if ((GLint)ctx->Unpack.LsbFirst == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.RowLength == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.RowLength = param;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.ImageHeight == param)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.ImageHeight = param;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.SkipPixels == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipPixels = param;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.SkipRows == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipRows = param;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ if (param < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.SkipImages == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipImages = param;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ if (param!=1 && param!=2 && param!=4 && param!=8) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
+ return;
+ }
+ if (ctx->Unpack.Alignment == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.Alignment = param;
+ break;
+ case GL_UNPACK_CLIENT_STORAGE_APPLE:
+ if (param == (GLint)ctx->Unpack.ClientStorage)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_PixelStoref( GLenum pname, GLfloat param )
+{
+ _mesa_PixelStorei( pname, (GLint) param );
+}
+
+
+
+/**********************************************************************/
+/***** glPixelMap *****/
+/**********************************************************************/
+
+
+
+void GLAPIENTRY
+_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
+{
+ GLint i;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
+ return;
+ }
+
+ if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {
+ /* test that mapsize is a power of two */
+ if (_mesa_bitcount((GLuint) mapsize) != 1) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
+ return;
+ }
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+
+ switch (map) {
+ case GL_PIXEL_MAP_S_TO_S:
+ ctx->Pixel.MapStoSsize = mapsize;
+ for (i=0;iPixel.MapStoS[i] = (GLint) values[i];
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_I:
+ ctx->Pixel.MapItoIsize = mapsize;
+ for (i=0;iPixel.MapItoI[i] = (GLint) values[i];
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_R:
+ ctx->Pixel.MapItoRsize = mapsize;
+ for (i=0;iPixel.MapItoR[i] = val;
+ ctx->Pixel.MapItoR8[i] = (GLint) (val * 255.0F);
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_G:
+ ctx->Pixel.MapItoGsize = mapsize;
+ for (i=0;iPixel.MapItoG[i] = val;
+ ctx->Pixel.MapItoG8[i] = (GLint) (val * 255.0F);
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_B:
+ ctx->Pixel.MapItoBsize = mapsize;
+ for (i=0;iPixel.MapItoB[i] = val;
+ ctx->Pixel.MapItoB8[i] = (GLint) (val * 255.0F);
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_A:
+ ctx->Pixel.MapItoAsize = mapsize;
+ for (i=0;iPixel.MapItoA[i] = val;
+ ctx->Pixel.MapItoA8[i] = (GLint) (val * 255.0F);
+ }
+ break;
+ case GL_PIXEL_MAP_R_TO_R:
+ ctx->Pixel.MapRtoRsize = mapsize;
+ for (i=0;iPixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F );
+ }
+ break;
+ case GL_PIXEL_MAP_G_TO_G:
+ ctx->Pixel.MapGtoGsize = mapsize;
+ for (i=0;iPixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F );
+ }
+ break;
+ case GL_PIXEL_MAP_B_TO_B:
+ ctx->Pixel.MapBtoBsize = mapsize;
+ for (i=0;iPixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F );
+ }
+ break;
+ case GL_PIXEL_MAP_A_TO_A:
+ ctx->Pixel.MapAtoAsize = mapsize;
+ for (i=0;iPixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F );
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPixelMapfv(map)" );
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
+{
+ const GLint n = MIN2(mapsize, MAX_PIXEL_MAP_TABLE);
+ GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
+ GLint i;
+ if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
+ for (i=0;iPixel.MapItoIsize;i++) {
+ values[i] = (GLfloat) ctx->Pixel.MapItoI[i];
+ }
+ break;
+ case GL_PIXEL_MAP_S_TO_S:
+ for (i=0;iPixel.MapStoSsize;i++) {
+ values[i] = (GLfloat) ctx->Pixel.MapStoS[i];
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_R:
+ MEMCPY(values,ctx->Pixel.MapItoR,ctx->Pixel.MapItoRsize*sizeof(GLfloat));
+ break;
+ case GL_PIXEL_MAP_I_TO_G:
+ MEMCPY(values,ctx->Pixel.MapItoG,ctx->Pixel.MapItoGsize*sizeof(GLfloat));
+ break;
+ case GL_PIXEL_MAP_I_TO_B:
+ MEMCPY(values,ctx->Pixel.MapItoB,ctx->Pixel.MapItoBsize*sizeof(GLfloat));
+ break;
+ case GL_PIXEL_MAP_I_TO_A:
+ MEMCPY(values,ctx->Pixel.MapItoA,ctx->Pixel.MapItoAsize*sizeof(GLfloat));
+ break;
+ case GL_PIXEL_MAP_R_TO_R:
+ MEMCPY(values,ctx->Pixel.MapRtoR,ctx->Pixel.MapRtoRsize*sizeof(GLfloat));
+ break;
+ case GL_PIXEL_MAP_G_TO_G:
+ MEMCPY(values,ctx->Pixel.MapGtoG,ctx->Pixel.MapGtoGsize*sizeof(GLfloat));
+ break;
+ case GL_PIXEL_MAP_B_TO_B:
+ MEMCPY(values,ctx->Pixel.MapBtoB,ctx->Pixel.MapBtoBsize*sizeof(GLfloat));
+ break;
+ case GL_PIXEL_MAP_A_TO_A:
+ MEMCPY(values,ctx->Pixel.MapAtoA,ctx->Pixel.MapAtoAsize*sizeof(GLfloat));
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetPixelMapuiv( GLenum map, GLuint *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (map) {
+ case GL_PIXEL_MAP_I_TO_I:
+ MEMCPY(values, ctx->Pixel.MapItoI, ctx->Pixel.MapItoIsize*sizeof(GLint));
+ break;
+ case GL_PIXEL_MAP_S_TO_S:
+ MEMCPY(values, ctx->Pixel.MapStoS, ctx->Pixel.MapStoSsize*sizeof(GLint));
+ break;
+ case GL_PIXEL_MAP_I_TO_R:
+ for (i=0;iPixel.MapItoRsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoR[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_G:
+ for (i=0;iPixel.MapItoGsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_B:
+ for (i=0;iPixel.MapItoBsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_A:
+ for (i=0;iPixel.MapItoAsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_R_TO_R:
+ for (i=0;iPixel.MapRtoRsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_G_TO_G:
+ for (i=0;iPixel.MapGtoGsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_B_TO_B:
+ for (i=0;iPixel.MapBtoBsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_A_TO_A:
+ for (i=0;iPixel.MapAtoAsize;i++) {
+ values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] );
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetPixelMapusv( GLenum map, GLushort *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (map) {
+ case GL_PIXEL_MAP_I_TO_I:
+ for (i=0;iPixel.MapItoIsize;i++) {
+ values[i] = (GLushort) ctx->Pixel.MapItoI[i];
+ }
+ break;
+ case GL_PIXEL_MAP_S_TO_S:
+ for (i=0;iPixel.MapStoSsize;i++) {
+ values[i] = (GLushort) ctx->Pixel.MapStoS[i];
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_R:
+ for (i=0;iPixel.MapItoRsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoR[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_G:
+ for (i=0;iPixel.MapItoGsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoG[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_B:
+ for (i=0;iPixel.MapItoBsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoB[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_A:
+ for (i=0;iPixel.MapItoAsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoA[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_R_TO_R:
+ for (i=0;iPixel.MapRtoRsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapRtoR[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_G_TO_G:
+ for (i=0;iPixel.MapGtoGsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapGtoG[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_B_TO_B:
+ for (i=0;iPixel.MapBtoBsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapBtoB[i] );
+ }
+ break;
+ case GL_PIXEL_MAP_A_TO_A:
+ for (i=0;iPixel.MapAtoAsize;i++) {
+ values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapAtoA[i] );
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
+ }
+}
+
+
+
+/**********************************************************************/
+/***** glPixelTransfer *****/
+/**********************************************************************/
+
+
+/*
+ * Implements glPixelTransfer[fi] whether called immediately or from a
+ * display list.
+ */
+void GLAPIENTRY
+_mesa_PixelTransferf( GLenum pname, GLfloat param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (pname) {
+ case GL_MAP_COLOR:
+ if (ctx->Pixel.MapColorFlag == (param ? GL_TRUE : GL_FALSE))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_MAP_STENCIL:
+ if (ctx->Pixel.MapStencilFlag == (param ? GL_TRUE : GL_FALSE))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_INDEX_SHIFT:
+ if (ctx->Pixel.IndexShift == (GLint) param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.IndexShift = (GLint) param;
+ break;
+ case GL_INDEX_OFFSET:
+ if (ctx->Pixel.IndexOffset == (GLint) param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.IndexOffset = (GLint) param;
+ break;
+ case GL_RED_SCALE:
+ if (ctx->Pixel.RedScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.RedScale = param;
+ break;
+ case GL_RED_BIAS:
+ if (ctx->Pixel.RedBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.RedBias = param;
+ break;
+ case GL_GREEN_SCALE:
+ if (ctx->Pixel.GreenScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.GreenScale = param;
+ break;
+ case GL_GREEN_BIAS:
+ if (ctx->Pixel.GreenBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.GreenBias = param;
+ break;
+ case GL_BLUE_SCALE:
+ if (ctx->Pixel.BlueScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.BlueScale = param;
+ break;
+ case GL_BLUE_BIAS:
+ if (ctx->Pixel.BlueBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.BlueBias = param;
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Pixel.AlphaScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.AlphaScale = param;
+ break;
+ case GL_ALPHA_BIAS:
+ if (ctx->Pixel.AlphaBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.AlphaBias = param;
+ break;
+ case GL_DEPTH_SCALE:
+ if (ctx->Pixel.DepthScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.DepthScale = param;
+ break;
+ case GL_DEPTH_BIAS:
+ if (ctx->Pixel.DepthBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.DepthBias = param;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixScale[0] = param;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixBias[0] = param;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixScale[1] = param;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixBias[1] = param;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixScale[2] = param;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixBias[2] = param;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[3] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixScale[3] = param;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[3] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixBias[3] = param;
+ break;
+ case GL_POST_CONVOLUTION_RED_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionScale[0] = param;
+ break;
+ case GL_POST_CONVOLUTION_RED_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionBias[0] = param;
+ break;
+ case GL_POST_CONVOLUTION_GREEN_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionScale[1] = param;
+ break;
+ case GL_POST_CONVOLUTION_GREEN_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionBias[1] = param;
+ break;
+ case GL_POST_CONVOLUTION_BLUE_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionScale[2] = param;
+ break;
+ case GL_POST_CONVOLUTION_BLUE_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionBias[2] = param;
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionScale[2] = param;
+ break;
+ case GL_POST_CONVOLUTION_ALPHA_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionBias[2] = param;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" );
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_PixelTransferi( GLenum pname, GLint param )
+{
+ _mesa_PixelTransferf( pname, (GLfloat) param );
+}
+
+/**********************************************************************/
+/***** Pixel processing functions ******/
+/**********************************************************************/
+
+
+/*
+ * Apply scale and bias factors to an array of RGBA pixels.
+ */
+void
+_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4],
+ GLfloat rScale, GLfloat gScale,
+ GLfloat bScale, GLfloat aScale,
+ GLfloat rBias, GLfloat gBias,
+ GLfloat bBias, GLfloat aBias)
+{
+ (void) ctx;
+
+ if (rScale != 1.0 || rBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias;
+ }
+ }
+ if (gScale != 1.0 || gBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias;
+ }
+ }
+ if (bScale != 1.0 || bBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias;
+ }
+ }
+ if (aScale != 1.0 || aBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias;
+ }
+ }
+}
+
+
+/*
+ * Apply pixel mapping to an array of floating point RGBA pixels.
+ */
+void
+_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
+{
+ const GLfloat rscale = (GLfloat) (ctx->Pixel.MapRtoRsize - 1);
+ const GLfloat gscale = (GLfloat) (ctx->Pixel.MapGtoGsize - 1);
+ const GLfloat bscale = (GLfloat) (ctx->Pixel.MapBtoBsize - 1);
+ const GLfloat ascale = (GLfloat) (ctx->Pixel.MapAtoAsize - 1);
+ const GLfloat *rMap = ctx->Pixel.MapRtoR;
+ const GLfloat *gMap = ctx->Pixel.MapGtoG;
+ const GLfloat *bMap = ctx->Pixel.MapBtoB;
+ const GLfloat *aMap = ctx->Pixel.MapAtoA;
+ GLuint i;
+ for (i=0;iPixel.PostColorMatrixScale[0];
+ const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0];
+ const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1];
+ const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1];
+ const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2];
+ const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2];
+ const GLfloat as = ctx->Pixel.PostColorMatrixScale[3];
+ const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3];
+ const GLfloat *m = ctx->ColorMatrixStack.Top->m;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ const GLfloat r = rgba[i][RCOMP];
+ const GLfloat g = rgba[i][GCOMP];
+ const GLfloat b = rgba[i][BCOMP];
+ const GLfloat a = rgba[i][ACOMP];
+ rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb;
+ rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb;
+ rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb;
+ rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab;
+ }
+}
+
+
+/**
+ * Apply a color table lookup to an array of floating point RGBA colors.
+ */
+void
+_mesa_lookup_rgba_float(const struct gl_color_table *table,
+ GLuint n, GLfloat rgba[][4])
+{
+ if (!table->Table || table->Size == 0)
+ return;
+
+ switch (table->Format) {
+ case GL_INTENSITY:
+ /* replace RGBA with I */
+ if (table->Type == GL_FLOAT) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][RCOMP] * scale);
+ GLfloat c = lut[CLAMP(j, 0, max)];
+ rgba[i][RCOMP] = rgba[i][GCOMP] =
+ rgba[i][BCOMP] = rgba[i][ACOMP] = c;
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][RCOMP] * scale);
+ GLfloat c = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] =
+ rgba[i][BCOMP] = rgba[i][ACOMP] = c;
+ }
+ }
+ break;
+ case GL_LUMINANCE:
+ /* replace RGB with L */
+ if (table->Type == GL_FLOAT) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][RCOMP] * scale);
+ GLfloat c = lut[CLAMP(j, 0, max)];
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][RCOMP] * scale);
+ GLfloat c = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
+ }
+ }
+ break;
+ case GL_ALPHA:
+ /* replace A with A */
+ if (table->Type == GL_FLOAT) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][ACOMP] * scale);
+ rgba[i][ACOMP] = lut[CLAMP(j, 0, max)];
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][ACOMP] * scale);
+ rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]);
+ }
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ /* replace RGBA with LLLA */
+ if (table->Type == GL_FLOAT) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jL = IROUND(rgba[i][RCOMP] * scale);
+ GLint jA = IROUND(rgba[i][ACOMP] * scale);
+ GLfloat luminance, alpha;
+ jL = CLAMP(jL, 0, max);
+ jA = CLAMP(jA, 0, max);
+ luminance = lut[jL * 2 + 0];
+ alpha = lut[jA * 2 + 1];
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;;
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jL = IROUND(rgba[i][RCOMP] * scale);
+ GLint jA = IROUND(rgba[i][ACOMP] * scale);
+ GLfloat luminance, alpha;
+ jL = CLAMP(jL, 0, max);
+ jA = CLAMP(jA, 0, max);
+ luminance = CHAN_TO_FLOAT(lut[jL * 2 + 0]);
+ alpha = CHAN_TO_FLOAT(lut[jA * 2 + 1]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;;
+ }
+ }
+ break;
+ case GL_RGB:
+ /* replace RGB with RGB */
+ if (table->Type == GL_FLOAT) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ GLint jG = IROUND(rgba[i][GCOMP] * scale);
+ GLint jB = IROUND(rgba[i][BCOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ jG = CLAMP(jG, 0, max);
+ jB = CLAMP(jB, 0, max);
+ rgba[i][RCOMP] = lut[jR * 3 + 0];
+ rgba[i][GCOMP] = lut[jG * 3 + 1];
+ rgba[i][BCOMP] = lut[jB * 3 + 2];
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ GLint jG = IROUND(rgba[i][GCOMP] * scale);
+ GLint jB = IROUND(rgba[i][BCOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ jG = CLAMP(jG, 0, max);
+ jB = CLAMP(jB, 0, max);
+ rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 3 + 0]);
+ rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 3 + 1]);
+ rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 3 + 2]);
+ }
+ }
+ break;
+ case GL_RGBA:
+ /* replace RGBA with RGBA */
+ if (table->Type == GL_FLOAT) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ GLint jG = IROUND(rgba[i][GCOMP] * scale);
+ GLint jB = IROUND(rgba[i][BCOMP] * scale);
+ GLint jA = IROUND(rgba[i][ACOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ jG = CLAMP(jG, 0, max);
+ jB = CLAMP(jB, 0, max);
+ jA = CLAMP(jA, 0, max);
+ rgba[i][RCOMP] = lut[jR * 4 + 0];
+ rgba[i][GCOMP] = lut[jG * 4 + 1];
+ rgba[i][BCOMP] = lut[jB * 4 + 2];
+ rgba[i][ACOMP] = lut[jA * 4 + 3];
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ GLint jG = IROUND(rgba[i][GCOMP] * scale);
+ GLint jB = IROUND(rgba[i][BCOMP] * scale);
+ GLint jA = IROUND(rgba[i][ACOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ jG = CLAMP(jG, 0, max);
+ jB = CLAMP(jB, 0, max);
+ jA = CLAMP(jA, 0, max);
+ rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 4 + 0]);
+ rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 4 + 1]);
+ rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 4 + 2]);
+ rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[jA * 4 + 3]);
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_float");
+ return;
+ }
+}
+
+
+
+/**
+ * Apply a color table lookup to an array of GLchan RGBA colors.
+ */
+void
+_mesa_lookup_rgba_chan(const struct gl_color_table *table,
+ GLuint n, GLchan rgba[][4])
+{
+ if (!table->Table || table->Size == 0)
+ return;
+
+ switch (table->Format) {
+ case GL_INTENSITY:
+ /* replace RGBA with I */
+ if (table->Type == GL_FLOAT) {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLchan c;
+ CLAMPED_FLOAT_TO_CHAN(c, lut[j]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] =
+ rgba[i][BCOMP] = rgba[i][ACOMP] = c;
+ }
+ }
+ else {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
+ /* common case */
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ const GLchan c = lut[rgba[i][RCOMP]];
+ rgba[i][RCOMP] = rgba[i][GCOMP] =
+ rgba[i][BCOMP] = rgba[i][ACOMP] = c;
+ }
+ }
+ else
+#endif
+ {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ rgba[i][RCOMP] = rgba[i][GCOMP] =
+ rgba[i][BCOMP] = rgba[i][ACOMP] = lut[j];
+ }
+ }
+ }
+ break;
+ case GL_LUMINANCE:
+ /* replace RGB with L */
+ if (table->Type == GL_FLOAT) {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLchan c;
+ CLAMPED_FLOAT_TO_CHAN(c, lut[j]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
+ }
+ }
+ else {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
+ /* common case */
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ const GLchan c = lut[rgba[i][RCOMP]];
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
+ }
+ }
+ else
+#endif
+ {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = lut[j];
+ }
+ }
+ }
+ break;
+ case GL_ALPHA:
+ /* replace A with A */
+ if (table->Type == GL_FLOAT) {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ GLchan c;
+ CLAMPED_FLOAT_TO_CHAN(c, lut[j]);
+ rgba[i][ACOMP] = c;
+ }
+ }
+ else {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
+ /* common case */
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = lut[rgba[i][ACOMP]];
+ }
+ }
+ else
+#endif
+ {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ rgba[i][ACOMP] = lut[j];
+ }
+ }
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ /* replace RGBA with LLLA */
+ if (table->Type == GL_FLOAT) {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ GLchan luminance, alpha;
+ CLAMPED_FLOAT_TO_CHAN(luminance, lut[jL * 2 + 0]);
+ CLAMPED_FLOAT_TO_CHAN(alpha, lut[jA * 2 + 1]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;;
+ }
+ }
+ else {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
+ /* common case */
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLchan l = lut[rgba[i][RCOMP] * 2 + 0];
+ GLchan a = lut[rgba[i][ACOMP] * 2 + 1];;
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = l;
+ rgba[i][ACOMP] = a;
+ }
+ }
+ else
+#endif
+ {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ GLchan luminance = lut[jL * 2 + 0];
+ GLchan alpha = lut[jA * 2 + 1];
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;
+ }
+ }
+ }
+ break;
+ case GL_RGB:
+ /* replace RGB with RGB */
+ if (table->Type == GL_FLOAT) {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
+ GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 3 + 0]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 3 + 1]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 3 + 2]);
+ }
+ }
+ else {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
+ /* common case */
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 3 + 0];
+ rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 3 + 1];
+ rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2];
+ }
+ }
+ else
+#endif
+ {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
+ GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
+ rgba[i][RCOMP] = lut[jR * 3 + 0];
+ rgba[i][GCOMP] = lut[jG * 3 + 1];
+ rgba[i][BCOMP] = lut[jB * 3 + 2];
+ }
+ }
+ }
+ break;
+ case GL_RGBA:
+ /* replace RGBA with RGBA */
+ if (table->Type == GL_FLOAT) {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
+ GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
+ GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]);
+ }
+ }
+ else {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
+ /* common case */
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 4 + 0];
+ rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 4 + 1];
+ rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 4 + 2];
+ rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3];
+ }
+ }
+ else
+#endif
+ {
+ const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
+ GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
+ GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]);
+ }
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_chan");
+ return;
+ }
+}
+
+
+
+/*
+ * Apply color index shift and offset to an array of pixels.
+ */
+void
+_mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] )
+{
+ GLint shift = ctx->Pixel.IndexShift;
+ GLint offset = ctx->Pixel.IndexOffset;
+ GLuint i;
+ if (shift > 0) {
+ for (i=0;i> shift) + offset;
+ }
+ }
+ else {
+ for (i=0;iPixel.MapItoIsize - 1;
+ GLuint i;
+ for (i=0;iPixel.MapItoI[ index[i] & mask ];
+ }
+}
+
+
+/*
+ * Map color indexes to rgba values.
+ */
+void
+_mesa_map_ci_to_rgba_chan( const GLcontext *ctx, GLuint n,
+ const GLuint index[], GLchan rgba[][4] )
+{
+#if CHAN_BITS == 8
+ GLuint rmask = ctx->Pixel.MapItoRsize - 1;
+ GLuint gmask = ctx->Pixel.MapItoGsize - 1;
+ GLuint bmask = ctx->Pixel.MapItoBsize - 1;
+ GLuint amask = ctx->Pixel.MapItoAsize - 1;
+ const GLubyte *rMap = ctx->Pixel.MapItoR8;
+ const GLubyte *gMap = ctx->Pixel.MapItoG8;
+ const GLubyte *bMap = ctx->Pixel.MapItoB8;
+ const GLubyte *aMap = ctx->Pixel.MapItoA8;
+ GLuint i;
+ for (i=0;iPixel.MapItoRsize - 1;
+ GLuint gmask = ctx->Pixel.MapItoGsize - 1;
+ GLuint bmask = ctx->Pixel.MapItoBsize - 1;
+ GLuint amask = ctx->Pixel.MapItoAsize - 1;
+ const GLfloat *rMap = ctx->Pixel.MapItoR;
+ const GLfloat *gMap = ctx->Pixel.MapItoG;
+ const GLfloat *bMap = ctx->Pixel.MapItoB;
+ const GLfloat *aMap = ctx->Pixel.MapItoA;
+ GLuint i;
+ for (i=0;iPixel.MapItoRsize - 1;
+ GLuint gmask = ctx->Pixel.MapItoGsize - 1;
+ GLuint bmask = ctx->Pixel.MapItoBsize - 1;
+ GLuint amask = ctx->Pixel.MapItoAsize - 1;
+ const GLfloat *rMap = ctx->Pixel.MapItoR;
+ const GLfloat *gMap = ctx->Pixel.MapItoG;
+ const GLfloat *bMap = ctx->Pixel.MapItoB;
+ const GLfloat *aMap = ctx->Pixel.MapItoA;
+ GLuint i;
+ for (i=0;iPixel.MapItoRsize - 1;
+ GLuint gmask = ctx->Pixel.MapItoGsize - 1;
+ GLuint bmask = ctx->Pixel.MapItoBsize - 1;
+ GLuint amask = ctx->Pixel.MapItoAsize - 1;
+ const GLubyte *rMap = ctx->Pixel.MapItoR8;
+ const GLubyte *gMap = ctx->Pixel.MapItoG8;
+ const GLubyte *bMap = ctx->Pixel.MapItoB8;
+ const GLubyte *aMap = ctx->Pixel.MapItoA8;
+ GLuint i;
+ for (i=0;iPixel.MapItoRsize - 1;
+ GLuint gmask = ctx->Pixel.MapItoGsize - 1;
+ GLuint bmask = ctx->Pixel.MapItoBsize - 1;
+ GLuint amask = ctx->Pixel.MapItoAsize - 1;
+ const GLfloat *rMap = ctx->Pixel.MapItoR;
+ const GLfloat *gMap = ctx->Pixel.MapItoG;
+ const GLfloat *bMap = ctx->Pixel.MapItoB;
+ const GLfloat *aMap = ctx->Pixel.MapItoA;
+ GLuint i;
+ for (i=0;iPixel.IndexShift;
+ GLint offset = ctx->Pixel.IndexOffset;
+ if (shift > 0) {
+ for (i=0;i> shift) + offset;
+ }
+ }
+ else {
+ for (i=0;iPixel.MapStoSsize - 1;
+ GLuint i;
+ for (i=0;iPixel.MapStoS[ stencil[i] & mask ];
+ }
+}
+
+
+
+/*
+ * This function converts an array of GLchan colors to GLfloat colors.
+ * Most importantly, it undoes the non-uniform quantization of pixel
+ * values introduced when we convert shallow (< 8 bit) pixel values
+ * to GLubytes in the ctx->Driver.ReadRGBASpan() functions.
+ * This fixes a number of OpenGL conformance failures when running on
+ * 16bpp displays, for example.
+ */
+void
+_mesa_chan_to_float_span(const GLcontext *ctx, GLuint n,
+ CONST GLchan rgba[][4], GLfloat rgbaf[][4])
+{
+#if CHAN_TYPE == GL_FLOAT
+ MEMCPY(rgbaf, rgba, n * 4 * sizeof(GLfloat));
+#else
+ const GLuint rShift = CHAN_BITS - ctx->Visual.redBits;
+ const GLuint gShift = CHAN_BITS - ctx->Visual.greenBits;
+ const GLuint bShift = CHAN_BITS - ctx->Visual.blueBits;
+ GLuint aShift;
+ const GLfloat rScale = 1.0F / (GLfloat) ((1 << ctx->Visual.redBits ) - 1);
+ const GLfloat gScale = 1.0F / (GLfloat) ((1 << ctx->Visual.greenBits) - 1);
+ const GLfloat bScale = 1.0F / (GLfloat) ((1 << ctx->Visual.blueBits ) - 1);
+ GLfloat aScale;
+ GLuint i;
+
+ if (ctx->Visual.alphaBits > 0) {
+ aShift = CHAN_BITS - ctx->Visual.alphaBits;
+ aScale = 1.0F / (GLfloat) ((1 << ctx->Visual.alphaBits) - 1);
+ }
+ else {
+ aShift = 0;
+ aScale = 1.0F / CHAN_MAXF;
+ }
+
+ for (i = 0; i < n; i++) {
+ const GLint r = rgba[i][RCOMP] >> rShift;
+ const GLint g = rgba[i][GCOMP] >> gShift;
+ const GLint b = rgba[i][BCOMP] >> bShift;
+ const GLint a = rgba[i][ACOMP] >> aShift;
+ rgbaf[i][RCOMP] = (GLfloat) r * rScale;
+ rgbaf[i][GCOMP] = (GLfloat) g * gScale;
+ rgbaf[i][BCOMP] = (GLfloat) b * bScale;
+ rgbaf[i][ACOMP] = (GLfloat) a * aScale;
+ }
+#endif
+}
+
+/**********************************************************************/
+/***** State Management *****/
+/**********************************************************************/
+
+/*
+ * Return a bitmask of IMAGE_*_BIT flags which to indicate which
+ * pixel transfer operations are enabled.
+ */
+static void
+update_image_transfer_state(GLcontext *ctx)
+{
+ GLuint mask = 0;
+
+ if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F ||
+ ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
+ ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F ||
+ ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
+ mask |= IMAGE_SCALE_BIAS_BIT;
+
+ if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
+ mask |= IMAGE_SHIFT_OFFSET_BIT;
+
+ if (ctx->Pixel.MapColorFlag)
+ mask |= IMAGE_MAP_COLOR_BIT;
+
+ if (ctx->Pixel.ColorTableEnabled)
+ mask |= IMAGE_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.Convolution1DEnabled ||
+ ctx->Pixel.Convolution2DEnabled ||
+ ctx->Pixel.Separable2DEnabled) {
+ mask |= IMAGE_CONVOLUTION_BIT;
+ if (ctx->Pixel.PostConvolutionScale[0] != 1.0F ||
+ ctx->Pixel.PostConvolutionScale[1] != 1.0F ||
+ ctx->Pixel.PostConvolutionScale[2] != 1.0F ||
+ ctx->Pixel.PostConvolutionScale[3] != 1.0F ||
+ ctx->Pixel.PostConvolutionBias[0] != 0.0F ||
+ ctx->Pixel.PostConvolutionBias[1] != 0.0F ||
+ ctx->Pixel.PostConvolutionBias[2] != 0.0F ||
+ ctx->Pixel.PostConvolutionBias[3] != 0.0F) {
+ mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS;
+ }
+ }
+
+ if (ctx->Pixel.PostConvolutionColorTableEnabled)
+ mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
+
+ if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY ||
+ ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[0] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[1] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[2] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
+ mask |= IMAGE_COLOR_MATRIX_BIT;
+
+ if (ctx->Pixel.PostColorMatrixColorTableEnabled)
+ mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.HistogramEnabled)
+ mask |= IMAGE_HISTOGRAM_BIT;
+
+ if (ctx->Pixel.MinMaxEnabled)
+ mask |= IMAGE_MIN_MAX_BIT;
+
+ ctx->_ImageTransferState = mask;
+}
+
+
+void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
+{
+ if (new_state & _NEW_COLOR_MATRIX)
+ _math_matrix_analyse( ctx->ColorMatrixStack.Top );
+
+ /* References ColorMatrix.type (derived above).
+ */
+ if (new_state & _IMAGE_NEW_TRANSFER_STATE)
+ update_image_transfer_state(ctx);
+}
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+
+/**
+ * Initialize the context's PIXEL attribute group.
+ */
+void
+_mesa_init_pixel( GLcontext *ctx )
+{
+ int i;
+
+ /* Pixel group */
+ ctx->Pixel.RedBias = 0.0;
+ ctx->Pixel.RedScale = 1.0;
+ ctx->Pixel.GreenBias = 0.0;
+ ctx->Pixel.GreenScale = 1.0;
+ ctx->Pixel.BlueBias = 0.0;
+ ctx->Pixel.BlueScale = 1.0;
+ ctx->Pixel.AlphaBias = 0.0;
+ ctx->Pixel.AlphaScale = 1.0;
+ ctx->Pixel.DepthBias = 0.0;
+ ctx->Pixel.DepthScale = 1.0;
+ ctx->Pixel.IndexOffset = 0;
+ ctx->Pixel.IndexShift = 0;
+ ctx->Pixel.ZoomX = 1.0;
+ ctx->Pixel.ZoomY = 1.0;
+ ctx->Pixel.MapColorFlag = GL_FALSE;
+ ctx->Pixel.MapStencilFlag = GL_FALSE;
+ ctx->Pixel.MapStoSsize = 1;
+ ctx->Pixel.MapItoIsize = 1;
+ ctx->Pixel.MapItoRsize = 1;
+ ctx->Pixel.MapItoGsize = 1;
+ ctx->Pixel.MapItoBsize = 1;
+ ctx->Pixel.MapItoAsize = 1;
+ ctx->Pixel.MapRtoRsize = 1;
+ ctx->Pixel.MapGtoGsize = 1;
+ ctx->Pixel.MapBtoBsize = 1;
+ ctx->Pixel.MapAtoAsize = 1;
+ ctx->Pixel.MapStoS[0] = 0;
+ ctx->Pixel.MapItoI[0] = 0;
+ ctx->Pixel.MapItoR[0] = 0.0;
+ ctx->Pixel.MapItoG[0] = 0.0;
+ ctx->Pixel.MapItoB[0] = 0.0;
+ ctx->Pixel.MapItoA[0] = 0.0;
+ ctx->Pixel.MapItoR8[0] = 0;
+ ctx->Pixel.MapItoG8[0] = 0;
+ ctx->Pixel.MapItoB8[0] = 0;
+ ctx->Pixel.MapItoA8[0] = 0;
+ ctx->Pixel.MapRtoR[0] = 0.0;
+ ctx->Pixel.MapGtoG[0] = 0.0;
+ ctx->Pixel.MapBtoB[0] = 0.0;
+ ctx->Pixel.MapAtoA[0] = 0.0;
+ ctx->Pixel.HistogramEnabled = GL_FALSE;
+ ctx->Pixel.MinMaxEnabled = GL_FALSE;
+ ctx->Pixel.PixelTextureEnabled = GL_FALSE;
+ ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(ctx->Pixel.PCCTscale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.PCCTbias, 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(ctx->Pixel.PCMCTscale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.PCMCTbias, 0.0, 0.0, 0.0, 0.0);
+ ctx->Pixel.ColorTableEnabled = GL_FALSE;
+ ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE;
+ ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE;
+ ctx->Pixel.Convolution1DEnabled = GL_FALSE;
+ ctx->Pixel.Convolution2DEnabled = GL_FALSE;
+ ctx->Pixel.Separable2DEnabled = GL_FALSE;
+ for (i = 0; i < 3; i++) {
+ ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0);
+ ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE;
+ ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0);
+ }
+ for (i = 0; i < MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_WIDTH * 4; i++) {
+ ctx->Convolution1D.Filter[i] = 0.0;
+ ctx->Convolution2D.Filter[i] = 0.0;
+ ctx->Separable2D.Filter[i] = 0.0;
+ }
+ ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0);
+ /* GL_SGI_texture_color_table */
+ ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0);
+
+ /* Pixel transfer */
+ ctx->Pack.Alignment = 4;
+ ctx->Pack.RowLength = 0;
+ ctx->Pack.ImageHeight = 0;
+ ctx->Pack.SkipPixels = 0;
+ ctx->Pack.SkipRows = 0;
+ ctx->Pack.SkipImages = 0;
+ ctx->Pack.SwapBytes = GL_FALSE;
+ ctx->Pack.LsbFirst = GL_FALSE;
+ ctx->Pack.ClientStorage = GL_FALSE;
+ ctx->Pack.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Pack.BufferObj = ctx->Array.NullBufferObj;
+#endif
+ ctx->Unpack.Alignment = 4;
+ ctx->Unpack.RowLength = 0;
+ ctx->Unpack.ImageHeight = 0;
+ ctx->Unpack.SkipPixels = 0;
+ ctx->Unpack.SkipRows = 0;
+ ctx->Unpack.SkipImages = 0;
+ ctx->Unpack.SwapBytes = GL_FALSE;
+ ctx->Unpack.LsbFirst = GL_FALSE;
+ ctx->Unpack.ClientStorage = GL_FALSE;
+ ctx->Unpack.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
+#endif
+
+ /*
+ * _mesa_unpack_image() returns image data in this format. When we
+ * execute image commands (glDrawPixels(), glTexImage(), etc) from
+ * within display lists we have to be sure to set the current
+ * unpacking parameters to these values!
+ */
+ ctx->DefaultPacking.Alignment = 1;
+ ctx->DefaultPacking.RowLength = 0;
+ ctx->DefaultPacking.SkipPixels = 0;
+ ctx->DefaultPacking.SkipRows = 0;
+ ctx->DefaultPacking.ImageHeight = 0;
+ ctx->DefaultPacking.SkipImages = 0;
+ ctx->DefaultPacking.SwapBytes = GL_FALSE;
+ ctx->DefaultPacking.LsbFirst = GL_FALSE;
+ ctx->DefaultPacking.ClientStorage = GL_FALSE;
+ ctx->DefaultPacking.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj;
+#endif
+
+ if (ctx->Visual.doubleBufferMode) {
+ ctx->Pixel.ReadBuffer = GL_BACK;
+ ctx->Pixel._ReadSrcMask = DD_BACK_LEFT_BIT;
+ }
+ else {
+ ctx->Pixel.ReadBuffer = GL_FRONT;
+ ctx->Pixel._ReadSrcMask = DD_FRONT_LEFT_BIT;
+ }
+
+ /* Miscellaneous */
+ ctx->_ImageTransferState = 0;
+}
Index: xc/extras/Mesa/src/mesa/main/pixel.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/pixel.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/pixel.h Fri Dec 10 10:05:26 2004
@@ -0,0 +1,153 @@
+/**
+ * \file pixel.h
+ * Pixel operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef PIXEL_H
+#define PIXEL_H
+
+
+#include "mtypes.h"
+
+
+/** \name API functions */
+/*@{*/
+
+extern void GLAPIENTRY
+_mesa_GetPixelMapfv( GLenum map, GLfloat *values );
+
+extern void GLAPIENTRY
+_mesa_GetPixelMapuiv( GLenum map, GLuint *values );
+
+extern void GLAPIENTRY
+_mesa_GetPixelMapusv( GLenum map, GLushort *values );
+
+extern void GLAPIENTRY
+_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values );
+
+extern void GLAPIENTRY
+_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values );
+
+extern void GLAPIENTRY
+_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values );
+
+extern void GLAPIENTRY
+_mesa_PixelStoref( GLenum pname, GLfloat param );
+
+
+extern void GLAPIENTRY
+_mesa_PixelStorei( GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_PixelTransferf( GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_PixelTransferi( GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor );
+
+/*@}*/
+
+
+/** \name Pixel processing functions */
+/*@{*/
+
+extern void
+_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4],
+ GLfloat rScale, GLfloat gScale,
+ GLfloat bScale, GLfloat aScale,
+ GLfloat rBias, GLfloat gBias,
+ GLfloat bBias, GLfloat aBias);
+
+extern void
+_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
+
+
+extern void
+_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
+
+
+extern void
+_mesa_lookup_rgba_float(const struct gl_color_table *table,
+ GLuint n, GLfloat rgba[][4]);
+
+extern void
+_mesa_lookup_rgba_chan(const struct gl_color_table *table,
+ GLuint n, GLchan rgba[][4]);
+
+
+extern void
+_mesa_shift_and_offset_ci(const GLcontext *ctx, GLuint n,
+ GLuint indexes[]);
+
+
+extern void
+_mesa_map_ci(const GLcontext *ctx, GLuint n, GLuint index[]);
+
+
+extern void
+_mesa_map_ci_to_rgba_chan(const GLcontext *ctx,
+ GLuint n, const GLuint index[],
+ GLchan rgba[][4]);
+
+
+extern void
+_mesa_map_ci_to_rgba(const GLcontext *ctx,
+ GLuint n, const GLuint index[], GLfloat rgba[][4]);
+
+
+extern void
+_mesa_map_ci8_to_rgba(const GLcontext *ctx,
+ GLuint n, const GLubyte index[],
+ GLchan rgba[][4]);
+
+
+extern void
+_mesa_shift_and_offset_stencil(const GLcontext *ctx, GLuint n,
+ GLstencil indexes[]);
+
+
+extern void
+_mesa_map_stencil(const GLcontext *ctx, GLuint n, GLstencil index[]);
+
+
+extern void
+_mesa_chan_to_float_span(const GLcontext *ctx, GLuint n,
+ CONST GLchan rgba[][4], GLfloat rgbaf[][4]);
+
+
+extern void
+_mesa_update_pixel( GLcontext *ctx, GLuint newstate );
+
+extern void
+_mesa_init_pixel( GLcontext * ctx );
+
+/*@}*/
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/points.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/points.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/points.c Fri Dec 10 10:05:18 2004
@@ -0,0 +1,292 @@
+/**
+ * \file points.c
+ * Point operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "context.h"
+#include "macros.h"
+#include "points.h"
+#include "texstate.h"
+#include "mtypes.h"
+
+
+/**
+ * Set the point size.
+ *
+ * \param size pointer diameter.
+ *
+ * \sa glPointSize().
+ *
+ * Verifies the parameter and updates gl_point_attrib::Size. On a change,
+ * flushes the vertices, updates the clamped point size and marks the
+ * DD_POINT_SIZE flag in __GLcontextRec::_TriangleCaps for the drivers if the
+ * size is different from one. Notifies the driver via
+ * the dd_function_table::PointSize callback.
+ */
+void GLAPIENTRY
+_mesa_PointSize( GLfloat size )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (size <= 0.0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" );
+ return;
+ }
+
+ if (ctx->Point.Size == size)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.Size = size;
+ ctx->Point._Size = CLAMP(size,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize);
+
+ if (ctx->Point._Size == 1.0F)
+ ctx->_TriangleCaps &= ~DD_POINT_SIZE;
+ else
+ ctx->_TriangleCaps |= DD_POINT_SIZE;
+
+ if (ctx->Driver.PointSize)
+ (*ctx->Driver.PointSize)(ctx, size);
+}
+
+
+#if _HAVE_FULL_GL
+
+/*
+ * Added by GL_NV_point_sprite
+ */
+void GLAPIENTRY
+_mesa_PointParameteriNV( GLenum pname, GLint param )
+{
+ const GLfloat value = (GLfloat) param;
+ _mesa_PointParameterfvEXT(pname, &value);
+}
+
+
+/*
+ * Added by GL_NV_point_sprite
+ */
+void GLAPIENTRY
+_mesa_PointParameterivNV( GLenum pname, const GLint *params )
+{
+ const GLfloat value = (GLfloat) params[0];
+ _mesa_PointParameterfvEXT(pname, &value);
+}
+
+
+
+/*
+ * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
+ */
+void GLAPIENTRY
+_mesa_PointParameterfEXT( GLenum pname, GLfloat param)
+{
+ _mesa_PointParameterfvEXT(pname, ¶m);
+}
+
+
+
+/*
+ * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
+ */
+void GLAPIENTRY
+_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (pname) {
+ case GL_DISTANCE_ATTENUATION_EXT:
+ if (ctx->Extensions.EXT_point_parameters) {
+ const GLboolean tmp = ctx->Point._Attenuated;
+ if (TEST_EQ_3V(ctx->Point.Params, params))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ COPY_3V(ctx->Point.Params, params);
+
+ /* Update several derived values now. This likely to be
+ * more efficient than trying to catch this statechange in
+ * state.c.
+ */
+ ctx->Point._Attenuated = (params[0] != 1.0 ||
+ params[1] != 0.0 ||
+ params[2] != 0.0);
+
+ if (tmp != ctx->Point._Attenuated) {
+ ctx->_TriangleCaps ^= DD_POINT_ATTEN;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+ case GL_POINT_SIZE_MIN_EXT:
+ if (ctx->Extensions.EXT_point_parameters) {
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
+ return;
+ }
+ if (ctx->Point.MinSize == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.MinSize = params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+ case GL_POINT_SIZE_MAX_EXT:
+ if (ctx->Extensions.EXT_point_parameters) {
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
+ return;
+ }
+ if (ctx->Point.MaxSize == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.MaxSize = params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+ case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+ if (ctx->Extensions.EXT_point_parameters) {
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
+ return;
+ }
+ if (ctx->Point.Threshold == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.Threshold = params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ /* This is one area where ARB_point_sprite and NV_point_sprite
+ * differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is
+ * always ZERO. NV_point_sprite adds the S and R modes.
+ */
+ if (ctx->Extensions.NV_point_sprite) {
+ GLenum value = (GLenum) params[0];
+ if (value != GL_ZERO && value != GL_S && value != GL_R) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)");
+ return;
+ }
+ if (ctx->Point.SpriteRMode == value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SpriteRMode = value;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ if (ctx->Extensions.ARB_point_sprite) {
+ GLenum value = (GLenum) params[0];
+ if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)");
+ return;
+ }
+ if (ctx->Point.SpriteOrigin == value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SpriteOrigin = value;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)" );
+ return;
+ }
+
+ if (ctx->Driver.PointParameterfv)
+ (*ctx->Driver.PointParameterfv)(ctx, pname, params);
+}
+#endif
+
+
+/**
+ * Initialize the context point state.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes __GLcontextRec::Point and point related constants in
+ * __GLcontextRec::Const.
+ */
+void _mesa_init_point( GLcontext * ctx )
+{
+ int i;
+
+ /* Point group */
+ ctx->Point.SmoothFlag = GL_FALSE;
+ ctx->Point.Size = 1.0;
+ ctx->Point._Size = 1.0;
+ ctx->Point.Params[0] = 1.0;
+ ctx->Point.Params[1] = 0.0;
+ ctx->Point.Params[2] = 0.0;
+ ctx->Point._Attenuated = GL_FALSE;
+ ctx->Point.MinSize = 0.0;
+ ctx->Point.MaxSize = ctx->Const.MaxPointSize;
+ ctx->Point.Threshold = 1.0;
+ ctx->Point.PointSprite = GL_FALSE; /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
+ ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+ ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ }
+}
Index: xc/extras/Mesa/src/mesa/main/points.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/points.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/points.h Thu Apr 8 05:17:49 2004
@@ -0,0 +1,57 @@
+/**
+ * \file points.h
+ * Point operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef POINTS_H
+#define POINTS_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_PointSize( GLfloat size );
+
+extern void GLAPIENTRY
+_mesa_PointParameteriNV( GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_PointParameterivNV( GLenum pname, const GLint *params );
+
+extern void GLAPIENTRY
+_mesa_PointParameterfEXT( GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params );
+
+extern void
+_mesa_init_point( GLcontext * ctx );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/polygon.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/polygon.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/polygon.c Thu Apr 8 05:17:49 2004
@@ -0,0 +1,304 @@
+/**
+ * \file polygon.c
+ * Polygon operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "image.h"
+#include "enums.h"
+#include "macros.h"
+#include "polygon.h"
+#include "mtypes.h"
+
+
+/**
+ * Specify whether to cull front- or back-facing facets.
+ *
+ * \param mode culling mode.
+ *
+ * \sa glCullFace().
+ *
+ * Verifies the parameter and updates gl_polygon_attrib::CullFaceMode. On
+ * change, flushes the vertices and notifies the driver via
+ * the dd_function_table::CullFace callback.
+ */
+void GLAPIENTRY
+_mesa_CullFace( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode));
+
+ if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" );
+ return;
+ }
+
+ if (ctx->Polygon.CullFaceMode == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.CullFaceMode = mode;
+
+ if (ctx->Driver.CullFace)
+ ctx->Driver.CullFace( ctx, mode );
+}
+
+
+/**
+ * Define front- and back-facing
+ *
+ * \param mode orientation of front-facing polygons.
+ *
+ * \sa glFrontFace().
+ *
+ * Verifies the parameter and updates gl_polygon_attrib::FrontFace. On change
+ * flushes the vertices and notifies the driver via
+ * the dd_function_table::FrontFace callback.
+ */
+void GLAPIENTRY
+_mesa_FrontFace( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode));
+
+ if (mode!=GL_CW && mode!=GL_CCW) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" );
+ return;
+ }
+
+ if (ctx->Polygon.FrontFace == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.FrontFace = mode;
+
+ ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
+
+ if (ctx->Driver.FrontFace)
+ ctx->Driver.FrontFace( ctx, mode );
+}
+
+
+/**
+ * Set the polygon rasterization mode.
+ *
+ * \param face the polygons which \p mode applies to.
+ * \param mode how polygons should be rasterized.
+ *
+ * \sa glPolygonMode().
+ *
+ * Verifies the parameters and updates gl_polygon_attrib::FrontMode and
+ * gl_polygon_attrib::BackMode. On change flushes the vertices and notifies the
+ * driver via the dd_function_table::PolygonMode callback.
+ */
+void GLAPIENTRY
+_mesa_PolygonMode( GLenum face, GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glPolygonMode %s %s\n",
+ _mesa_lookup_enum_by_nr(face),
+ _mesa_lookup_enum_by_nr(mode));
+
+ if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" );
+ return;
+ }
+
+ switch (face) {
+ case GL_FRONT:
+ if (ctx->Polygon.FrontMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.FrontMode = mode;
+ break;
+ case GL_FRONT_AND_BACK:
+ if (ctx->Polygon.FrontMode == mode &&
+ ctx->Polygon.BackMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.FrontMode = mode;
+ ctx->Polygon.BackMode = mode;
+ break;
+ case GL_BACK:
+ if (ctx->Polygon.BackMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.BackMode = mode;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
+ return;
+ }
+
+ ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
+ if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL)
+ ctx->_TriangleCaps |= DD_TRI_UNFILLED;
+
+ if (ctx->Driver.PolygonMode) {
+ (*ctx->Driver.PolygonMode)( ctx, face, mode );
+ }
+}
+
+#if _HAVE_FULL_GL
+
+void GLAPIENTRY
+_mesa_PolygonStipple( const GLubyte *pattern )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glPolygonStipple\n");
+
+ FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE);
+ _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
+
+ if (ctx->Driver.PolygonStipple)
+ ctx->Driver.PolygonStipple( ctx, (const GLubyte *) ctx->PolygonStipple );
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetPolygonStipple( GLubyte *dest )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glGetPolygonStipple\n");
+
+ _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack);
+}
+
+
+void GLAPIENTRY
+_mesa_PolygonOffset( GLfloat factor, GLfloat units )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units);
+
+ if (ctx->Polygon.OffsetFactor == factor &&
+ ctx->Polygon.OffsetUnits == units)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetFactor = factor;
+ ctx->Polygon.OffsetUnits = units;
+
+ if (ctx->Driver.PolygonOffset)
+ ctx->Driver.PolygonOffset( ctx, factor, units );
+}
+
+
+
+void GLAPIENTRY
+_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_PolygonOffset(factor, bias * ctx->DepthMaxF );
+}
+
+#endif
+
+
+/**********************************************************************/
+/** \name State Management */
+/*@{*/
+
+/*
+ * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
+ * in ctx->_TriangleCaps if needed.
+ */
+void _mesa_update_polygon( GLcontext *ctx )
+{
+ ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
+
+ if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
+ ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
+
+ /* Any Polygon offsets enabled? */
+ if (ctx->Polygon.OffsetPoint ||
+ ctx->Polygon.OffsetLine ||
+ ctx->Polygon.OffsetFill) {
+ ctx->_TriangleCaps |= DD_TRI_OFFSET;
+ }
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Initialization */
+/*@{*/
+
+/**
+ * Initialize the context polygon state.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes __GLcontextRec::Polygon and __GLcontextRec::PolygonStipple
+ * attribute groups.
+ */
+void _mesa_init_polygon( GLcontext * ctx )
+{
+ /* Polygon group */
+ ctx->Polygon.CullFlag = GL_FALSE;
+ ctx->Polygon.CullFaceMode = GL_BACK;
+ ctx->Polygon.FrontFace = GL_CCW;
+ ctx->Polygon._FrontBit = 0;
+ ctx->Polygon.FrontMode = GL_FILL;
+ ctx->Polygon.BackMode = GL_FILL;
+ ctx->Polygon.SmoothFlag = GL_FALSE;
+ ctx->Polygon.StippleFlag = GL_FALSE;
+ ctx->Polygon.OffsetFactor = 0.0F;
+ ctx->Polygon.OffsetUnits = 0.0F;
+ ctx->Polygon.OffsetPoint = GL_FALSE;
+ ctx->Polygon.OffsetLine = GL_FALSE;
+ ctx->Polygon.OffsetFill = GL_FALSE;
+
+
+ /* Polygon Stipple group */
+ MEMSET( ctx->PolygonStipple, 0xff, 32*sizeof(GLuint) );
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/polygon.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/polygon.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/polygon.h Thu Apr 8 05:17:49 2004
@@ -0,0 +1,65 @@
+/**
+ * \file polygon.h
+ * Polygon operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef POLYGON_H
+#define POLYGON_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_CullFace( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_FrontFace( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_PolygonMode( GLenum face, GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_PolygonOffset( GLfloat factor, GLfloat units );
+
+extern void GLAPIENTRY
+_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias );
+
+extern void GLAPIENTRY
+_mesa_PolygonStipple( const GLubyte *mask );
+
+extern void GLAPIENTRY
+_mesa_GetPolygonStipple( GLubyte *mask );
+
+extern void
+_mesa_update_polygon( GLcontext *ctx );
+
+extern void
+_mesa_init_polygon( GLcontext * ctx );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/rastpos.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/rastpos.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/rastpos.c Fri Dec 10 10:05:20 2004
@@ -0,0 +1,1025 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file rastpos.c
+ * Raster position operations.
+ */
+
+#include "glheader.h"
+#include "colormac.h"
+#include "context.h"
+#include "feedback.h"
+#include "light.h"
+#include "macros.h"
+#include "rastpos.h"
+#include "state.h"
+#include "simple_list.h"
+#include "mtypes.h"
+
+#include "math/m_matrix.h"
+
+
+/**
+ * Clip a point against the view volume.
+ *
+ * \param v vertex vector describing the point to clip.
+ *
+ * \return zero if outside view volume, or one if inside.
+ */
+static GLuint
+viewclip_point( const GLfloat v[] )
+{
+ if ( v[0] > v[3] || v[0] < -v[3]
+ || v[1] > v[3] || v[1] < -v[3]
+ || v[2] > v[3] || v[2] < -v[3] ) {
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
+
+/**
+ * Clip a point against the far/near Z clipping planes.
+ *
+ * \param v vertex vector describing the point to clip.
+ *
+ * \return zero if outside view volume, or one if inside.
+ */
+static GLuint
+viewclip_point_z( const GLfloat v[] )
+{
+ if (v[2] > v[3] || v[2] < -v[3] ) {
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
+
+/**
+ * Clip a point against the user clipping planes.
+ *
+ * \param ctx GL context.
+ * \param v vertex vector describing the point to clip.
+ *
+ * \return zero if the point was clipped, or one otherwise.
+ */
+static GLuint
+userclip_point( GLcontext *ctx, const GLfloat v[] )
+{
+ GLuint p;
+
+ for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
+ + v[1] * ctx->Transform._ClipUserPlane[p][1]
+ + v[2] * ctx->Transform._ClipUserPlane[p][2]
+ + v[3] * ctx->Transform._ClipUserPlane[p][3];
+ if (dot < 0.0F) {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+
+/**
+ * This has been split off to allow the normal shade routines to
+ * get a little closer to the vertex buffer, and to use the
+ * GLvector objects directly.
+ * \param ctx the context
+ * \param vertex vertex location
+ * \param normal normal vector
+ * \param Rcolor returned color
+ * \param Rspec returned specular color (if separate specular enabled)
+ * \param Rindex returned color index
+ */
+static void
+shade_rastpos(GLcontext *ctx,
+ const GLfloat vertex[4],
+ const GLfloat normal[3],
+ GLfloat Rcolor[4],
+ GLfloat Rspec[4],
+ GLfloat *Rindex)
+{
+ GLfloat (*base)[3] = ctx->Light._BaseColor;
+ struct gl_light *light;
+ GLfloat diffuseColor[4], specularColor[4];
+ GLfloat diffuse = 0, specular = 0;
+
+ if (!ctx->_ShineTable[0] || !ctx->_ShineTable[1])
+ _mesa_validate_all_lighting_tables( ctx );
+
+ COPY_3V(diffuseColor, base[0]);
+ diffuseColor[3] = CLAMP(
+ ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F );
+ ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 0.0);
+
+ foreach (light, &ctx->Light.EnabledList) {
+ GLfloat n_dot_h;
+ GLfloat attenuation = 1.0;
+ GLfloat VP[3];
+ GLfloat n_dot_VP;
+ GLfloat *h;
+ GLfloat diffuseContrib[3], specularContrib[3];
+ GLboolean normalized;
+
+ if (!(light->_Flags & LIGHT_POSITIONAL)) {
+ COPY_3V(VP, light->_VP_inf_norm);
+ attenuation = light->_VP_inf_spot_attenuation;
+ }
+ else {
+ GLfloat d;
+
+ SUB_3V(VP, light->_Position, vertex);
+ d = (GLfloat) LEN_3FV( VP );
+
+ if ( d > 1e-6) {
+ GLfloat invd = 1.0F / d;
+ SELF_SCALE_SCALAR_3V(VP, invd);
+ }
+ attenuation = 1.0F / (light->ConstantAttenuation + d *
+ (light->LinearAttenuation + d *
+ light->QuadraticAttenuation));
+
+ if (light->_Flags & LIGHT_SPOT) {
+ GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+
+ if (PV_dot_dir_CosCutoff) {
+ continue;
+ }
+ else {
+ double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
+ int k = (int) x;
+ GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
+ + (x-k)*light->_SpotExpTable[k][1]);
+ attenuation *= spot;
+ }
+ }
+ }
+
+ if (attenuation < 1e-3)
+ continue;
+
+ n_dot_VP = DOT3( normal, VP );
+
+ if (n_dot_VP < 0.0F) {
+ ACC_SCALE_SCALAR_3V(diffuseColor, attenuation, light->_MatAmbient[0]);
+ continue;
+ }
+
+ COPY_3V(diffuseContrib, light->_MatAmbient[0]);
+ ACC_SCALE_SCALAR_3V(diffuseContrib, n_dot_VP, light->_MatDiffuse[0]);
+ diffuse += n_dot_VP * light->_dli * attenuation;
+ ASSIGN_3V(specularContrib, 0.0, 0.0, 0.0);
+
+ {
+ if (ctx->Light.Model.LocalViewer) {
+ GLfloat v[3];
+ COPY_3V(v, vertex);
+ NORMALIZE_3FV(v);
+ SUB_3V(VP, VP, v);
+ h = VP;
+ normalized = 0;
+ }
+ else if (light->_Flags & LIGHT_POSITIONAL) {
+ h = VP;
+ ACC_3V(h, ctx->_EyeZDir);
+ normalized = 0;
+ }
+ else {
+ h = light->_h_inf_norm;
+ normalized = 1;
+ }
+
+ n_dot_h = DOT3(normal, h);
+
+ if (n_dot_h > 0.0F) {
+ GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
+ GLfloat spec_coef;
+ GLfloat shininess = mat[MAT_ATTRIB_FRONT_SHININESS][0];
+
+ if (!normalized) {
+ n_dot_h *= n_dot_h;
+ n_dot_h /= LEN_SQUARED_3FV( h );
+ shininess *= .5;
+ }
+
+ GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef );
+
+ if (spec_coef > 1.0e-10) {
+ if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
+ ACC_SCALE_SCALAR_3V( specularContrib, spec_coef,
+ light->_MatSpecular[0]);
+ }
+ else {
+ ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef,
+ light->_MatSpecular[0]);
+ }
+ specular += spec_coef * light->_sli * attenuation;
+ }
+ }
+ }
+
+ ACC_SCALE_SCALAR_3V( diffuseColor, attenuation, diffuseContrib );
+ ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib );
+ }
+
+ if (ctx->Visual.rgbMode) {
+ Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F);
+ Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F);
+ Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F);
+ Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F);
+ Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F);
+ Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F);
+ Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F);
+ Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F);
+ }
+ else {
+ GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES];
+ GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT];
+ GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT];
+ GLfloat i = (ind[MAT_INDEX_AMBIENT]
+ + diffuse * (1.0F-specular) * d_a
+ + specular * s_a);
+ if (i > ind[MAT_INDEX_SPECULAR]) {
+ i = ind[MAT_INDEX_SPECULAR];
+ }
+ *Rindex = i;
+ }
+}
+
+
+/**
+ * Do texgen needed for glRasterPos.
+ * \param ctx rendering context
+ * \param vObj object-space vertex coordinate
+ * \param vEye eye-space vertex coordinate
+ * \param normal vertex normal
+ * \param unit texture unit number
+ * \param texcoord incoming texcoord and resulting texcoord
+ */
+static void
+compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
+ const GLfloat normal[3], GLuint unit, GLfloat texcoord[4])
+{
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+
+ /* always compute sphere map terms, just in case */
+ GLfloat u[3], two_nu, rx, ry, rz, m, mInv;
+ COPY_3V(u, vEye);
+ NORMALIZE_3FV(u);
+ two_nu = 2.0F * DOT3(normal, u);
+ rx = u[0] - normal[0] * two_nu;
+ ry = u[1] - normal[1] * two_nu;
+ rz = u[2] - normal[2] * two_nu;
+ m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F);
+ if (m > 0.0F)
+ mInv = 0.5F * _mesa_inv_sqrtf(m);
+ else
+ mInv = 0.0F;
+
+ if (texUnit->TexGenEnabled & S_BIT) {
+ switch (texUnit->GenModeS) {
+ case GL_OBJECT_LINEAR:
+ texcoord[0] = DOT4(vObj, texUnit->ObjectPlaneS);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[0] = DOT4(vEye, texUnit->EyePlaneS);
+ break;
+ case GL_SPHERE_MAP:
+ texcoord[0] = rx * mInv + 0.5F;
+ break;
+ case GL_REFLECTION_MAP:
+ texcoord[0] = rx;
+ break;
+ case GL_NORMAL_MAP:
+ texcoord[0] = normal[0];
+ break;
+ default:
+ _mesa_problem(ctx, "Bad S texgen in compute_texgen()");
+ return;
+ }
+ }
+
+ if (texUnit->TexGenEnabled & T_BIT) {
+ switch (texUnit->GenModeT) {
+ case GL_OBJECT_LINEAR:
+ texcoord[1] = DOT4(vObj, texUnit->ObjectPlaneT);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[1] = DOT4(vEye, texUnit->EyePlaneT);
+ break;
+ case GL_SPHERE_MAP:
+ texcoord[1] = ry * mInv + 0.5F;
+ break;
+ case GL_REFLECTION_MAP:
+ texcoord[1] = ry;
+ break;
+ case GL_NORMAL_MAP:
+ texcoord[1] = normal[1];
+ break;
+ default:
+ _mesa_problem(ctx, "Bad T texgen in compute_texgen()");
+ return;
+ }
+ }
+
+ if (texUnit->TexGenEnabled & R_BIT) {
+ switch (texUnit->GenModeR) {
+ case GL_OBJECT_LINEAR:
+ texcoord[2] = DOT4(vObj, texUnit->ObjectPlaneR);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[2] = DOT4(vEye, texUnit->EyePlaneR);
+ break;
+ case GL_REFLECTION_MAP:
+ texcoord[2] = rz;
+ break;
+ case GL_NORMAL_MAP:
+ texcoord[2] = normal[2];
+ break;
+ default:
+ _mesa_problem(ctx, "Bad R texgen in compute_texgen()");
+ return;
+ }
+ }
+
+ if (texUnit->TexGenEnabled & Q_BIT) {
+ switch (texUnit->GenModeQ) {
+ case GL_OBJECT_LINEAR:
+ texcoord[3] = DOT4(vObj, texUnit->ObjectPlaneQ);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[3] = DOT4(vEye, texUnit->EyePlaneQ);
+ break;
+ default:
+ _mesa_problem(ctx, "Bad Q texgen in compute_texgen()");
+ return;
+ }
+ }
+}
+
+
+
+/**
+ * Set the raster position for pixel operations.
+ *
+ * All glRasterPos command call this function to update the current
+ * raster position.
+ *
+ * \param ctx GL context.
+ * \param x x coordinate for the raster position.
+ * \param y y coordinate for the raster position.
+ * \param z z coordinate for the raster position.
+ * \param w w coordinate for the raster position.
+ *
+ * \sa Called by _mesa_RasterPos4f().
+ *
+ * Flushes the vertices, transforms and clips the vertex coordinates, and
+ * finally sets the current raster position and associated data in
+ * __GLcontextRec::Current. When in selection mode calls
+ * _mesa_update_hitflag() with the current raster position.
+ */
+static void
+raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state( ctx );
+
+ if (ctx->VertexProgram._Enabled) {
+ /* XXX implement this */
+ _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
+ return;
+ }
+ else {
+ GLfloat obj[4], eye[4], clip[4], ndc[3], d;
+ GLfloat *norm, eyenorm[3];
+ GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+
+ ASSIGN_4V( obj, x, y, z, w );
+ /* apply modelview matrix: eye = MV * obj */
+ TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, obj );
+ /* apply projection matrix: clip = Proj * eye */
+ TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye );
+
+ /* clip to view volume */
+ if (ctx->Transform.RasterPositionUnclipped) {
+ /* GL_IBM_rasterpos_clip: only clip against Z */
+ if (viewclip_point_z(clip) == 0) {
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
+ }
+ }
+ else if (viewclip_point(clip) == 0) {
+ /* Normal OpenGL behaviour */
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
+ }
+
+ /* clip to user clipping planes */
+ if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) {
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
+ }
+
+ /* ndc = clip / W */
+ d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3];
+ ndc[0] = clip[0] * d;
+ ndc[1] = clip[1] * d;
+ ndc[2] = clip[2] * d;
+ /* wincoord = viewport_mapping(ndc) */
+ ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX]
+ + ctx->Viewport._WindowMap.m[MAT_TX]);
+ ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY]
+ + ctx->Viewport._WindowMap.m[MAT_TY]);
+ ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ]
+ + ctx->Viewport._WindowMap.m[MAT_TZ])
+ / ctx->DepthMaxF;
+ ctx->Current.RasterPos[3] = clip[3];
+
+ /* compute raster distance */
+ if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
+ ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+ else
+ ctx->Current.RasterDistance =
+ SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
+
+ /* compute transformed normal vector (for lighting or texgen) */
+ if (ctx->_NeedEyeCoords) {
+ const GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv;
+ TRANSFORM_NORMAL( eyenorm, objnorm, inv );
+ norm = eyenorm;
+ }
+ else {
+ norm = objnorm;
+ }
+
+ /* update raster color */
+ if (ctx->Light.Enabled) {
+ /* lighting */
+ shade_rastpos( ctx, obj, norm,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterSecondaryColor,
+ &ctx->Current.RasterIndex );
+ }
+ else {
+ /* use current color or index */
+ if (ctx->Visual.rgbMode) {
+ COPY_4FV(ctx->Current.RasterColor,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ COPY_4FV(ctx->Current.RasterSecondaryColor,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
+ }
+ else {
+ ctx->Current.RasterIndex = ctx->Current.Index;
+ }
+ }
+
+ /* texture coords */
+ {
+ GLuint u;
+ for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
+ GLfloat tc[4];
+ COPY_4V(tc, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]);
+ if (ctx->Texture.Unit[u].TexGenEnabled) {
+ compute_texgen(ctx, obj, eye, norm, u, tc);
+ }
+ TRANSFORM_POINT(ctx->Current.RasterTexCoords[u],
+ ctx->TextureMatrixStack[u].Top->m, tc);
+ }
+ }
+
+ ctx->Current.RasterPosValid = GL_TRUE;
+ }
+
+ if (ctx->RenderMode == GL_SELECT) {
+ _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
+ }
+}
+
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2d(GLdouble x, GLdouble y)
+{
+ _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2f(GLfloat x, GLfloat y)
+{
+ _mesa_RasterPos4f(x, y, 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2i(GLint x, GLint y)
+{
+ _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2s(GLshort x, GLshort y)
+{
+ _mesa_RasterPos4f(x, y, 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
+{
+ _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
+{
+ _mesa_RasterPos4f(x, y, z, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3i(GLint x, GLint y, GLint z)
+{
+ _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z)
+{
+ _mesa_RasterPos4f(x, y, z, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+/** Calls raster_pos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ raster_pos4f(ctx, x, y, z, w);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
+{
+ _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ _mesa_RasterPos4f(x, y, z, w);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2dv(const GLdouble *v)
+{
+ _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2fv(const GLfloat *v)
+{
+ _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2iv(const GLint *v)
+{
+ _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos2sv(const GLshort *v)
+{
+ _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3dv(const GLdouble *v)
+{
+ _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3fv(const GLfloat *v)
+{
+ _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3iv(const GLint *v)
+{
+ _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos3sv(const GLshort *v)
+{
+ _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4dv(const GLdouble *v)
+{
+ _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4fv(const GLfloat *v)
+{
+ _mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4iv(const GLint *v)
+{
+ _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+/** Calls _mesa_RasterPos4f() */
+void GLAPIENTRY
+_mesa_RasterPos4sv(const GLshort *v)
+{
+ _mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
+}
+
+
+/**********************************************************************/
+/*** GL_ARB_window_pos / GL_MESA_window_pos ***/
+/**********************************************************************/
+
+#if FEATURE_windowpos
+/**
+ * All glWindowPosMESA and glWindowPosARB commands call this function to
+ * update the current raster position.
+ */
+static void
+window_pos3f(GLfloat x, GLfloat y, GLfloat z)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat z2;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_CURRENT(ctx, 0);
+
+ z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near)
+ + ctx->Viewport.Near;
+
+ /* set raster position */
+ ctx->Current.RasterPos[0] = x;
+ ctx->Current.RasterPos[1] = y;
+ ctx->Current.RasterPos[2] = z2;
+ ctx->Current.RasterPos[3] = 1.0F;
+
+ ctx->Current.RasterPosValid = GL_TRUE;
+
+ if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
+ ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+ else
+ ctx->Current.RasterDistance = 0.0;
+
+ /* raster color = current color or index */
+ if (ctx->Visual.rgbMode) {
+ ctx->Current.RasterColor[0]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F);
+ ctx->Current.RasterColor[1]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F);
+ ctx->Current.RasterColor[2]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F);
+ ctx->Current.RasterColor[3]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[0]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[1]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[2]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[3]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F);
+ }
+ else {
+ ctx->Current.RasterIndex = ctx->Current.Index;
+ }
+
+ /* raster texcoord = current texcoord */
+ {
+ GLuint texSet;
+ for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) {
+ COPY_4FV( ctx->Current.RasterTexCoords[texSet],
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] );
+ }
+ }
+
+ if (ctx->RenderMode==GL_SELECT) {
+ _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
+ }
+}
+
+
+/* This is just to support the GL_MESA_window_pos version */
+static void
+window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ window_pos3f(x, y, z);
+ ctx->Current.RasterPos[3] = w;
+}
+
+
+void GLAPIENTRY
+_mesa_WindowPos2dMESA(GLdouble x, GLdouble y)
+{
+ window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos2fMESA(GLfloat x, GLfloat y)
+{
+ window_pos4f(x, y, 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos2iMESA(GLint x, GLint y)
+{
+ window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos2sMESA(GLshort x, GLshort y)
+{
+ window_pos4f(x, y, 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
+{
+ window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
+{
+ window_pos4f(x, y, z, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z)
+{
+ window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
+{
+ window_pos4f(x, y, z, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ window_pos4f(x, y, z, w);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
+{
+ window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ window_pos4f(x, y, z, w);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos2dvMESA(const GLdouble *v)
+{
+ window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos2fvMESA(const GLfloat *v)
+{
+ window_pos4f(v[0], v[1], 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos2ivMESA(const GLint *v)
+{
+ window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos2svMESA(const GLshort *v)
+{
+ window_pos4f(v[0], v[1], 0.0F, 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3dvMESA(const GLdouble *v)
+{
+ window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3fvMESA(const GLfloat *v)
+{
+ window_pos4f(v[0], v[1], v[2], 1.0);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3ivMESA(const GLint *v)
+{
+ window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos3svMESA(const GLshort *v)
+{
+ window_pos4f(v[0], v[1], v[2], 1.0F);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4dvMESA(const GLdouble *v)
+{
+ window_pos4f((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4fvMESA(const GLfloat *v)
+{
+ window_pos4f(v[0], v[1], v[2], v[3]);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4ivMESA(const GLint *v)
+{
+ window_pos4f((GLfloat) v[0], (GLfloat) v[1],
+ (GLfloat) v[2], (GLfloat) v[3]);
+}
+
+void GLAPIENTRY
+_mesa_WindowPos4svMESA(const GLshort *v)
+{
+ window_pos4f(v[0], v[1], v[2], v[3]);
+}
+
+#endif
+
+#if 0
+
+/*
+ * OpenGL implementation of glWindowPos*MESA()
+ */
+void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ GLfloat fx, fy;
+
+ /* Push current matrix mode and viewport attributes */
+ glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT );
+
+ /* Setup projection parameters */
+ glMatrixMode( GL_PROJECTION );
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode( GL_MODELVIEW );
+ glPushMatrix();
+ glLoadIdentity();
+
+ glDepthRange( z, z );
+ glViewport( (int) x - 1, (int) y - 1, 2, 2 );
+
+ /* set the raster (window) position */
+ fx = x - (int) x;
+ fy = y - (int) y;
+ glRasterPos4f( fx, fy, 0.0, w );
+
+ /* restore matrices, viewport and matrix mode */
+ glPopMatrix();
+ glMatrixMode( GL_PROJECTION );
+ glPopMatrix();
+
+ glPopAttrib();
+}
+
+#endif
+
+
+/**********************************************************************/
+/** \name Initialization */
+/**********************************************************************/
+/*@{*/
+
+/**
+ * Initialize the context current raster position information.
+ *
+ * \param ctx GL context.
+ *
+ * Initialize the current raster position information in
+ * __GLcontextRec::Current, and adds the extension entry points to the
+ * dispatcher.
+ */
+void _mesa_init_rastpos( GLcontext * ctx )
+{
+ int i;
+
+ ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 );
+ ctx->Current.RasterDistance = 0.0;
+ ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 );
+ ctx->Current.RasterIndex = 1.0;
+ for (i=0; iCurrent.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 );
+ ctx->Current.RasterPosValid = GL_TRUE;
+
+ /*
+ * For XFree86/DRI: tell libGL to add these functions to the dispatcher.
+ * Basically, we should add all extension functions above offset 577.
+ * This enables older libGL libraries to work with newer drivers that
+ * have newer extensions.
+ */
+ /* GL_ARB_window_pos aliases with GL_MESA_window_pos */
+ _glapi_add_entrypoint("glWindowPos2dARB", 513);
+ _glapi_add_entrypoint("glWindowPos2dvARB", 514);
+ _glapi_add_entrypoint("glWindowPos2fARB", 515);
+ _glapi_add_entrypoint("glWindowPos2fvARB", 516);
+ _glapi_add_entrypoint("glWindowPos2iARB", 517);
+ _glapi_add_entrypoint("glWindowPos2ivARB", 518);
+ _glapi_add_entrypoint("glWindowPos2sARB", 519);
+ _glapi_add_entrypoint("glWindowPos2svARB", 520);
+ _glapi_add_entrypoint("glWindowPos3dARB", 521);
+ _glapi_add_entrypoint("glWindowPos3dvARB", 522);
+ _glapi_add_entrypoint("glWindowPos3fARB", 523);
+ _glapi_add_entrypoint("glWindowPos3fvARB", 524);
+ _glapi_add_entrypoint("glWindowPos3iARB", 525);
+ _glapi_add_entrypoint("glWindowPos3ivARB", 526);
+ _glapi_add_entrypoint("glWindowPos3sARB", 527);
+ _glapi_add_entrypoint("glWindowPos3svARB", 528);
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/rastpos.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/rastpos.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/rastpos.h Thu Apr 8 05:17:49 2004
@@ -0,0 +1,193 @@
+/**
+ * \file rastpos.h
+ * Raster position operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef RASTPOS_H
+#define RASTPOS_H
+
+
+#include "glheader.h"
+
+
+extern void GLAPIENTRY
+_mesa_RasterPos2d(GLdouble x, GLdouble y);
+
+extern void GLAPIENTRY
+_mesa_RasterPos2f(GLfloat x, GLfloat y);
+
+extern void GLAPIENTRY
+_mesa_RasterPos2i(GLint x, GLint y);
+
+extern void GLAPIENTRY
+_mesa_RasterPos2s(GLshort x, GLshort y);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3i(GLint x, GLint y, GLint z);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
+
+extern void GLAPIENTRY
+_mesa_RasterPos2dv(const GLdouble *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos2fv(const GLfloat *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos2iv(const GLint *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos2sv(const GLshort *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3dv(const GLdouble *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3fv(const GLfloat *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3iv(const GLint *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos3sv(const GLshort *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4dv(const GLdouble *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4fv(const GLfloat *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4iv(const GLint *v);
+
+extern void GLAPIENTRY
+_mesa_RasterPos4sv(const GLshort *v);
+
+
+/**********************************************************************/
+/** \name GL_MESA_window_pos */
+/**********************************************************************/
+/*@{*/
+
+extern void GLAPIENTRY
+_mesa_WindowPos2dMESA(GLdouble x, GLdouble y);
+
+extern void GLAPIENTRY
+_mesa_WindowPos2fMESA(GLfloat x, GLfloat y);
+
+extern void GLAPIENTRY
+_mesa_WindowPos2iMESA(GLint x, GLint y);
+
+extern void GLAPIENTRY
+_mesa_WindowPos2sMESA(GLshort x, GLshort y);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w);
+
+extern void GLAPIENTRY
+_mesa_WindowPos2dvMESA(const GLdouble *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos2fvMESA(const GLfloat *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos2ivMESA(const GLint *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos2svMESA(const GLshort *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3dvMESA(const GLdouble *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3fvMESA(const GLfloat *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3ivMESA(const GLint *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos3svMESA(const GLshort *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4dvMESA(const GLdouble *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4fvMESA(const GLfloat *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4ivMESA(const GLint *v);
+
+extern void GLAPIENTRY
+_mesa_WindowPos4svMESA(const GLshort *v);
+
+extern void
+_mesa_init_rastpos( GLcontext * ctx );
+
+/*@}*/
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/simple_list.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/simple_list.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/simple_list.h Thu Apr 8 05:17:49 2004
@@ -0,0 +1,197 @@
+/**
+ * \file simple_list.h
+ * Simple macros for type-safe, intrusive lists.
+ *
+ * Intended to work with a list sentinal which is created as an empty
+ * list. Insert & delete are O(1).
+ *
+ * \author
+ * (C) 1997, Keith Whitwell
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _SIMPLE_LIST_H
+#define _SIMPLE_LIST_H
+
+/**
+ * Remove an element from list.
+ *
+ * \param elem element to remove.
+ */
+#define remove_from_list(elem) \
+do { \
+ (elem)->next->prev = (elem)->prev; \
+ (elem)->prev->next = (elem)->next; \
+} while (0)
+
+/**
+ * Insert an element to the list head.
+ *
+ * \param list list.
+ * \param elem element to insert.
+ */
+#define insert_at_head(list, elem) \
+do { \
+ (elem)->prev = list; \
+ (elem)->next = (list)->next; \
+ (list)->next->prev = elem; \
+ (list)->next = elem; \
+} while(0)
+
+/**
+ * Insert an element to the list tail.
+ *
+ * \param list list.
+ * \param elem element to insert.
+ */
+#define insert_at_tail(list, elem) \
+do { \
+ (elem)->next = list; \
+ (elem)->prev = (list)->prev; \
+ (list)->prev->next = elem; \
+ (list)->prev = elem; \
+} while(0)
+
+/**
+ * Move an element to the list head.
+ *
+ * \param list list.
+ * \param elem element to move.
+ */
+#define move_to_head(list, elem) \
+do { \
+ remove_from_list(elem); \
+ insert_at_head(list, elem); \
+} while (0)
+
+/**
+ * Move an element to the list tail.
+ *
+ * \param list list.
+ * \param elem element to move.
+ */
+#define move_to_tail(list, elem) \
+do { \
+ remove_from_list(elem); \
+ insert_at_tail(list, elem); \
+} while (0)
+
+/**
+ * Make a empty list empty.
+ *
+ * \param sentinal list (sentinal element).
+ */
+#define make_empty_list(sentinal) \
+do { \
+ (sentinal)->next = sentinal; \
+ (sentinal)->prev = sentinal; \
+} while (0)
+
+/**
+ * Get list first element.
+ *
+ * \param list list.
+ *
+ * \return pointer to first element.
+ */
+#define first_elem(list) ((list)->next)
+
+/**
+ * Get list last element.
+ *
+ * \param list list.
+ *
+ * \return pointer to last element.
+ */
+#define last_elem(list) ((list)->prev)
+
+/**
+ * Get next element.
+ *
+ * \param elem element.
+ *
+ * \return pointer to next element.
+ */
+#define next_elem(elem) ((elem)->next)
+
+/**
+ * Get previous element.
+ *
+ * \param elem element.
+ *
+ * \return pointer to previous element.
+ */
+#define prev_elem(elem) ((elem)->prev)
+
+/**
+ * Test whether element is at end of the list.
+ *
+ * \param list list.
+ * \param elem element.
+ *
+ * \return non-zero if element is at end of list, or zero otherwise.
+ */
+#define at_end(list, elem) ((elem) == (list))
+
+/**
+ * Test if a list is empty.
+ *
+ * \param list list.
+ *
+ * \return non-zero if list empty, or zero otherwise.
+ */
+#define is_empty_list(list) ((list)->next == (list))
+
+/**
+ * Walk through the elements of a list.
+ *
+ * \param ptr pointer to the current element.
+ * \param list list.
+ *
+ * \note It should be followed by a { } block or a single statement, as in a \c
+ * for loop.
+ */
+#define foreach(ptr, list) \
+ for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next )
+
+/**
+ * Walk through the elements of a list.
+ *
+ * Same as #foreach but lets you unlink the current value during a list
+ * traversal. Useful for freeing a list, element by element.
+ *
+ * \param ptr pointer to the current element.
+ * \param t temporary pointer.
+ * \param list list.
+ *
+ * \note It should be followed by a { } block or a single statement, as in a \c
+ * for loop.
+ */
+#define foreach_s(ptr, t, list) \
+ for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/state.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/state.c:1.1.1.5
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/state.c Fri Dec 10 10:32:25 2004
@@ -0,0 +1,951 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file state.c
+ * State management.
+ *
+ * This file manages recalculation of derived values in the __GLcontextRec.
+ * Also, this is where we initialize the API dispatch table.
+ */
+
+#include "glheader.h"
+#include "accum.h"
+#include "api_loopback.h"
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+#include "arbprogram.h"
+#endif
+#include "attrib.h"
+#include "blend.h"
+#if FEATURE_ARB_vertex_buffer_object
+#include "bufferobj.h"
+#endif
+#include "buffers.h"
+#include "clip.h"
+#include "colortab.h"
+#include "context.h"
+#include "convolve.h"
+#include "depth.h"
+#include "dlist.h"
+#include "drawpix.h"
+#include "enable.h"
+#include "eval.h"
+#include "get.h"
+#include "feedback.h"
+#include "fog.h"
+#include "hint.h"
+#include "histogram.h"
+#include "imports.h"
+#include "light.h"
+#include "lines.h"
+#include "macros.h"
+#include "matrix.h"
+#if FEATURE_ARB_occlusion_query
+#include "occlude.h"
+#endif
+#include "pixel.h"
+#include "points.h"
+#include "polygon.h"
+#include "rastpos.h"
+#include "state.h"
+#include "stencil.h"
+#include "teximage.h"
+#include "texobj.h"
+#include "texstate.h"
+#include "mtypes.h"
+#include "varray.h"
+#if FEATURE_NV_vertex_program
+#include "nvprogram.h"
+#endif
+#if FEATURE_NV_fragment_program
+#include "nvfragprog.h"
+#include "nvprogram.h"
+#include "program.h"
+#endif
+#include "debug.h"
+
+/* #include "math/m_matrix.h" */
+/* #include "math/m_xform.h" */
+
+
+/**********************************************************************/
+/** \name Dispatch table setup */
+/*@{*/
+
+/**
+ * Generic no-op dispatch function.
+ *
+ * Used in replacement of the functions which are not part of Mesa subset.
+ *
+ * Displays a message.
+ */
+static int
+generic_noop(void)
+{
+ _mesa_problem(NULL, "User called no-op dispatch function (an unsupported extension function?)");
+ return 0;
+}
+
+
+/**
+ * Set all pointers in the given dispatch table to point to a
+ * generic no-op function - generic_noop().
+ *
+ * \param table dispatch table.
+ * \param tableSize dispatch table size.
+ */
+void
+_mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize)
+{
+ typedef void (*func_ptr_t)(void);
+ GLuint i;
+ func_ptr_t *dispatch = (func_ptr_t *) table;
+ for (i = 0; i < tableSize; i++) {
+ dispatch[i] = (func_ptr_t)generic_noop;
+ }
+}
+
+
+/**
+ * Initialize a dispatch table with pointers to Mesa's immediate-mode
+ * commands.
+ *
+ * Pointers to glBegin()/glEnd() object commands and a few others
+ * are provided via the GLvertexformat interface.
+ *
+ * \param exec dispatch table.
+ * \param tableSize dispatch table size.
+ */
+void
+_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
+{
+ /* first initialize all dispatch slots to no-op */
+ _mesa_init_no_op_table(exec, tableSize);
+
+#if _HAVE_FULL_GL
+ _mesa_loopback_init_api_table( exec );
+#endif
+
+ /* load the dispatch slots we understand */
+ exec->AlphaFunc = _mesa_AlphaFunc;
+ exec->BlendFunc = _mesa_BlendFunc;
+ exec->Clear = _mesa_Clear;
+ exec->ClearColor = _mesa_ClearColor;
+ exec->ClearStencil = _mesa_ClearStencil;
+ exec->ColorMask = _mesa_ColorMask;
+ exec->CullFace = _mesa_CullFace;
+ exec->Disable = _mesa_Disable;
+ exec->DrawBuffer = _mesa_DrawBuffer;
+ exec->Enable = _mesa_Enable;
+ exec->Finish = _mesa_Finish;
+ exec->Flush = _mesa_Flush;
+ exec->FrontFace = _mesa_FrontFace;
+ exec->Frustum = _mesa_Frustum;
+ exec->GetError = _mesa_GetError;
+ exec->GetFloatv = _mesa_GetFloatv;
+ exec->GetString = _mesa_GetString;
+ exec->InitNames = _mesa_InitNames;
+ exec->LineStipple = _mesa_LineStipple;
+ exec->LineWidth = _mesa_LineWidth;
+ exec->LoadIdentity = _mesa_LoadIdentity;
+ exec->LoadMatrixf = _mesa_LoadMatrixf;
+ exec->LoadName = _mesa_LoadName;
+ exec->LogicOp = _mesa_LogicOp;
+ exec->MatrixMode = _mesa_MatrixMode;
+ exec->MultMatrixf = _mesa_MultMatrixf;
+ exec->Ortho = _mesa_Ortho;
+ exec->PixelStorei = _mesa_PixelStorei;
+ exec->PopMatrix = _mesa_PopMatrix;
+ exec->PopName = _mesa_PopName;
+ exec->PushMatrix = _mesa_PushMatrix;
+ exec->PushName = _mesa_PushName;
+ exec->RasterPos2f = _mesa_RasterPos2f;
+ exec->RasterPos2fv = _mesa_RasterPos2fv;
+ exec->RasterPos2i = _mesa_RasterPos2i;
+ exec->RasterPos2iv = _mesa_RasterPos2iv;
+ exec->ReadBuffer = _mesa_ReadBuffer;
+ exec->RenderMode = _mesa_RenderMode;
+ exec->Rotatef = _mesa_Rotatef;
+ exec->Scalef = _mesa_Scalef;
+ exec->Scissor = _mesa_Scissor;
+ exec->SelectBuffer = _mesa_SelectBuffer;
+ exec->ShadeModel = _mesa_ShadeModel;
+ exec->StencilFunc = _mesa_StencilFunc;
+ exec->StencilMask = _mesa_StencilMask;
+ exec->StencilOp = _mesa_StencilOp;
+ exec->TexEnvfv = _mesa_TexEnvfv;
+ exec->TexEnvi = _mesa_TexEnvi;
+ exec->TexImage2D = _mesa_TexImage2D;
+ exec->TexParameteri = _mesa_TexParameteri;
+ exec->Translatef = _mesa_Translatef;
+ exec->Viewport = _mesa_Viewport;
+#if _HAVE_FULL_GL
+ exec->Accum = _mesa_Accum;
+ exec->Bitmap = _mesa_Bitmap;
+ exec->CallList = _mesa_CallList;
+ exec->CallLists = _mesa_CallLists;
+ exec->ClearAccum = _mesa_ClearAccum;
+ exec->ClearDepth = _mesa_ClearDepth;
+ exec->ClearIndex = _mesa_ClearIndex;
+ exec->ClipPlane = _mesa_ClipPlane;
+ exec->ColorMaterial = _mesa_ColorMaterial;
+ exec->CopyPixels = _mesa_CopyPixels;
+ exec->CullParameterfvEXT = _mesa_CullParameterfvEXT;
+ exec->CullParameterdvEXT = _mesa_CullParameterdvEXT;
+ exec->DeleteLists = _mesa_DeleteLists;
+ exec->DepthFunc = _mesa_DepthFunc;
+ exec->DepthMask = _mesa_DepthMask;
+ exec->DepthRange = _mesa_DepthRange;
+ exec->DrawPixels = _mesa_DrawPixels;
+ exec->EndList = _mesa_EndList;
+ exec->FeedbackBuffer = _mesa_FeedbackBuffer;
+ exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
+ exec->Fogf = _mesa_Fogf;
+ exec->Fogfv = _mesa_Fogfv;
+ exec->Fogi = _mesa_Fogi;
+ exec->Fogiv = _mesa_Fogiv;
+ exec->GenLists = _mesa_GenLists;
+ exec->GetClipPlane = _mesa_GetClipPlane;
+ exec->GetBooleanv = _mesa_GetBooleanv;
+ exec->GetDoublev = _mesa_GetDoublev;
+ exec->GetIntegerv = _mesa_GetIntegerv;
+ exec->GetLightfv = _mesa_GetLightfv;
+ exec->GetLightiv = _mesa_GetLightiv;
+ exec->GetMapdv = _mesa_GetMapdv;
+ exec->GetMapfv = _mesa_GetMapfv;
+ exec->GetMapiv = _mesa_GetMapiv;
+ exec->GetMaterialfv = _mesa_GetMaterialfv;
+ exec->GetMaterialiv = _mesa_GetMaterialiv;
+ exec->GetPixelMapfv = _mesa_GetPixelMapfv;
+ exec->GetPixelMapuiv = _mesa_GetPixelMapuiv;
+ exec->GetPixelMapusv = _mesa_GetPixelMapusv;
+ exec->GetPolygonStipple = _mesa_GetPolygonStipple;
+ exec->GetTexEnvfv = _mesa_GetTexEnvfv;
+ exec->GetTexEnviv = _mesa_GetTexEnviv;
+ exec->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv;
+ exec->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv;
+ exec->GetTexParameterfv = _mesa_GetTexParameterfv;
+ exec->GetTexParameteriv = _mesa_GetTexParameteriv;
+ exec->GetTexGendv = _mesa_GetTexGendv;
+ exec->GetTexGenfv = _mesa_GetTexGenfv;
+ exec->GetTexGeniv = _mesa_GetTexGeniv;
+ exec->GetTexImage = _mesa_GetTexImage;
+ exec->Hint = _mesa_Hint;
+ exec->IndexMask = _mesa_IndexMask;
+ exec->IsEnabled = _mesa_IsEnabled;
+ exec->IsList = _mesa_IsList;
+ exec->LightModelf = _mesa_LightModelf;
+ exec->LightModelfv = _mesa_LightModelfv;
+ exec->LightModeli = _mesa_LightModeli;
+ exec->LightModeliv = _mesa_LightModeliv;
+ exec->Lightf = _mesa_Lightf;
+ exec->Lightfv = _mesa_Lightfv;
+ exec->Lighti = _mesa_Lighti;
+ exec->Lightiv = _mesa_Lightiv;
+ exec->ListBase = _mesa_ListBase;
+ exec->LoadMatrixd = _mesa_LoadMatrixd;
+ exec->Map1d = _mesa_Map1d;
+ exec->Map1f = _mesa_Map1f;
+ exec->Map2d = _mesa_Map2d;
+ exec->Map2f = _mesa_Map2f;
+ exec->MapGrid1d = _mesa_MapGrid1d;
+ exec->MapGrid1f = _mesa_MapGrid1f;
+ exec->MapGrid2d = _mesa_MapGrid2d;
+ exec->MapGrid2f = _mesa_MapGrid2f;
+ exec->MultMatrixd = _mesa_MultMatrixd;
+ exec->NewList = _mesa_NewList;
+ exec->PassThrough = _mesa_PassThrough;
+ exec->PixelMapfv = _mesa_PixelMapfv;
+ exec->PixelMapuiv = _mesa_PixelMapuiv;
+ exec->PixelMapusv = _mesa_PixelMapusv;
+ exec->PixelStoref = _mesa_PixelStoref;
+ exec->PixelTransferf = _mesa_PixelTransferf;
+ exec->PixelTransferi = _mesa_PixelTransferi;
+ exec->PixelZoom = _mesa_PixelZoom;
+ exec->PointSize = _mesa_PointSize;
+ exec->PolygonMode = _mesa_PolygonMode;
+ exec->PolygonOffset = _mesa_PolygonOffset;
+ exec->PolygonStipple = _mesa_PolygonStipple;
+ exec->PopAttrib = _mesa_PopAttrib;
+ exec->PushAttrib = _mesa_PushAttrib;
+ exec->RasterPos2d = _mesa_RasterPos2d;
+ exec->RasterPos2dv = _mesa_RasterPos2dv;
+ exec->RasterPos2s = _mesa_RasterPos2s;
+ exec->RasterPos2sv = _mesa_RasterPos2sv;
+ exec->RasterPos3d = _mesa_RasterPos3d;
+ exec->RasterPos3dv = _mesa_RasterPos3dv;
+ exec->RasterPos3f = _mesa_RasterPos3f;
+ exec->RasterPos3fv = _mesa_RasterPos3fv;
+ exec->RasterPos3i = _mesa_RasterPos3i;
+ exec->RasterPos3iv = _mesa_RasterPos3iv;
+ exec->RasterPos3s = _mesa_RasterPos3s;
+ exec->RasterPos3sv = _mesa_RasterPos3sv;
+ exec->RasterPos4d = _mesa_RasterPos4d;
+ exec->RasterPos4dv = _mesa_RasterPos4dv;
+ exec->RasterPos4f = _mesa_RasterPos4f;
+ exec->RasterPos4fv = _mesa_RasterPos4fv;
+ exec->RasterPos4i = _mesa_RasterPos4i;
+ exec->RasterPos4iv = _mesa_RasterPos4iv;
+ exec->RasterPos4s = _mesa_RasterPos4s;
+ exec->RasterPos4sv = _mesa_RasterPos4sv;
+ exec->ReadPixels = _mesa_ReadPixels;
+ exec->Rotated = _mesa_Rotated;
+ exec->Scaled = _mesa_Scaled;
+ exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
+ exec->TexEnvf = _mesa_TexEnvf;
+ exec->TexEnviv = _mesa_TexEnviv;
+ exec->TexGend = _mesa_TexGend;
+ exec->TexGendv = _mesa_TexGendv;
+ exec->TexGenf = _mesa_TexGenf;
+ exec->TexGenfv = _mesa_TexGenfv;
+ exec->TexGeni = _mesa_TexGeni;
+ exec->TexGeniv = _mesa_TexGeniv;
+ exec->TexImage1D = _mesa_TexImage1D;
+ exec->TexParameterf = _mesa_TexParameterf;
+ exec->TexParameterfv = _mesa_TexParameterfv;
+ exec->TexParameteriv = _mesa_TexParameteriv;
+ exec->Translated = _mesa_Translated;
+#endif
+
+ /* 1.1 */
+ exec->BindTexture = _mesa_BindTexture;
+ exec->DeleteTextures = _mesa_DeleteTextures;
+ exec->GenTextures = _mesa_GenTextures;
+#if _HAVE_FULL_GL
+ exec->AreTexturesResident = _mesa_AreTexturesResident;
+ exec->AreTexturesResidentEXT = _mesa_AreTexturesResident;
+ exec->ColorPointer = _mesa_ColorPointer;
+ exec->CopyTexImage1D = _mesa_CopyTexImage1D;
+ exec->CopyTexImage2D = _mesa_CopyTexImage2D;
+ exec->CopyTexSubImage1D = _mesa_CopyTexSubImage1D;
+ exec->CopyTexSubImage2D = _mesa_CopyTexSubImage2D;
+ exec->DisableClientState = _mesa_DisableClientState;
+ exec->EdgeFlagPointer = _mesa_EdgeFlagPointer;
+ exec->EnableClientState = _mesa_EnableClientState;
+ exec->GenTexturesEXT = _mesa_GenTextures;
+ exec->GetPointerv = _mesa_GetPointerv;
+ exec->IndexPointer = _mesa_IndexPointer;
+ exec->InterleavedArrays = _mesa_InterleavedArrays;
+ exec->IsTexture = _mesa_IsTexture;
+ exec->IsTextureEXT = _mesa_IsTexture;
+ exec->NormalPointer = _mesa_NormalPointer;
+ exec->PopClientAttrib = _mesa_PopClientAttrib;
+ exec->PrioritizeTextures = _mesa_PrioritizeTextures;
+ exec->PushClientAttrib = _mesa_PushClientAttrib;
+ exec->TexCoordPointer = _mesa_TexCoordPointer;
+ exec->TexSubImage1D = _mesa_TexSubImage1D;
+ exec->TexSubImage2D = _mesa_TexSubImage2D;
+ exec->VertexPointer = _mesa_VertexPointer;
+#endif
+
+ /* 1.2 */
+#if _HAVE_FULL_GL
+ exec->CopyTexSubImage3D = _mesa_CopyTexSubImage3D;
+ exec->TexImage3D = _mesa_TexImage3D;
+ exec->TexSubImage3D = _mesa_TexSubImage3D;
+#endif
+
+ /* OpenGL 1.2 GL_ARB_imaging */
+#if _HAVE_FULL_GL
+ exec->BlendColor = _mesa_BlendColor;
+ exec->BlendEquation = _mesa_BlendEquation;
+ exec->BlendEquationSeparateEXT = _mesa_BlendEquationSeparateEXT;
+ exec->ColorSubTable = _mesa_ColorSubTable;
+ exec->ColorTable = _mesa_ColorTable;
+ exec->ColorTableParameterfv = _mesa_ColorTableParameterfv;
+ exec->ColorTableParameteriv = _mesa_ColorTableParameteriv;
+ exec->ConvolutionFilter1D = _mesa_ConvolutionFilter1D;
+ exec->ConvolutionFilter2D = _mesa_ConvolutionFilter2D;
+ exec->ConvolutionParameterf = _mesa_ConvolutionParameterf;
+ exec->ConvolutionParameterfv = _mesa_ConvolutionParameterfv;
+ exec->ConvolutionParameteri = _mesa_ConvolutionParameteri;
+ exec->ConvolutionParameteriv = _mesa_ConvolutionParameteriv;
+ exec->CopyColorSubTable = _mesa_CopyColorSubTable;
+ exec->CopyColorTable = _mesa_CopyColorTable;
+ exec->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D;
+ exec->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D;
+ exec->GetColorTable = _mesa_GetColorTable;
+ exec->GetColorTableEXT = _mesa_GetColorTable;
+ exec->GetColorTableParameterfv = _mesa_GetColorTableParameterfv;
+ exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
+ exec->GetColorTableParameteriv = _mesa_GetColorTableParameteriv;
+ exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
+ exec->GetConvolutionFilter = _mesa_GetConvolutionFilter;
+ exec->GetConvolutionFilterEXT = _mesa_GetConvolutionFilter;
+ exec->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv;
+ exec->GetConvolutionParameterfvEXT = _mesa_GetConvolutionParameterfv;
+ exec->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv;
+ exec->GetConvolutionParameterivEXT = _mesa_GetConvolutionParameteriv;
+ exec->GetHistogram = _mesa_GetHistogram;
+ exec->GetHistogramEXT = _mesa_GetHistogram;
+ exec->GetHistogramParameterfv = _mesa_GetHistogramParameterfv;
+ exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv;
+ exec->GetHistogramParameteriv = _mesa_GetHistogramParameteriv;
+ exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv;
+ exec->GetMinmax = _mesa_GetMinmax;
+ exec->GetMinmaxEXT = _mesa_GetMinmax;
+ exec->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv;
+ exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv;
+ exec->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv;
+ exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv;
+ exec->GetSeparableFilter = _mesa_GetSeparableFilter;
+ exec->GetSeparableFilterEXT = _mesa_GetSeparableFilter;
+ exec->Histogram = _mesa_Histogram;
+ exec->Minmax = _mesa_Minmax;
+ exec->ResetHistogram = _mesa_ResetHistogram;
+ exec->ResetMinmax = _mesa_ResetMinmax;
+ exec->SeparableFilter2D = _mesa_SeparableFilter2D;
+#endif
+
+ /* 2. GL_EXT_blend_color */
+#if 0
+/* exec->BlendColorEXT = _mesa_BlendColorEXT; */
+#endif
+
+ /* 3. GL_EXT_polygon_offset */
+#if _HAVE_FULL_GL
+ exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT;
+#endif
+
+ /* 6. GL_EXT_texture3d */
+#if 0
+/* exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D; */
+/* exec->TexImage3DEXT = _mesa_TexImage3DEXT; */
+/* exec->TexSubImage3DEXT = _mesa_TexSubImage3D; */
+#endif
+
+ /* 11. GL_EXT_histogram */
+#if _HAVE_FULL_GL
+ exec->GetHistogramEXT = _mesa_GetHistogram;
+ exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv;
+ exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv;
+ exec->GetMinmaxEXT = _mesa_GetMinmax;
+ exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv;
+ exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv;
+#endif
+
+ /* ?. GL_SGIX_pixel_texture */
+#if _HAVE_FULL_GL
+ exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX;
+#endif
+
+ /* 15. GL_SGIS_pixel_texture */
+#if _HAVE_FULL_GL
+ exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS;
+ exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS;
+ exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS;
+ exec->PixelTexGenParameterfvSGIS = _mesa_PixelTexGenParameterfvSGIS;
+ exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS;
+ exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS;
+#endif
+
+ /* 30. GL_EXT_vertex_array */
+#if _HAVE_FULL_GL
+ exec->ColorPointerEXT = _mesa_ColorPointerEXT;
+ exec->EdgeFlagPointerEXT = _mesa_EdgeFlagPointerEXT;
+ exec->IndexPointerEXT = _mesa_IndexPointerEXT;
+ exec->NormalPointerEXT = _mesa_NormalPointerEXT;
+ exec->TexCoordPointerEXT = _mesa_TexCoordPointerEXT;
+ exec->VertexPointerEXT = _mesa_VertexPointerEXT;
+#endif
+
+ /* 37. GL_EXT_blend_minmax */
+#if 0
+ exec->BlendEquationEXT = _mesa_BlendEquationEXT;
+#endif
+
+ /* 54. GL_EXT_point_parameters */
+#if _HAVE_FULL_GL
+ exec->PointParameterfEXT = _mesa_PointParameterfEXT;
+ exec->PointParameterfvEXT = _mesa_PointParameterfvEXT;
+#endif
+
+ /* 78. GL_EXT_paletted_texture */
+#if 0
+ exec->ColorTableEXT = _mesa_ColorTableEXT;
+ exec->ColorSubTableEXT = _mesa_ColorSubTableEXT;
+#endif
+#if _HAVE_FULL_GL
+ exec->GetColorTableEXT = _mesa_GetColorTable;
+ exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
+ exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
+#endif
+
+ /* 97. GL_EXT_compiled_vertex_array */
+#if _HAVE_FULL_GL
+ exec->LockArraysEXT = _mesa_LockArraysEXT;
+ exec->UnlockArraysEXT = _mesa_UnlockArraysEXT;
+#endif
+
+ /* 148. GL_EXT_multi_draw_arrays */
+#if _HAVE_FULL_GL
+ exec->MultiDrawArraysEXT = _mesa_MultiDrawArraysEXT;
+ exec->MultiDrawElementsEXT = _mesa_MultiDrawElementsEXT;
+#endif
+
+ /* 173. GL_INGR_blend_func_separate */
+#if _HAVE_FULL_GL
+ exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT;
+#endif
+
+ /* 196. GL_MESA_resize_buffers */
+#if _HAVE_FULL_GL
+ exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
+#endif
+
+ /* 197. GL_MESA_window_pos */
+#if _HAVE_FULL_GL
+ exec->WindowPos2dMESA = _mesa_WindowPos2dMESA;
+ exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA;
+ exec->WindowPos2fMESA = _mesa_WindowPos2fMESA;
+ exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA;
+ exec->WindowPos2iMESA = _mesa_WindowPos2iMESA;
+ exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA;
+ exec->WindowPos2sMESA = _mesa_WindowPos2sMESA;
+ exec->WindowPos2svMESA = _mesa_WindowPos2svMESA;
+ exec->WindowPos3dMESA = _mesa_WindowPos3dMESA;
+ exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA;
+ exec->WindowPos3fMESA = _mesa_WindowPos3fMESA;
+ exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA;
+ exec->WindowPos3iMESA = _mesa_WindowPos3iMESA;
+ exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA;
+ exec->WindowPos3sMESA = _mesa_WindowPos3sMESA;
+ exec->WindowPos3svMESA = _mesa_WindowPos3svMESA;
+ exec->WindowPos4dMESA = _mesa_WindowPos4dMESA;
+ exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA;
+ exec->WindowPos4fMESA = _mesa_WindowPos4fMESA;
+ exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA;
+ exec->WindowPos4iMESA = _mesa_WindowPos4iMESA;
+ exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA;
+ exec->WindowPos4sMESA = _mesa_WindowPos4sMESA;
+ exec->WindowPos4svMESA = _mesa_WindowPos4svMESA;
+#endif
+
+ /* 200. GL_IBM_multimode_draw_arrays */
+#if _HAVE_FULL_GL
+ exec->MultiModeDrawArraysIBM = _mesa_MultiModeDrawArraysIBM;
+ exec->MultiModeDrawElementsIBM = _mesa_MultiModeDrawElementsIBM;
+#endif
+
+ /* 233. GL_NV_vertex_program */
+#if FEATURE_NV_vertex_program
+ exec->BindProgramNV = _mesa_BindProgram;
+ exec->DeleteProgramsNV = _mesa_DeletePrograms;
+ exec->ExecuteProgramNV = _mesa_ExecuteProgramNV;
+ exec->GenProgramsNV = _mesa_GenPrograms;
+ exec->AreProgramsResidentNV = _mesa_AreProgramsResidentNV;
+ exec->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV;
+ exec->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV;
+ exec->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV;
+ exec->GetProgramivNV = _mesa_GetProgramivNV;
+ exec->GetProgramStringNV = _mesa_GetProgramStringNV;
+ exec->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV;
+ exec->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
+ exec->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
+ exec->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
+ exec->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
+ exec->IsProgramNV = _mesa_IsProgram;
+ exec->LoadProgramNV = _mesa_LoadProgramNV;
+ exec->ProgramParameter4dNV = _mesa_ProgramParameter4dNV;
+ exec->ProgramParameter4dvNV = _mesa_ProgramParameter4dvNV;
+ exec->ProgramParameter4fNV = _mesa_ProgramParameter4fNV;
+ exec->ProgramParameter4fvNV = _mesa_ProgramParameter4fvNV;
+ exec->ProgramParameters4dvNV = _mesa_ProgramParameters4dvNV;
+ exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV;
+ exec->TrackMatrixNV = _mesa_TrackMatrixNV;
+ exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV;
+ /* glVertexAttrib*NV functions handled in api_loopback.c */
+#endif
+
+ /* 282. GL_NV_fragment_program */
+#if FEATURE_NV_fragment_program
+ exec->ProgramNamedParameter4fNV = _mesa_ProgramNamedParameter4fNV;
+ exec->ProgramNamedParameter4dNV = _mesa_ProgramNamedParameter4dNV;
+ exec->ProgramNamedParameter4fvNV = _mesa_ProgramNamedParameter4fvNV;
+ exec->ProgramNamedParameter4dvNV = _mesa_ProgramNamedParameter4dvNV;
+ exec->GetProgramNamedParameterfvNV = _mesa_GetProgramNamedParameterfvNV;
+ exec->GetProgramNamedParameterdvNV = _mesa_GetProgramNamedParameterdvNV;
+ exec->ProgramLocalParameter4dARB = _mesa_ProgramLocalParameter4dARB;
+ exec->ProgramLocalParameter4dvARB = _mesa_ProgramLocalParameter4dvARB;
+ exec->ProgramLocalParameter4fARB = _mesa_ProgramLocalParameter4fARB;
+ exec->ProgramLocalParameter4fvARB = _mesa_ProgramLocalParameter4fvARB;
+ exec->GetProgramLocalParameterdvARB = _mesa_GetProgramLocalParameterdvARB;
+ exec->GetProgramLocalParameterfvARB = _mesa_GetProgramLocalParameterfvARB;
+#endif
+
+ /* 262. GL_NV_point_sprite */
+#if _HAVE_FULL_GL
+ exec->PointParameteriNV = _mesa_PointParameteriNV;
+ exec->PointParameterivNV = _mesa_PointParameterivNV;
+#endif
+
+ /* 268. GL_EXT_stencil_two_side */
+#if _HAVE_FULL_GL
+ exec->ActiveStencilFaceEXT = _mesa_ActiveStencilFaceEXT;
+#endif
+
+ /* ???. GL_EXT_depth_bounds_test */
+ exec->DepthBoundsEXT = _mesa_DepthBoundsEXT;
+
+ /* ARB 1. GL_ARB_multitexture */
+#if _HAVE_FULL_GL
+ exec->ActiveTextureARB = _mesa_ActiveTextureARB;
+ exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
+#endif
+
+ /* ARB 3. GL_ARB_transpose_matrix */
+#if _HAVE_FULL_GL
+ exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB;
+ exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB;
+ exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB;
+ exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB;
+#endif
+
+ /* ARB 5. GL_ARB_multisample */
+#if _HAVE_FULL_GL
+ exec->SampleCoverageARB = _mesa_SampleCoverageARB;
+#endif
+
+ /* ARB 12. GL_ARB_texture_compression */
+#if _HAVE_FULL_GL
+ exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB;
+ exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB;
+ exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB;
+ exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB;
+ exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB;
+ exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB;
+ exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB;
+#endif
+
+ /* ARB 14. GL_ARB_point_parameters */
+ /* reuse EXT_point_parameters functions */
+
+ /* ARB 26. GL_ARB_vertex_program */
+ /* ARB 27. GL_ARB_fragment_program */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */
+ /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */
+ /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */
+ /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */
+ /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */
+ /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */
+ /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */
+ /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */
+ /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */
+ /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */
+ /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */
+ /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */
+ /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */
+ /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */
+ /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */
+ /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */
+ /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */
+ /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */
+ /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */
+ /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */
+ /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */
+ /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */
+ /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */
+ /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */
+ /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */
+ /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */
+ /* glVertexAttrib4bvARB handled in api_loopback.c */
+ /* glVertexAttrib4ivARB handled in api_loopback.c */
+ /* glVertexAttrib4ubvARB handled in api_loopback.c */
+ /* glVertexAttrib4usvARB handled in api_loopback.c */
+ /* glVertexAttrib4uivARB handled in api_loopback.c */
+ /* glVertexAttrib4NbvARB handled in api_loopback.c */
+ /* glVertexAttrib4NsvARB handled in api_loopback.c */
+ /* glVertexAttrib4NivARB handled in api_loopback.c */
+ /* glVertexAttrib4NusvARB handled in api_loopback.c */
+ /* glVertexAttrib4NuivARB handled in api_loopback.c */
+ exec->VertexAttribPointerARB = _mesa_VertexAttribPointerARB;
+ exec->EnableVertexAttribArrayARB = _mesa_EnableVertexAttribArrayARB;
+ exec->DisableVertexAttribArrayARB = _mesa_DisableVertexAttribArrayARB;
+ exec->ProgramStringARB = _mesa_ProgramStringARB;
+ /* glBindProgramARB aliases glBindProgramNV */
+ /* glDeleteProgramsARB aliases glDeleteProgramsNV */
+ /* glGenProgramsARB aliases glGenProgramsNV */
+ /* glIsProgramARB aliases glIsProgramNV */
+ /* glGetVertexAttribdvARB aliases glGetVertexAttribdvNV */
+ /* glGetVertexAttribfvARB aliases glGetVertexAttribfvNV */
+ /* glGetVertexAttribivARB aliases glGetVertexAttribivNV */
+ /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
+ exec->ProgramEnvParameter4dARB = _mesa_ProgramEnvParameter4dARB;
+ exec->ProgramEnvParameter4dvARB = _mesa_ProgramEnvParameter4dvARB;
+ exec->ProgramEnvParameter4fARB = _mesa_ProgramEnvParameter4fARB;
+ exec->ProgramEnvParameter4fvARB = _mesa_ProgramEnvParameter4fvARB;
+ exec->ProgramLocalParameter4dARB = _mesa_ProgramLocalParameter4dARB;
+ exec->ProgramLocalParameter4dvARB = _mesa_ProgramLocalParameter4dvARB;
+ exec->ProgramLocalParameter4fARB = _mesa_ProgramLocalParameter4fARB;
+ exec->ProgramLocalParameter4fvARB = _mesa_ProgramLocalParameter4fvARB;
+ exec->GetProgramEnvParameterdvARB = _mesa_GetProgramEnvParameterdvARB;
+ exec->GetProgramEnvParameterfvARB = _mesa_GetProgramEnvParameterfvARB;
+ exec->GetProgramLocalParameterdvARB = _mesa_GetProgramLocalParameterdvARB;
+ exec->GetProgramLocalParameterfvARB = _mesa_GetProgramLocalParameterfvARB;
+ exec->GetProgramivARB = _mesa_GetProgramivARB;
+ exec->GetProgramStringARB = _mesa_GetProgramStringARB;
+#endif
+
+ /* ARB 28. GL_ARB_vertex_buffer_object */
+#if FEATURE_ARB_vertex_buffer_object
+ exec->BindBufferARB = _mesa_BindBufferARB;
+ exec->BufferDataARB = _mesa_BufferDataARB;
+ exec->BufferSubDataARB = _mesa_BufferSubDataARB;
+ exec->DeleteBuffersARB = _mesa_DeleteBuffersARB;
+ exec->GenBuffersARB = _mesa_GenBuffersARB;
+ exec->GetBufferParameterivARB = _mesa_GetBufferParameterivARB;
+ exec->GetBufferPointervARB = _mesa_GetBufferPointervARB;
+ exec->GetBufferSubDataARB = _mesa_GetBufferSubDataARB;
+ exec->IsBufferARB = _mesa_IsBufferARB;
+ exec->MapBufferARB = _mesa_MapBufferARB;
+ exec->UnmapBufferARB = _mesa_UnmapBufferARB;
+#endif
+
+#if FEATURE_ARB_occlusion_query
+ exec->GenQueriesARB = _mesa_GenQueriesARB;
+ exec->DeleteQueriesARB = _mesa_DeleteQueriesARB;
+ exec->IsQueryARB = _mesa_IsQueryARB;
+ exec->BeginQueryARB = _mesa_BeginQueryARB;
+ exec->EndQueryARB = _mesa_EndQueryARB;
+ exec->GetQueryivARB = _mesa_GetQueryivARB;
+ exec->GetQueryObjectivARB = _mesa_GetQueryObjectivARB;
+ exec->GetQueryObjectuivARB = _mesa_GetQueryObjectuivARB;
+#endif
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name State update logic */
+/*@{*/
+
+
+static void
+update_separate_specular( GLcontext *ctx )
+{
+ if (NEED_SECONDARY_COLOR(ctx))
+ ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
+ else
+ ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
+}
+
+
+/**
+ * Update state dependent on vertex arrays.
+ */
+static void
+update_arrays( GLcontext *ctx )
+{
+ GLuint i, min;
+
+ /* find min of _MaxElement values for all enabled arrays */
+
+ /* 0 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) {
+ min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement;
+ }
+ else if (ctx->Array.Vertex.Enabled) {
+ min = ctx->Array.Vertex._MaxElement;
+ }
+ else {
+ /* can't draw anything without vertex positions! */
+ min = 0;
+ }
+
+ /* 1 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement);
+ }
+ /* no conventional vertex weight array */
+
+ /* 2 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement);
+ }
+ else if (ctx->Array.Normal.Enabled) {
+ min = MIN2(min, ctx->Array.Normal._MaxElement);
+ }
+
+ /* 3 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement);
+ }
+ else if (ctx->Array.Color.Enabled) {
+ min = MIN2(min, ctx->Array.Color._MaxElement);
+ }
+
+ /* 4 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement);
+ }
+ else if (ctx->Array.SecondaryColor.Enabled) {
+ min = MIN2(min, ctx->Array.SecondaryColor._MaxElement);
+ }
+
+ /* 5 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]._MaxElement);
+ }
+ else if (ctx->Array.FogCoord.Enabled) {
+ min = MIN2(min, ctx->Array.FogCoord._MaxElement);
+ }
+
+ /* 6 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement);
+ }
+
+ /* 7 */
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement);
+ }
+
+ /* 8..15 */
+ for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) {
+ if (ctx->VertexProgram._Enabled
+ && ctx->Array.VertexAttrib[i].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement);
+ }
+ else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits
+ && ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0].Enabled) {
+ min = MIN2(min, ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement);
+ }
+ }
+
+ if (ctx->Array.Index.Enabled) {
+ min = MIN2(min, ctx->Array.Index._MaxElement);
+ }
+
+ if (ctx->Array.EdgeFlag.Enabled) {
+ min = MIN2(min, ctx->Array.EdgeFlag._MaxElement);
+ }
+
+ /* _MaxElement is one past the last legal array element */
+ ctx->Array._MaxElement = min;
+}
+
+
+/**
+ * Update derived vertex/fragment program state.
+ */
+static void
+update_program(GLcontext *ctx)
+{
+ /* For now, just set the _Enabled (really enabled) flags.
+ * In the future we may have to check other state to be sure we really
+ * have a runable program or shader.
+ */
+ ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
+ && ctx->VertexProgram.Current->Instructions;
+ ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
+ && ctx->FragmentProgram.Current->Instructions;
+}
+
+
+/*
+ * If __GLcontextRec::NewState is non-zero then this function \b must be called
+ * before rendering any primitive. Basically, function pointers and
+ * miscellaneous flags are updated to reflect the current state of the state
+ * machine.
+ *
+ * Calls dd_function_table::UpdateState to perform any internal state management
+ * necessary.
+ *
+ * \sa _mesa_update_modelview_project(), _mesa_update_texture(),
+ * _mesa_update_buffers(), _mesa_update_polygon(), _mesa_update_lighting() and
+ * _mesa_update_tnl_spaces().
+ */
+void _mesa_update_state( GLcontext *ctx )
+{
+ GLuint new_state = ctx->NewState;
+
+ if (MESA_VERBOSE & VERBOSE_STATE)
+ _mesa_print_state("_mesa_update_state", new_state);
+
+ if (new_state & _NEW_PROGRAM)
+ update_program( ctx );
+
+ if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
+ _mesa_update_modelview_project( ctx, new_state );
+
+ if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
+ _mesa_update_texture( ctx, new_state );
+
+ if (new_state & (_NEW_SCISSOR|_NEW_BUFFERS))
+ _mesa_update_buffers( ctx );
+
+ if (new_state & _NEW_POLYGON)
+ _mesa_update_polygon( ctx );
+
+ if (new_state & _NEW_LIGHT)
+ _mesa_update_lighting( ctx );
+
+ if (new_state & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_pixel( ctx, new_state );
+
+ if (new_state & _DD_NEW_SEPARATE_SPECULAR)
+ update_separate_specular( ctx );
+
+ if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
+ update_arrays( ctx );
+
+ /* ctx->_NeedEyeCoords is now up to date.
+ *
+ * If the truth value of this variable has changed, update for the
+ * new lighting space and recompute the positions of lights and the
+ * normal transform.
+ *
+ * If the lighting space hasn't changed, may still need to recompute
+ * light positions & normal transforms for other reasons.
+ */
+ if (new_state & _MESA_NEW_NEED_EYE_COORDS)
+ _mesa_update_tnl_spaces( ctx, new_state );
+
+ /*
+ * Give the driver a chance to act upon the new_state flags.
+ * The driver might plug in different span functions, for example.
+ * Also, this is where the driver can invalidate the state of any
+ * active modules (such as swrast_setup, swrast, tnl, etc).
+ *
+ * Set ctx->NewState to zero to avoid recursion if
+ * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
+ */
+ new_state = ctx->NewState;
+ ctx->NewState = 0;
+ ctx->Driver.UpdateState(ctx, new_state);
+ ctx->Array.NewState = 0;
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/state.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/state.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/state.h Thu Apr 8 05:17:49 2004
@@ -0,0 +1,46 @@
+/**
+ * \file state.h
+ * State management.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef STATE_H
+#define STATE_H
+
+#include "mtypes.h"
+
+extern void
+_mesa_init_no_op_table(struct _glapi_table *exec, GLuint tableSize);
+
+extern void
+_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize);
+
+extern void
+_mesa_update_state( GLcontext *ctx );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/stencil.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/stencil.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/stencil.c Thu Apr 8 05:17:50 2004
@@ -0,0 +1,296 @@
+/**
+ * \file stencil.c
+ * Stencil operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "depth.h"
+#include "macros.h"
+#include "stencil.h"
+#include "mtypes.h"
+#include "enable.h"
+
+
+/**
+ * Set the clear value for the stencil buffer.
+ *
+ * \param s clear value.
+ *
+ * \sa glClearStencil().
+ *
+ * Updates gl_stencil_attrib::Clear. On change
+ * flushes the vertices and notifies the driver via
+ * the dd_function_table::ClearStencil callback.
+ */
+void GLAPIENTRY
+_mesa_ClearStencil( GLint s )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Stencil.Clear == (GLstencil) s)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.Clear = (GLstencil) s;
+
+ if (ctx->Driver.ClearStencil) {
+ (*ctx->Driver.ClearStencil)( ctx, s );
+ }
+}
+
+
+/**
+ * Set the function and reference value for stencil testing.
+ *
+ * \param func test function.
+ * \param ref reference value.
+ * \param mask bitmask.
+ *
+ * \sa glStencilFunc().
+ *
+ * Verifies the parameters and updates the respective values in
+ * __GLcontextRec::Stencil. On change flushes the vertices and notifies the
+ * driver via the dd_function_table::StencilFunc callback.
+ */
+void GLAPIENTRY
+_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const GLint face = ctx->Stencil.ActiveFace;
+ GLint maxref;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (func) {
+ case GL_NEVER:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_GREATER:
+ case GL_GEQUAL:
+ case GL_EQUAL:
+ case GL_NOTEQUAL:
+ case GL_ALWAYS:
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFunc" );
+ return;
+ }
+
+ maxref = (1 << STENCIL_BITS) - 1;
+ ref = (GLstencil) CLAMP( ref, 0, maxref );
+
+ if (ctx->Stencil.Function[face] == func &&
+ ctx->Stencil.ValueMask[face] == (GLstencil) mask &&
+ ctx->Stencil.Ref[face] == ref)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.Function[face] = func;
+ ctx->Stencil.Ref[face] = ref;
+ ctx->Stencil.ValueMask[face] = (GLstencil) mask;
+
+ if (ctx->Driver.StencilFunc) {
+ (*ctx->Driver.StencilFunc)( ctx, func, ref, mask );
+ }
+}
+
+
+/**
+ * Set the stencil writing mask.
+ *
+ * \param mask bit-mask to enable/disable writing of individual bits in the
+ * stencil planes.
+ *
+ * \sa glStencilMask().
+ *
+ * Updates gl_stencil_attrib::WriteMask. On change flushes the vertices and
+ * notifies the driver via the dd_function_table::StencilMask callback.
+ */
+void GLAPIENTRY
+_mesa_StencilMask( GLuint mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const GLint face = ctx->Stencil.ActiveFace;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Stencil.WriteMask[face] == (GLstencil) mask)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.WriteMask[face] = (GLstencil) mask;
+
+ if (ctx->Driver.StencilMask) {
+ (*ctx->Driver.StencilMask)( ctx, mask );
+ }
+}
+
+
+/**
+ * Set the stencil test actions.
+ *
+ * \param fail action to take when stencil test fails.
+ * \param zfail action to take when stencil test passes, but the depth test fails.
+ * \param zpass action to take when stencil test passes and the depth test
+ * passes (or depth testing is not enabled).
+ *
+ * \sa glStencilOp().
+ *
+ * Verifies the parameters and updates the respective fields in
+ * __GLcontextRec::Stencil. On change flushes the vertices and notifies the
+ * driver via the dd_function_table::StencilOp callback.
+ */
+void GLAPIENTRY
+_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const GLint face = ctx->Stencil.ActiveFace;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (fail) {
+ case GL_KEEP:
+ case GL_ZERO:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ break;
+ case GL_INCR_WRAP_EXT:
+ case GL_DECR_WRAP_EXT:
+ if (ctx->Extensions.EXT_stencil_wrap) {
+ break;
+ }
+ /* FALL-THROUGH */
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp");
+ return;
+ }
+ switch (zfail) {
+ case GL_KEEP:
+ case GL_ZERO:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ break;
+ case GL_INCR_WRAP_EXT:
+ case GL_DECR_WRAP_EXT:
+ if (ctx->Extensions.EXT_stencil_wrap) {
+ break;
+ }
+ /* FALL-THROUGH */
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp");
+ return;
+ }
+ switch (zpass) {
+ case GL_KEEP:
+ case GL_ZERO:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ break;
+ case GL_INCR_WRAP_EXT:
+ case GL_DECR_WRAP_EXT:
+ if (ctx->Extensions.EXT_stencil_wrap) {
+ break;
+ }
+ /* FALL-THROUGH */
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp");
+ return;
+ }
+
+ if (ctx->Stencil.ZFailFunc[face] == zfail &&
+ ctx->Stencil.ZPassFunc[face] == zpass &&
+ ctx->Stencil.FailFunc[face] == fail)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.ZFailFunc[face] = zfail;
+ ctx->Stencil.ZPassFunc[face] = zpass;
+ ctx->Stencil.FailFunc[face] = fail;
+
+ if (ctx->Driver.StencilOp) {
+ (*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass);
+ }
+}
+
+
+#if _HAVE_FULL_GL
+/* GL_EXT_stencil_two_side */
+void GLAPIENTRY
+_mesa_ActiveStencilFaceEXT(GLenum face)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (face == GL_FRONT || face == GL_BACK) {
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 1;
+ }
+
+ if (ctx->Driver.ActiveStencilFace) {
+ (*ctx->Driver.ActiveStencilFace)( ctx, (GLuint) ctx->Stencil.ActiveFace );
+ }
+}
+#endif
+
+
+/**
+ * Initialize the context stipple state.
+ *
+ * \param ctx GL context.
+ *
+ * Initializes __GLcontextRec::Stencil attribute group.
+ */
+void _mesa_init_stencil( GLcontext * ctx )
+{
+
+ /* Stencil group */
+ ctx->Stencil.Enabled = GL_FALSE;
+ ctx->Stencil.TestTwoSide = GL_FALSE;
+ ctx->Stencil.ActiveFace = 0; /* 0 = GL_FRONT, 1 = GL_BACK */
+ ctx->Stencil.Function[0] = GL_ALWAYS;
+ ctx->Stencil.Function[1] = GL_ALWAYS;
+ ctx->Stencil.FailFunc[0] = GL_KEEP;
+ ctx->Stencil.FailFunc[1] = GL_KEEP;
+ ctx->Stencil.ZPassFunc[0] = GL_KEEP;
+ ctx->Stencil.ZPassFunc[1] = GL_KEEP;
+ ctx->Stencil.ZFailFunc[0] = GL_KEEP;
+ ctx->Stencil.ZFailFunc[1] = GL_KEEP;
+ ctx->Stencil.Ref[0] = 0;
+ ctx->Stencil.Ref[1] = 0;
+ ctx->Stencil.ValueMask[0] = STENCIL_MAX;
+ ctx->Stencil.ValueMask[1] = STENCIL_MAX;
+ ctx->Stencil.WriteMask[0] = STENCIL_MAX;
+ ctx->Stencil.WriteMask[1] = STENCIL_MAX;
+ ctx->Stencil.Clear = 0;
+}
Index: xc/extras/Mesa/src/mesa/main/stencil.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/stencil.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/stencil.h Thu Apr 8 05:17:50 2004
@@ -0,0 +1,61 @@
+/**
+ * \file stencil.h
+ * Stencil operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef STENCIL_H
+#define STENCIL_H
+
+
+#include "mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_ClearStencil( GLint s );
+
+
+extern void GLAPIENTRY
+_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask );
+
+
+extern void GLAPIENTRY
+_mesa_StencilMask( GLuint mask );
+
+
+extern void GLAPIENTRY
+_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass );
+
+
+extern void GLAPIENTRY
+_mesa_ActiveStencilFaceEXT(GLenum face);
+
+
+extern void
+_mesa_init_stencil( GLcontext * ctx );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/texcompress.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texcompress.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texcompress.c Fri Dec 10 10:05:17 2004
@@ -0,0 +1,254 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texcompress.c
+ * Helper functions for texture compression.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "context.h"
+#include "image.h"
+#include "texcompress.h"
+#include "texformat.h"
+#include "texstore.h"
+
+/**
+ * Get the list of supported internal compression formats.
+ *
+ * \param ctx GL context.
+ * \param formats the resulting format list (may be NULL).
+ *
+ * \return number of formats.
+ */
+GLuint
+_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats )
+{
+ GLuint n = 0;
+ if (ctx->Extensions.ARB_texture_compression) {
+ if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+ if (formats) {
+ formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX;
+ formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX;
+ }
+ else {
+ n += 2;
+ }
+ }
+ if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ if (formats) {
+ formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+ /* Skip this one because it has a restriction (all transparent
+ * pixels become black). See the texture compressions spec for
+ * a detailed explanation. This is what NVIDIA does.
+ formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
+ */
+ formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
+ formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
+ }
+ else {
+ n += 3;
+ }
+ }
+ if (ctx->Extensions.S3_s3tc) {
+ if (formats) {
+ formats[n++] = GL_RGB_S3TC;
+ formats[n++] = GL_RGB4_S3TC;
+ formats[n++] = GL_RGBA_S3TC;
+ formats[n++] = GL_RGBA4_S3TC;
+ }
+ else {
+ n += 4;
+ }
+ }
+ }
+ return n;
+}
+
+
+
+/**
+ * Return number of bytes needed to store a texture of the given size
+ * using the specified compressed format.
+ * This is called via the ctx->Driver.CompressedTextureSize function,
+ * unless a device driver overrides it.
+ *
+ * \param width texture width in texels.
+ * \param height texture height in texels.
+ * \param depth texture depth in texels.
+ * \param format - one of the specific compressed texture formats
+ *
+ * \return size in bytes, or zero if bad format
+ */
+GLuint
+_mesa_compressed_texture_size( GLcontext *ctx,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format )
+{
+ GLuint size;
+
+ ASSERT(depth == 1);
+ (void) depth;
+
+ switch (format) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ /* round up width to next multiple of 8, height to next multiple of 4 */
+ width = (width + 7) & ~7;
+ height = (height + 3) & ~3;
+ /* 16 bytes per 8x4 tile of RGB[A] texels */
+ size = width * height / 2;
+ /* Textures smaller than 8x4 will effectively be made into 8x4 and
+ * take 16 bytes.
+ */
+ if (size < 16)
+ size = 16;
+ return size;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ /* round up width, height to next multiple of 4 */
+ width = (width + 3) & ~3;
+ height = (height + 3) & ~3;
+ /* 8 bytes per 4x4 tile of RGB[A] texels */
+ size = width * height / 2;
+ /* Textures smaller than 4x4 will effectively be made into 4x4 and
+ * take 8 bytes.
+ */
+ if (size < 8)
+ size = 8;
+ return size;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ /* round up width, height to next multiple of 4 */
+ width = (width + 3) & ~3;
+ height = (height + 3) & ~3;
+ /* 16 bytes per 4x4 tile of RGBA texels */
+ size = width * height; /* simple! */
+ /* Textures smaller than 4x4 will effectively be made into 4x4 and
+ * take 16 bytes.
+ */
+ if (size < 16)
+ size = 16;
+ return size;
+ default:
+ _mesa_problem(ctx, "bad texformat in compressed_texture_size");
+ return 0;
+ }
+}
+
+
+/*
+ * Compute the bytes per row in a compressed texture image.
+ * We use this for computing the destination address for sub-texture updates.
+ * \param format one of the specific texture compression formats
+ * \param width image width in pixels
+ * \return stride, in bytes, between rows for compressed image
+ */
+GLint
+_mesa_compressed_row_stride(GLenum format, GLsizei width)
+{
+ GLint stride;
+
+ switch (format) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */
+ break;
+ default:
+ return 0;
+ }
+
+ return stride;
+}
+
+
+/*
+ * Return the address of the pixel at (col, row, img) in a
+ * compressed texture image.
+ * \param col, row, img - image position (3D)
+ * \param format - compressed image format
+ * \param width - image width
+ * \param image - the image address
+ * \return address of pixel at (row, col)
+ */
+GLubyte *
+_mesa_compressed_image_address(GLint col, GLint row, GLint img,
+ GLenum format,
+ GLsizei width, const GLubyte *image)
+{
+ GLubyte *addr;
+
+ (void) img;
+
+ /* We try to spot a "complete" subtexture "above" ROW, COL;
+ * this texture is given by appropriate rounding of WIDTH x ROW.
+ * Then we just add the amount left (usually on the left).
+ *
+ * Example for X*Y microtiles (Z bytes each)
+ * offset = Z * (((width + X - 1) / X) * (row / Y) + col / X);
+ */
+
+ switch (format) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8);
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4);
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4);
+ break;
+ default:
+ return 0;
+ }
+
+ return addr;
+}
Index: xc/extras/Mesa/src/mesa/main/texcompress.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texcompress.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texcompress.h Fri Dec 10 10:05:17 2004
@@ -0,0 +1,65 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef TEXCOMPRESS_H
+#define TEXCOMPRESS_H
+
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+extern GLuint
+_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats );
+
+extern GLuint
+_mesa_compressed_texture_size( GLcontext *ctx,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format );
+
+extern GLint
+_mesa_compressed_row_stride(GLenum format, GLsizei width);
+
+
+extern GLubyte *
+_mesa_compressed_image_address(GLint col, GLint row, GLint img,
+ GLenum format,
+ GLsizei width, const GLubyte *image);
+
+
+extern void
+_mesa_init_texture_s3tc( GLcontext *ctx );
+
+extern void
+_mesa_init_texture_fxt1( GLcontext *ctx );
+
+
+
+#else
+#define _mesa_get_compressed_formats( c, f ) 0
+#define _mesa_compressed_texture_size( c, w, h, d, f ) 0
+#define _mesa_compressed_row_stride( f, w) 0
+#define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0
+#define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0)
+#endif
+
+#endif /* TEXCOMPRESS_H */
Index: xc/extras/Mesa/src/mesa/main/texcompress_fxt1.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texcompress_fxt1.c:1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texcompress_fxt1.c Fri Dec 17 11:38:03 2004
@@ -0,0 +1,1774 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/main/texcompress_fxt1.c,v 1.2 2004/12/17 16:38:03 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texcompress_fxt1.c
+ * GL_EXT_texture_compression_fxt1 support.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "context.h"
+#include "convolve.h"
+#include "image.h"
+#include "texcompress.h"
+#include "texformat.h"
+#include "texstore.h"
+
+
+int
+fxt1_encode (GLcontext *ctx,
+ unsigned int width, unsigned int height,
+ int srcFormat,
+ const void *source, int srcRowStride,
+ void *dest, int destRowStride);
+void
+fxt1_decode_1 (const void *texture, int width,
+ int i, int j, unsigned char *rgba);
+
+
+/**
+ * Called during context initialization.
+ */
+void
+_mesa_init_texture_fxt1( GLcontext *ctx )
+{
+ (void) ctx;
+}
+
+
+/**
+ * Called via TexFormat->StoreImage to store an RGB_FXT1 texture.
+ */
+static GLboolean
+texstore_rgb_fxt1(STORE_PARAMS)
+{
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == &_mesa_texformat_rgb_fxt1);
+ ASSERT(dstXoffset % 8 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset == 0);
+ (void) dstZoffset; (void) dstImageStride;
+
+ if (srcFormat != GL_RGB ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGB/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ pixels = tempImage;
+ srcRowStride = 3 * srcWidth;
+ srcFormat = GL_RGB;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ GL_COMPRESSED_RGB_FXT1_3DFX,
+ texWidth, (GLubyte *) dstAddr);
+
+ fxt1_encode(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
+ dst, dstRowStride);
+
+ if (tempImage)
+ _mesa_free((void*) tempImage);
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Called via TexFormat->StoreImage to store an RGBA_FXT1 texture.
+ */
+static GLboolean
+texstore_rgba_fxt1(STORE_PARAMS)
+{
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == &_mesa_texformat_rgba_fxt1);
+ ASSERT(dstXoffset % 8 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset == 0);
+ (void) dstZoffset; (void) dstImageStride;
+
+ if (srcFormat != GL_RGBA ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGBA/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ pixels = tempImage;
+ srcRowStride = 4 * srcWidth;
+ srcFormat = GL_RGBA;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ GL_COMPRESSED_RGBA_FXT1_3DFX,
+ texWidth, (GLubyte *) dstAddr);
+
+ fxt1_encode(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
+ dst, dstRowStride);
+
+ if (tempImage)
+ _mesa_free((void*) tempImage);
+
+ return GL_TRUE;
+}
+
+
+static void
+fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ (void) k;
+ fxt1_decode_1(texImage->Data, texImage->Width, i, j, texel);
+}
+
+
+static void
+fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ (void) k;
+ fxt1_decode_1(texImage->Data, texImage->Width, i, j, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
+}
+
+
+static void
+fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ (void) k;
+ fxt1_decode_1(texImage->Data, texImage->Width, i, j, texel);
+ texel[ACOMP] = 255;
+}
+
+
+static void
+fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ (void) k;
+ fxt1_decode_1(texImage->Data, texImage->Width, i, j, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = 1.0;
+}
+
+
+
+const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
+ MESA_FORMAT_RGB_FXT1, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /*approx*/ /* RedBits */
+ 4, /*approx*/ /* GreenBits */
+ 4, /*approx*/ /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* TexelBytes */
+ texstore_rgb_fxt1, /* StoreTexImageFunc */
+ NULL, /*impossible*/ /* FetchTexel1D */
+ fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */
+ NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
+ MESA_FORMAT_RGBA_FXT1, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /*approx*/ /* RedBits */
+ 4, /*approx*/ /* GreenBits */
+ 4, /*approx*/ /* BlueBits */
+ 1, /*approx*/ /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* TexelBytes */
+ texstore_rgba_fxt1, /* StoreTexImageFunc */
+ NULL, /*impossible*/ /* FetchTexel1D */
+ fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */
+ NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
+};
+
+
+/***************************************************************************\
+ * FXT1 encoder
+ *
+ * The encoder was built by reversing the decoder,
+ * and is vaguely based on Texus2 by 3dfx. Note that this code
+ * is merely a proof of concept, since it is higly UNoptimized;
+ * moreover, it is sub-optimal due to inital conditions passed
+ * to Lloyd's algorithm (the interpolation modes are worse).
+\***************************************************************************/
+
+
+#define MAX_COMP 4 /* ever needed maximum number of components in texel */
+#define MAX_VECT 4 /* ever needed maximum number of base vectors to find */
+#define N_TEXELS 32 /* number of texels in a block (always 32) */
+#define LL_N_REP 50 /* number of iterations in lloyd's vq */
+#define LL_RMS_D 10 /* fault tolerance (maximum delta) */
+#define LL_RMS_E 255 /* fault tolerance (maximum error) */
+#define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */
+#define ISTBLACK(v) (*((unsigned long *)(v)) == 0)
+
+
+#ifdef __GNUC__
+
+#define FX64_NATIVE 1
+
+typedef unsigned long long Fx64;
+
+#define FX64_MOV32(a, b) a = b
+#define FX64_OR32(a, b) a |= b
+#define FX64_SHL(a, c) a <<= c
+
+#else /* !__GNUC__ */
+
+#define FX64_NATIVE 0
+
+typedef struct {
+ unsigned lo, hi;
+} Fx64;
+
+#define FX64_MOV32(a, b) a.lo = b
+#define FX64_OR32(a, b) a.lo |= b
+
+/* Works only for c < 32, but that's all that's needed here... */
+#define FX64_SHL(a, c) \
+ do { \
+ a.hi = (a.hi << (c)) | (a.lo >> (32 - (c))); \
+ a.lo <<= (c); \
+ } while (0)
+
+#endif /* !__GNUC__ */
+
+
+static int
+fxt1_bestcol (float vec[][MAX_COMP], int nv,
+ unsigned char input[MAX_COMP], int nc)
+{
+ int i, j, best = -1;
+ float err = 1e9; /* big enough */
+
+ for (j = 0; j < nv; j++) {
+ float e = 0;
+ for (i = 0; i < nc; i++) {
+ e += (vec[j][i] - input[i]) * (vec[j][i] - input[i]);
+ }
+ if (e < err) {
+ err = e;
+ best = j;
+ }
+ }
+
+ return best;
+}
+
+
+static int
+fxt1_worst (float vec[MAX_COMP],
+ unsigned char input[N_TEXELS][MAX_COMP], int nc, int n)
+{
+ int i, k, worst = -1;
+ float err = -1; /* small enough */
+
+ for (k = 0; k < n; k++) {
+ float e = 0;
+ for (i = 0; i < nc; i++) {
+ e += (vec[i] - input[k][i]) * (vec[i] - input[k][i]);
+ }
+ if (e > err) {
+ err = e;
+ worst = k;
+ }
+ }
+
+ return worst;
+}
+
+
+static int
+fxt1_variance (double variance[MAX_COMP],
+ unsigned char input[N_TEXELS][MAX_COMP], int nc, int n)
+{
+ int i, k, best = 0;
+ int sx, sx2;
+ double var, maxvar = -1; /* small enough */
+ double teenth = 1.0 / n;
+
+ for (i = 0; i < nc; i++) {
+ sx = sx2 = 0;
+ for (k = 0; k < n; k++) {
+ int t = input[k][i];
+ sx += t;
+ sx2 += t * t;
+ }
+ var = sx2 * teenth - sx * sx * teenth * teenth;
+ if (maxvar < var) {
+ maxvar = var;
+ best = i;
+ }
+ if (variance) {
+ variance[i] = var;
+ }
+ }
+
+ return best;
+}
+
+
+static int
+fxt1_choose (float vec[][MAX_COMP], int nv,
+ unsigned char input[N_TEXELS][MAX_COMP], int nc, int n)
+{
+#if 0
+ /* Choose colors from a grid.
+ */
+ int i, j;
+
+ for (j = 0; j < nv; j++) {
+ int m = j * (n - 1) / (nv - 1);
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = input[m][i];
+ }
+ }
+#else
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 8x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ int i, j, k;
+ int minSum = 1000; /* big enough */
+ int maxSum = -1; /* small enough */
+ int minCol = 0; /* phoudoin: silent compiler! */
+ int maxCol = 0; /* phoudoin: silent compiler! */
+
+ struct {
+ int flag;
+ int key;
+ int freq;
+ int idx;
+ } hist[N_TEXELS];
+ int lenh = 0;
+
+ memset(hist, 0, sizeof(hist));
+
+ for (k = 0; k < n; k++) {
+ int l;
+ int key = 0;
+ int sum = 0;
+ for (i = 0; i < nc; i++) {
+ key <<= 8;
+ key |= input[k][i];
+ sum += input[k][i];
+ }
+ for (l = 0; l < n; l++) {
+ if (!hist[l].flag) {
+ /* alloc new slot */
+ hist[l].flag = !0;
+ hist[l].key = key;
+ hist[l].freq = 1;
+ hist[l].idx = k;
+ lenh = l + 1;
+ break;
+ } else if (hist[l].key == key) {
+ hist[l].freq++;
+ break;
+ }
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minCol = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxCol = k;
+ }
+ }
+
+ if (lenh <= nv) {
+ for (j = 0; j < lenh; j++) {
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = (float)input[hist[j].idx][i];
+ }
+ }
+ for (; j < nv; j++) {
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = vec[0][i];
+ }
+ }
+ return 0;
+ }
+
+ for (j = 0; j < nv; j++) {
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = ((nv - 1 - j) * input[minCol][i] + j * input[maxCol][i] + (nv - 1) / 2) / (nv - 1);
+ }
+ }
+#endif
+
+ return !0;
+}
+
+
+static int
+fxt1_lloyd (float vec[][MAX_COMP], int nv,
+ unsigned char input[N_TEXELS][MAX_COMP], int nc, int n)
+{
+ /* Use the generalized lloyd's algorithm for VQ:
+ * find 4 color vectors.
+ *
+ * for each sample color
+ * sort to nearest vector.
+ *
+ * replace each vector with the centroid of it's matching colors.
+ *
+ * repeat until RMS doesn't improve.
+ *
+ * if a color vector has no samples, or becomes the same as another
+ * vector, replace it with the color which is farthest from a sample.
+ *
+ * vec[][MAX_COMP] initial vectors and resulting colors
+ * nv number of resulting colors required
+ * input[N_TEXELS][MAX_COMP] input texels
+ * nc number of components in input / vec
+ * n number of input samples
+ */
+
+ int sum[MAX_VECT][MAX_COMP]; /* used to accumulate closest texels */
+ int cnt[MAX_VECT]; /* how many times a certain vector was chosen */
+ float error, lasterror = 1e9;
+
+ int i, j, k, rep;
+
+ /* the quantizer */
+ for (rep = 0; rep < LL_N_REP; rep++) {
+ /* reset sums & counters */
+ for (j = 0; j < nv; j++) {
+ for (i = 0; i < nc; i++) {
+ sum[j][i] = 0;
+ }
+ cnt[j] = 0;
+ }
+ error = 0;
+
+ /* scan whole block */
+ for (k = 0; k < n; k++) {
+#if 1
+ int best = -1;
+ float err = 1e9; /* big enough */
+ /* determine best vector */
+ for (j = 0; j < nv; j++) {
+ float e = (vec[j][0] - input[k][0]) * (vec[j][0] - input[k][0]) +
+ (vec[j][1] - input[k][1]) * (vec[j][1] - input[k][1]) +
+ (vec[j][2] - input[k][2]) * (vec[j][2] - input[k][2]);
+ if (nc == 4) {
+ e += (vec[j][3] - input[k][3]) * (vec[j][3] - input[k][3]);
+ }
+ if (e < err) {
+ err = e;
+ best = j;
+ }
+ }
+#else
+ int best = fxt1_bestcol(vec, n_vect, input[k], n_comp, &err);
+#endif
+ /* add in closest color */
+ for (i = 0; i < nc; i++) {
+ sum[best][i] += input[k][i];
+ }
+ /* mark this vector as used */
+ cnt[best]++;
+ /* accumulate error */
+ error += err;
+ }
+
+ /* check RMS */
+ if ((error < LL_RMS_E) ||
+ ((error < lasterror) && ((lasterror - error) < LL_RMS_D))) {
+ return !0; /* good match */
+ }
+ lasterror = error;
+
+ /* move each vector to the barycenter of its closest colors */
+ for (j = 0; j < nv; j++) {
+ if (cnt[j]) {
+ float div = 1.0 / cnt[j];
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = div * sum[j][i];
+ }
+ } else {
+ /* this vec has no samples or is identical with a previous vec */
+ int worst = fxt1_worst(vec[j], input, nc, n);
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = input[worst][i];
+ }
+ }
+ }
+ }
+
+ return 0; /* could not converge fast enough */
+}
+
+
+static void
+fxt1_quantize_CHROMA (unsigned long *cc,
+ unsigned char input[N_TEXELS][MAX_COMP])
+{
+ const int n_vect = 4; /* 4 base vectors to find */
+ const int n_comp = 3; /* 3 components: R, G, B */
+ float vec[MAX_VECT][MAX_COMP];
+ int i, j, k;
+ Fx64 hi; /* high quadword */
+ unsigned long lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ if (fxt1_choose(vec, n_vect, input, n_comp, N_TEXELS) != 0) {
+ fxt1_lloyd(vec, n_vect, input, n_comp, N_TEXELS);
+ }
+
+ FX64_MOV32(hi, 4); /* cc-chroma = "010" + unused bit */
+ for (j = n_vect - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (unsigned int)(vec[j][i] / 8.0));
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+
+ lohi = lolo = 0;
+ /* right microtile */
+ for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
+ lohi <<= 2;
+ lohi |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
+ }
+ /* left microtile */
+ for (; k >= 0; k--) {
+ lolo <<= 2;
+ lolo |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
+ }
+ cc[1] = lohi;
+ cc[0] = lolo;
+}
+
+
+static void
+fxt1_quantize_ALPHA0 (unsigned long *cc,
+ unsigned char input[N_TEXELS][MAX_COMP],
+ unsigned char reord[N_TEXELS][MAX_COMP], int n)
+{
+ const int n_vect = 3; /* 3 base vectors to find */
+ const int n_comp = 4; /* 4 components: R, G, B, A */
+ float vec[MAX_VECT][MAX_COMP];
+ int i, j, k;
+ Fx64 hi; /* high quadword */
+ unsigned long lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ /* the last vector indicates zero */
+ for (i = 0; i < n_comp; i++) {
+ vec[n_vect][i] = 0;
+ }
+
+ /* the first n texels in reord are guaranteed to be non-zero */
+ if (fxt1_choose(vec, n_vect, reord, n_comp, n) != 0) {
+ fxt1_lloyd(vec, n_vect, reord, n_comp, n);
+ }
+
+ FX64_MOV32(hi, 6); /* alpha = "011" + lerp = 0 */
+ for (j = n_vect - 1; j >= 0; j--) {
+ /* add in alphas */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (unsigned int)(vec[j][ACOMP] / 8.0));
+ }
+ for (j = n_vect - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp - 1; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (unsigned int)(vec[j][i] / 8.0));
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+
+ lohi = lolo = 0;
+ /* right microtile */
+ for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
+ lohi <<= 2;
+ lohi |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
+ }
+ /* left microtile */
+ for (; k >= 0; k--) {
+ lolo <<= 2;
+ lolo |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
+ }
+ cc[1] = lohi;
+ cc[0] = lolo;
+}
+
+
+static void
+fxt1_quantize_ALPHA1 (unsigned long *cc,
+ unsigned char input[N_TEXELS][MAX_COMP])
+{
+ const int n_vect = 3; /* highest vector number in each microtile */
+ const int n_comp = 4; /* 4 components: R, G, B, A */
+ float vec[1 + 1 + 1][MAX_COMP]; /* 1.5 extrema for each sub-block */
+ float b, iv[MAX_COMP]; /* interpolation vector */
+ int i, j, k;
+ Fx64 hi; /* high quadword */
+ unsigned long lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ int minSum;
+ int maxSum;
+ int minColL = 0, maxColL = 0;
+ int minColR = 0, maxColR = 0;
+ int sumL = 0, sumR = 0;
+
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 4x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ minSum = 1000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ int sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColL = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColL = k;
+ }
+ sumL += sum;
+ }
+ minSum = 1000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (; k < N_TEXELS; k++) {
+ int sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColR = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColR = k;
+ }
+ sumR += sum;
+ }
+
+ /* choose the common vector (yuck!) */
+{
+ int j1, j2;
+ int v1 = 0, v2 = 0;
+ float err = 1e9; /* big enough */
+ float tv[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
+ for (i = 0; i < n_comp; i++) {
+ tv[0][i] = input[minColL][i];
+ tv[1][i] = input[maxColL][i];
+ tv[2][i] = input[minColR][i];
+ tv[3][i] = input[maxColR][i];
+ }
+ for (j1 = 0; j1 < 2; j1++) {
+ for (j2 = 2; j2 < 4; j2++) {
+ float e = 0;
+ for (i = 0; i < n_comp; i++) {
+ e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] - tv[j2][i]);
+ }
+ if (e < err) {
+ err = e;
+ v1 = j1;
+ v2 = j2;
+ }
+ }
+ }
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = tv[1 - v1][i];
+ vec[1][i] = (tv[v1][i] * sumL + tv[v2][i] * sumR) / (sumL + sumR);
+ vec[2][i] = tv[5 - v2][i];
+ }
+}
+
+ /* left microtile */
+ cc[0] = 0;
+ if (minColL != maxColL) {
+ /* compute interpolation vector */
+ float d2 = 0;
+ float rd2;
+
+ for (i = 0; i < n_comp; i++) {
+ iv[i] = vec[1][i] - vec[0][i];
+ d2 += iv[i] * iv[i];
+ }
+ rd2 = (float)n_vect / d2;
+ b = 0;
+ for (i = 0; i < n_comp; i++) {
+ b -= iv[i] * vec[0][i];
+ iv[i] *= rd2;
+ }
+ b = b * rd2 + 0.5f;
+
+ /* add in texels */
+ lolo = 0;
+ for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
+ int texel;
+ /* interpolate color */
+ float dot = 0;
+ for (i = 0; i < n_comp; i++) {
+ dot += input[k][i] * iv[i];
+ }
+ texel = (int)(dot + b);
+ if (texel < 0) {
+ texel = 0;
+ } else if (texel > n_vect) {
+ texel = n_vect;
+ }
+ /* add in texel */
+ lolo <<= 2;
+ lolo |= texel;
+ }
+
+ cc[0] = lolo;
+ }
+
+ /* right microtile */
+ cc[1] = 0;
+ if (minColR != maxColR) {
+ /* compute interpolation vector */
+ float d2 = 0;
+ float rd2;
+
+ for (i = 0; i < n_comp; i++) {
+ iv[i] = vec[1][i] - vec[2][i];
+ d2 += iv[i] * iv[i];
+ }
+ rd2 = (float)n_vect / d2;
+ b = 0;
+ for (i = 0; i < n_comp; i++) {
+ b -= iv[i] * vec[2][i];
+ iv[i] *= rd2;
+ }
+ b = b * rd2 + 0.5f;
+
+ /* add in texels */
+ lohi = 0;
+ for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
+ int texel;
+ /* interpolate color */
+ float dot = 0;
+ for (i = 0; i < n_comp; i++) {
+ dot += input[k][i] * iv[i];
+ }
+ texel = (int)(dot + b);
+ if (texel < 0) {
+ texel = 0;
+ } else if (texel > n_vect) {
+ texel = n_vect;
+ }
+ /* add in texel */
+ lohi <<= 2;
+ lohi |= texel;
+ }
+
+ cc[1] = lohi;
+ }
+
+ FX64_MOV32(hi, 7); /* alpha = "011" + lerp = 1 */
+ for (j = n_vect - 1; j >= 0; j--) {
+ /* add in alphas */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (unsigned int)(vec[j][ACOMP] / 8.0));
+ }
+ for (j = n_vect - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp - 1; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (unsigned int)(vec[j][i] / 8.0));
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+}
+
+
+static void
+fxt1_quantize_HI (unsigned long *cc,
+ unsigned char input[N_TEXELS][MAX_COMP],
+ unsigned char reord[N_TEXELS][MAX_COMP], int n)
+{
+ const int n_vect = 6; /* highest vector number */
+ const int n_comp = 3; /* 3 components: R, G, B */
+ float b = 0.0; /* phoudoin: silent compiler! */
+ float iv[MAX_COMP]; /* interpolation vector */
+ int i, k;
+ unsigned long hihi; /* high quadword: hi dword */
+
+ int minSum = 1000; /* big enough */
+ int maxSum = -1; /* small enough */
+ int minCol = 0; /* phoudoin: silent compiler! */
+ int maxCol = 0; /* phoudoin: silent compiler! */
+
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 8x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ for (k = 0; k < n; k++) {
+ int sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += reord[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minCol = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxCol = k;
+ }
+ }
+
+ hihi = 0; /* cc-hi = "00" */
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ hihi <<= 5;
+ hihi |= reord[maxCol][i] >> 3;
+ }
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ hihi <<= 5;
+ hihi |= reord[minCol][i] >> 3;
+ }
+ cc[3] = hihi;
+ cc[0] = cc[1] = cc[2] = 0;
+
+ /* compute interpolation vector */
+ if (minCol != maxCol) {
+ float d2 = 0;
+ float rd2;
+
+ for (i = 0; i < n_comp; i++) {
+ iv[i] = reord[maxCol][i] - reord[minCol][i];
+ d2 += iv[i] * iv[i];
+ }
+ rd2 = (float)n_vect / d2;
+ b = 0;
+ for (i = 0; i < n_comp; i++) {
+ b -= iv[i] * reord[minCol][i];
+ iv[i] *= rd2;
+ }
+ b = b * rd2 + 0.5f;
+ }
+
+ /* add in texels */
+ for (k = N_TEXELS - 1; k >= 0; k--) {
+ int t = k * 3;
+ unsigned long *kk = (unsigned long *)((unsigned long)cc + t / 8);
+ int texel = n_vect + 1; /* transparent black */
+
+ if (!ISTBLACK(input[k])) {
+ if (minCol != maxCol) {
+ /* interpolate color */
+ float dot = 0;
+ for (i = 0; i < n_comp; i++) {
+ dot += input[k][i] * iv[i];
+ }
+ texel = (int)(dot + b);
+ if (texel < 0) {
+ texel = 0;
+ } else if (texel > n_vect) {
+ texel = n_vect;
+ }
+ /* add in texel */
+ kk[0] |= texel << (t & 7);
+ }
+ } else {
+ /* add in texel */
+ kk[0] |= texel << (t & 7);
+ }
+ }
+}
+
+
+static void
+fxt1_quantize_MIXED1 (unsigned long *cc,
+ unsigned char input[N_TEXELS][MAX_COMP])
+{
+ const int n_vect = 2; /* highest vector number in each microtile */
+ const int n_comp = 3; /* 3 components: R, G, B */
+ unsigned char vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
+ float b, iv[MAX_COMP]; /* interpolation vector */
+ int i, j, k;
+ Fx64 hi; /* high quadword */
+ unsigned long lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ int minSum;
+ int maxSum;
+ int minColL = 0, maxColL = -1;
+ int minColR = 0, maxColR = -1;
+
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 4x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ minSum = 1000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ if (!ISTBLACK(input[k])) {
+ int sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColL = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColL = k;
+ }
+ }
+ }
+ minSum = 1000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (; k < N_TEXELS; k++) {
+ if (!ISTBLACK(input[k])) {
+ int sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColR = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColR = k;
+ }
+ }
+ }
+
+ /* left microtile */
+ if (maxColL == -1) {
+ /* all transparent black */
+ cc[0] = -1;
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = 0;
+ vec[1][i] = 0;
+ }
+ } else {
+ cc[0] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = input[minColL][i];
+ vec[1][i] = input[maxColL][i];
+ }
+ if (minColL != maxColL) {
+ /* compute interpolation vector */
+ float d2 = 0;
+ float rd2;
+
+ for (i = 0; i < n_comp; i++) {
+ iv[i] = vec[1][i] - vec[0][i];
+ d2 += iv[i] * iv[i];
+ }
+ rd2 = (float)n_vect / d2;
+ b = 0;
+ for (i = 0; i < n_comp; i++) {
+ b -= iv[i] * vec[0][i];
+ iv[i] *= rd2;
+ }
+ b = b * rd2 + 0.5f;
+
+ /* add in texels */
+ lolo = 0;
+ for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
+ int texel = n_vect + 1; /* transparent black */
+ if (!ISTBLACK(input[k])) {
+ /* interpolate color */
+ float dot = 0;
+ for (i = 0; i < n_comp; i++) {
+ dot += input[k][i] * iv[i];
+ }
+ texel = (int)(dot + b);
+ if (texel < 0) {
+ texel = 0;
+ } else if (texel > n_vect) {
+ texel = n_vect;
+ }
+ }
+ /* add in texel */
+ lolo <<= 2;
+ lolo |= texel;
+ }
+ cc[0] = lolo;
+ }
+ }
+
+ /* right microtile */
+ if (maxColR == -1) {
+ /* all transparent black */
+ cc[1] = -1;
+ for (i = 0; i < n_comp; i++) {
+ vec[2][i] = 0;
+ vec[3][i] = 0;
+ }
+ } else {
+ cc[1] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[2][i] = input[minColR][i];
+ vec[3][i] = input[maxColR][i];
+ }
+ if (minColR != maxColR) {
+ /* compute interpolation vector */
+ float d2 = 0;
+ float rd2;
+
+ for (i = 0; i < n_comp; i++) {
+ iv[i] = vec[3][i] - vec[2][i];
+ d2 += iv[i] * iv[i];
+ }
+ rd2 = (float)n_vect / d2;
+ b = 0;
+ for (i = 0; i < n_comp; i++) {
+ b -= iv[i] * vec[2][i];
+ iv[i] *= rd2;
+ }
+ b = b * rd2 + 0.5f;
+
+ /* add in texels */
+ lohi = 0;
+ for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
+ int texel = n_vect + 1; /* transparent black */
+ if (!ISTBLACK(input[k])) {
+ /* interpolate color */
+ float dot = 0;
+ for (i = 0; i < n_comp; i++) {
+ dot += input[k][i] * iv[i];
+ }
+ texel = (int)(dot + b);
+ if (texel < 0) {
+ texel = 0;
+ } else if (texel > n_vect) {
+ texel = n_vect;
+ }
+ }
+ /* add in texel */
+ lohi <<= 2;
+ lohi |= texel;
+ }
+ cc[1] = lohi;
+ }
+ }
+
+ FX64_MOV32(hi, 9 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
+ for (j = 2 * 2 - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, vec[j][i] >> 3);
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+}
+
+
+static void
+fxt1_quantize_MIXED0 (unsigned long *cc,
+ unsigned char input[N_TEXELS][MAX_COMP])
+{
+ const int n_vect = 3; /* highest vector number in each microtile */
+ const int n_comp = 3; /* 3 components: R, G, B */
+ unsigned char vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
+ float b, iv[MAX_COMP]; /* interpolation vector */
+ int i, j, k;
+ Fx64 hi; /* high quadword */
+ unsigned long lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ int minColL = 0, maxColL = 0;
+ int minColR = 0, maxColR = 0;
+#if 0
+ int minSum;
+ int maxSum;
+
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 4x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ minSum = 1000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ int sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColL = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColL = k;
+ }
+ }
+ minSum = 1000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (; k < N_TEXELS; k++) {
+ int sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColR = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColR = k;
+ }
+ }
+#else
+ int minVal;
+ int maxVal;
+ int maxVarL = fxt1_variance(NULL, input, n_comp, N_TEXELS / 2);
+ int maxVarR = fxt1_variance(NULL, &input[N_TEXELS / 2], n_comp, N_TEXELS / 2);
+
+ /* Scan the channel with max variance for lo & hi
+ * and use those as the two representative colors.
+ */
+ minVal = 1000; /* big enough */
+ maxVal = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ int t = input[k][maxVarL];
+ if (minVal > t) {
+ minVal = t;
+ minColL = k;
+ }
+ if (maxVal < t) {
+ maxVal = t;
+ maxColL = k;
+ }
+ }
+ minVal = 1000; /* big enough */
+ maxVal = -1; /* small enough */
+ for (; k < N_TEXELS; k++) {
+ int t = input[k][maxVarR];
+ if (minVal > t) {
+ minVal = t;
+ minColR = k;
+ }
+ if (maxVal < t) {
+ maxVal = t;
+ maxColR = k;
+ }
+ }
+#endif
+
+ /* left microtile */
+ cc[0] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = input[minColL][i];
+ vec[1][i] = input[maxColL][i];
+ }
+ if (minColL != maxColL) {
+ /* compute interpolation vector */
+ float d2 = 0;
+ float rd2;
+
+ for (i = 0; i < n_comp; i++) {
+ iv[i] = vec[1][i] - vec[0][i];
+ d2 += iv[i] * iv[i];
+ }
+ rd2 = (float)n_vect / d2;
+ b = 0;
+ for (i = 0; i < n_comp; i++) {
+ b -= iv[i] * vec[0][i];
+ iv[i] *= rd2;
+ }
+ b = b * rd2 + 0.5f;
+
+ /* add in texels */
+ lolo = 0;
+ for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
+ int texel;
+ /* interpolate color */
+ float dot = 0;
+ for (i = 0; i < n_comp; i++) {
+ dot += input[k][i] * iv[i];
+ }
+ texel = (int)(dot + b);
+ if (texel < 0) {
+ texel = 0;
+ } else if (texel > n_vect) {
+ texel = n_vect;
+ }
+ /* add in texel */
+ lolo <<= 2;
+ lolo |= texel;
+ }
+
+ /* funky encoding for LSB of green */
+ if ((int)((lolo >> 1) & 1) != (((vec[1][GCOMP] ^ vec[0][GCOMP]) >> 2) & 1)) {
+ for (i = 0; i < n_comp; i++) {
+ vec[1][i] = input[minColL][i];
+ vec[0][i] = input[maxColL][i];
+ }
+ lolo = ~lolo;
+ }
+
+ cc[0] = lolo;
+ }
+
+ /* right microtile */
+ cc[1] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[2][i] = input[minColR][i];
+ vec[3][i] = input[maxColR][i];
+ }
+ if (minColR != maxColR) {
+ /* compute interpolation vector */
+ float d2 = 0;
+ float rd2;
+
+ for (i = 0; i < n_comp; i++) {
+ iv[i] = vec[3][i] - vec[2][i];
+ d2 += iv[i] * iv[i];
+ }
+ rd2 = (float)n_vect / d2;
+ b = 0;
+ for (i = 0; i < n_comp; i++) {
+ b -= iv[i] * vec[2][i];
+ iv[i] *= rd2;
+ }
+ b = b * rd2 + 0.5f;
+
+ /* add in texels */
+ lohi = 0;
+ for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
+ int texel;
+ /* interpolate color */
+ float dot = 0;
+ for (i = 0; i < n_comp; i++) {
+ dot += input[k][i] * iv[i];
+ }
+ texel = (int)(dot + b);
+ if (texel < 0) {
+ texel = 0;
+ } else if (texel > n_vect) {
+ texel = n_vect;
+ }
+ /* add in texel */
+ lohi <<= 2;
+ lohi |= texel;
+ }
+
+ /* funky encoding for LSB of green */
+ if ((int)((lohi >> 1) & 1) != (((vec[3][GCOMP] ^ vec[2][GCOMP]) >> 2) & 1)) {
+ for (i = 0; i < n_comp; i++) {
+ vec[3][i] = input[minColR][i];
+ vec[2][i] = input[maxColR][i];
+ }
+ lohi = ~lohi;
+ }
+
+ cc[1] = lohi;
+ }
+
+ FX64_MOV32(hi, 8 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
+ for (j = 2 * 2 - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, vec[j][i] >> 3);
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+}
+
+
+static void
+fxt1_quantize (unsigned long *cc, const unsigned char *lines[], int comps)
+{
+ int trualpha;
+ unsigned char reord[N_TEXELS][MAX_COMP];
+
+ unsigned char input[N_TEXELS][MAX_COMP];
+ int i, k, l;
+
+ memset(input, -1, sizeof(input));
+
+ /* 8 texels each line */
+ for (l = 0; l < 4; l++) {
+ for (k = 0; k < 4; k++) {
+ for (i = 0; i < comps; i++) {
+ input[k + l * 4][i] = *lines[l]++;
+ }
+ }
+ for (; k < 8; k++) {
+ for (i = 0; i < comps; i++) {
+ input[k + l * 4 + 12][i] = *lines[l]++;
+ }
+ }
+ }
+
+ /* block layout:
+ * 00, 01, 02, 03, 08, 09, 0a, 0b
+ * 10, 11, 12, 13, 18, 19, 1a, 1b
+ * 04, 05, 06, 07, 0c, 0d, 0e, 0f
+ * 14, 15, 16, 17, 1c, 1d, 1e, 1f
+ */
+
+ /* [dBorca]
+ * stupidity flows forth from this
+ */
+ l = N_TEXELS;
+ trualpha = 0;
+ if (comps == 4) {
+ /* skip all transparent black texels */
+ l = 0;
+ for (k = 0; k < N_TEXELS; k++) {
+ /* test all components against 0 */
+ if (!ISTBLACK(input[k])) {
+ /* texel is not transparent black */
+ COPY_4UBV(reord[l], input[k]);
+ if (reord[l][ACOMP] < (255 - ALPHA_TS)) {
+ /* non-opaque texel */
+ trualpha = !0;
+ }
+ l++;
+ }
+ }
+ }
+
+#if 0
+ if (trualpha) {
+ fxt1_quantize_ALPHA0(cc, input, reord, l);
+ } else if (l == 0) {
+ cc[0] = cc[1] = cc[2] = -1;
+ cc[3] = 0;
+ } else if (l < N_TEXELS) {
+ fxt1_quantize_HI(cc, input, reord, l);
+ } else {
+ fxt1_quantize_CHROMA(cc, input);
+ }
+ (void)fxt1_quantize_ALPHA1;
+ (void)fxt1_quantize_MIXED1;
+ (void)fxt1_quantize_MIXED0;
+#else
+ if (trualpha) {
+ fxt1_quantize_ALPHA1(cc, input);
+ } else if (l == 0) {
+ cc[0] = cc[1] = cc[2] = -1;
+ cc[3] = 0;
+ } else if (l < N_TEXELS) {
+ fxt1_quantize_MIXED1(cc, input);
+ } else {
+ fxt1_quantize_MIXED0(cc, input);
+ }
+ (void)fxt1_quantize_ALPHA0;
+ (void)fxt1_quantize_HI;
+ (void)fxt1_quantize_CHROMA;
+#endif
+}
+
+
+int
+fxt1_encode (GLcontext *ctx,
+ unsigned int width, unsigned int height,
+ int srcFormat,
+ const void *source, int srcRowStride,
+ void *dest, int destRowStride)
+{
+ const int comps = (srcFormat == GL_RGB) ? 3 : 4;
+ unsigned int x, y;
+ const unsigned char *data;
+ unsigned long *encoded = dest;
+ GLubyte *newSource = NULL;
+
+ (void) ctx;
+
+ /*
+ * Rescale image if width is less than 8 or height is less than 4.
+ */
+ if (width < 8 || height < 4) {
+ GLint newWidth = (width + 7) & ~7;
+ GLint newHeight = (height + 3) & ~3;
+ newSource = MALLOC(comps * newWidth * newHeight * sizeof(GLchan));
+ _mesa_upscale_teximage2d(width, height, newWidth, newHeight,
+ comps, source, srcRowStride, newSource);
+ source = newSource;
+ width = newWidth;
+ height = newHeight;
+ srcRowStride = comps * newWidth;
+ }
+
+ data = source;
+ destRowStride = (destRowStride - width * 2) / 4;
+ for (y = 0; y < height; y += 4) {
+ unsigned int offs = 0 + (y + 0) * srcRowStride;
+ for (x = 0; x < width; x += 8) {
+ const unsigned char *lines[4];
+ lines[0] = &data[offs];
+ lines[1] = lines[0] + srcRowStride;
+ lines[2] = lines[1] + srcRowStride;
+ lines[3] = lines[2] + srcRowStride;
+ offs += 8 * comps;
+ fxt1_quantize(encoded, lines, comps);
+ /* 128 bits per 8x4 block = 4bpp */
+ encoded += 4;
+ }
+ encoded += destRowStride;
+ }
+
+ if (newSource != NULL) {
+ FREE(newSource);
+ }
+
+ return 0;
+}
+
+
+/***************************************************************************\
+ * FXT1 decoder
+ *
+ * The decoder is based on GL_3DFX_texture_compression_FXT1
+ * specification and serves as a concept for the encoder.
+\***************************************************************************/
+
+
+/* lookup table for scaling 5 bit colors up to 8 bits */
+static unsigned char _rgb_scale_5[] = {
+ 0, 8, 16, 25, 33, 41, 49, 58,
+ 66, 74, 82, 90, 99, 107, 115, 123,
+ 132, 140, 148, 156, 165, 173, 181, 189,
+ 197, 206, 214, 222, 230, 239, 247, 255
+};
+
+/* lookup table for scaling 6 bit colors up to 8 bits */
+static unsigned char _rgb_scale_6[] = {
+ 0, 4, 8, 12, 16, 20, 24, 28,
+ 32, 36, 40, 45, 49, 53, 57, 61,
+ 65, 69, 73, 77, 81, 85, 89, 93,
+ 97, 101, 105, 109, 113, 117, 121, 125,
+ 130, 134, 138, 142, 146, 150, 154, 158,
+ 162, 166, 170, 174, 178, 182, 186, 190,
+ 194, 198, 202, 206, 210, 215, 219, 223,
+ 227, 231, 235, 239, 243, 247, 251, 255
+};
+
+
+#define CC_SEL(cc, which) ((cc)[(which) / 32] >> ((which) & 31))
+#define UP5(c) _rgb_scale_5[(c) & 31]
+#define UP6(c, b) _rgb_scale_6[(((c) & 31) << 1) | ((b) & 1)]
+#define LERP(n, t, c0, c1) (((n) - (t)) * (c0) + (t) * (c1) + (n) / 2) / (n)
+#define ZERO_4UBV(v) *((unsigned long *)(v)) = 0
+
+
+static void
+fxt1_decode_1HI (unsigned long code, int t, unsigned char *rgba)
+{
+ const unsigned long *cc;
+
+ t *= 3;
+ cc = (unsigned long *)(code + t / 8);
+ t = (cc[0] >> (t & 7)) & 7;
+
+ if (t == 7) {
+ ZERO_4UBV(rgba);
+ } else {
+ cc = (unsigned long *)(code + 12);
+ if (t == 0) {
+ rgba[BCOMP] = UP5(CC_SEL(cc, 0));
+ rgba[GCOMP] = UP5(CC_SEL(cc, 5));
+ rgba[RCOMP] = UP5(CC_SEL(cc, 10));
+ } else if (t == 6) {
+ rgba[BCOMP] = UP5(CC_SEL(cc, 15));
+ rgba[GCOMP] = UP5(CC_SEL(cc, 20));
+ rgba[RCOMP] = UP5(CC_SEL(cc, 25));
+ } else {
+ rgba[BCOMP] = LERP(6, t, UP5(CC_SEL(cc, 0)), UP5(CC_SEL(cc, 15)));
+ rgba[GCOMP] = LERP(6, t, UP5(CC_SEL(cc, 5)), UP5(CC_SEL(cc, 20)));
+ rgba[RCOMP] = LERP(6, t, UP5(CC_SEL(cc, 10)), UP5(CC_SEL(cc, 25)));
+ }
+ rgba[ACOMP] = 255;
+ }
+}
+
+
+static void
+fxt1_decode_1CHROMA (unsigned long code, int t, unsigned char *rgba)
+{
+ const unsigned long *cc;
+ unsigned long kk;
+
+ cc = (unsigned long *)code;
+ if (t & 16) {
+ cc++;
+ t &= 15;
+ }
+ t = (cc[0] >> (t * 2)) & 3;
+
+ t *= 15;
+ cc = (unsigned long *)(code + 8 + t / 8);
+ kk = cc[0] >> (t & 7);
+ rgba[BCOMP] = UP5(kk);
+ rgba[GCOMP] = UP5(kk >> 5);
+ rgba[RCOMP] = UP5(kk >> 10);
+ rgba[ACOMP] = 255;
+}
+
+
+static void
+fxt1_decode_1MIXED (unsigned long code, int t, unsigned char *rgba)
+{
+ const unsigned long *cc;
+ unsigned int col[2][3];
+ int glsb, selb;
+
+ cc = (unsigned long *)code;
+ if (t & 16) {
+ t &= 15;
+ t = (cc[1] >> (t * 2)) & 3;
+ /* col 2 */
+ col[0][BCOMP] = (*(unsigned long *)(code + 11)) >> 6;
+ col[0][GCOMP] = CC_SEL(cc, 99);
+ col[0][RCOMP] = CC_SEL(cc, 104);
+ /* col 3 */
+ col[1][BCOMP] = CC_SEL(cc, 109);
+ col[1][GCOMP] = CC_SEL(cc, 114);
+ col[1][RCOMP] = CC_SEL(cc, 119);
+ glsb = CC_SEL(cc, 126);
+ selb = CC_SEL(cc, 33);
+ } else {
+ t = (cc[0] >> (t * 2)) & 3;
+ /* col 0 */
+ col[0][BCOMP] = CC_SEL(cc, 64);
+ col[0][GCOMP] = CC_SEL(cc, 69);
+ col[0][RCOMP] = CC_SEL(cc, 74);
+ /* col 1 */
+ col[1][BCOMP] = CC_SEL(cc, 79);
+ col[1][GCOMP] = CC_SEL(cc, 84);
+ col[1][RCOMP] = CC_SEL(cc, 89);
+ glsb = CC_SEL(cc, 125);
+ selb = CC_SEL(cc, 1);
+ }
+
+ if (CC_SEL(cc, 124) & 1) {
+ /* alpha[0] == 1 */
+
+ if (t == 3) {
+ ZERO_4UBV(rgba);
+ } else {
+ if (t == 0) {
+ rgba[BCOMP] = UP5(col[0][BCOMP]);
+ rgba[GCOMP] = UP5(col[0][GCOMP]);
+ rgba[RCOMP] = UP5(col[0][RCOMP]);
+ } else if (t == 2) {
+ rgba[BCOMP] = UP5(col[1][BCOMP]);
+ rgba[GCOMP] = UP6(col[1][GCOMP], glsb);
+ rgba[RCOMP] = UP5(col[1][RCOMP]);
+ } else {
+ rgba[BCOMP] = (UP5(col[0][BCOMP]) + UP5(col[1][BCOMP])) / 2;
+ rgba[GCOMP] = (UP5(col[0][GCOMP]) + UP6(col[1][GCOMP], glsb)) / 2;
+ rgba[RCOMP] = (UP5(col[0][RCOMP]) + UP5(col[1][RCOMP])) / 2;
+ }
+ rgba[ACOMP] = 255;
+ }
+ } else {
+ /* alpha[0] == 0 */
+
+ if (t == 0) {
+ rgba[BCOMP] = UP5(col[0][BCOMP]);
+ rgba[GCOMP] = UP6(col[0][GCOMP], glsb ^ selb);
+ rgba[RCOMP] = UP5(col[0][RCOMP]);
+ } else if (t == 3) {
+ rgba[BCOMP] = UP5(col[1][BCOMP]);
+ rgba[GCOMP] = UP6(col[1][GCOMP], glsb);
+ rgba[RCOMP] = UP5(col[1][RCOMP]);
+ } else {
+ rgba[BCOMP] = LERP(3, t, UP5(col[0][BCOMP]), UP5(col[1][BCOMP]));
+ rgba[GCOMP] = LERP(3, t, UP6(col[0][GCOMP], glsb ^ selb),
+ UP6(col[1][GCOMP], glsb));
+ rgba[RCOMP] = LERP(3, t, UP5(col[0][RCOMP]), UP5(col[1][RCOMP]));
+ }
+ rgba[ACOMP] = 255;
+ }
+}
+
+
+static void
+fxt1_decode_1ALPHA (unsigned long code, int t, unsigned char *rgba)
+{
+ const unsigned long *cc;
+
+ cc = (unsigned long *)code;
+ if (CC_SEL(cc, 124) & 1) {
+ /* lerp == 1 */
+ unsigned int col0[4];
+
+ if (t & 16) {
+ t &= 15;
+ t = (cc[1] >> (t * 2)) & 3;
+ /* col 2 */
+ col0[BCOMP] = (*(unsigned long *)(code + 11)) >> 6;
+ col0[GCOMP] = CC_SEL(cc, 99);
+ col0[RCOMP] = CC_SEL(cc, 104);
+ col0[ACOMP] = CC_SEL(cc, 119);
+ } else {
+ t = (cc[0] >> (t * 2)) & 3;
+ /* col 0 */
+ col0[BCOMP] = CC_SEL(cc, 64);
+ col0[GCOMP] = CC_SEL(cc, 69);
+ col0[RCOMP] = CC_SEL(cc, 74);
+ col0[ACOMP] = CC_SEL(cc, 109);
+ }
+
+ if (t == 0) {
+ rgba[BCOMP] = UP5(col0[BCOMP]);
+ rgba[GCOMP] = UP5(col0[GCOMP]);
+ rgba[RCOMP] = UP5(col0[RCOMP]);
+ rgba[ACOMP] = UP5(col0[ACOMP]);
+ } else if (t == 3) {
+ rgba[BCOMP] = UP5(CC_SEL(cc, 79));
+ rgba[GCOMP] = UP5(CC_SEL(cc, 84));
+ rgba[RCOMP] = UP5(CC_SEL(cc, 89));
+ rgba[ACOMP] = UP5(CC_SEL(cc, 114));
+ } else {
+ rgba[BCOMP] = LERP(3, t, UP5(col0[BCOMP]), UP5(CC_SEL(cc, 79)));
+ rgba[GCOMP] = LERP(3, t, UP5(col0[GCOMP]), UP5(CC_SEL(cc, 84)));
+ rgba[RCOMP] = LERP(3, t, UP5(col0[RCOMP]), UP5(CC_SEL(cc, 89)));
+ rgba[ACOMP] = LERP(3, t, UP5(col0[ACOMP]), UP5(CC_SEL(cc, 114)));
+ }
+ } else {
+ /* lerp == 0 */
+
+ if (t & 16) {
+ cc++;
+ t &= 15;
+ }
+ t = (cc[0] >> (t * 2)) & 3;
+
+ if (t == 3) {
+ ZERO_4UBV(rgba);
+ } else {
+ unsigned long kk;
+ cc = (unsigned long *)code;
+ rgba[ACOMP] = UP5(cc[3] >> (t * 5 + 13));
+ t *= 15;
+ cc = (unsigned long *)(code + 8 + t / 8);
+ kk = cc[0] >> (t & 7);
+ rgba[BCOMP] = UP5(kk);
+ rgba[GCOMP] = UP5(kk >> 5);
+ rgba[RCOMP] = UP5(kk >> 10);
+ }
+ }
+}
+
+
+void
+fxt1_decode_1 (const void *texture, int width,
+ int i, int j, unsigned char *rgba)
+{
+ static void (*decode_1[]) (unsigned long, int, unsigned char *) = {
+ fxt1_decode_1HI, /* cc-high = "00?" */
+ fxt1_decode_1HI, /* cc-high = "00?" */
+ fxt1_decode_1CHROMA, /* cc-chroma = "010" */
+ fxt1_decode_1ALPHA, /* alpha = "011" */
+ fxt1_decode_1MIXED, /* mixed = "1??" */
+ fxt1_decode_1MIXED, /* mixed = "1??" */
+ fxt1_decode_1MIXED, /* mixed = "1??" */
+ fxt1_decode_1MIXED /* mixed = "1??" */
+ };
+
+ unsigned long code = (unsigned long)texture +
+ ((j / 4) * (width / 8) + (i / 8)) * 16;
+ int mode = CC_SEL((unsigned long *)code, 125);
+ int t = i & 7;
+
+ if (t & 4) {
+ t += 12;
+ }
+ t += (j & 3) * 4;
+
+ decode_1[mode](code, t, rgba);
+}
Index: xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c:1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c Fri Dec 17 11:38:03 2004
@@ -0,0 +1,451 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c,v 1.2 2004/12/17 16:38:03 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texcompress_s3tc.c
+ * GL_EXT_texture_compression_s3tc support.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "context.h"
+#include "convolve.h"
+#include "image.h"
+#include "texcompress.h"
+#include "texformat.h"
+#include "texstore.h"
+
+
+
+void
+_mesa_init_texture_s3tc( GLcontext *ctx )
+{
+ /* called during context initialization */
+ (void) ctx;
+}
+
+
+/**
+ * Called via TexFormat->StoreImage to store an RGB_DXT1 texture.
+ */
+static GLboolean
+texstore_rgb_dxt1(STORE_PARAMS)
+{
+#if 0
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset; (void) dstImageStride;
+
+ if (srcFormat != GL_RGB ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGB/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ pixels = tempImage;
+ srcRowStride = 3 * srcWidth;
+ srcFormat = GL_RGB;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ texWidth, (GLubyte *) dstAddr);
+
+ compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
+ dst, dstRowStride);
+
+ if (tempImage)
+ _mesa_free((void *) tempImage);
+#endif
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture.
+ */
+static GLboolean
+texstore_rgba_dxt1(STORE_PARAMS)
+{
+#if 0
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset; (void) dstImageStride;
+
+ if (srcFormat != GL_RGBA ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGBA/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ pixels = tempImage;
+ srcRowStride = 4 * srcWidth;
+ srcFormat = GL_RGBA;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ texWidth, (GLubyte *) dstAddr);
+ compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
+ dst, dstRowStride);
+ if (tempImage)
+ _mesa_free((void*) tempImage);
+#endif
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture.
+ */
+static GLboolean
+texstore_rgba_dxt3(STORE_PARAMS)
+{
+#if 0
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset; (void) dstImageStride;
+
+ if (srcFormat != GL_RGBA ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGBA/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ pixels = tempImage;
+ srcRowStride = 4 * srcWidth;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
+ texWidth, (GLubyte *) dstAddr);
+ compress_rgba_dxt3(ctx, srcWidth, srcHeight, pixels,
+ srcRowStride, dst, dstRowStride);
+ if (tempImage)
+ _mesa_free((void *) tempImage);
+#endif
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture.
+ */
+static GLboolean
+texstore_rgba_dxt5(STORE_PARAMS)
+{
+#if 0
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset; (void) dstImageStride;
+
+ if (srcFormat != GL_RGBA ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGBA/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ pixels = tempImage;
+ srcRowStride = 4 * srcWidth;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
+ texWidth, (GLubyte *) dstAddr);
+ compress_rgba_dxt5(ctx, srcWidth, srcHeight, pixels,
+ srcRowStride, dst, dstRowStride);
+ if (tempImage)
+ _mesa_free((void *) tempImage);
+#endif
+
+ return GL_TRUE;
+}
+
+
+static void
+fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ (void) texImage; (void) i; (void) j; (void) k; (void) texel;
+}
+
+
+static void
+fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
+}
+
+
+static void
+fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ (void) texImage; (void) i; (void) j; (void) k; (void) texel;
+}
+
+
+static void
+fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
+}
+
+
+static void
+fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ (void) texImage; (void) i; (void) j; (void) k; (void) texel;
+}
+
+
+static void
+fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
+}
+
+
+static void
+fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ (void) texImage; (void) i; (void) j; (void) k; (void) texel;
+}
+
+
+static void
+fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
+}
+
+
+const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
+ MESA_FORMAT_RGB_DXT1, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /*approx*/ /* RedBits */
+ 4, /*approx*/ /* GreenBits */
+ 4, /*approx*/ /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* TexelBytes */
+ texstore_rgb_dxt1, /* StoreTexImageFunc */
+ NULL, /*impossible*/ /* FetchTexel1D */
+ fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
+ NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
+ MESA_FORMAT_RGBA_DXT1, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /*approx*/ /* RedBits */
+ 4, /*approx*/ /* GreenBits */
+ 4, /*approx*/ /* BlueBits */
+ 1, /*approx*/ /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* TexelBytes */
+ texstore_rgba_dxt1, /* StoreTexImageFunc */
+ NULL, /*impossible*/ /* FetchTexel1D */
+ fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */
+ NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
+ MESA_FORMAT_RGBA_DXT3, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /*approx*/ /* RedBits */
+ 4, /*approx*/ /* GreenBits */
+ 4, /*approx*/ /* BlueBits */
+ 4, /*approx*/ /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* TexelBytes */
+ texstore_rgba_dxt3, /* StoreTexImageFunc */
+ NULL, /*impossible*/ /* FetchTexel1D */
+ fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */
+ NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
+ MESA_FORMAT_RGBA_DXT5, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4,/*approx*/ /* RedBits */
+ 4,/*approx*/ /* GreenBits */
+ 4,/*approx*/ /* BlueBits */
+ 4,/*approx*/ /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* TexelBytes */
+ texstore_rgba_dxt5, /* StoreTexImageFunc */
+ NULL, /*impossible*/ /* FetchTexel1D */
+ fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */
+ NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
+};
Index: xc/extras/Mesa/src/mesa/main/texformat.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texformat.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texformat.c Fri Dec 10 10:05:19 2004
@@ -0,0 +1,1264 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texformat.c
+ * Texture formats.
+ *
+ * \author Gareth Hughes
+ */
+
+
+#include "glheader.h"
+#include "colormac.h"
+#include "context.h"
+#include "image.h"
+#include "imports.h"
+#include "mtypes.h"
+#include "texformat.h"
+#include "teximage.h"
+#include "texstate.h"
+#include "texstore.h"
+
+
+
+/* Texel fetch routines for all supported formats
+ */
+#define DIM 1
+#include "texformat_tmp.h"
+
+#define DIM 2
+#include "texformat_tmp.h"
+
+#define DIM 3
+#include "texformat_tmp.h"
+
+/**
+ * Null texel fetch function.
+ *
+ * Have to have this so the FetchTexel function pointer is never NULL.
+ */
+static void fetch_null_texel( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ (void) texImage; (void) i; (void) j; (void) k;
+ texel[RCOMP] = 0;
+ texel[GCOMP] = 0;
+ texel[BCOMP] = 0;
+ texel[ACOMP] = 0;
+ _mesa_warning(NULL, "fetch_null_texel() called!");
+}
+
+static void fetch_null_texelf( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ (void) texImage; (void) i; (void) j; (void) k;
+ texel[RCOMP] = 0.0;
+ texel[GCOMP] = 0.0;
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 0.0;
+ _mesa_warning(NULL, "fetch_null_texelf() called!");
+}
+
+
+/***************************************************************/
+/** \name Default GLchan-based formats */
+/*@{*/
+
+const struct gl_texture_format _mesa_texformat_rgba = {
+ MESA_FORMAT_RGBA, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ CHAN_BITS, /* RedBits */
+ CHAN_BITS, /* GreenBits */
+ CHAN_BITS, /* BlueBits */
+ CHAN_BITS, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4 * sizeof(GLchan), /* TexelBytes */
+ _mesa_texstore_rgba, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba, /* FetchTexel1D */
+ fetch_texel_2d_rgba, /* FetchTexel2D */
+ fetch_texel_3d_rgba, /* FetchTexel3D */
+ fetch_texel_1d_f_rgba, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb = {
+ MESA_FORMAT_RGB, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ CHAN_BITS, /* RedBits */
+ CHAN_BITS, /* GreenBits */
+ CHAN_BITS, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 3 * sizeof(GLchan), /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_rgb, /* FetchTexel1D */
+ fetch_texel_2d_rgb, /* FetchTexel2D */
+ fetch_texel_3d_rgb, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_alpha = {
+ MESA_FORMAT_ALPHA, /* MesaFormat */
+ GL_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ CHAN_BITS, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ sizeof(GLchan), /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_alpha, /* FetchTexel1D */
+ fetch_texel_2d_alpha, /* FetchTexel2D */
+ fetch_texel_3d_alpha, /* FetchTexel3D */
+ fetch_texel_1d_f_alpha, /* FetchTexel1Df */
+ fetch_texel_2d_f_alpha, /* FetchTexel2Df */
+ fetch_texel_3d_f_alpha, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance = {
+ MESA_FORMAT_LUMINANCE, /* MesaFormat */
+ GL_LUMINANCE, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ CHAN_BITS, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ sizeof(GLchan), /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_luminance, /* FetchTexel1D */
+ fetch_texel_2d_luminance, /* FetchTexel2D */
+ fetch_texel_3d_luminance, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_alpha = {
+ MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ CHAN_BITS, /* AlphaBits */
+ CHAN_BITS, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2 * sizeof(GLchan), /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_alpha, /* FetchTexel1D */
+ fetch_texel_2d_luminance_alpha, /* FetchTexel2D */
+ fetch_texel_3d_luminance_alpha, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_alpha, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_alpha, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_alpha, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_intensity = {
+ MESA_FORMAT_INTENSITY, /* MesaFormat */
+ GL_INTENSITY, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ CHAN_BITS, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ sizeof(GLchan), /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_intensity, /* FetchTexel1D */
+ fetch_texel_2d_intensity, /* FetchTexel2D */
+ fetch_texel_3d_intensity, /* FetchTexel3D */
+ fetch_texel_1d_f_intensity, /* FetchTexel1Df */
+ fetch_texel_2d_f_intensity, /* FetchTexel2Df */
+ fetch_texel_3d_f_intensity, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_depth_component_float32 = {
+ MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, /* MesaFormat */
+ GL_DEPTH_COMPONENT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ sizeof(GLfloat) * 8, /* DepthBits */
+ sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_depth_component_float32,/* StoreTexImageFunc */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */
+ fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */
+ fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_depth_component16 = {
+ MESA_FORMAT_DEPTH_COMPONENT16, /* MesaFormat */
+ GL_DEPTH_COMPONENT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ sizeof(GLushort) * 8, /* DepthBits */
+ sizeof(GLushort), /* TexelBytes */
+ _mesa_texstore_depth_component16, /* StoreTexImageFunc */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */
+ fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */
+ fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba_float32 = {
+ MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 8 * sizeof(GLfloat), /* RedBits */
+ 8 * sizeof(GLfloat), /* GreenBits */
+ 8 * sizeof(GLfloat), /* BlueBits */
+ 8 * sizeof(GLfloat), /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba_f32, /* FetchTexel1D */
+ fetch_texel_2d_rgba_f32, /* FetchTexel1D */
+ fetch_texel_3d_rgba_f32, /* FetchTexel1D */
+ fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba_float16 = {
+ MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 8 * sizeof(GLhalfARB), /* RedBits */
+ 8 * sizeof(GLhalfARB), /* GreenBits */
+ 8 * sizeof(GLhalfARB), /* BlueBits */
+ 8 * sizeof(GLhalfARB), /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba_f16, /* FetchTexel1D */
+ fetch_texel_2d_rgba_f16, /* FetchTexel1D */
+ fetch_texel_3d_rgba_f16, /* FetchTexel1D */
+ fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb_float32 = {
+ MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 8 * sizeof(GLfloat), /* RedBits */
+ 8 * sizeof(GLfloat), /* GreenBits */
+ 8 * sizeof(GLfloat), /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 3 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_rgb_f32, /* FetchTexel1D */
+ fetch_texel_2d_rgb_f32, /* FetchTexel1D */
+ fetch_texel_3d_rgb_f32, /* FetchTexel1D */
+ fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb_float16 = {
+ MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 8 * sizeof(GLhalfARB), /* RedBits */
+ 8 * sizeof(GLhalfARB), /* GreenBits */
+ 8 * sizeof(GLhalfARB), /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 3 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_rgb_f16, /* FetchTexel1D */
+ fetch_texel_2d_rgb_f16, /* FetchTexel1D */
+ fetch_texel_3d_rgb_f16, /* FetchTexel1D */
+ fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_alpha_float32 = {
+ MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */
+ GL_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLfloat), /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_alpha_f32, /* FetchTexel1D */
+ fetch_texel_2d_alpha_f32, /* FetchTexel1D */
+ fetch_texel_3d_alpha_f32, /* FetchTexel1D */
+ fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_alpha_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_alpha_float16 = {
+ MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */
+ GL_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLhalfARB), /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_alpha_f16, /* FetchTexel1D */
+ fetch_texel_2d_alpha_f16, /* FetchTexel1D */
+ fetch_texel_3d_alpha_f16, /* FetchTexel1D */
+ fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_alpha_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_float32 = {
+ MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */
+ GL_LUMINANCE, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 8 * sizeof(GLfloat), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_f32, /* FetchTexel1D */
+ fetch_texel_2d_luminance_f32, /* FetchTexel2D */
+ fetch_texel_3d_luminance_f32, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_float16 = {
+ MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */
+ GL_LUMINANCE, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 8 * sizeof(GLhalfARB), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_f16, /* FetchTexel1D */
+ fetch_texel_2d_luminance_f16, /* FetchTexel2D */
+ fetch_texel_3d_luminance_f16, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = {
+ MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLfloat), /* AlphaBits */
+ 8 * sizeof(GLfloat), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32, /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_alpha_f32, /* FetchTexel1D */
+ fetch_texel_2d_luminance_alpha_f32, /* FetchTexel2D */
+ fetch_texel_3d_luminance_alpha_f32, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_alpha_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = {
+ MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLhalfARB), /* AlphaBits */
+ 8 * sizeof(GLhalfARB), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16, /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_alpha_f16, /* FetchTexel1D */
+ fetch_texel_2d_luminance_alpha_f16, /* FetchTexel2D */
+ fetch_texel_3d_luminance_alpha_f16, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_alpha_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_intensity_float32 = {
+ MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */
+ GL_INTENSITY, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 8 * sizeof(GLfloat), /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_intensity_f32, /* FetchTexel1D */
+ fetch_texel_2d_intensity_f32, /* FetchTexel2D */
+ fetch_texel_3d_intensity_f32, /* FetchTexel3D */
+ fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_intensity_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_intensity_float16 = {
+ MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */
+ GL_INTENSITY, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 8 * sizeof(GLhalfARB), /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_intensity_f16, /* FetchTexel1D */
+ fetch_texel_2d_intensity_f16, /* FetchTexel2D */
+ fetch_texel_3d_intensity_f16, /* FetchTexel3D */
+ fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_intensity_f16 /* FetchTexel3Df */
+};
+
+
+/*@}*/
+
+
+/***************************************************************/
+/** \name Hardware formats */
+/*@{*/
+
+const struct gl_texture_format _mesa_texformat_rgba8888 = {
+ MESA_FORMAT_RGBA8888, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_rgba8888, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba8888, /* FetchTexel1D */
+ fetch_texel_2d_rgba8888, /* FetchTexel2D */
+ fetch_texel_3d_rgba8888, /* FetchTexel3D */
+ fetch_texel_1d_f_rgba8888, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba8888, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba8888_rev = {
+ MESA_FORMAT_RGBA8888_REV, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_rgba8888, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */
+ fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */
+ fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_rgba8888_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba8888_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba8888_rev, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_argb8888 = {
+ MESA_FORMAT_ARGB8888, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_argb8888, /* StoreTexImageFunc */
+ fetch_texel_1d_argb8888, /* FetchTexel1D */
+ fetch_texel_2d_argb8888, /* FetchTexel2D */
+ fetch_texel_3d_argb8888, /* FetchTexel3D */
+ fetch_texel_1d_f_argb8888, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb8888, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb8888, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_argb8888_rev = {
+ MESA_FORMAT_ARGB8888_REV, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_argb8888, /* StoreTexImageFunc */
+ fetch_texel_1d_argb8888_rev, /* FetchTexel1D */
+ fetch_texel_2d_argb8888_rev, /* FetchTexel2D */
+ fetch_texel_3d_argb8888_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_argb8888_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb8888_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb8888_rev, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb888 = {
+ MESA_FORMAT_RGB888, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 3, /* TexelBytes */
+ _mesa_texstore_rgb888, /* StoreTexImageFunc */
+ fetch_texel_1d_rgb888, /* FetchTexel1D */
+ fetch_texel_2d_rgb888, /* FetchTexel2D */
+ fetch_texel_3d_rgb888, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb888, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb888, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb888, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_bgr888 = {
+ MESA_FORMAT_BGR888, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 3, /* TexelBytes */
+ _mesa_texstore_bgr888, /* StoreTexImageFunc */
+ fetch_texel_1d_bgr888, /* FetchTexel1D */
+ fetch_texel_2d_bgr888, /* FetchTexel2D */
+ fetch_texel_3d_bgr888, /* FetchTexel3D */
+ fetch_texel_1d_f_bgr888, /* FetchTexel1Df */
+ fetch_texel_2d_f_bgr888, /* FetchTexel2Df */
+ fetch_texel_3d_f_bgr888, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb565 = {
+ MESA_FORMAT_RGB565, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 5, /* RedBits */
+ 6, /* GreenBits */
+ 5, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_rgb565, /* StoreTexImageFunc */
+ fetch_texel_1d_rgb565, /* FetchTexel1D */
+ fetch_texel_2d_rgb565, /* FetchTexel2D */
+ fetch_texel_3d_rgb565, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb565, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb565, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb565, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb565_rev = {
+ MESA_FORMAT_RGB565_REV, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 5, /* RedBits */
+ 6, /* GreenBits */
+ 5, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_rgb565, /* StoreTexImageFunc */
+ fetch_texel_1d_rgb565_rev, /* FetchTexel1D */
+ fetch_texel_2d_rgb565_rev, /* FetchTexel2D */
+ fetch_texel_3d_rgb565_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb565_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb565_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb565_rev, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_argb4444 = {
+ MESA_FORMAT_ARGB4444, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /* RedBits */
+ 4, /* GreenBits */
+ 4, /* BlueBits */
+ 4, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_argb4444, /* StoreTexImageFunc */
+ fetch_texel_1d_argb4444, /* FetchTexel1D */
+ fetch_texel_2d_argb4444, /* FetchTexel2D */
+ fetch_texel_3d_argb4444, /* FetchTexel3D */
+ fetch_texel_1d_f_argb4444, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb4444, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb4444, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_argb4444_rev = {
+ MESA_FORMAT_ARGB4444_REV, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /* RedBits */
+ 4, /* GreenBits */
+ 4, /* BlueBits */
+ 4, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_argb4444, /* StoreTexImageFunc */
+ fetch_texel_1d_argb4444_rev, /* FetchTexel1D */
+ fetch_texel_2d_argb4444_rev, /* FetchTexel2D */
+ fetch_texel_3d_argb4444_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_argb4444_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb4444_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb4444_rev, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_argb1555 = {
+ MESA_FORMAT_ARGB1555, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 5, /* RedBits */
+ 5, /* GreenBits */
+ 5, /* BlueBits */
+ 1, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_argb1555, /* StoreTexImageFunc */
+ fetch_texel_1d_argb1555, /* FetchTexel1D */
+ fetch_texel_2d_argb1555, /* FetchTexel2D */
+ fetch_texel_3d_argb1555, /* FetchTexel3D */
+ fetch_texel_1d_f_argb1555, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb1555, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb1555, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_argb1555_rev = {
+ MESA_FORMAT_ARGB1555_REV, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 5, /* RedBits */
+ 5, /* GreenBits */
+ 5, /* BlueBits */
+ 1, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_argb1555, /* StoreTexImageFunc */
+ fetch_texel_1d_argb1555_rev, /* FetchTexel1D */
+ fetch_texel_2d_argb1555_rev, /* FetchTexel2D */
+ fetch_texel_3d_argb1555_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_argb1555_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb1555_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb1555_rev, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_al88 = {
+ MESA_FORMAT_AL88, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8, /* AlphaBits */
+ 8, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_al88, /* StoreTexImageFunc */
+ fetch_texel_1d_al88, /* FetchTexel1D */
+ fetch_texel_2d_al88, /* FetchTexel2D */
+ fetch_texel_3d_al88, /* FetchTexel3D */
+ fetch_texel_1d_f_al88, /* FetchTexel1Df */
+ fetch_texel_2d_f_al88, /* FetchTexel2Df */
+ fetch_texel_3d_f_al88, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_al88_rev = {
+ MESA_FORMAT_AL88_REV, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8, /* AlphaBits */
+ 8, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_al88, /* StoreTexImageFunc */
+ fetch_texel_1d_al88_rev, /* FetchTexel1D */
+ fetch_texel_2d_al88_rev, /* FetchTexel2D */
+ fetch_texel_3d_al88_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_al88_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_al88_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_al88_rev, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb332 = {
+ MESA_FORMAT_RGB332, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 3, /* RedBits */
+ 3, /* GreenBits */
+ 2, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1, /* TexelBytes */
+ _mesa_texstore_rgb332, /* StoreTexImageFunc */
+ fetch_texel_1d_rgb332, /* FetchTexel1D */
+ fetch_texel_2d_rgb332, /* FetchTexel2D */
+ fetch_texel_3d_rgb332, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb332, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb332, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb332, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_a8 = {
+ MESA_FORMAT_A8, /* MesaFormat */
+ GL_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1, /* TexelBytes */
+ _mesa_texstore_a8, /* StoreTexImageFunc */
+ fetch_texel_1d_a8, /* FetchTexel1D */
+ fetch_texel_2d_a8, /* FetchTexel2D */
+ fetch_texel_3d_a8, /* FetchTexel3D */
+ fetch_texel_1d_f_a8, /* FetchTexel1Df */
+ fetch_texel_2d_f_a8, /* FetchTexel2Df */
+ fetch_texel_3d_f_a8, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_l8 = {
+ MESA_FORMAT_L8, /* MesaFormat */
+ GL_LUMINANCE, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 8, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1, /* TexelBytes */
+ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_l8, /* FetchTexel1D */
+ fetch_texel_2d_l8, /* FetchTexel2D */
+ fetch_texel_3d_l8, /* FetchTexel3D */
+ fetch_texel_1d_f_l8, /* FetchTexel1Df */
+ fetch_texel_2d_f_l8, /* FetchTexel2Df */
+ fetch_texel_3d_f_l8, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_i8 = {
+ MESA_FORMAT_I8, /* MesaFormat */
+ GL_INTENSITY, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 8, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1, /* TexelBytes */
+ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_i8, /* FetchTexel1D */
+ fetch_texel_2d_i8, /* FetchTexel2D */
+ fetch_texel_3d_i8, /* FetchTexel3D */
+ fetch_texel_1d_f_i8, /* FetchTexel1Df */
+ fetch_texel_2d_f_i8, /* FetchTexel2Df */
+ fetch_texel_3d_f_i8, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_ci8 = {
+ MESA_FORMAT_CI8, /* MesaFormat */
+ GL_COLOR_INDEX, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 8, /* IndexBits */
+ 0, /* DepthBits */
+ 1, /* TexelBytes */
+ _mesa_texstore_ci8, /* StoreTexImageFunc */
+ fetch_texel_1d_ci8, /* FetchTexel1D */
+ fetch_texel_2d_ci8, /* FetchTexel2D */
+ fetch_texel_3d_ci8, /* FetchTexel3D */
+ fetch_texel_1d_f_ci8, /* FetchTexel1Df */
+ fetch_texel_2d_f_ci8, /* FetchTexel2Df */
+ fetch_texel_3d_f_ci8, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_ycbcr = {
+ MESA_FORMAT_YCBCR, /* MesaFormat */
+ GL_YCBCR_MESA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_ycbcr, /* StoreTexImageFunc */
+ fetch_texel_1d_ycbcr, /* FetchTexel1D */
+ fetch_texel_2d_ycbcr, /* FetchTexel2D */
+ fetch_texel_3d_ycbcr, /* FetchTexel3D */
+ fetch_texel_1d_f_ycbcr, /* FetchTexel1Df */
+ fetch_texel_2d_f_ycbcr, /* FetchTexel2Df */
+ fetch_texel_3d_f_ycbcr, /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
+ MESA_FORMAT_YCBCR_REV, /* MesaFormat */
+ GL_YCBCR_MESA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2, /* TexelBytes */
+ _mesa_texstore_ycbcr, /* StoreTexImageFunc */
+ fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */
+ fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */
+ fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_ycbcr_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_ycbcr_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_ycbcr_rev, /* FetchTexel3Df */
+};
+
+/*@}*/
+
+
+/***************************************************************/
+/** \name Null format (useful for proxy textures) */
+/*@{*/
+
+const struct gl_texture_format _mesa_null_texformat = {
+ -1, /* MesaFormat */
+ 0, /* BaseFormat */
+ GL_NONE, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel2D */
+ fetch_null_texel, /* FetchTexel3D */
+ fetch_null_texelf, /* FetchTexel1Df */
+ fetch_null_texelf, /* FetchTexel2Df */
+ fetch_null_texelf, /* FetchTexel3Df */
+};
+
+/*@}*/
+
+
+/**
+ * Choose an appropriate texture format given the format, type and
+ * internalFormat parameters passed to glTexImage().
+ *
+ * \param ctx the GL context.
+ * \param internalFormat user's prefered internal texture format.
+ * \param format incoming image pixel format.
+ * \param type incoming image data type.
+ *
+ * \return a pointer to a gl_texture_format object which describes the
+ * choosen texture format, or NULL on failure.
+ *
+ * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
+ * will typically override this function with a specialized version.
+ */
+const struct gl_texture_format *
+_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
+ GLenum format, GLenum type )
+{
+ (void) format;
+ (void) type;
+
+ switch (internalFormat) {
+ /* RGBA formats */
+ case 4:
+ case GL_RGBA:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return &_mesa_texformat_rgba;
+ case GL_RGBA8:
+ return &_mesa_texformat_rgba8888;
+ case GL_RGB5_A1:
+ return &_mesa_texformat_argb1555;
+ case GL_RGBA2:
+ return &_mesa_texformat_argb4444_rev; /* just to test another format*/
+ case GL_RGBA4:
+ return &_mesa_texformat_argb4444;
+
+ /* RGB formats */
+ case 3:
+ case GL_RGB:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return &_mesa_texformat_rgb;
+ case GL_RGB8:
+ return &_mesa_texformat_rgb888;
+ case GL_R3_G3_B2:
+ return &_mesa_texformat_rgb332;
+ case GL_RGB4:
+ return &_mesa_texformat_rgb565_rev; /* just to test another format */
+ case GL_RGB5:
+ return &_mesa_texformat_rgb565;
+
+ /* Alpha formats */
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return &_mesa_texformat_alpha;
+ case GL_ALPHA8:
+ return &_mesa_texformat_a8;
+
+ /* Luminance formats */
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ return &_mesa_texformat_luminance;
+ case GL_LUMINANCE8:
+ return &_mesa_texformat_l8;
+
+ /* Luminance/Alpha formats */
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return &_mesa_texformat_luminance_alpha;
+ case GL_LUMINANCE8_ALPHA8:
+ return &_mesa_texformat_al88;
+
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ return &_mesa_texformat_intensity;
+ case GL_INTENSITY8:
+ return &_mesa_texformat_i8;
+
+ case GL_COLOR_INDEX:
+ case GL_COLOR_INDEX1_EXT:
+ case GL_COLOR_INDEX2_EXT:
+ case GL_COLOR_INDEX4_EXT:
+ case GL_COLOR_INDEX12_EXT:
+ case GL_COLOR_INDEX16_EXT:
+ case GL_COLOR_INDEX8_EXT:
+ return &_mesa_texformat_ci8;
+
+ default:
+ ; /* fallthrough */
+ }
+
+ if (ctx->Extensions.SGIX_depth_texture) {
+ switch (internalFormat) {
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT24_SGIX:
+ case GL_DEPTH_COMPONENT32_SGIX:
+ return &_mesa_texformat_depth_component_float32;
+ case GL_DEPTH_COMPONENT16_SGIX:
+ return &_mesa_texformat_depth_component16;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ARB_texture_compression) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ return &_mesa_texformat_alpha;
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ return &_mesa_texformat_luminance;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ return &_mesa_texformat_luminance_alpha;
+ case GL_COMPRESSED_INTENSITY_ARB:
+ return &_mesa_texformat_intensity;
+ case GL_COMPRESSED_RGB_ARB:
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ return &_mesa_texformat_rgb_fxt1;
+ else if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ return &_mesa_texformat_rgb_dxt1;
+ else
+ return &_mesa_texformat_rgb;
+ case GL_COMPRESSED_RGBA_ARB:
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ return &_mesa_texformat_rgba_fxt1;
+ else if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */
+ else
+ return &_mesa_texformat_rgba;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.MESA_ycbcr_texture) {
+ if (internalFormat == GL_YCBCR_MESA) {
+ if (type == GL_UNSIGNED_SHORT_8_8_MESA)
+ return &_mesa_texformat_ycbcr;
+ else
+ return &_mesa_texformat_ycbcr_rev;
+ }
+ }
+
+ if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ return &_mesa_texformat_rgb_fxt1;
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ return &_mesa_texformat_rgba_fxt1;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgb_dxt1;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgba_dxt1;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ return &_mesa_texformat_rgba_dxt3;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ return &_mesa_texformat_rgba_dxt5;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.S3_s3tc) {
+ switch (internalFormat) {
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ return &_mesa_texformat_rgb_dxt1;
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ return &_mesa_texformat_rgba_dxt3;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ARB_texture_float) {
+ switch (internalFormat) {
+ case GL_ALPHA16F_ARB:
+ return &_mesa_texformat_alpha_float16;
+ case GL_ALPHA32F_ARB:
+ return &_mesa_texformat_alpha_float32;
+ case GL_LUMINANCE16F_ARB:
+ return &_mesa_texformat_luminance_float16;
+ case GL_LUMINANCE32F_ARB:
+ return &_mesa_texformat_luminance_float32;
+ case GL_LUMINANCE_ALPHA16F_ARB:
+ return &_mesa_texformat_luminance_alpha_float16;
+ case GL_LUMINANCE_ALPHA32F_ARB:
+ return &_mesa_texformat_luminance_alpha_float32;
+ case GL_INTENSITY16F_ARB:
+ return &_mesa_texformat_intensity_float16;
+ case GL_INTENSITY32F_ARB:
+ return &_mesa_texformat_intensity_float32;
+ case GL_RGB16F_ARB:
+ return &_mesa_texformat_rgb_float16;
+ case GL_RGB32F_ARB:
+ return &_mesa_texformat_rgb_float32;
+ case GL_RGBA16F_ARB:
+ return &_mesa_texformat_rgba_float16;
+ case GL_RGBA32F_ARB:
+ return &_mesa_texformat_rgba_float32;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
+ return NULL;
+}
Index: xc/extras/Mesa/src/mesa/main/texformat.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texformat.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texformat.h Fri Dec 10 10:05:19 2004
@@ -0,0 +1,229 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texformat.h
+ * Texture formats definitions.
+ *
+ * \author Gareth Hughes
+ */
+
+
+#ifndef TEXFORMAT_H
+#define TEXFORMAT_H
+
+
+#include "mtypes.h"
+
+
+/**
+ * Mesa internal texture image formats.
+ * All texture images are stored in one of these formats.
+ *
+ * NOTE: when you add a new format, be sure to update the do_row()
+ * function in texstore.c used for auto mipmap generation.
+ */
+enum _format {
+ /**
+ * \name Hardware-friendly formats.
+ *
+ * Drivers can override the default formats and convert texture images to
+ * one of these as required. The driver's
+ * dd_function_table::ChooseTextureFormat function will choose one of these
+ * formats.
+ *
+ * \note In the default case, some of these formats will be duplicates of
+ * the generic formats listed below. However, these formats guarantee their
+ * internal component sizes, while GLchan may vary between GLubyte, GLushort
+ * and GLfloat.
+ */
+ /*@{*/
+ /* msb <------ TEXEL BITS -----------> lsb */
+ /* ---- ---- ---- ---- ---- ---- ---- ---- */
+ MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
+ MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
+ MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
+ MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */
+ MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */
+ MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */
+ MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */
+ MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */
+ MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */
+ MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */
+ MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */
+ MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */
+ MESA_FORMAT_RGB332, /* RRRG GGBB */
+ MESA_FORMAT_A8, /* AAAA AAAA */
+ MESA_FORMAT_L8, /* LLLL LLLL */
+ MESA_FORMAT_I8, /* IIII IIII */
+ MESA_FORMAT_CI8, /* CCCC CCCC */
+ MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
+ MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
+ /*@}*/
+
+ /**
+ * \name Compressed texture formats.
+ */
+ /*@{*/
+ MESA_FORMAT_RGB_FXT1,
+ MESA_FORMAT_RGBA_FXT1,
+ MESA_FORMAT_RGB_DXT1,
+ MESA_FORMAT_RGBA_DXT1,
+ MESA_FORMAT_RGBA_DXT3,
+ MESA_FORMAT_RGBA_DXT5,
+ /*@}*/
+
+ /**
+ * \name Generic GLchan-based formats.
+ *
+ * Software-oriented texture formats. Texels are arrays of GLchan
+ * values so there are no byte order issues.
+ *
+ * \note Because these are based on the GLchan data type, one cannot assume
+ * 8 bits per channel with these formats. If you require GLubyte channels,
+ * use one of the hardware formats above.
+ */
+ /*@{*/
+ MESA_FORMAT_RGBA,
+ MESA_FORMAT_RGB,
+ MESA_FORMAT_ALPHA,
+ MESA_FORMAT_LUMINANCE,
+ MESA_FORMAT_LUMINANCE_ALPHA,
+ MESA_FORMAT_INTENSITY,
+ /*@}*/
+
+ /**
+ * Depth textures
+ */
+ /*@{*/
+ MESA_FORMAT_DEPTH_COMPONENT_FLOAT32,
+ MESA_FORMAT_DEPTH_COMPONENT16,
+ /*@}*/
+
+ /**
+ * \name Floating point texture formats.
+ */
+ /*@{*/
+ MESA_FORMAT_RGBA_FLOAT32,
+ MESA_FORMAT_RGBA_FLOAT16,
+ MESA_FORMAT_RGB_FLOAT32,
+ MESA_FORMAT_RGB_FLOAT16,
+ MESA_FORMAT_ALPHA_FLOAT32,
+ MESA_FORMAT_ALPHA_FLOAT16,
+ MESA_FORMAT_LUMINANCE_FLOAT32,
+ MESA_FORMAT_LUMINANCE_FLOAT16,
+ MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
+ MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
+ MESA_FORMAT_INTENSITY_FLOAT32,
+ MESA_FORMAT_INTENSITY_FLOAT16
+ /*@}*/
+};
+
+
+/** GLchan-valued formats */
+/*@{*/
+extern const struct gl_texture_format _mesa_texformat_rgba;
+extern const struct gl_texture_format _mesa_texformat_rgb;
+extern const struct gl_texture_format _mesa_texformat_alpha;
+extern const struct gl_texture_format _mesa_texformat_luminance;
+extern const struct gl_texture_format _mesa_texformat_luminance_alpha;
+extern const struct gl_texture_format _mesa_texformat_intensity;
+/*@}*/
+
+/** Depth textures */
+/*@{*/
+extern const struct gl_texture_format _mesa_texformat_depth_component_float32;
+extern const struct gl_texture_format _mesa_texformat_depth_component16;
+/*@}*/
+
+/** Floating point texture formats */
+/*@{*/
+extern const struct gl_texture_format _mesa_texformat_rgba_float32;
+extern const struct gl_texture_format _mesa_texformat_rgba_float16;
+extern const struct gl_texture_format _mesa_texformat_rgb_float32;
+extern const struct gl_texture_format _mesa_texformat_rgb_float16;
+extern const struct gl_texture_format _mesa_texformat_alpha_float32;
+extern const struct gl_texture_format _mesa_texformat_alpha_float16;
+extern const struct gl_texture_format _mesa_texformat_luminance_float32;
+extern const struct gl_texture_format _mesa_texformat_luminance_float16;
+extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32;
+extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16;
+extern const struct gl_texture_format _mesa_texformat_intensity_float32;
+extern const struct gl_texture_format _mesa_texformat_intensity_float16;
+/*@}*/
+
+/** \name Assorted hardware-friendly formats */
+/*@{*/
+extern const struct gl_texture_format _mesa_texformat_rgba8888;
+extern const struct gl_texture_format _mesa_texformat_rgba8888_rev;
+extern const struct gl_texture_format _mesa_texformat_argb8888;
+extern const struct gl_texture_format _mesa_texformat_argb8888_rev;
+extern const struct gl_texture_format _mesa_texformat_rgb888;
+extern const struct gl_texture_format _mesa_texformat_bgr888;
+extern const struct gl_texture_format _mesa_texformat_rgb565;
+extern const struct gl_texture_format _mesa_texformat_rgb565_rev;
+extern const struct gl_texture_format _mesa_texformat_argb4444;
+extern const struct gl_texture_format _mesa_texformat_argb4444_rev;
+extern const struct gl_texture_format _mesa_texformat_argb1555;
+extern const struct gl_texture_format _mesa_texformat_argb1555_rev;
+extern const struct gl_texture_format _mesa_texformat_al88;
+extern const struct gl_texture_format _mesa_texformat_al88_rev;
+extern const struct gl_texture_format _mesa_texformat_rgb332;
+extern const struct gl_texture_format _mesa_texformat_a8;
+extern const struct gl_texture_format _mesa_texformat_l8;
+extern const struct gl_texture_format _mesa_texformat_i8;
+extern const struct gl_texture_format _mesa_texformat_ci8;
+
+/*@}*/
+
+/** \name YCbCr formats */
+/*@{*/
+extern const struct gl_texture_format _mesa_texformat_ycbcr;
+extern const struct gl_texture_format _mesa_texformat_ycbcr_rev;
+/*@}*/
+
+/** \name Compressed formats */
+/*@{*/
+extern const struct gl_texture_format _mesa_texformat_rgb_fxt1;
+extern const struct gl_texture_format _mesa_texformat_rgba_fxt1;
+extern const struct gl_texture_format _mesa_texformat_rgb_dxt1;
+extern const struct gl_texture_format _mesa_texformat_rgba_dxt1;
+extern const struct gl_texture_format _mesa_texformat_rgba_dxt3;
+extern const struct gl_texture_format _mesa_texformat_rgba_dxt5;
+/*@}*/
+
+/** \name The null format */
+/*@{*/
+extern const struct gl_texture_format _mesa_null_texformat;
+/*@}*/
+
+
+extern const struct gl_texture_format *
+_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
+ GLenum format, GLenum type );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/texformat_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texformat_tmp.h:1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texformat_tmp.h Fri Dec 17 11:38:03 2004
@@ -0,0 +1,1236 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/main/texformat_tmp.h,v 1.2 2004/12/17 16:38:03 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texformat_tmp.h
+ * Texel fetch functions template.
+ *
+ * This template file is used by texformat.c to generate texel fetch functions
+ * for 1-D, 2-D and 3-D texture images.
+ *
+ * It should be expanded by defining \p DIM as the number texture dimensions
+ * (1, 2 or 3). According to the value of \p DIM a series of macros is defined
+ * for the texel lookup in the gl_texture_image::Data.
+ *
+ * \sa texformat.c and FetchTexel.
+ *
+ * \author Gareth Hughes
+ * \author Brian Paul
+ */
+
+
+#if DIM == 1
+
+#define CHAN_SRC( t, i, j, k, sz ) \
+ ((GLchan *)(t)->Data + (i) * (sz))
+#define UBYTE_SRC( t, i, j, k, sz ) \
+ ((GLubyte *)(t)->Data + (i) * (sz))
+#define USHORT_SRC( t, i, j, k ) \
+ ((GLushort *)(t)->Data + (i))
+#define UINT_SRC( t, i, j, k ) \
+ ((GLuint *)(t)->Data + (i))
+#define FLOAT_SRC( t, i, j, k, sz ) \
+ ((GLfloat *)(t)->Data + (i) * (sz))
+#define HALF_SRC( t, i, j, k, sz ) \
+ ((GLhalfARB *)(t)->Data + (i) * (sz))
+
+#define FETCH(x) fetch_texel_1d_##x
+
+#elif DIM == 2
+
+#define CHAN_SRC( t, i, j, k, sz ) \
+ ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
+#define UBYTE_SRC( t, i, j, k, sz ) \
+ ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
+#define USHORT_SRC( t, i, j, k ) \
+ ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i)))
+#define UINT_SRC( t, i, j, k ) \
+ ((GLuint *)(t)->Data + ((t)->RowStride * (j) + (i)))
+#define FLOAT_SRC( t, i, j, k, sz ) \
+ ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
+#define HALF_SRC( t, i, j, k, sz ) \
+ ((GLhalfARB *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
+
+#define FETCH(x) fetch_texel_2d_##x
+
+#elif DIM == 3
+
+#define CHAN_SRC( t, i, j, k, sz ) \
+ (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
+ (t)->RowStride + (i)) * (sz)
+#define UBYTE_SRC( t, i, j, k, sz ) \
+ ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
+ (t)->RowStride + (i)) * (sz))
+#define USHORT_SRC( t, i, j, k ) \
+ ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
+ (t)->RowStride + (i)))
+#define UINT_SRC( t, i, j, k ) \
+ ((GLuint *)(t)->Data + (((t)->Height * (k) + (j)) * \
+ (t)->RowStride + (i)))
+#define FLOAT_SRC( t, i, j, k, sz ) \
+ ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
+ (t)->RowStride + (i)) * (sz))
+#define HALF_SRC( t, i, j, k, sz ) \
+ ((GLhalfARB *)(t)->Data + (((t)->Height * (k) + (j)) * \
+ (t)->RowStride + (i)) * (sz))
+
+#define FETCH(x) fetch_texel_3d_##x
+
+#else
+#error illegal number of texture dimensions
+#endif
+
+
+/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLchans */
+static void FETCH(rgba)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
+ COPY_CHAN4( texel, src );
+}
+
+/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */
+static void FETCH(f_rgba)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
+ texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
+ texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
+ texel[ACOMP] = CHAN_TO_FLOAT(src[3]);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLchans */
+static void FETCH(rgb)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[1];
+ texel[BCOMP] = src[2];
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */
+static void FETCH(f_rgb)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
+ texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */
+static void FETCH(alpha)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0;
+ texel[ACOMP] = src[0];
+}
+
+/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLfloats */
+static void FETCH(f_alpha)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
+static void FETCH(luminance)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
+static void FETCH(f_luminance)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */
+static void FETCH(luminance_alpha)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 2 );
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[0];
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = src[1];
+}
+
+/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLfloats */
+static void FETCH(f_luminance_alpha)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 2 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[ACOMP] = CHAN_TO_FLOAT(src[1]);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */
+static void FETCH(intensity)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[0];
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = src[0];
+}
+
+/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLfloats */
+static void FETCH(f_intensity)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
+}
+
+
+/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
+ * returning 1 GLfloat.
+ * Note: no GLchan version of this function.
+ */
+static void FETCH(f_depth_component_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
+ texel[0] = src[0];
+}
+
+
+/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
+ * returning 1 GLfloat.
+ * Note: no GLchan version of this function.
+ */
+static void FETCH(f_depth_component16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ texel[0] = src[0] * (1.0F / 65535.0F);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(rgba_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 4 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[3]);
+}
+
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 4 );
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[1];
+ texel[BCOMP] = src[2];
+ texel[ACOMP] = src[3];
+}
+
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(rgba_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 4 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
+ UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1]));
+ UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2]));
+ UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[3]));
+}
+
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 4 );
+ texel[RCOMP] = _mesa_half_to_float(src[0]);
+ texel[GCOMP] = _mesa_half_to_float(src[1]);
+ texel[BCOMP] = _mesa_half_to_float(src[2]);
+ texel[ACOMP] = _mesa_half_to_float(src[3]);
+}
+
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(rgb_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 3 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]);
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[1];
+ texel[BCOMP] = src[2];
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(rgb_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 3 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
+ UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1]));
+ UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2]));
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = _mesa_half_to_float(src[0]);
+ texel[GCOMP] = _mesa_half_to_float(src[1]);
+ texel[BCOMP] = _mesa_half_to_float(src[2]);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(alpha_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0;
+ UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[0]);
+}
+
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0.0F;
+ texel[ACOMP] = src[0];
+}
+
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(alpha_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0;
+ UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[0]));
+}
+
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0.0F;
+ texel[ACOMP] = _mesa_half_to_float(src[0]);
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(luminance_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
+ texel[GCOMP] =
+ texel[BCOMP] = texel[RCOMP];
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(luminance_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
+ texel[GCOMP] =
+ texel[BCOMP] = texel[RCOMP];
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = _mesa_half_to_float(src[0]);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(luminance_alpha_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 2 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
+ texel[GCOMP] =
+ texel[BCOMP] = texel[RCOMP];
+ UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[1]);
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 2 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = src[1];
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(luminance_alpha_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 2 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
+ texel[GCOMP] =
+ texel[BCOMP] = texel[RCOMP];
+ UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[1]));
+}
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 2 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = _mesa_half_to_float(src[0]);
+ texel[ACOMP] = _mesa_half_to_float(src[1]);
+}
+
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(intensity_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = texel[RCOMP];
+}
+
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = src[0];
+}
+
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
+ * returning 4 GLchans.
+ */
+static void FETCH(intensity_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
+ UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = texel[RCOMP];
+}
+
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = _mesa_half_to_float(src[0]);
+}
+
+
+
+/*
+ * Begin Hardware formats
+ */
+
+/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLchans */
+static void FETCH(rgba8888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s >> 24) );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
+}
+
+/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
+static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
+static void FETCH(rgba8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) );
+}
+
+/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLfloats */
+static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
+static void FETCH(argb8888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) );
+}
+
+/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLfloats */
+static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLchans */
+static void FETCH(argb8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s >> 24) );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
+static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
+static void FETCH(rgb888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = UBYTE_TO_CHAN( src[2] );
+ texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLfloats */
+static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
+ texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
+ texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
+static void FETCH(bgr888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
+ texel[BCOMP] = UBYTE_TO_CHAN( src[2] );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLfloats */
+static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
+ texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
+ texel[BCOMP] = UBYTE_TO_FLOAT( src[2] );
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
+static void FETCH(rgb565)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = *src;
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLfloats */
+static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = *src;
+ texel[RCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F);
+ texel[GCOMP] = ((s >> 3) & 0xfc) * (1.0F / 252.0F);
+ texel[BCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.0F);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
+static void FETCH(rgb565_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLfloats */
+static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
+ texel[RCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F);
+ texel[GCOMP] = ((s >> 3) & 0xfc) * (1.0F / 252.0F);
+ texel[BCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.0F);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
+static void FETCH(argb4444)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = *src;
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
+}
+
+/* Fetch texel from 1D, 2D or 3D argb4444 texture, return 4 GLfloats */
+static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = *src;
+ texel[RCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
+ texel[GCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
+ texel[BCOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
+ texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
+static void FETCH(argb4444_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
+}
+
+/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLfloats */
+static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
+ texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+ texel[BCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
+ texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
+static void FETCH(argb1555)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = *src;
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
+}
+
+/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLfloats */
+static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = *src;
+ texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
+ texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F);
+ texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F);
+ texel[ACOMP] = ((s >> 15) & 0x01);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
+static void FETCH(argb1555_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
+}
+
+/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLfloats */
+static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = USHORT_SRC( texImage, i, j, k );
+ const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
+ texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
+ texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F);
+ texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F);
+ texel[ACOMP] = ((s >> 15) & 0x01);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
+static void FETCH(al88)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_CHAN( s & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( s >> 8 );
+}
+
+/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLfloats */
+static void FETCH(f_al88)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
+static void FETCH(al88_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_CHAN( s >> 8 );
+ texel[ACOMP] = UBYTE_TO_CHAN( s & 0xff );
+}
+
+/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLfloats */
+static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+ texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
+static void FETCH(rgb332)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ const GLubyte s = *src;
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s << 6) & 0xc0) * 255 / 0xc0 );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLfloats */
+static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ const GLubyte s = *src;
+ texel[RCOMP] = ((s ) & 0xe0) * (1.0F / 224.0F);
+ texel[GCOMP] = ((s << 3) & 0xe0) * (1.0F / 224.0F);
+ texel[BCOMP] = ((s << 6) & 0xc0) * (1.0F / 192.0F);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
+static void FETCH(a8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0;
+ texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+}
+
+/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLfloats */
+static void FETCH(f_a8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+}
+
+
+/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
+static void FETCH(l8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLfloats */
+static void FETCH(f_l8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
+static void FETCH(i8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+}
+
+/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLfloats */
+static void FETCH(f_i8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+}
+
+
+/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
+ * color table, and return 4 GLchans.
+ */
+static void FETCH(ci8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ const struct gl_color_table *palette;
+ const GLchan *table;
+ GLuint index;
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->Texture.SharedPalette) {
+ palette = &ctx->Texture.Palette;
+ }
+ else {
+ palette = &texImage->TexObject->Palette;
+ }
+ if (palette->Size == 0)
+ return; /* undefined results */
+ ASSERT(palette->Type != GL_FLOAT);
+ table = (const GLchan *) palette->Table;
+
+ /* Mask the index against size of palette to avoid going out of bounds */
+ index = (*src) & (palette->Size - 1);
+
+ switch (palette->Format) {
+ case GL_ALPHA:
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0;
+ texel[ACOMP] = table[index];
+ return;
+ case GL_LUMINANCE:
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = table[index];
+ texel[ACOMP] = CHAN_MAX;
+ break;
+ case GL_INTENSITY:
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = table[index];
+ return;
+ case GL_LUMINANCE_ALPHA:
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = table[index * 2 + 0];
+ texel[ACOMP] = table[index * 2 + 1];
+ return;
+ case GL_RGB:
+ texel[RCOMP] = table[index * 3 + 0];
+ texel[GCOMP] = table[index * 3 + 1];
+ texel[BCOMP] = table[index * 3 + 2];
+ texel[ACOMP] = CHAN_MAX;
+ return;
+ case GL_RGBA:
+ texel[RCOMP] = table[index * 4 + 0];
+ texel[GCOMP] = table[index * 4 + 1];
+ texel[BCOMP] = table[index * 4 + 2];
+ texel[ACOMP] = table[index * 4 + 3];
+ return;
+ default:
+ _mesa_problem(ctx, "Bad palette format in palette_sample");
+ }
+}
+
+
+/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
+ * color table, and return 4 GLfloats.
+ */
+static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ GLchan rgba[4];
+ /* Sample as GLchan */
+ FETCH(ci8)(texImage, i, j, k, rgba);
+ /* and return as floats */
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
+}
+
+
+/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */
+/* We convert YCbCr to RGB here */
+/* XXX this may break if GLchan != GLubyte */
+static void FETCH(ycbcr)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */
+ const GLubyte cb = *src0 & 0xff; /* chroma U */
+ const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
+ const GLubyte cr = *src1 & 0xff; /* chroma V */
+ GLint r, g, b;
+ if (i & 1) {
+ /* odd pixel: use y1,cr,cb */
+ r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128));
+ g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128));
+ }
+ else {
+ /* even pixel: use y0,cr,cb */
+ r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128));
+ g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
+ }
+ texel[RCOMP] = CLAMP(r, 0, CHAN_MAX);
+ texel[GCOMP] = CLAMP(g, 0, CHAN_MAX);
+ texel[BCOMP] = CLAMP(b, 0, CHAN_MAX);
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats */
+/* We convert YCbCr to RGB here */
+static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */
+ const GLubyte cb = *src0 & 0xff; /* chroma U */
+ const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
+ const GLubyte cr = *src1 & 0xff; /* chroma V */
+ GLfloat r, g, b;
+ if (i & 1) {
+ /* odd pixel: use y1,cr,cb */
+ r = (1.164 * (y1-16) + 1.596 * (cr-128));
+ g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y1-16) + 2.018 * (cb-128));
+ }
+ else {
+ /* even pixel: use y0,cr,cb */
+ r = (1.164 * (y0-16) + 1.596 * (cr-128));
+ g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y0-16) + 2.018 * (cb-128));
+ }
+ /* XXX remove / 255 here by tweaking arithmetic above */
+ r /= 255.0;
+ g /= 255.0;
+ b /= 255.0;
+ /* XXX should we really clamp??? */
+ texel[RCOMP] = CLAMP(r, 0.0, 1.0);
+ texel[GCOMP] = CLAMP(g, 0.0, 1.0);
+ texel[BCOMP] = CLAMP(b, 0.0, 1.0);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */
+/* We convert YCbCr to RGB here */
+/* XXX this may break if GLchan != GLubyte */
+static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = *src0 & 0xff; /* luminance */
+ const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
+ const GLubyte y1 = *src1 & 0xff; /* luminance */
+ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
+ GLint r, g, b;
+ if (i & 1) {
+ /* odd pixel: use y1,cr,cb */
+ r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128));
+ g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128));
+ }
+ else {
+ /* even pixel: use y0,cr,cb */
+ r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128));
+ g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
+ }
+ texel[RCOMP] = CLAMP(r, 0, CHAN_MAX);
+ texel[GCOMP] = CLAMP(g, 0, CHAN_MAX);
+ texel[BCOMP] = CLAMP(b, 0, CHAN_MAX);
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats */
+/* We convert YCbCr to RGB here */
+static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = *src0 & 0xff; /* luminance */
+ const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
+ const GLubyte y1 = *src1 & 0xff; /* luminance */
+ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
+ GLfloat r, g, b;
+ if (i & 1) {
+ /* odd pixel: use y1,cr,cb */
+ r = (1.164 * (y1-16) + 1.596 * (cr-128));
+ g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y1-16) + 2.018 * (cb-128));
+ }
+ else {
+ /* even pixel: use y0,cr,cb */
+ r = (1.164 * (y0-16) + 1.596 * (cr-128));
+ g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y0-16) + 2.018 * (cb-128));
+ }
+ /* XXX remove / 255 here by tweaking arithmetic above */
+ r /= 255.0;
+ g /= 255.0;
+ b /= 255.0;
+ /* XXX should we really clamp??? */
+ texel[RCOMP] = CLAMP(r, 0.0, 1.0);
+ texel[GCOMP] = CLAMP(g, 0.0, 1.0);
+ texel[BCOMP] = CLAMP(b, 0.0, 1.0);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+
+#undef CHAN_SRC
+#undef UBYTE_SRC
+#undef USHORT_SRC
+#undef UINT_SRC
+#undef FLOAT_SRC
+#undef HALF_SRC
+#undef FETCH
+#undef DIM
Index: xc/extras/Mesa/src/mesa/main/teximage.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/teximage.c:1.5
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/teximage.c Fri Dec 10 10:41:02 2004
@@ -0,0 +1,3369 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/main/teximage.c,v 1.5 2004/12/10 15:41:02 alanh Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file teximage.c
+ * Texture images manipulation functions.
+ *
+ * \note Mesa's native texture data type is GLchan. Native formats are
+ * GL_ALPHA, GL_LUMINANCE, GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, GL_RGBA, and
+ * GL_COLOR_INDEX.
+ *
+ * \note Device drivers are free to implement any internal format they want.
+ */
+
+
+#include "glheader.h"
+#include "context.h"
+#include "convolve.h"
+#include "image.h"
+#include "imports.h"
+#include "macros.h"
+#include "state.h"
+#include "texcompress.h"
+#include "texformat.h"
+#include "teximage.h"
+#include "texstate.h"
+#include "texstore.h"
+#include "mtypes.h"
+
+
+#if 0
+static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img)
+{
+#if CHAN_TYPE == GL_FLOAT
+ _mesa_problem(NULL, "PrintTexture doesn't support float channels");
+#else
+ GLuint i, j, c;
+ const GLchan *data = (const GLchan *) img->Data;
+
+ if (!data) {
+ _mesa_printf("No texture data\n");
+ return;
+ }
+
+ switch (img->Format) {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_INTENSITY:
+ case GL_COLOR_INDEX:
+ c = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ c = 2;
+ break;
+ case GL_RGB:
+ c = 3;
+ break;
+ case GL_RGBA:
+ c = 4;
+ break;
+ default:
+ _mesa_problem(NULL, "error in PrintTexture\n");
+ return;
+ }
+
+ for (i = 0; i < img->Height; i++) {
+ for (j = 0; j < img->Width; j++) {
+ if (c==1)
+ _mesa_printf("%02x ", data[0]);
+ else if (c==2)
+ _mesa_printf("%02x%02x ", data[0], data[1]);
+ else if (c==3)
+ _mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]);
+ else if (c==4)
+ _mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]);
+ data += (img->RowStride - img->Width) * c;
+ }
+ _mesa_printf("\n");
+ }
+#endif
+}
+#endif
+
+
+/*
+ * Compute floor(log_base_2(n)).
+ * If n < 0 return -1.
+ */
+static int
+logbase2( int n )
+{
+ GLint i = 1;
+ GLint log2 = 0;
+
+ if (n < 0)
+ return -1;
+
+ if (n == 0)
+ return 0;
+
+ while ( n > i ) {
+ i *= 2;
+ log2++;
+ }
+ if (i != n) {
+ return log2 - 1;
+ }
+ else {
+ return log2;
+ }
+}
+
+
+
+/**
+ * Return the simple base format for a given internal texture format.
+ * For example, given GL_LUMINANCE12_ALPHA4, return GL_LUMINANCE_ALPHA.
+ *
+ * \param ctx GL context.
+ * \param internalFormat the internal texture format token or 1, 2, 3, or 4.
+ *
+ * \return the corresponding \u base internal format (GL_ALPHA, GL_LUMINANCE,
+ * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA), or -1 if invalid enum.
+ *
+ * This is the format which is used during texture application (i.e. the
+ * texture format and env mode determine the arithmetic used.
+ */
+GLint
+_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
+{
+ switch (internalFormat) {
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return GL_ALPHA;
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ return GL_LUMINANCE;
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return GL_LUMINANCE_ALPHA;
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY8:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ return GL_INTENSITY;
+ case 3:
+ case GL_RGB:
+ case GL_R3_G3_B2:
+ case GL_RGB4:
+ case GL_RGB5:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return GL_RGB;
+ case 4:
+ case GL_RGBA:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return GL_RGBA;
+ default:
+ ; /* fallthrough */
+ }
+
+ if (ctx->Extensions.EXT_paletted_texture) {
+ switch (internalFormat) {
+ case GL_COLOR_INDEX:
+ case GL_COLOR_INDEX1_EXT:
+ case GL_COLOR_INDEX2_EXT:
+ case GL_COLOR_INDEX4_EXT:
+ case GL_COLOR_INDEX8_EXT:
+ case GL_COLOR_INDEX12_EXT:
+ case GL_COLOR_INDEX16_EXT:
+ return GL_COLOR_INDEX;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.SGIX_depth_texture) {
+ switch (internalFormat) {
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT16_SGIX:
+ case GL_DEPTH_COMPONENT24_SGIX:
+ case GL_DEPTH_COMPONENT32_SGIX:
+ return GL_DEPTH_COMPONENT;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ARB_texture_compression) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA:
+ return GL_ALPHA;
+ case GL_COMPRESSED_LUMINANCE:
+ return GL_LUMINANCE;
+ case GL_COMPRESSED_LUMINANCE_ALPHA:
+ return GL_LUMINANCE_ALPHA;
+ case GL_COMPRESSED_INTENSITY:
+ return GL_INTENSITY;
+ case GL_COMPRESSED_RGB:
+ return GL_RGB;
+ case GL_COMPRESSED_RGBA:
+ return GL_RGBA;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ return GL_RGB;
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ return GL_RGBA;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return GL_RGB;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ return GL_RGBA;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.S3_s3tc) {
+ switch (internalFormat) {
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ return GL_RGB;
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ return GL_RGBA;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.MESA_ycbcr_texture) {
+ if (internalFormat == GL_YCBCR_MESA)
+ return GL_YCBCR_MESA;
+ }
+
+ if (ctx->Extensions.ARB_texture_float) {
+ switch (internalFormat) {
+ case GL_ALPHA16F_ARB:
+ case GL_ALPHA32F_ARB:
+ return GL_ALPHA;
+ case GL_RGBA16F_ARB:
+ case GL_RGBA32F_ARB:
+ return GL_RGBA;
+ case GL_RGB16F_ARB:
+ case GL_RGB32F_ARB:
+ return GL_RGB;
+ case GL_INTENSITY16F_ARB:
+ case GL_INTENSITY32F_ARB:
+ return GL_INTENSITY;
+ case GL_LUMINANCE16F_ARB:
+ case GL_LUMINANCE32F_ARB:
+ return GL_LUMINANCE;
+ case GL_LUMINANCE_ALPHA16F_ARB:
+ case GL_LUMINANCE_ALPHA32F_ARB:
+ return GL_LUMINANCE_ALPHA;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ return -1; /* error */
+}
+
+
+/**
+ * Test if the given image format is a color/RGBA format (i.e., not color
+ * index, depth, stencil, etc).
+ * \param format the image format value (may by an internal texture format)
+ * \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.
+ */
+static GLboolean
+is_color_format(GLenum format)
+{
+ switch (format) {
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY8:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ case 3:
+ case GL_RGB:
+ case GL_BGR:
+ case GL_R3_G3_B2:
+ case GL_RGB4:
+ case GL_RGB5:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ case 4:
+ case GL_ABGR_EXT:
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ /* float texture formats */
+ case GL_ALPHA16F_ARB:
+ case GL_ALPHA32F_ARB:
+ case GL_LUMINANCE16F_ARB:
+ case GL_LUMINANCE32F_ARB:
+ case GL_LUMINANCE_ALPHA16F_ARB:
+ case GL_LUMINANCE_ALPHA32F_ARB:
+ case GL_INTENSITY16F_ARB:
+ case GL_INTENSITY32F_ARB:
+ case GL_RGB16F_ARB:
+ case GL_RGB32F_ARB:
+ case GL_RGBA16F_ARB:
+ case GL_RGBA32F_ARB:
+ /* compressed formats */
+ case GL_COMPRESSED_ALPHA:
+ case GL_COMPRESSED_LUMINANCE:
+ case GL_COMPRESSED_LUMINANCE_ALPHA:
+ case GL_COMPRESSED_INTENSITY:
+ case GL_COMPRESSED_RGB:
+ case GL_COMPRESSED_RGBA:
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ return GL_TRUE;
+ case GL_YCBCR_MESA: /* not considered to be RGB */
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if the given image format is a color index format.
+ */
+static GLboolean
+is_index_format(GLenum format)
+{
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_COLOR_INDEX1_EXT:
+ case GL_COLOR_INDEX2_EXT:
+ case GL_COLOR_INDEX4_EXT:
+ case GL_COLOR_INDEX8_EXT:
+ case GL_COLOR_INDEX12_EXT:
+ case GL_COLOR_INDEX16_EXT:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if the given image format is a depth component format.
+ */
+static GLboolean
+is_depth_format(GLenum format)
+{
+ switch (format) {
+ case GL_DEPTH_COMPONENT16_ARB:
+ case GL_DEPTH_COMPONENT24_ARB:
+ case GL_DEPTH_COMPONENT32_ARB:
+ case GL_DEPTH_COMPONENT:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if the given image format is a YCbCr format.
+ */
+static GLboolean
+is_ycbcr_format(GLenum format)
+{
+ switch (format) {
+ case GL_YCBCR_MESA:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if it is a supported compressed format.
+ *
+ * \param internalFormat the internal format token provided by the user.
+ *
+ * \ret GL_TRUE if \p internalFormat is a supported compressed format, or
+ * GL_FALSE otherwise.
+ *
+ * Currently only GL_COMPRESSED_RGB_FXT1_3DFX and GL_COMPRESSED_RGBA_FXT1_3DFX
+ * are supported.
+ */
+static GLboolean
+is_compressed_format(GLcontext *ctx, GLenum internalFormat)
+{
+ (void) ctx;
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Store a gl_texture_image pointer in a gl_texture_object structure
+ * according to the target and level parameters.
+ *
+ * \param tObj texture object.
+ * \param target texture target.
+ * \param level image level.
+ * \param texImage texture image.
+ *
+ * This was basically prompted by the introduction of cube maps.
+ */
+void
+_mesa_set_tex_image(struct gl_texture_object *tObj,
+ GLenum target, GLint level,
+ struct gl_texture_image *texImage)
+{
+ ASSERT(tObj);
+ ASSERT(texImage);
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_3D:
+ tObj->Image[0][level] = texImage;
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: {
+ GLuint face = ((GLuint) target -
+ (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X);
+ tObj->Image[face][level] = texImage;
+ break;
+ }
+ case GL_TEXTURE_RECTANGLE_NV:
+ ASSERT(level == 0);
+ tObj->Image[0][level] = texImage;
+ break;
+ default:
+ _mesa_problem(NULL, "bad target in _mesa_set_tex_image()");
+ return;
+ }
+ /* Set the 'back' pointer */
+ texImage->TexObject = tObj;
+}
+
+
+/**
+ * Allocate a texture image structure.
+ *
+ * Called via ctx->Driver.NewTextureImage() unless overriden by a device
+ * driver.
+ *
+ * \return a pointer to gl_texture_image struct with all fields initialized to
+ * zero.
+ */
+struct gl_texture_image *
+_mesa_new_texture_image( GLcontext *ctx )
+{
+ (void) ctx;
+ return CALLOC_STRUCT(gl_texture_image);
+}
+
+
+/**
+ * Free texture image.
+ *
+ * \param teximage texture image.
+ *
+ * Free the texture image structure and the associated image data if it's not
+ * marked as client data.
+ */
+void
+_mesa_delete_texture_image( struct gl_texture_image *teximage )
+{
+ if (teximage->Data && !teximage->IsClientData) {
+ MESA_PBUFFER_FREE( teximage->Data );
+ teximage->Data = NULL;
+ }
+ FREE( teximage );
+}
+
+
+/**
+ * Test if a target is a proxy target.
+ *
+ * \param target texture target.
+ *
+ * \return GL_TRUE if the target is a proxy target, GL_FALSE otherwise.
+ */
+static GLboolean
+is_proxy_target(GLenum target)
+{
+ return (target == GL_PROXY_TEXTURE_1D ||
+ target == GL_PROXY_TEXTURE_2D ||
+ target == GL_PROXY_TEXTURE_3D ||
+ target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
+ target == GL_PROXY_TEXTURE_RECTANGLE_NV);
+}
+
+
+/**
+ * Get the texture object that corresponds to the target of the given texture unit.
+ *
+ * \param ctx GL context.
+ * \param texUnit texture unit.
+ * \param target texture target.
+ *
+ * \return pointer to the texture object on success, or NULL on failure.
+ *
+ * \sa gl_texture_unit.
+ */
+struct gl_texture_object *
+_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+ GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D:
+ return texUnit->Current1D;
+ case GL_PROXY_TEXTURE_1D:
+ return ctx->Texture.Proxy1D;
+ case GL_TEXTURE_2D:
+ return texUnit->Current2D;
+ case GL_PROXY_TEXTURE_2D:
+ return ctx->Texture.Proxy2D;
+ case GL_TEXTURE_3D:
+ return texUnit->Current3D;
+ case GL_PROXY_TEXTURE_3D:
+ return ctx->Texture.Proxy3D;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ return ctx->Extensions.ARB_texture_cube_map
+ ? texUnit->CurrentCubeMap : NULL;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ return ctx->Extensions.ARB_texture_cube_map
+ ? ctx->Texture.ProxyCubeMap : NULL;
+ case GL_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle
+ ? texUnit->CurrentRect : NULL;
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle
+ ? ctx->Texture.ProxyRect : NULL;
+ default:
+ _mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
+ return NULL;
+ }
+}
+
+
+/**
+ * Get the texture image struct which corresponds to target and level
+ * of the given texture unit.
+ *
+ * \param ctx GL context.
+ * \param texUnit texture unit.
+ * \param target texture target.
+ * \param level image level.
+ *
+ * \return pointer to the texture image structure on success, or NULL on failure.
+ *
+ * \sa gl_texture_unit.
+ */
+struct gl_texture_image *
+_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+ GLenum target, GLint level)
+{
+ ASSERT(texUnit);
+ ASSERT(level < MAX_TEXTURE_LEVELS);
+ switch (target) {
+ case GL_TEXTURE_1D:
+ return texUnit->Current1D->Image[0][level];
+ case GL_PROXY_TEXTURE_1D:
+ return ctx->Texture.Proxy1D->Image[0][level];
+ case GL_TEXTURE_2D:
+ return texUnit->Current2D->Image[0][level];
+ case GL_PROXY_TEXTURE_2D:
+ return ctx->Texture.Proxy2D->Image[0][level];
+ case GL_TEXTURE_3D:
+ return texUnit->Current3D->Image[0][level];
+ case GL_PROXY_TEXTURE_3D:
+ return ctx->Texture.Proxy3D->Image[0][level];
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ if (ctx->Extensions.ARB_texture_cube_map) {
+ GLuint face = ((GLuint) target -
+ (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X);
+ return texUnit->CurrentCubeMap->Image[face][level];
+ }
+ else
+ return NULL;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.ARB_texture_cube_map)
+ return ctx->Texture.ProxyCubeMap->Image[0][level];
+ else
+ return NULL;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (ctx->Extensions.NV_texture_rectangle) {
+ ASSERT(level == 0);
+ return texUnit->CurrentRect->Image[0][level];
+ }
+ else {
+ return NULL;
+ }
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ if (ctx->Extensions.NV_texture_rectangle) {
+ ASSERT(level == 0);
+ return ctx->Texture.ProxyRect->Image[0][level];
+ }
+ else {
+ return NULL;
+ }
+ default:
+ _mesa_problem(ctx, "bad target in _mesa_select_tex_image()");
+ return NULL;
+ }
+}
+
+
+/**
+ * Like _mesa_select_tex_image() but if the image doesn't exist, allocate
+ * it and install it. Only return NULL if passed a bad parameter or run
+ * out of memory.
+ */
+struct gl_texture_image *
+_mesa_get_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+ GLenum target, GLint level)
+{
+ struct gl_texture_image *texImage;
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ struct gl_texture_object *texObj;
+ texImage = ctx->Driver.NewTextureImage(ctx);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation");
+ return NULL;
+ }
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ ASSERT(texObj);
+ _mesa_set_tex_image(texObj, target, level, texImage);
+ }
+ return texImage;
+}
+
+
+/**
+ * Return pointer to the specified proxy texture image.
+ * Note that proxy textures are per-context, not per-texture unit.
+ * \return pointer to texture image or NULL if invalid target, invalid
+ * level, or out of memory.
+ */
+struct gl_texture_image *
+_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level)
+{
+ struct gl_texture_image *texImage;
+
+ if (level < 0 )
+ return NULL;
+
+ switch (target) {
+ case GL_PROXY_TEXTURE_1D:
+ if (level >= ctx->Const.MaxTextureLevels)
+ return NULL;
+ texImage = ctx->Texture.Proxy1D->Image[0][level];
+ if (!texImage) {
+ texImage = ctx->Driver.NewTextureImage(ctx);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
+ return NULL;
+ }
+ ctx->Texture.Proxy1D->Image[0][level] = texImage;
+ /* Set the 'back' pointer */
+ texImage->TexObject = ctx->Texture.Proxy1D;
+ }
+ return texImage;
+ case GL_PROXY_TEXTURE_2D:
+ if (level >= ctx->Const.MaxTextureLevels)
+ return NULL;
+ texImage = ctx->Texture.Proxy2D->Image[0][level];
+ if (!texImage) {
+ texImage = ctx->Driver.NewTextureImage(ctx);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
+ return NULL;
+ }
+ ctx->Texture.Proxy2D->Image[0][level] = texImage;
+ /* Set the 'back' pointer */
+ texImage->TexObject = ctx->Texture.Proxy2D;
+ }
+ return texImage;
+ case GL_PROXY_TEXTURE_3D:
+ if (level >= ctx->Const.Max3DTextureLevels)
+ return NULL;
+ texImage = ctx->Texture.Proxy3D->Image[0][level];
+ if (!texImage) {
+ texImage = ctx->Driver.NewTextureImage(ctx);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
+ return NULL;
+ }
+ ctx->Texture.Proxy3D->Image[0][level] = texImage;
+ /* Set the 'back' pointer */
+ texImage->TexObject = ctx->Texture.Proxy3D;
+ }
+ return texImage;
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ if (level >= ctx->Const.MaxCubeTextureLevels)
+ return NULL;
+ texImage = ctx->Texture.ProxyCubeMap->Image[0][level];
+ if (!texImage) {
+ texImage = ctx->Driver.NewTextureImage(ctx);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
+ return NULL;
+ }
+ ctx->Texture.ProxyCubeMap->Image[0][level] = texImage;
+ /* Set the 'back' pointer */
+ texImage->TexObject = ctx->Texture.ProxyCubeMap;
+ }
+ return texImage;
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ if (level > 0)
+ return NULL;
+ texImage = ctx->Texture.ProxyRect->Image[0][level];
+ if (!texImage) {
+ texImage = ctx->Driver.NewTextureImage(ctx);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
+ return NULL;
+ }
+ ctx->Texture.ProxyRect->Image[0][level] = texImage;
+ /* Set the 'back' pointer */
+ texImage->TexObject = ctx->Texture.ProxyRect;
+ }
+ return texImage;
+ default:
+ return NULL;
+ }
+}
+
+
+/**
+ * Get the maximum number of allowed mipmap levels.
+ *
+ * \param ctx GL context.
+ * \param target texture target.
+ *
+ * \return the maximum number of allowed mipmap levels for the given
+ * texture target, or zero if passed a bad target.
+ *
+ * \sa gl_constants.
+ */
+GLint
+_mesa_max_texture_levels(GLcontext *ctx, GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_PROXY_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_2D:
+ return ctx->Const.MaxTextureLevels;
+ case GL_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_3D:
+ return ctx->Const.Max3DTextureLevels;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ return ctx->Const.MaxCubeTextureLevels;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ return 1;
+ default:
+ return 0; /* bad target */
+ }
+}
+
+
+
+#if 000 /* not used anymore */
+/*
+ * glTexImage[123]D can accept a NULL image pointer. In this case we
+ * create a texture image with unspecified image contents per the OpenGL
+ * spec.
+ */
+static GLubyte *
+make_null_texture(GLint width, GLint height, GLint depth, GLenum format)
+{
+ const GLint components = _mesa_components_in_format(format);
+ const GLint numPixels = width * height * depth;
+ GLubyte *data = (GLubyte *) MALLOC(numPixels * components * sizeof(GLubyte));
+
+#ifdef DEBUG
+ /*
+ * Let's see if anyone finds this. If glTexImage2D() is called with
+ * a NULL image pointer then load the texture image with something
+ * interesting instead of leaving it indeterminate.
+ */
+ if (data) {
+ static const char message[8][32] = {
+ " X X XXXXX XXX X ",
+ " XX XX X X X X X ",
+ " X X X X X X X ",
+ " X X XXXX XXX XXXXX ",
+ " X X X X X X ",
+ " X X X X X X X ",
+ " X X XXXXX XXX X X ",
+ " "
+ };
+
+ GLubyte *imgPtr = data;
+ GLint h, i, j, k;
+ for (h = 0; h < depth; h++) {
+ for (i = 0; i < height; i++) {
+ GLint srcRow = 7 - (i % 8);
+ for (j = 0; j < width; j++) {
+ GLint srcCol = j % 32;
+ GLubyte texel = (message[srcRow][srcCol]=='X') ? 255 : 70;
+ for (k = 0; k < components; k++) {
+ *imgPtr++ = texel;
+ }
+ }
+ }
+ }
+ }
+#endif
+
+ return data;
+}
+#endif
+
+
+
+/**
+ * Reset the fields of a gl_texture_image struct to zero.
+ *
+ * \param img texture image structure.
+ *
+ * This is called when a proxy texture test fails, we set all the
+ * image members (except DriverData) to zero.
+ * It's also used in glTexImage[123]D as a safeguard to be sure all
+ * required fields get initialized properly by the Driver.TexImage[123]D
+ * functions.
+ */
+static void
+clear_teximage_fields(struct gl_texture_image *img)
+{
+ ASSERT(img);
+ img->Format = 0;
+ img->IntFormat = 0;
+ img->Border = 0;
+ img->Width = 0;
+ img->Height = 0;
+ img->Depth = 0;
+ img->RowStride = 0;
+ img->Width2 = 0;
+ img->Height2 = 0;
+ img->Depth2 = 0;
+ img->WidthLog2 = 0;
+ img->HeightLog2 = 0;
+ img->DepthLog2 = 0;
+ img->Data = NULL;
+ img->TexFormat = &_mesa_null_texformat;
+ img->FetchTexelc = NULL;
+ img->FetchTexelf = NULL;
+ img->IsCompressed = 0;
+ img->CompressedSize = 0;
+}
+
+
+/**
+ * Initialize basic fields of the gl_texture_image struct.
+ *
+ * \param ctx GL context.
+ * \param target texture target.
+ * \param img texture image structure to be initialized.
+ * \param width image width.
+ * \param height image height.
+ * \param depth image depth.
+ * \param border image border.
+ * \param internalFormat internal format.
+ *
+ * Fills in the fields of \p img with the given information.
+ * Note: width, height and depth include the border.
+ */
+void
+_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
+ struct gl_texture_image *img,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum internalFormat)
+{
+ ASSERT(img);
+ img->Format = _mesa_base_tex_format( ctx, internalFormat );
+ ASSERT(img->Format > 0);
+ img->IntFormat = internalFormat;
+ img->Border = border;
+ img->Width = width;
+ img->Height = height;
+ img->Depth = depth;
+ img->RowStride = width;
+ img->WidthLog2 = logbase2(width - 2 * border);
+ if (height == 1) /* 1-D texture */
+ img->HeightLog2 = 0;
+ else
+ img->HeightLog2 = logbase2(height - 2 * border);
+ if (depth == 1) /* 2-D texture */
+ img->DepthLog2 = 0;
+ else
+ img->DepthLog2 = logbase2(depth - 2 * border);
+ img->Width2 = width - 2 * border; /*1 << img->WidthLog2;*/
+ img->Height2 = height - 2 * border; /*1 << img->HeightLog2;*/
+ img->Depth2 = depth - 2 * border; /*1 << img->DepthLog2;*/
+ img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
+ img->IsCompressed = is_compressed_format(ctx, internalFormat);
+ if (img->IsCompressed)
+ img->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, width,
+ height, depth, internalFormat);
+ else
+ img->CompressedSize = 0;
+
+ if ((width == 1 || _mesa_bitcount(width - 2 * border) == 1) &&
+ (height == 1 || _mesa_bitcount(height - 2 * border) == 1) &&
+ (depth == 1 || _mesa_bitcount(depth - 2 * border) == 1))
+ img->_IsPowerOfTwo = GL_TRUE;
+ else
+ img->_IsPowerOfTwo = GL_FALSE;
+
+ /* Compute Width/Height/DepthScale for mipmap lod computation */
+ if (target == GL_TEXTURE_RECTANGLE_NV) {
+ /* scale = 1.0 since texture coords directly map to texels */
+ img->WidthScale = 1.0;
+ img->HeightScale = 1.0;
+ img->DepthScale = 1.0;
+ }
+ else {
+ img->WidthScale = (GLfloat) img->Width;
+ img->HeightScale = (GLfloat) img->Height;
+ img->DepthScale = (GLfloat) img->Depth;
+ }
+}
+
+
+/**
+ * This is the fallback for Driver.TestProxyTexImage(). Test the texture
+ * level, width, height and depth against the ctx->Const limits for textures.
+ *
+ * A hardware driver might override this function if, for example, the
+ * max 3D texture size is 512x512x64 (i.e. not a cube).
+ *
+ * \param target one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D,
+ * GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV,
+ * GL_PROXY_TEXTURE_CUBE_MAP_ARB.
+ * \param level as passed to glTexImage
+ * \param internalFormat as passed to glTexImage
+ * \param format as passed to glTexImage
+ * \param type as passed to glTexImage
+ * \param width as passed to glTexImage
+ * \param height as passed to glTexImage
+ * \param depth as passed to glTexImage
+ * \param border as passed to glTexImage
+ * \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.
+ */
+GLboolean
+_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat, GLenum format, GLenum type,
+ GLint width, GLint height, GLint depth, GLint border)
+{
+ GLint maxSize;
+
+ (void) internalFormat;
+ (void) format;
+ (void) type;
+
+ switch (target) {
+ case GL_PROXY_TEXTURE_1D:
+ maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+ if (width < 2 * border || width > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(width - 2 * border) != 1) ||
+ level >= ctx->Const.MaxTextureLevels) {
+ /* bad width or level */
+ return GL_FALSE;
+ }
+ return GL_TRUE;
+ case GL_PROXY_TEXTURE_2D:
+ maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+ if (width < 2 * border || width > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(width - 2 * border) != 1) ||
+ height < 2 * border || height > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(height - 2 * border) != 1) ||
+ level >= ctx->Const.MaxTextureLevels) {
+ /* bad width or height or level */
+ return GL_FALSE;
+ }
+ return GL_TRUE;
+ case GL_PROXY_TEXTURE_3D:
+ maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
+ if (width < 2 * border || width > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(width - 2 * border) != 1) ||
+ height < 2 * border || height > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(height - 2 * border) != 1) ||
+ depth < 2 * border || depth > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(depth - 2 * border) != 1) ||
+ level >= ctx->Const.Max3DTextureLevels) {
+ /* bad width or height or depth or level */
+ return GL_FALSE;
+ }
+ return GL_TRUE;
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ if (width < 1 || width > ctx->Const.MaxTextureRectSize ||
+ height < 1 || height > ctx->Const.MaxTextureRectSize ||
+ level != 0) {
+ /* bad width or height or level */
+ return GL_FALSE;
+ }
+ return GL_TRUE;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
+ if (width < 2 * border || width > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(width - 2 * border) != 1) ||
+ height < 2 * border || height > 2 + maxSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two &&
+ _mesa_bitcount(height - 2 * border) != 1) ||
+ level >= ctx->Const.MaxCubeTextureLevels) {
+ /* bad width or height */
+ return GL_FALSE;
+ }
+ return GL_TRUE;
+ default:
+ _mesa_problem(ctx, "Invalid target in _mesa_test_proxy_teximage");
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test the glTexImage[123]D() parameters for errors.
+ *
+ * \param ctx GL context.
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * \param internalFormat internal format given by the user.
+ * \param format pixel data format given by the user.
+ * \param type pixel data type given by the user.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ * \param depth image depth given by the user.
+ * \param border image border given by the user.
+ *
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ *
+ * Verifies each of the parameters against the constants specified in
+ * __GLcontextRec::Const and the supported extensions, and according to the
+ * OpenGL specification.
+ */
+static GLboolean
+texture_error_check( GLcontext *ctx, GLenum target,
+ GLint level, GLint internalFormat,
+ GLenum format, GLenum type,
+ GLuint dimensions,
+ GLint width, GLint height,
+ GLint depth, GLint border )
+{
+ const GLboolean isProxy = is_proxy_target(target);
+ GLboolean sizeOK;
+
+ /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
+ if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(level=%d)", dimensions, level);
+ }
+ return GL_TRUE;
+ }
+
+ /* Check border */
+ if (border < 0 || border > 1 ||
+ ((target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(border=%d)", dimensions, border);
+ }
+ return GL_TRUE;
+ }
+
+ if (width < 0 || height < 0 || depth < 0) {
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(width, height or depth < 0)", dimensions);
+ }
+ return GL_TRUE;
+ }
+
+ /* Check target and call ctx->Driver.TestProxyTexImage() to check the
+ * level, width, height and depth.
+ */
+ if (dimensions == 1) {
+ if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) {
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D,
+ level, internalFormat,
+ format, type,
+ width, 1, 1, border);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions == 2) {
+ if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) {
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D,
+ level, internalFormat,
+ format, type,
+ width, height, 1, border);
+ }
+ else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
+ (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
+ sizeOK = (width == height) &&
+ ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB,
+ level, internalFormat, format, type,
+ width, height, 1, border);
+ }
+ else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV ||
+ target == GL_TEXTURE_RECTANGLE_NV) {
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx,
+ GL_PROXY_TEXTURE_RECTANGLE_NV,
+ level, internalFormat,
+ format, type,
+ width, height, 1, border);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions == 3) {
+ if (target == GL_PROXY_TEXTURE_3D || target == GL_TEXTURE_3D) {
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_3D,
+ level, internalFormat,
+ format, type,
+ width, height, depth, border);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else {
+ _mesa_problem( ctx, "bad dims in texture_error_check" );
+ return GL_TRUE;
+ }
+
+ if (!sizeOK) {
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(level=%d, width=%d, height=%d, depth=%d)",
+ dimensions, level, width, height, depth);
+ }
+ return GL_TRUE;
+ }
+
+ /* Check internalFormat */
+ if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(internalFormat=0x%x)",
+ dimensions, internalFormat);
+ }
+ return GL_TRUE;
+ }
+
+ /* Check incoming image format and type */
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there
+ * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4.
+ */
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage%dD(format or type)", dimensions);
+ }
+ return GL_TRUE;
+ }
+
+ /* make sure internal format and format basically agree */
+ if ((is_color_format(internalFormat) != is_color_format(format)) ||
+ (is_index_format(internalFormat) != is_index_format(format)) ||
+ (is_depth_format(internalFormat) != is_depth_format(format)) ||
+ (is_ycbcr_format(internalFormat) != is_ycbcr_format(format))) {
+ if (!isProxy)
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage(internalFormat/format)");
+ return GL_TRUE;
+ }
+
+ /* additional checks for ycbcr textures */
+ if (internalFormat == GL_YCBCR_MESA) {
+ ASSERT(ctx->Extensions.MESA_ycbcr_texture);
+ if (type != GL_UNSIGNED_SHORT_8_8_MESA &&
+ type != GL_UNSIGNED_SHORT_8_8_REV_MESA) {
+ char message[100];
+ _mesa_sprintf(message,
+ "glTexImage%d(format/type YCBCR mismatch", dimensions);
+ _mesa_error(ctx, GL_INVALID_ENUM, message);
+ return GL_TRUE; /* error */
+ }
+ if (target != GL_TEXTURE_2D &&
+ target != GL_PROXY_TEXTURE_2D &&
+ target != GL_TEXTURE_RECTANGLE_NV &&
+ target != GL_PROXY_TEXTURE_RECTANGLE_NV) {
+ if (!isProxy)
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)");
+ return GL_TRUE;
+ }
+ if (border != 0) {
+ if (!isProxy) {
+ char message[100];
+ _mesa_sprintf(message,
+ "glTexImage%d(format=GL_YCBCR_MESA and border=%d)",
+ dimensions, border);
+ _mesa_error(ctx, GL_INVALID_VALUE, message);
+ }
+ return GL_TRUE;
+ }
+ }
+
+ /* additional checks for depth textures */
+ if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
+ /* Only 1D and 2D textures supported */
+ if (target != GL_TEXTURE_1D &&
+ target != GL_PROXY_TEXTURE_1D &&
+ target != GL_TEXTURE_2D &&
+ target != GL_PROXY_TEXTURE_2D) {
+ if (!isProxy)
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexImage(target/internalFormat)");
+ return GL_TRUE;
+ }
+ }
+
+ /* additional checks for compressed textures */
+ if (is_compressed_format(ctx, internalFormat)) {
+ if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) {
+ /* OK */
+ }
+ else if (ctx->Extensions.ARB_texture_cube_map &&
+ (target == GL_PROXY_TEXTURE_CUBE_MAP ||
+ (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
+ /* OK */
+ }
+ else {
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexImage%d(target)", dimensions);
+ return GL_TRUE;
+ }
+ }
+ if (border != 0) {
+ if (!isProxy) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage%D(border!=0)", dimensions);
+ }
+ return GL_TRUE;
+ }
+ }
+
+ /* if we get here, the parameters are OK */
+ return GL_FALSE;
+}
+
+
+/**
+ * Test glTexSubImage[123]D() parameters for errors.
+ *
+ * \param ctx GL context.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * \param xoffset sub-image x offset given by the user.
+ * \param yoffset sub-image y offset given by the user.
+ * \param zoffset sub-image z offset given by the user.
+ * \param format pixel data format given by the user.
+ * \param type pixel data type given by the user.
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ * \param depth image depth given by the user.
+ *
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ *
+ * Verifies each of the parameters against the constants specified in
+ * __GLcontextRec::Const and the supported extensions, and according to the
+ * OpenGL specification.
+ */
+static GLboolean
+subtexture_error_check( GLcontext *ctx, GLuint dimensions,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint width, GLint height, GLint depth,
+ GLenum format, GLenum type )
+{
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_image *destTex;
+
+ /* Check target */
+ if (dimensions == 1) {
+ if (target != GL_TEXTURE_1D) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage1D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions == 2) {
+ if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <=GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (ctx->Extensions.NV_texture_rectangle &&
+ target == GL_TEXTURE_RECTANGLE_NV) {
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (target != GL_TEXTURE_2D) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions == 3) {
+ if (target != GL_TEXTURE_3D) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else {
+ _mesa_problem( ctx, "invalid dims in texture_error_check" );
+ return GL_TRUE;
+ }
+
+ /* Basic level check */
+ if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level);
+ return GL_TRUE;
+ }
+
+ if (width < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexSubImage%dD(width=%d)", dimensions, width);
+ return GL_TRUE;
+ }
+ if (height < 0 && dimensions > 1) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexSubImage%dD(height=%d)", dimensions, height);
+ return GL_TRUE;
+ }
+ if (depth < 0 && dimensions > 2) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexSubImage%dD(depth=%d)", dimensions, depth);
+ return GL_TRUE;
+ }
+
+ destTex = _mesa_select_tex_image(ctx, texUnit, target, level);
+
+ if (!destTex) {
+ /* undefined image level */
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD", dimensions);
+ return GL_TRUE;
+ }
+
+ if (xoffset < -((GLint)destTex->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset)",
+ dimensions);
+ return GL_TRUE;
+ }
+ if (xoffset + width > (GLint) (destTex->Width + destTex->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset+width)",
+ dimensions);
+ return GL_TRUE;
+ }
+ if (dimensions > 1) {
+ if (yoffset < -((GLint)destTex->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset)",
+ dimensions);
+ return GL_TRUE;
+ }
+ if (yoffset + height > (GLint) (destTex->Height + destTex->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset+height)",
+ dimensions);
+ return GL_TRUE;
+ }
+ }
+ if (dimensions > 2) {
+ if (zoffset < -((GLint)destTex->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
+ return GL_TRUE;
+ }
+ if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
+ return GL_TRUE;
+ }
+ }
+
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexSubImage%dD(format or type)", dimensions);
+ return GL_TRUE;
+ }
+
+ if (destTex->IsCompressed) {
+ const struct gl_texture_unit *texUnit;
+ const struct gl_texture_image *texImage;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+
+ if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) {
+ /* OK */
+ }
+ else if (ctx->Extensions.ARB_texture_cube_map &&
+ (target == GL_PROXY_TEXTURE_CUBE_MAP ||
+ (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
+ /* OK */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexSubImage%D(target)", dimensions);
+ return GL_TRUE;
+ }
+ /* offset must be multiple of 4 */
+ if ((xoffset & 3) || (yoffset & 3)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexSubImage%D(xoffset or yoffset)", dimensions);
+ return GL_TRUE;
+ }
+ /* size must be multiple of 4 or equal to whole texture size */
+ if ((width & 3) && (GLuint) width != texImage->Width) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexSubImage%D(width)", dimensions);
+ return GL_TRUE;
+ }
+ if ((height & 3) && (GLuint) height != texImage->Height) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexSubImage%D(width)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
+ return GL_FALSE;
+}
+
+
+/**
+ * Test glCopyTexImage[12]D() parameters for errors.
+ *
+ * \param ctx GL context.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * \param internalFormat internal format given by the user.
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ * \param depth image depth given by the user.
+ * \param border texture border.
+ *
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ *
+ * Verifies each of the parameters against the constants specified in
+ * __GLcontextRec::Const and the supported extensions, and according to the
+ * OpenGL specification.
+ */
+static GLboolean
+copytexture_error_check( GLcontext *ctx, GLuint dimensions,
+ GLenum target, GLint level, GLint internalFormat,
+ GLint width, GLint height, GLint border )
+{
+ GLenum format, type;
+ GLboolean sizeOK;
+
+ /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
+ if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexImage%dD(level=%d)", dimensions, level);
+ return GL_TRUE;
+ }
+
+ /* Check border */
+ if (border < 0 || border > 1 ||
+ ((target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
+ return GL_TRUE;
+ }
+
+ /* The format and type aren't really significant here, but we need to pass
+ * something to TestProxyTexImage().
+ */
+ format = _mesa_base_tex_format(ctx, internalFormat);
+ type = GL_FLOAT;
+
+ /* Check target and call ctx->Driver.TestProxyTexImage() to check the
+ * level, width, height and depth.
+ */
+ if (dimensions == 1) {
+ if (target == GL_TEXTURE_1D) {
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D,
+ level, internalFormat,
+ format, type,
+ width, 1, 1, border);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions == 2) {
+ if (target == GL_TEXTURE_2D) {
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D,
+ level, internalFormat,
+ format, type,
+ width, height, 1, border);
+ }
+ else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
+ return GL_TRUE;
+ }
+ sizeOK = (width == height) &&
+ ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB,
+ level, internalFormat, format, type,
+ width, height, 1, border);
+ }
+ else if (target == GL_TEXTURE_RECTANGLE_NV) {
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
+ return GL_TRUE;
+ }
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx,
+ GL_PROXY_TEXTURE_RECTANGLE_NV,
+ level, internalFormat,
+ format, type,
+ width, height, 1, border);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else {
+ _mesa_problem(ctx, "invalid dimensions in copytexture_error_check");
+ return GL_TRUE;
+ }
+
+ if (!sizeOK) {
+ if (dimensions == 1) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexImage1D(width=%d)", width);
+ }
+ else {
+ ASSERT(dimensions == 2);
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexImage2D(width=%d, height=%d)", width, height);
+ }
+ return GL_TRUE;
+ }
+
+ if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexImage%dD(internalFormat)", dimensions);
+ return GL_TRUE;
+ }
+
+ if (is_compressed_format(ctx, internalFormat)) {
+ if (target != GL_TEXTURE_2D) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glCopyTexImage%d(target)", dimensions);
+ return GL_TRUE;
+ }
+ if (border != 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyTexImage%D(border!=0)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
+ /* if we get here, the parameters are OK */
+ return GL_FALSE;
+}
+
+
+/**
+ * Test glCopyTexImage[12]D() parameters for errors.
+ *
+ * \param ctx GL context.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * \param xoffset sub-image x offset given by the user.
+ * \param yoffset sub-image y offset given by the user.
+ * \param zoffset sub-image z offset given by the user.
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ *
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ *
+ * Verifies each of the parameters against the constants specified in
+ * __GLcontextRec::Const and the supported extensions, and according to the
+ * OpenGL specification.
+ */
+static GLboolean
+copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height )
+{
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_image *teximage;
+
+ /* Check target */
+ if (dimensions == 1) {
+ if (target != GL_TEXTURE_1D) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions == 2) {
+ if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (target == GL_TEXTURE_RECTANGLE_NV) {
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (target != GL_TEXTURE_2D) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions == 3) {
+ if (target != GL_TEXTURE_3D) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" );
+ return GL_TRUE;
+ }
+ }
+
+ /* Check level */
+ if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(level=%d)", dimensions, level);
+ return GL_TRUE;
+ }
+
+ /* Check size */
+ if (width < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(width=%d)", dimensions, width);
+ return GL_TRUE;
+ }
+ if (dimensions > 1 && height < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(height=%d)", dimensions, height);
+ return GL_TRUE;
+ }
+
+ teximage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ if (!teximage) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyTexSubImage%dD(undefined texture level: %d)",
+ dimensions, level);
+ return GL_TRUE;
+ }
+
+ if (xoffset < -((GLint)teximage->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset);
+ return GL_TRUE;
+ }
+ if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(xoffset+width)", dimensions);
+ return GL_TRUE;
+ }
+ if (dimensions > 1) {
+ if (yoffset < -((GLint)teximage->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset);
+ return GL_TRUE;
+ }
+ /* NOTE: we're adding the border here, not subtracting! */
+ if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(yoffset+height)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
+ if (dimensions > 2) {
+ if (zoffset < -((GLint)teximage->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(zoffset)", dimensions);
+ return GL_TRUE;
+ }
+ if (zoffset > (GLint) (teximage->Depth + teximage->Border)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%dD(zoffset+depth)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
+ if (teximage->IsCompressed) {
+ if (target != GL_TEXTURE_2D) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glCopyTexSubImage%d(target)", dimensions);
+ return GL_TRUE;
+ }
+ /* offset must be multiple of 4 */
+ if ((xoffset & 3) || (yoffset & 3)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%D(xoffset or yoffset)", dimensions);
+ return GL_TRUE;
+ }
+ /* size must be multiple of 4 */
+ if ((width & 3) != 0 && (GLuint) width != teximage->Width) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%D(width)", dimensions);
+ return GL_TRUE;
+ }
+ if ((height & 3) != 0 && (GLuint) height != teximage->Height) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexSubImage%D(height)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
+ if (teximage->IntFormat == GL_YCBCR_MESA) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D");
+ return GL_TRUE;
+ }
+
+ /* if we get here, the parameters are OK */
+ return GL_FALSE;
+}
+
+
+/**
+ * Get texture image. Called by glGetTexImage.
+ *
+ * \param target texture target.
+ * \param level image level.
+ * \param format pixel data format for returned image.
+ * \param type pixel data type for returned image.
+ * \param pixels returned pixel data.
+ */
+void GLAPIENTRY
+_mesa_GetTexImage( GLenum target, GLint level, GLenum format,
+ GLenum type, GLvoid *pixels )
+{
+ const struct gl_texture_unit *texUnit;
+ const struct gl_texture_object *texObj;
+ const struct gl_texture_image *texImage;
+ GLint maxLevels = 0;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ texUnit = &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ if (!texObj || is_proxy_target(target)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");
+ return;
+ }
+
+ maxLevels = _mesa_max_texture_levels(ctx, target);
+ ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */
+
+ if (level < 0 || level >= maxLevels) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );
+ return;
+ }
+
+ if (_mesa_sizeof_packed_type(type) <= 0) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" );
+ return;
+ }
+
+ if (_mesa_components_in_format(format) <= 0 ||
+ format == GL_STENCIL_INDEX) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" );
+ return;
+ }
+
+ if (!ctx->Extensions.EXT_paletted_texture && is_index_format(format)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+ }
+
+ if (!ctx->Extensions.SGIX_depth_texture && is_depth_format(format)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+ }
+
+ if (!ctx->Extensions.MESA_ycbcr_texture && is_ycbcr_format(format)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+ }
+
+ if (!pixels)
+ return;
+
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ /* invalid mipmap level, not an error */
+ return;
+ }
+
+ if (!texImage->Data) {
+ /* no image data, not an error */
+ return;
+ }
+
+ /* Make sure the requested image format is compatible with the
+ * texture's format.
+ */
+ if (is_color_format(format)
+ && !is_color_format(texImage->TexFormat->BaseFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+ return;
+ }
+ else if (is_index_format(format)
+ && !is_index_format(texImage->TexFormat->BaseFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+ return;
+ }
+ else if (is_depth_format(format)
+ && !is_depth_format(texImage->TexFormat->BaseFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+ return;
+ }
+ else if (is_ycbcr_format(format)
+ && !is_ycbcr_format(texImage->TexFormat->BaseFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+ return;
+ }
+
+ /*
+ * XXX Move this code into a new driver fall-back function
+ */
+ {
+ const GLint width = texImage->Width;
+ const GLint height = texImage->Height;
+ const GLint depth = texImage->Depth;
+ GLint img, row;
+ for (img = 0; img < depth; img++) {
+ for (row = 0; row < height; row++) {
+ /* compute destination address in client memory */
+ GLvoid *dest = _mesa_image_address( &ctx->Pack, pixels,
+ width, height, format, type,
+ img, row, 0);
+ assert(dest);
+
+ if (format == GL_COLOR_INDEX) {
+ GLuint indexRow[MAX_WIDTH];
+ GLint col;
+ /* Can't use FetchTexel here because that returns RGBA */
+ if (texImage->TexFormat->IndexBits == 8) {
+ const GLubyte *src = (const GLubyte *) texImage->Data;
+ for (col = 0; col < width; col++) {
+ indexRow[col] = src[texImage->Width *
+ (img * texImage->Height + row) + col];
+ }
+ }
+ else if (texImage->TexFormat->IndexBits == 16) {
+ const GLushort *src = (const GLushort *) texImage->Data;
+ for (col = 0; col < width; col++) {
+ indexRow[col] = src[texImage->Width *
+ (img * texImage->Height + row) + col];
+ }
+ }
+ else {
+ _mesa_problem(ctx,
+ "Color index problem in _mesa_GetTexImage");
+ return;
+ }
+ _mesa_pack_index_span(ctx, width, type, dest,
+ indexRow, &ctx->Pack,
+ 0 /* no image transfer */);
+ }
+ else if (format == GL_DEPTH_COMPONENT) {
+ GLfloat depthRow[MAX_WIDTH];
+ GLint col;
+ for (col = 0; col < width; col++) {
+ (*texImage->FetchTexelf)(texImage, col, row, img,
+ depthRow + col);
+ }
+ _mesa_pack_depth_span(ctx, width, dest, type,
+ depthRow, &ctx->Pack);
+ }
+ else if (format == GL_YCBCR_MESA) {
+ /* No pixel transfer */
+ const GLint rowstride = texImage->RowStride;
+ MEMCPY(dest,
+ (const GLushort *) texImage->Data + row * rowstride,
+ width * sizeof(GLushort));
+ /* check for byte swapping */
+ if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR
+ && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
+ (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV
+ && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
+ if (!ctx->Pack.SwapBytes)
+ _mesa_swap2((GLushort *) dest, width);
+ }
+ else if (ctx->Pack.SwapBytes) {
+ _mesa_swap2((GLushort *) dest, width);
+ }
+ }
+ else {
+ /* general case: convert row to RGBA format */
+ GLfloat rgba[MAX_WIDTH][4];
+ GLint col;
+ for (col = 0; col < width; col++) {
+ (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
+ }
+ _mesa_pack_rgba_span_float(ctx, width,
+ (const GLfloat (*)[4]) rgba,
+ format, type, dest, &ctx->Pack,
+ 0 /* no image transfer */);
+ } /* format */
+ } /* row */
+ } /* img */
+ }
+}
+
+
+
+/*
+ * Called from the API. Note that width includes the border.
+ */
+void GLAPIENTRY
+_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
+ GLsizei width, GLint border, GLenum format,
+ GLenum type, const GLvoid *pixels )
+{
+ GLsizei postConvWidth = width;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (is_color_format(internalFormat)) {
+ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
+ }
+
+ if (target == GL_TEXTURE_1D) {
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+
+ if (texture_error_check(ctx, target, level, internalFormat,
+ format, type, 1, postConvWidth, 1, 1, border)) {
+ return; /* error was recorded */
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ /* free the old texture data */
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, 1, 1,
+ border, internalFormat);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ ASSERT(ctx->Driver.TexImage1D);
+
+ /* Give the texture to the driver! may be null! */
+ (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat,
+ width, border, format, type, pixels,
+ &ctx->Unpack, texObj, texImage);
+
+ ASSERT(texImage->TexFormat);
+
+ /* If driver didn't explicitly set this, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ else if (target == GL_PROXY_TEXTURE_1D) {
+ /* Proxy texture: check for errors and update proxy state */
+ struct gl_texture_image *texImage;
+ texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+ if (texture_error_check(ctx, target, level, internalFormat,
+ format, type, 1, postConvWidth, 1, 1, border)) {
+ /* when error, clear all proxy texture image parameters */
+ if (texImage)
+ clear_teximage_fields(texImage);
+ }
+ else {
+ /* no error, set the tex image parameters */
+ ASSERT(texImage);
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, 1, 1,
+ border, internalFormat);
+ texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
+ internalFormat, format, type);
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
+ GLsizei width, GLsizei height, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GLsizei postConvWidth = width, postConvHeight = height;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (is_color_format(internalFormat)) {
+ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
+ &postConvHeight);
+ }
+
+ if (target == GL_TEXTURE_2D ||
+ (ctx->Extensions.ARB_texture_cube_map &&
+ target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ||
+ (ctx->Extensions.NV_texture_rectangle &&
+ target == GL_TEXTURE_RECTANGLE_NV)) {
+ /* non-proxy target */
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+
+ if (texture_error_check(ctx, target, level, internalFormat,
+ format, type, 2, postConvWidth, postConvHeight,
+ 1, border)) {
+ return; /* error was recorded */
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ /* free the old texture data */
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, postConvHeight, 1,
+ border, internalFormat);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ ASSERT(ctx->Driver.TexImage2D);
+
+ /* Give the texture to the driver! may be null! */
+ (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat,
+ width, height, border, format, type, pixels,
+ &ctx->Unpack, texObj, texImage);
+
+ ASSERT(texImage->TexFormat);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ else if (target == GL_PROXY_TEXTURE_2D ||
+ (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB &&
+ ctx->Extensions.ARB_texture_cube_map) ||
+ (target == GL_PROXY_TEXTURE_RECTANGLE_NV &&
+ ctx->Extensions.NV_texture_rectangle)) {
+ /* Proxy texture: check for errors and update proxy state */
+ struct gl_texture_image *texImage;
+ texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+ if (texture_error_check(ctx, target, level, internalFormat,
+ format, type, 2, postConvWidth, postConvHeight,
+ 1, border)) {
+ /* when error, clear all proxy texture image parameters */
+ if (texImage)
+ clear_teximage_fields(ctx->Texture.Proxy2D->Image[0][level]);
+ }
+ else {
+ /* no error, set the tex image parameters */
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, postConvHeight, 1,
+ border, internalFormat);
+ texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
+ internalFormat, format, type);
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" );
+ return;
+ }
+}
+
+
+/*
+ * Called by the API or display list executor.
+ * Note that width and height include the border.
+ */
+void GLAPIENTRY
+_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target == GL_TEXTURE_3D) {
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+
+ if (texture_error_check(ctx, target, level, (GLint) internalFormat,
+ format, type, 3, width, height, depth, border)) {
+ return; /* error was recorded */
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ width, height, depth,
+ border, internalFormat);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ ASSERT(ctx->Driver.TexImage3D);
+
+ /* Give the texture to the driver! may be null! */
+ (*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat,
+ width, height, depth, border, format, type,
+ pixels, &ctx->Unpack, texObj, texImage);
+
+ ASSERT(texImage->TexFormat);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ else if (target == GL_PROXY_TEXTURE_3D) {
+ /* Proxy texture: check for errors and update proxy state */
+ struct gl_texture_image *texImage;
+ texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+ if (texture_error_check(ctx, target, level, internalFormat,
+ format, type, 3, width, height, depth, border)) {
+ /* when error, clear all proxy texture image parameters */
+ if (texImage)
+ clear_teximage_fields(texImage);
+ }
+ else {
+ /* no error, set the tex image parameters */
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
+ border, internalFormat);
+ texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
+ internalFormat, format, type);
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" );
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height,
+ depth, border, format, type, pixels);
+}
+
+
+
+void GLAPIENTRY
+_mesa_TexSubImage1D( GLenum target, GLint level,
+ GLint xoffset, GLsizei width,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GLsizei postConvWidth = width;
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ /* XXX should test internal format */
+ if (is_color_format(format)) {
+ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
+ }
+
+ if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0,
+ postConvWidth, 1, 1, format, type)) {
+ return; /* error was detected */
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ assert(texImage);
+
+ if (width == 0)
+ return; /* no-op, not an error */
+
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+
+ ASSERT(ctx->Driver.TexSubImage1D);
+ (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
+ format, type, pixels, &ctx->Unpack,
+ texObj, texImage);
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+void GLAPIENTRY
+_mesa_TexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ GLsizei postConvWidth = width, postConvHeight = height;
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ /* XXX should test internal format */
+ if (is_color_format(format)) {
+ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
+ &postConvHeight);
+ }
+
+ if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
+ postConvWidth, postConvHeight, 1, format, type)) {
+ return; /* error was detected */
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ assert(texImage);
+
+ if (width == 0 || height == 0)
+ return; /* no-op, not an error */
+
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+ yoffset += texImage->Border;
+
+ ASSERT(ctx->Driver.TexSubImage2D);
+ (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset,
+ width, height, format, type, pixels,
+ &ctx->Unpack, texObj, texImage);
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+
+void GLAPIENTRY
+_mesa_TexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type,
+ const GLvoid *pixels )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type)) {
+ return; /* error was detected */
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ assert(texImage);
+
+ if (width == 0 || height == 0 || height == 0)
+ return; /* no-op, not an error */
+
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+ yoffset += texImage->Border;
+ zoffset += texImage->Border;
+
+ ASSERT(ctx->Driver.TexSubImage3D);
+ (*ctx->Driver.TexSubImage3D)(ctx, target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, type, pixels,
+ &ctx->Unpack, texObj, texImage );
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexImage1D( GLenum target, GLint level,
+ GLenum internalFormat,
+ GLint x, GLint y,
+ GLsizei width, GLint border )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLsizei postConvWidth = width;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ if (is_color_format(internalFormat)) {
+ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
+ }
+
+ if (copytexture_error_check(ctx, 1, target, level, internalFormat,
+ postConvWidth, 1, border))
+ return;
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ /* free the old texture data */
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
+ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
+ border, internalFormat);
+
+
+ ASSERT(ctx->Driver.CopyTexImage1D);
+ (*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat,
+ x, y, width, border);
+
+ ASSERT(texImage->TexFormat);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint border )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLsizei postConvWidth = width, postConvHeight = height;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ if (is_color_format(internalFormat)) {
+ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
+ &postConvHeight);
+ }
+
+ if (copytexture_error_check(ctx, 2, target, level, internalFormat,
+ postConvWidth, postConvHeight, border))
+ return;
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ /* free the old texture data */
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, postConvHeight, 1,
+ border, internalFormat);
+
+ ASSERT(ctx->Driver.CopyTexImage2D);
+ (*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat,
+ x, y, width, height, border);
+
+ ASSERT(texImage->TexFormat);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y, GLsizei width )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_image *texImage;
+ GLsizei postConvWidth = width;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ /* XXX should test internal format */
+ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
+
+ if (copytexsubimage_error_check(ctx, 1, target, level,
+ xoffset, 0, 0, postConvWidth, 1))
+ return;
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ ASSERT(texImage);
+
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+
+ ASSERT(ctx->Driver.CopyTexSubImage1D);
+ (*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width);
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_image *texImage;
+ GLsizei postConvWidth = width, postConvHeight = height;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ /* XXX should test internal format */
+ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight);
+
+ if (copytexsubimage_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
+ postConvWidth, postConvHeight))
+ return;
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ ASSERT(texImage);
+
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+ yoffset += texImage->Border;
+
+ ASSERT(ctx->Driver.CopyTexSubImage2D);
+ (*ctx->Driver.CopyTexSubImage2D)(ctx, target, level,
+ xoffset, yoffset, x, y, width, height);
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_image *texImage;
+ GLsizei postConvWidth = width, postConvHeight = height;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ /* XXX should test internal format */
+ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight);
+
+ if (copytexsubimage_error_check(ctx, 3, target, level, xoffset, yoffset,
+ zoffset, postConvWidth, postConvHeight))
+ return;
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ ASSERT(texImage);
+
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+ yoffset += texImage->Border;
+ zoffset += texImage->Border;
+
+ ASSERT(ctx->Driver.CopyTexSubImage3D);
+ (*ctx->Driver.CopyTexSubImage3D)(ctx, target, level,
+ xoffset, yoffset, zoffset,
+ x, y, width, height);
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+
+
+/**********************************************************************/
+/****** Compressed Textures ******/
+/**********************************************************************/
+
+
+/**
+ * Error checking for glCompressedTexImage[123]D().
+ * \return error code or GL_NO_ERROR.
+ */
+static GLenum
+compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
+ GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize)
+{
+ GLint expectedSize, maxLevels = 0, maxTextureSize;
+
+ if (dimensions == 1) {
+ /* 1D compressed textures not allowed */
+ return GL_INVALID_ENUM;
+ }
+ else if (dimensions == 2) {
+ if (target == GL_PROXY_TEXTURE_2D) {
+ maxLevels = ctx->Const.MaxTextureLevels;
+ }
+ else if (target == GL_TEXTURE_2D) {
+ maxLevels = ctx->Const.MaxTextureLevels;
+ }
+ else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map)
+ return GL_INVALID_ENUM; /*target*/
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map)
+ return GL_INVALID_ENUM; /*target*/
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else {
+ return GL_INVALID_ENUM; /*target*/
+ }
+ }
+ else if (dimensions == 3) {
+ /* 3D compressed textures not allowed */
+ return GL_INVALID_ENUM;
+ }
+
+ maxTextureSize = 1 << (maxLevels - 1);
+
+ if (!is_compressed_format(ctx, internalFormat))
+ return GL_INVALID_ENUM;
+
+ if (_mesa_base_tex_format(ctx, internalFormat) < 0)
+ return GL_INVALID_ENUM;
+
+ if (border != 0)
+ return GL_INVALID_VALUE;
+
+ /*
+ * XXX We should probably use the proxy texture error check function here.
+ */
+ if (width < 1 || width > maxTextureSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two && logbase2(width) < 0))
+ return GL_INVALID_VALUE;
+
+ if ((height < 1 || height > maxTextureSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two && logbase2(height) < 0))
+ && dimensions > 1)
+ return GL_INVALID_VALUE;
+
+ if ((depth < 1 || depth > maxTextureSize ||
+ (!ctx->Extensions.ARB_texture_non_power_of_two && logbase2(depth) < 0))
+ && dimensions > 2)
+ return GL_INVALID_VALUE;
+
+ /* For cube map, width must equal height */
+ if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height)
+ return GL_INVALID_VALUE;
+
+ if (level < 0 || level >= maxLevels)
+ return GL_INVALID_VALUE;
+
+ expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth,
+ internalFormat);
+ if (expectedSize != imageSize)
+ return GL_INVALID_VALUE;
+
+ return GL_NO_ERROR;
+}
+
+
+/**
+ * Error checking for glCompressedTexSubImage[123]D().
+ * \warning There are some bad assumptions here about the size of compressed
+ * texture tiles (multiple of 4) used to test the validity of the
+ * offset and size parameters.
+ * \return error code or GL_NO_ERROR.
+ */
+static GLenum
+compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLsizei imageSize)
+{
+ GLint expectedSize, maxLevels = 0, maxTextureSize;
+ (void) zoffset;
+
+ if (dimensions == 1) {
+ /* 1D compressed textures not allowed */
+ return GL_INVALID_ENUM;
+ }
+ else if (dimensions == 2) {
+ if (target == GL_PROXY_TEXTURE_2D) {
+ maxLevels = ctx->Const.MaxTextureLevels;
+ }
+ else if (target == GL_TEXTURE_2D) {
+ maxLevels = ctx->Const.MaxTextureLevels;
+ }
+ else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map)
+ return GL_INVALID_ENUM; /*target*/
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map)
+ return GL_INVALID_ENUM; /*target*/
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else {
+ return GL_INVALID_ENUM; /*target*/
+ }
+ }
+ else if (dimensions == 3) {
+ /* 3D compressed textures not allowed */
+ return GL_INVALID_ENUM;
+ }
+
+ maxTextureSize = 1 << (maxLevels - 1);
+
+ if (!is_compressed_format(ctx, format))
+ return GL_INVALID_ENUM;
+
+ if (width < 1 || width > maxTextureSize)
+ return GL_INVALID_VALUE;
+
+ if ((height < 1 || height > maxTextureSize)
+ && dimensions > 1)
+ return GL_INVALID_VALUE;
+
+ if (level < 0 || level >= maxLevels)
+ return GL_INVALID_VALUE;
+
+ /* XXX these tests are specific to the compressed format.
+ * this code should be generalized in some way.
+ */
+ if ((xoffset & 3) != 0 || (yoffset & 3) != 0)
+ return GL_INVALID_VALUE;
+
+ if ((width & 3) != 0 && width != 2 && width != 1)
+ return GL_INVALID_VALUE;
+
+ if ((height & 3) != 0 && height != 2 && height != 1)
+ return GL_INVALID_VALUE;
+
+ expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth,
+ format);
+ if (expectedSize != imageSize)
+ return GL_INVALID_VALUE;
+
+ return GL_NO_ERROR;
+}
+
+
+
+void GLAPIENTRY
+_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLint border, GLsizei imageSize,
+ const GLvoid *data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target == GL_TEXTURE_1D) {
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLenum error = compressed_texture_error_check(ctx, 1, target, level,
+ internalFormat, width, 1, 1, border, imageSize);
+ if (error) {
+ _mesa_error(ctx, error, "glCompressedTexImage1D");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+
+ _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
+ border, internalFormat);
+
+ ASSERT(ctx->Driver.CompressedTexImage1D);
+ (*ctx->Driver.CompressedTexImage1D)(ctx, target, level,
+ internalFormat, width, border,
+ imageSize, data,
+ texObj, texImage);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ else if (target == GL_PROXY_TEXTURE_1D) {
+ /* Proxy texture: check for errors and update proxy state */
+ GLenum error = compressed_texture_error_check(ctx, 1, target, level,
+ internalFormat, width, 1, 1, border, imageSize);
+ if (!error) {
+ ASSERT(ctx->Driver.TestProxyTexImage);
+ error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
+ internalFormat, GL_NONE, GL_NONE,
+ width, 1, 1, border);
+ }
+ if (error) {
+ /* if error, clear all proxy texture image parameters */
+ struct gl_texture_image *texImage;
+ texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+ if (texImage)
+ clear_teximage_fields(texImage);
+ }
+ else {
+ /* store the teximage parameters */
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_image *texImage;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
+ border, internalFormat);
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLint border, GLsizei imageSize,
+ const GLvoid *data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target == GL_TEXTURE_2D ||
+ (ctx->Extensions.ARB_texture_cube_map &&
+ target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLenum error = compressed_texture_error_check(ctx, 2, target, level,
+ internalFormat, width, height, 1, border, imageSize);
+ if (error) {
+ _mesa_error(ctx, error, "glCompressedTexImage2D");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
+ border, internalFormat);
+
+ ASSERT(ctx->Driver.CompressedTexImage2D);
+ (*ctx->Driver.CompressedTexImage2D)(ctx, target, level,
+ internalFormat, width, height,
+ border, imageSize, data,
+ texObj, texImage);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ else if (target == GL_PROXY_TEXTURE_2D ||
+ (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB &&
+ ctx->Extensions.ARB_texture_cube_map)) {
+ /* Proxy texture: check for errors and update proxy state */
+ GLenum error = compressed_texture_error_check(ctx, 2, target, level,
+ internalFormat, width, height, 1, border, imageSize);
+ if (!error) {
+ ASSERT(ctx->Driver.TestProxyTexImage);
+ error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
+ internalFormat, GL_NONE, GL_NONE,
+ width, height, 1, border);
+ }
+ if (error) {
+ /* if error, clear all proxy texture image parameters */
+ struct gl_texture_image *texImage;
+ texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+ if (texImage)
+ clear_teximage_fields(texImage);
+ }
+ else {
+ /* store the teximage parameters */
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_image *texImage;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
+ border, internalFormat);
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(target)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexImage3DARB(GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize, const GLvoid *data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (target == GL_TEXTURE_3D) {
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLenum error = compressed_texture_error_check(ctx, 3, target, level,
+ internalFormat, width, height, depth, border, imageSize);
+ if (error) {
+ _mesa_error(ctx, error, "glCompressedTexImage3D");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_get_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D");
+ return;
+ }
+ else if (texImage->Data && !texImage->IsClientData) {
+ MESA_PBUFFER_FREE(texImage->Data);
+ }
+ texImage->Data = NULL;
+
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth,
+ border, internalFormat);
+
+ ASSERT(ctx->Driver.CompressedTexImage3D);
+ (*ctx->Driver.CompressedTexImage3D)(ctx, target, level,
+ internalFormat,
+ width, height, depth,
+ border, imageSize, data,
+ texObj, texImage);
+
+ /* state update */
+ texObj->Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ else if (target == GL_PROXY_TEXTURE_3D) {
+ /* Proxy texture: check for errors and update proxy state */
+ GLenum error = compressed_texture_error_check(ctx, 3, target, level,
+ internalFormat, width, height, depth, border, imageSize);
+ if (!error) {
+ ASSERT(ctx->Driver.TestProxyTexImage);
+ error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
+ internalFormat, GL_NONE, GL_NONE,
+ width, height, depth, border);
+ }
+ if (error) {
+ /* if error, clear all proxy texture image parameters */
+ struct gl_texture_image *texImage;
+ texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+ if (texImage)
+ clear_teximage_fields(texImage);
+ }
+ else {
+ /* store the teximage parameters */
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_image *texImage;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height,
+ depth, border, internalFormat);
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3D(target)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
+ GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLenum error;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ error = compressed_subtexture_error_check(ctx, 1, target, level,
+ xoffset, 0, 0, width, 1, 1, format, imageSize);
+ if (error) {
+ _mesa_error(ctx, error, "glCompressedTexSubImage1D");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ assert(texImage);
+
+ if ((GLint) format != texImage->IntFormat) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCompressedTexSubImage1D(format)");
+ return;
+ }
+
+ if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)");
+ return;
+ }
+
+ if (width == 0)
+ return; /* no-op, not an error */
+
+ if (ctx->Driver.CompressedTexSubImage1D) {
+ (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level,
+ xoffset, width,
+ format, imageSize, data,
+ texObj, texImage);
+ }
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
+ GLint yoffset, GLsizei width, GLsizei height,
+ GLenum format, GLsizei imageSize,
+ const GLvoid *data)
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLenum error;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ error = compressed_subtexture_error_check(ctx, 2, target, level,
+ xoffset, yoffset, 0, width, height, 1, format, imageSize);
+ if (error) {
+ /* XXX proxy target? */
+ _mesa_error(ctx, error, "glCompressedTexSubImage2D");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ assert(texImage);
+
+ if ((GLint) format != texImage->IntFormat) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCompressedTexSubImage2D(format)");
+ return;
+ }
+
+ if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) ||
+ ((height == 1 || height == 2) && (GLuint) height != texImage->Height)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)");
+ return;
+ }
+
+ if (width == 0 || height == 0)
+ return; /* no-op, not an error */
+
+ if (ctx->Driver.CompressedTexSubImage2D) {
+ (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level,
+ xoffset, yoffset, width, height,
+ format, imageSize, data,
+ texObj, texImage);
+ }
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
+ GLint yoffset, GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLenum error;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ error = compressed_subtexture_error_check(ctx, 3, target, level,
+ xoffset, yoffset, zoffset, width, height, depth, format, imageSize);
+ if (error) {
+ _mesa_error(ctx, error, "glCompressedTexSubImage2D");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ assert(texImage);
+
+ if ((GLint) format != texImage->IntFormat) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCompressedTexSubImage3D(format)");
+ return;
+ }
+
+ if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) ||
+ ((height == 1 || height == 2) && (GLuint) height != texImage->Height) ||
+ ((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)");
+ return;
+ }
+
+ if (width == 0 || height == 0 || depth == 0)
+ return; /* no-op, not an error */
+
+ if (ctx->Driver.CompressedTexSubImage3D) {
+ (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, imageSize, data,
+ texObj, texImage);
+ }
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+
+void GLAPIENTRY
+_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
+{
+ const struct gl_texture_unit *texUnit;
+ const struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLint maxLevels;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ if (!texObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB");
+ return;
+ }
+
+ maxLevels = _mesa_max_texture_levels(ctx, target);
+ ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */
+
+ if (level < 0 || level >= maxLevels) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)");
+ return;
+ }
+
+ if (is_proxy_target(target)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)");
+ return;
+ }
+
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ if (!texImage) {
+ /* probably invalid mipmap level */
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)");
+ return;
+ }
+
+ if (!texImage->IsCompressed) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB");
+ return;
+ }
+
+ if (!img)
+ return;
+
+ /* just memcpy, no pixelstore or pixel transfer */
+ MEMCPY(img, texImage->Data, texImage->CompressedSize);
+}
Index: xc/extras/Mesa/src/mesa/main/teximage.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/teximage.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/teximage.h Thu Jun 10 10:23:56 2004
@@ -0,0 +1,227 @@
+/**
+ * \file teximage.h
+ * Texture images manipulation functions.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXIMAGE_H
+#define TEXIMAGE_H
+
+
+#include "mtypes.h"
+
+
+/** \name Internal functions */
+/*@{*/
+
+extern GLint
+_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat );
+
+
+extern struct gl_texture_image *
+_mesa_new_texture_image( GLcontext *ctx );
+
+
+extern void
+_mesa_delete_texture_image( struct gl_texture_image *teximage );
+
+
+extern void
+_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
+ struct gl_texture_image *img,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum internalFormat);
+
+
+extern void
+_mesa_set_tex_image(struct gl_texture_object *tObj,
+ GLenum target, GLint level,
+ struct gl_texture_image *texImage);
+
+
+extern struct gl_texture_object *
+_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+ GLenum target);
+
+
+extern struct gl_texture_image *
+_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+ GLenum target, GLint level);
+
+
+extern struct gl_texture_image *
+_mesa_get_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+ GLenum target, GLint level);
+
+
+extern struct gl_texture_image *
+_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level);
+
+
+extern GLint
+_mesa_max_texture_levels(GLcontext *ctx, GLenum target);
+
+
+extern GLboolean
+_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat, GLenum format, GLenum type,
+ GLint width, GLint height, GLint depth, GLint border);
+
+/*@}*/
+
+
+/** \name API entry point functions */
+/*@{*/
+
+extern void GLAPIENTRY
+_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
+ GLsizei width, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
+ GLsizei width, GLsizei height, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
+ GLsizei width, GLsizei height, GLsizei depth, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_GetTexImage( GLenum target, GLint level,
+ GLenum format, GLenum type, GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
+ GLsizei width,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_TexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_TexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+
+extern void GLAPIENTRY
+_mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
+ GLint x, GLint y, GLsizei width, GLint border );
+
+
+extern void GLAPIENTRY
+_mesa_CopyTexImage2D( GLenum target, GLint level,
+ GLenum internalformat, GLint x, GLint y,
+ GLsizei width, GLsizei height, GLint border );
+
+
+extern void GLAPIENTRY
+_mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
+ GLint x, GLint y, GLsizei width );
+
+
+extern void GLAPIENTRY
+_mesa_CopyTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height );
+
+
+extern void GLAPIENTRY
+_mesa_CopyTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height );
+
+
+
+extern void GLAPIENTRY
+_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
+ GLenum internalformat, GLsizei width,
+ GLint border, GLsizei imageSize,
+ const GLvoid *data);
+
+extern void GLAPIENTRY
+_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLint border, GLsizei imageSize,
+ const GLvoid *data);
+
+extern void GLAPIENTRY
+_mesa_CompressedTexImage3DARB(GLenum target, GLint level,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize, const GLvoid *data);
+
+#ifdef VMS
+#define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
+#define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
+#define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
+#endif
+extern void GLAPIENTRY
+_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
+ GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data);
+
+extern void GLAPIENTRY
+_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
+ GLint yoffset, GLsizei width, GLsizei height,
+ GLenum format, GLsizei imageSize,
+ const GLvoid *data);
+
+extern void GLAPIENTRY
+_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
+ GLint yoffset, GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth, GLenum format,
+ GLsizei imageSize, const GLvoid *data);
+
+extern void GLAPIENTRY
+_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img);
+
+/*@}*/
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/texobj.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texobj.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texobj.c Fri Dec 10 10:05:21 2004
@@ -0,0 +1,1029 @@
+/**
+ * \file texobj.c
+ * Texture object management.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "colortab.h"
+#include "context.h"
+#include "enums.h"
+#include "hash.h"
+#include "imports.h"
+#include "macros.h"
+#include "teximage.h"
+#include "texstate.h"
+#include "texobj.h"
+#include "mtypes.h"
+
+
+/**********************************************************************/
+/** \name Internal functions */
+/*@{*/
+
+/**
+ * Allocate and initialize a new texture object. But don't put it into the
+ * texture object hash table.
+ *
+ * Called via ctx->Driver.NewTextureObject, unless overridden by a device
+ * driver.
+ *
+ * \param shared the shared GL state structure to contain the texture object
+ * \param name integer name for the texture object
+ * \param target either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D,
+ * GL_TEXTURE_CUBE_MAP_ARB or GL_TEXTURE_RECTANGLE_NV. zero is ok for the sake
+ * of GenTextures()
+ *
+ * \return pointer to new texture object.
+ */
+struct gl_texture_object *
+_mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target )
+{
+ struct gl_texture_object *obj;
+ (void) ctx;
+ obj = MALLOC_STRUCT(gl_texture_object);
+ _mesa_initialize_texture_object(obj, name, target);
+ return obj;
+}
+
+
+/**
+ * Initialize a new texture object to default values.
+ * \param obj the texture object
+ * \param name the texture name
+ * \param target the texture target
+ */
+void
+_mesa_initialize_texture_object( struct gl_texture_object *obj,
+ GLuint name, GLenum target )
+{
+ ASSERT(target == 0 ||
+ target == GL_TEXTURE_1D ||
+ target == GL_TEXTURE_2D ||
+ target == GL_TEXTURE_3D ||
+ target == GL_TEXTURE_CUBE_MAP_ARB ||
+ target == GL_TEXTURE_RECTANGLE_NV);
+
+ _mesa_bzero(obj, sizeof(*obj));
+ /* init the non-zero fields */
+ _glthread_INIT_MUTEX(obj->Mutex);
+ obj->RefCount = 1;
+ obj->Name = name;
+ obj->Target = target;
+ obj->Priority = 1.0F;
+ if (target == GL_TEXTURE_RECTANGLE_NV) {
+ obj->WrapS = GL_CLAMP_TO_EDGE;
+ obj->WrapT = GL_CLAMP_TO_EDGE;
+ obj->WrapR = GL_CLAMP_TO_EDGE;
+ obj->MinFilter = GL_LINEAR;
+ }
+ else {
+ obj->WrapS = GL_REPEAT;
+ obj->WrapT = GL_REPEAT;
+ obj->WrapR = GL_REPEAT;
+ obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
+ }
+ obj->MagFilter = GL_LINEAR;
+ obj->MinLod = -1000.0;
+ obj->MaxLod = 1000.0;
+ obj->LodBias = 0.0;
+ obj->BaseLevel = 0;
+ obj->MaxLevel = 1000;
+ obj->MaxAnisotropy = 1.0;
+ obj->CompareFlag = GL_FALSE; /* SGIX_shadow */
+ obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */
+ obj->CompareMode = GL_NONE; /* ARB_shadow */
+ obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */
+ obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */
+ obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */
+ _mesa_init_colortable(&obj->Palette);
+}
+
+
+/**
+ * Deallocate a texture object struct. It should have already been
+ * removed from the texture object pool.
+ *
+ * \param shared the shared GL state to which the object belongs.
+ * \param texOjb the texture object to delete.
+ */
+void
+_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
+{
+ GLuint i, face;
+
+ (void) ctx;
+
+ _mesa_free_colortable_data(&texObj->Palette);
+
+ /* free the texture images */
+ for (face = 0; face < 6; face++) {
+ for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
+ if (texObj->Image[face][i]) {
+ _mesa_delete_texture_image( texObj->Image[face][i] );
+ }
+ }
+ }
+
+ /* destroy the mutex -- it may have allocated memory (eg on bsd) */
+ _glthread_DESTROY_MUTEX(texObj->Mutex);
+
+ /* free this object */
+ _mesa_free(texObj);
+}
+
+
+/**
+ * Add the given texture object to the texture object pool.
+ */
+void
+_mesa_save_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
+{
+ /* insert into linked list */
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+ texObj->Next = ctx->Shared->TexObjectList;
+ ctx->Shared->TexObjectList = texObj;
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+
+ if (texObj->Name > 0) {
+ /* insert into hash table */
+ _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj);
+ }
+}
+
+
+/**
+ * Remove the given texture object from the texture object pool.
+ * Do not deallocate the texture object though.
+ */
+void
+_mesa_remove_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
+{
+ struct gl_texture_object *tprev, *tcurr;
+
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+
+ /* unlink from the linked list */
+ tprev = NULL;
+ tcurr = ctx->Shared->TexObjectList;
+ while (tcurr) {
+ if (tcurr == texObj) {
+ if (tprev) {
+ tprev->Next = texObj->Next;
+ }
+ else {
+ ctx->Shared->TexObjectList = texObj->Next;
+ }
+ break;
+ }
+ tprev = tcurr;
+ tcurr = tcurr->Next;
+ }
+
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+
+ if (texObj->Name > 0) {
+ /* remove from hash table */
+ _mesa_HashRemove(ctx->Shared->TexObjects, texObj->Name);
+ }
+}
+
+/**
+ * Copy texture object state from one texture object to another.
+ *
+ * \param dest destination texture object.
+ * \param src source texture object.
+ */
+void
+_mesa_copy_texture_object( struct gl_texture_object *dest,
+ const struct gl_texture_object *src )
+{
+ dest->Name = src->Name;
+ dest->Priority = src->Priority;
+ dest->BorderColor[0] = src->BorderColor[0];
+ dest->BorderColor[1] = src->BorderColor[1];
+ dest->BorderColor[2] = src->BorderColor[2];
+ dest->BorderColor[3] = src->BorderColor[3];
+ dest->WrapS = src->WrapS;
+ dest->WrapT = src->WrapT;
+ dest->WrapR = src->WrapR;
+ dest->MinFilter = src->MinFilter;
+ dest->MagFilter = src->MagFilter;
+ dest->MinLod = src->MinLod;
+ dest->MaxLod = src->MaxLod;
+ dest->LodBias = src->LodBias;
+ dest->BaseLevel = src->BaseLevel;
+ dest->MaxLevel = src->MaxLevel;
+ dest->MaxAnisotropy = src->MaxAnisotropy;
+ dest->CompareFlag = src->CompareFlag;
+ dest->CompareOperator = src->CompareOperator;
+ dest->ShadowAmbient = src->ShadowAmbient;
+ dest->CompareMode = src->CompareMode;
+ dest->CompareFunc = src->CompareFunc;
+ dest->DepthMode = src->DepthMode;
+ dest->_MaxLevel = src->_MaxLevel;
+ dest->_MaxLambda = src->_MaxLambda;
+ dest->GenerateMipmap = src->GenerateMipmap;
+ dest->Palette = src->Palette;
+ dest->Complete = src->Complete;
+ dest->_IsPowerOfTwo = src->_IsPowerOfTwo;
+}
+
+
+/**
+ * Report why a texture object is incomplete.
+ *
+ * \param t texture object.
+ * \param why string describing why it's incomplete.
+ *
+ * \note For debug purposes only.
+ */
+#if 0
+static void
+incomplete(const struct gl_texture_object *t, const char *why)
+{
+ _mesa_printf("Texture Obj %d incomplete because: %s\n", t->Name, why);
+}
+#else
+#define incomplete(t, why)
+#endif
+
+
+/**
+ * Examine a texture object to determine if it is complete.
+ *
+ * The gl_texture_object::Complete flag will be set to GL_TRUE or GL_FALSE
+ * accordingly.
+ *
+ * \param ctx GL context.
+ * \param t texture object.
+ *
+ * According to the texture target, verifies that each of the mipmaps is
+ * present and has the expected size.
+ */
+void
+_mesa_test_texobj_completeness( const GLcontext *ctx,
+ struct gl_texture_object *t )
+{
+ const GLint baseLevel = t->BaseLevel;
+ GLint maxLog2 = 0, maxLevels = 0;
+
+ t->Complete = GL_TRUE; /* be optimistic */
+ t->_IsPowerOfTwo = GL_TRUE; /* may be set FALSE below */
+
+ /* Always need the base level image */
+ if (!t->Image[0][baseLevel]) {
+ char s[100];
+ sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL",
+ (void *) t, t->Name, baseLevel);
+ incomplete(t, s);
+ t->Complete = GL_FALSE;
+ return;
+ }
+
+ /* Check width/height/depth for zero */
+ if (t->Image[0][baseLevel]->Width == 0 ||
+ t->Image[0][baseLevel]->Height == 0 ||
+ t->Image[0][baseLevel]->Depth == 0) {
+ incomplete(t, "texture width = 0");
+ t->Complete = GL_FALSE;
+ return;
+ }
+
+ /* Compute _MaxLevel */
+ if (t->Target == GL_TEXTURE_1D) {
+ maxLog2 = t->Image[0][baseLevel]->WidthLog2;
+ maxLevels = ctx->Const.MaxTextureLevels;
+ }
+ else if (t->Target == GL_TEXTURE_2D) {
+ maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
+ t->Image[0][baseLevel]->HeightLog2);
+ maxLevels = ctx->Const.MaxTextureLevels;
+ }
+ else if (t->Target == GL_TEXTURE_3D) {
+ GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2,
+ t->Image[0][baseLevel]->HeightLog2);
+ maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2));
+ maxLevels = ctx->Const.Max3DTextureLevels;
+ }
+ else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
+ maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
+ t->Image[0][baseLevel]->HeightLog2);
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
+ maxLog2 = 0; /* not applicable */
+ maxLevels = 1; /* no mipmapping */
+ }
+ else {
+ _mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness");
+ return;
+ }
+
+ ASSERT(maxLevels > 0);
+
+ t->_MaxLevel = baseLevel + maxLog2;
+ t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel);
+ t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1);
+
+ /* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
+ t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel);
+
+ if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
+ /* make sure that all six cube map level 0 images are the same size */
+ const GLuint w = t->Image[0][baseLevel]->Width2;
+ const GLuint h = t->Image[0][baseLevel]->Height2;
+ GLuint face;
+ for (face = 1; face < 6; face++) {
+ if (t->Image[face][baseLevel] == NULL ||
+ t->Image[face][baseLevel]->Width2 != w ||
+ t->Image[face][baseLevel]->Height2 != h) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "Non-quare cubemap image");
+ return;
+ }
+ }
+ }
+
+ /* check for non power of two */
+ if (!t->Image[0][baseLevel]->_IsPowerOfTwo) {
+ t->_IsPowerOfTwo = GL_FALSE;
+ }
+
+ /* extra checking for mipmaps */
+ if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) {
+ /*
+ * Mipmapping: determine if we have a complete set of mipmaps
+ */
+ GLint i;
+ GLint minLevel = baseLevel;
+ GLint maxLevel = t->_MaxLevel;
+
+ if (minLevel > maxLevel) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "minLevel > maxLevel");
+ return;
+ }
+
+ /* Test dimension-independent attributes */
+ for (i = minLevel; i <= maxLevel; i++) {
+ if (t->Image[0][i]) {
+ if (t->Image[0][i]->TexFormat != t->Image[0][baseLevel]->TexFormat) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "Format[i] != Format[baseLevel]");
+ return;
+ }
+ if (t->Image[0][i]->Border != t->Image[0][baseLevel]->Border) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "Border[i] != Border[baseLevel]");
+ return;
+ }
+ }
+ }
+
+ /* Test things which depend on number of texture image dimensions */
+ if (t->Target == GL_TEXTURE_1D) {
+ /* Test 1-D mipmaps */
+ GLuint width = t->Image[0][baseLevel]->Width2;
+ for (i = baseLevel + 1; i < maxLevels; i++) {
+ if (width > 1) {
+ width /= 2;
+ }
+ if (i >= minLevel && i <= maxLevel) {
+ if (!t->Image[0][i]) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "1D Image[0][i] == NULL");
+ return;
+ }
+ if (t->Image[0][i]->Width2 != width ) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "1D Image[0][i] bad width");
+ return;
+ }
+ }
+ if (width == 1) {
+ return; /* found smallest needed mipmap, all done! */
+ }
+ }
+ }
+ else if (t->Target == GL_TEXTURE_2D) {
+ /* Test 2-D mipmaps */
+ GLuint width = t->Image[0][baseLevel]->Width2;
+ GLuint height = t->Image[0][baseLevel]->Height2;
+ for (i = baseLevel + 1; i < maxLevels; i++) {
+ if (width > 1) {
+ width /= 2;
+ }
+ if (height > 1) {
+ height /= 2;
+ }
+ if (i >= minLevel && i <= maxLevel) {
+ if (!t->Image[0][i]) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "2D Image[0][i] == NULL");
+ return;
+ }
+ if (t->Image[0][i]->Width2 != width) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "2D Image[0][i] bad width");
+ return;
+ }
+ if (t->Image[0][i]->Height2 != height) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "2D Image[0][i] bad height");
+ return;
+ }
+ if (width==1 && height==1) {
+ return; /* found smallest needed mipmap, all done! */
+ }
+ }
+ }
+ }
+ else if (t->Target == GL_TEXTURE_3D) {
+ /* Test 3-D mipmaps */
+ GLuint width = t->Image[0][baseLevel]->Width2;
+ GLuint height = t->Image[0][baseLevel]->Height2;
+ GLuint depth = t->Image[0][baseLevel]->Depth2;
+ for (i = baseLevel + 1; i < maxLevels; i++) {
+ if (width > 1) {
+ width /= 2;
+ }
+ if (height > 1) {
+ height /= 2;
+ }
+ if (depth > 1) {
+ depth /= 2;
+ }
+ if (i >= minLevel && i <= maxLevel) {
+ if (!t->Image[0][i]) {
+ incomplete(t, "3D Image[0][i] == NULL");
+ t->Complete = GL_FALSE;
+ return;
+ }
+ if (t->Image[0][i]->Format == GL_DEPTH_COMPONENT) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
+ return;
+ }
+ if (t->Image[0][i]->Width2 != width) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "3D Image[0][i] bad width");
+ return;
+ }
+ if (t->Image[0][i]->Height2 != height) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "3D Image[0][i] bad height");
+ return;
+ }
+ if (t->Image[0][i]->Depth2 != depth) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "3D Image[0][i] bad depth");
+ return;
+ }
+ }
+ if (width == 1 && height == 1 && depth == 1) {
+ return; /* found smallest needed mipmap, all done! */
+ }
+ }
+ }
+ else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
+ /* make sure 6 cube faces are consistant */
+ GLuint width = t->Image[0][baseLevel]->Width2;
+ GLuint height = t->Image[0][baseLevel]->Height2;
+ for (i = baseLevel + 1; i < maxLevels; i++) {
+ if (width > 1) {
+ width /= 2;
+ }
+ if (height > 1) {
+ height /= 2;
+ }
+ if (i >= minLevel && i <= maxLevel) {
+ GLuint face;
+ for (face = 0; face < 6; face++) {
+ /* check that we have images defined */
+ if (!t->Image[face][i]) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "CubeMap Image[n][i] == NULL");
+ return;
+ }
+ /* Don't support GL_DEPTH_COMPONENT for cube maps */
+ if (t->Image[face][i]->Format == GL_DEPTH_COMPONENT) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
+ return;
+ }
+ /* check that all six images have same size */
+ if (t->Image[face][i]->Width2!=width ||
+ t->Image[face][i]->Height2!=height) {
+ t->Complete = GL_FALSE;
+ incomplete(t, "CubeMap Image[n][i] bad size");
+ return;
+ }
+ }
+ }
+ if (width == 1 && height == 1) {
+ return; /* found smallest needed mipmap, all done! */
+ }
+ }
+ }
+ else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
+ /* XXX special checking? */
+ }
+ else {
+ /* Target = ??? */
+ _mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n");
+ }
+ }
+}
+
+/*@}*/
+
+
+/***********************************************************************/
+/** \name API functions */
+/*@{*/
+
+/**
+ * Texture name generation lock.
+ *
+ * Used by _mesa_GenTextures() to guarantee that the generation and allocation
+ * of texture IDs is atomic.
+ */
+_glthread_DECLARE_STATIC_MUTEX(GenTexturesLock);
+
+/**
+ * Generate texture names.
+ *
+ * \param n number of texture names to be generated.
+ * \param textures an array in which will hold the generated texture names.
+ *
+ * \sa glGenTextures().
+ *
+ * While holding the GenTexturesLock lock, calls _mesa_HashFindFreeKeyBlock()
+ * to find a block of free texture IDs which are stored in \p textures.
+ * Corresponding empty texture objects are also generated.
+ */
+void GLAPIENTRY
+_mesa_GenTextures( GLsizei n, GLuint *textures )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint first;
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (n < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
+ return;
+ }
+
+ if (!textures)
+ return;
+
+ /*
+ * This must be atomic (generation and allocation of texture IDs)
+ */
+ _glthread_LOCK_MUTEX(GenTexturesLock);
+
+ first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n);
+
+ /* Allocate new, empty texture objects */
+ for (i = 0; i < n; i++) {
+ struct gl_texture_object *texObj;
+ GLuint name = first + i;
+ GLenum target = 0;
+ texObj = (*ctx->Driver.NewTextureObject)( ctx, name, target);
+ if (!texObj) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures");
+ return;
+ }
+ _mesa_save_texture_object(ctx, texObj);
+ textures[i] = name;
+ }
+
+ _glthread_UNLOCK_MUTEX(GenTexturesLock);
+}
+
+
+/**
+ * Delete named textures.
+ *
+ * \param n number of textures to be deleted.
+ * \param textures array of texture IDs to be deleted.
+ *
+ * \sa glDeleteTextures().
+ *
+ * If we're about to delete a texture that's currently bound to any
+ * texture unit, unbind the texture first. Decrement the reference
+ * count on the texture object and delete it if it's zero.
+ * Recall that texture objects can be shared among several rendering
+ * contexts.
+ */
+void GLAPIENTRY
+_mesa_DeleteTextures( GLsizei n, const GLuint *textures)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
+
+ if (!textures)
+ return;
+
+ for (i = 0; i < n; i++) {
+ if (textures[i] > 0) {
+ struct gl_texture_object *delObj = (struct gl_texture_object *)
+ _mesa_HashLookup(ctx->Shared->TexObjects, textures[i]);
+ if (delObj) {
+ /* First check if this texture is currently bound.
+ * If so, unbind it and decrement the reference count.
+ */
+ GLuint u;
+ for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) {
+ struct gl_texture_unit *unit = &ctx->Texture.Unit[u];
+ if (delObj == unit->Current1D) {
+ unit->Current1D = ctx->Shared->Default1D;
+ ctx->Shared->Default1D->RefCount++;
+ delObj->RefCount--;
+ if (delObj == unit->_Current)
+ unit->_Current = unit->Current1D;
+ }
+ else if (delObj == unit->Current2D) {
+ unit->Current2D = ctx->Shared->Default2D;
+ ctx->Shared->Default2D->RefCount++;
+ delObj->RefCount--;
+ if (delObj == unit->_Current)
+ unit->_Current = unit->Current2D;
+ }
+ else if (delObj == unit->Current3D) {
+ unit->Current3D = ctx->Shared->Default3D;
+ ctx->Shared->Default3D->RefCount++;
+ delObj->RefCount--;
+ if (delObj == unit->_Current)
+ unit->_Current = unit->Current3D;
+ }
+ else if (delObj == unit->CurrentCubeMap) {
+ unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
+ ctx->Shared->DefaultCubeMap->RefCount++;
+ delObj->RefCount--;
+ if (delObj == unit->_Current)
+ unit->_Current = unit->CurrentCubeMap;
+ }
+ else if (delObj == unit->CurrentRect) {
+ unit->CurrentRect = ctx->Shared->DefaultRect;
+ ctx->Shared->DefaultRect->RefCount++;
+ delObj->RefCount--;
+ if (delObj == unit->_Current)
+ unit->_Current = unit->CurrentRect;
+ }
+ }
+ ctx->NewState |= _NEW_TEXTURE;
+
+ /* If user hasn't already tried to delete the texture... */
+ if (!delObj->DeletePending) {
+ delObj->DeletePending = GL_TRUE;
+ delObj->RefCount--;
+ ASSERT(delObj->RefCount >= 0);
+ }
+
+ /* See if we can really delete the texture now */
+ if (delObj->RefCount == 0) {
+ ASSERT(delObj->Name != 0); /* Never delete default tex objects */
+ _mesa_remove_texture_object(ctx, delObj);
+ ASSERT(ctx->Driver.DeleteTexture);
+ (*ctx->Driver.DeleteTexture)(ctx, delObj);
+ }
+ }
+ }
+ }
+}
+
+
+/**
+ * Bind a named texture to a texturing target.
+ *
+ * \param target texture target.
+ * \param texName texture name.
+ *
+ * \sa glBindTexture().
+ *
+ * Determines the old texture object bound and returns immediately if rebinding
+ * the same texture. Get the current texture which is either a default texture
+ * if name is null, a named texture from the hash, or a new texture if the
+ * given texture name is new. Increments its reference count, binds it, and
+ * calls dd_function_table::BindTexture. Decrements the old texture reference
+ * count and deletes it if it reaches zero.
+ */
+void GLAPIENTRY
+_mesa_BindTexture( GLenum target, GLuint texName )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_texture_object *oldTexObj;
+ struct gl_texture_object *newTexObj = 0;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glBindTexture %s %d\n",
+ _mesa_lookup_enum_by_nr(target), (GLint) texName);
+
+ /*
+ * Get pointer to currently bound texture object (oldTexObj)
+ */
+ switch (target) {
+ case GL_TEXTURE_1D:
+ oldTexObj = texUnit->Current1D;
+ break;
+ case GL_TEXTURE_2D:
+ oldTexObj = texUnit->Current2D;
+ break;
+ case GL_TEXTURE_3D:
+ oldTexObj = texUnit->Current3D;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ return;
+ }
+ oldTexObj = texUnit->CurrentCubeMap;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ return;
+ }
+ oldTexObj = texUnit->CurrentRect;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ return;
+ }
+
+ if (oldTexObj->Name == texName)
+ /* XXX this might be wrong. If the texobj is in use by another
+ * context and a texobj parameter was changed, this might be our
+ * only chance to update this context's hardware state.
+ */
+ return; /* rebinding the same texture- no change */
+
+ /*
+ * Get pointer to new texture object (newTexObj)
+ */
+ if (texName == 0) {
+ /* newTexObj = a default texture object */
+ switch (target) {
+ case GL_TEXTURE_1D:
+ newTexObj = ctx->Shared->Default1D;
+ break;
+ case GL_TEXTURE_2D:
+ newTexObj = ctx->Shared->Default2D;
+ break;
+ case GL_TEXTURE_3D:
+ newTexObj = ctx->Shared->Default3D;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ newTexObj = ctx->Shared->DefaultCubeMap;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ newTexObj = ctx->Shared->DefaultRect;
+ break;
+ default:
+ ; /* Bad targets are caught above */
+ }
+ }
+ else {
+ /* non-default texture object */
+ const struct _mesa_HashTable *hash = ctx->Shared->TexObjects;
+ newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName);
+ if (newTexObj) {
+ /* error checking */
+ if (newTexObj->Target != 0 && newTexObj->Target != target) {
+ /* the named texture object's dimensions don't match the target */
+ _mesa_error( ctx, GL_INVALID_OPERATION,
+ "glBindTexture(wrong dimensionality)" );
+ return;
+ }
+ if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) {
+ /* have to init wrap and filter state here - kind of klunky */
+ newTexObj->WrapS = GL_CLAMP_TO_EDGE;
+ newTexObj->WrapT = GL_CLAMP_TO_EDGE;
+ newTexObj->WrapR = GL_CLAMP_TO_EDGE;
+ newTexObj->MinFilter = GL_LINEAR;
+ if (ctx->Driver.TexParameter) {
+ static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE};
+ static const GLfloat fparam_filter[1] = {(GLfloat) GL_LINEAR};
+ (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_S, fparam_wrap );
+ (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_T, fparam_wrap );
+ (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_R, fparam_wrap );
+ (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_MIN_FILTER, fparam_filter );
+ }
+ }
+ }
+ else {
+ /* if this is a new texture id, allocate a texture object now */
+ newTexObj = (*ctx->Driver.NewTextureObject)(ctx, texName, target);
+ if (!newTexObj) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
+ return;
+ }
+ _mesa_save_texture_object(ctx, newTexObj);
+ }
+ newTexObj->Target = target;
+ }
+
+ newTexObj->RefCount++;
+
+ /* do the actual binding, but first flush outstanding vertices:
+ */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ texUnit->Current1D = newTexObj;
+ break;
+ case GL_TEXTURE_2D:
+ texUnit->Current2D = newTexObj;
+ break;
+ case GL_TEXTURE_3D:
+ texUnit->Current3D = newTexObj;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ texUnit->CurrentCubeMap = newTexObj;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ texUnit->CurrentRect = newTexObj;
+ break;
+ default:
+ _mesa_problem(ctx, "bad target in BindTexture");
+ return;
+ }
+
+ /* Pass BindTexture call to device driver */
+ if (ctx->Driver.BindTexture)
+ (*ctx->Driver.BindTexture)( ctx, target, newTexObj );
+
+ /* Decrement the reference count on the old texture and check if it's
+ * time to delete it.
+ */
+ oldTexObj->RefCount--;
+ ASSERT(oldTexObj->RefCount >= 0);
+ if (oldTexObj->RefCount == 0) {
+ ASSERT(oldTexObj->Name != 0);
+ ASSERT(oldTexObj->DeletePending);
+ _mesa_remove_texture_object(ctx, oldTexObj);
+ ASSERT(ctx->Driver.DeleteTexture);
+ (*ctx->Driver.DeleteTexture)( ctx, oldTexObj );
+ }
+}
+
+
+/**
+ * Set texture priorities.
+ *
+ * \param n number of textures.
+ * \param texName texture names.
+ * \param priorities corresponding texture priorities.
+ *
+ * \sa glPrioritizeTextures().
+ *
+ * Looks up each texture in the hash, clamps the corresponding priority between
+ * 0.0 and 1.0, and calls dd_function_table::PrioritizeTexture.
+ */
+void GLAPIENTRY
+_mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
+ const GLclampf *priorities )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (n < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
+ return;
+ }
+
+ if (!priorities)
+ return;
+
+ for (i = 0; i < n; i++) {
+ if (texName[i] > 0) {
+ struct gl_texture_object *t = (struct gl_texture_object *)
+ _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
+ if (t) {
+ t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
+ if (ctx->Driver.PrioritizeTexture)
+ ctx->Driver.PrioritizeTexture( ctx, t, t->Priority );
+ }
+ }
+ }
+
+ ctx->NewState |= _NEW_TEXTURE;
+}
+
+/**
+ * See if textures are loaded in texture memory.
+ *
+ * \param n number of textures to query.
+ * \param texName array with the texture names.
+ * \param residences array which will hold the residence status.
+ *
+ * \return GL_TRUE if all textures are resident and \p residences is left unchanged,
+ *
+ * \sa glAreTexturesResident().
+ *
+ * Looks up each texture in the hash and calls
+ * dd_function_table::IsTextureResident.
+ */
+GLboolean GLAPIENTRY
+_mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
+ GLboolean *residences)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLboolean allResident = GL_TRUE;
+ GLint i, j;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
+ return GL_FALSE;
+ }
+
+ if (!texName || !residences)
+ return GL_FALSE;
+
+ for (i = 0; i < n; i++) {
+ struct gl_texture_object *t;
+ if (texName[i] == 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident");
+ return GL_FALSE;
+ }
+ t = (struct gl_texture_object *)
+ _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
+ if (!t) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident");
+ return GL_FALSE;
+ }
+ if (!ctx->Driver.IsTextureResident ||
+ ctx->Driver.IsTextureResident(ctx, t)) {
+ /* The texture is resident */
+ if (!allResident)
+ residences[i] = GL_TRUE;
+ }
+ else {
+ /* The texture is not resident */
+ if (allResident) {
+ allResident = GL_FALSE;
+ for (j = 0; j < i; j++)
+ residences[j] = GL_TRUE;
+ }
+ residences[i] = GL_FALSE;
+ }
+ }
+
+ return allResident;
+}
+
+/**
+ * See if a name corresponds to a texture.
+ *
+ * \param texture texture name.
+ *
+ * \return GL_TRUE if texture name corresponds to a texture, or GL_FALSE
+ * otherwise.
+ *
+ * \sa glIsTexture().
+ *
+ * Calls _mesa_HashLookup().
+ */
+GLboolean GLAPIENTRY
+_mesa_IsTexture( GLuint texture )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ return texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture);
+}
+
+/*@}*/
Index: xc/extras/Mesa/src/mesa/main/texobj.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texobj.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texobj.h Thu Apr 8 05:17:51 2004
@@ -0,0 +1,101 @@
+/**
+ * \file texobj.h
+ * Texture object management.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXTOBJ_H
+#define TEXTOBJ_H
+
+
+#include "mtypes.h"
+
+
+/**
+ * \name Internal functions
+ */
+/*@{*/
+
+extern struct gl_texture_object *
+_mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target );
+
+extern void
+_mesa_initialize_texture_object( struct gl_texture_object *obj,
+ GLuint name, GLenum target );
+
+extern void
+_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
+
+extern void
+_mesa_save_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
+
+extern void
+_mesa_remove_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
+
+extern void
+_mesa_copy_texture_object( struct gl_texture_object *dest,
+ const struct gl_texture_object *src );
+
+extern void
+_mesa_test_texobj_completeness( const GLcontext *ctx,
+ struct gl_texture_object *obj );
+
+/*@}*/
+
+
+/**
+ * \name API functions
+ */
+/*@{*/
+
+extern void GLAPIENTRY
+_mesa_GenTextures( GLsizei n, GLuint *textures );
+
+
+extern void GLAPIENTRY
+_mesa_DeleteTextures( GLsizei n, const GLuint *textures );
+
+
+extern void GLAPIENTRY
+_mesa_BindTexture( GLenum target, GLuint texture );
+
+
+extern void GLAPIENTRY
+_mesa_PrioritizeTextures( GLsizei n, const GLuint *textures,
+ const GLclampf *priorities );
+
+
+extern GLboolean GLAPIENTRY
+_mesa_AreTexturesResident( GLsizei n, const GLuint *textures,
+ GLboolean *residences );
+
+extern GLboolean GLAPIENTRY
+_mesa_IsTexture( GLuint texture );
+
+/*@}*/
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/texstate.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texstate.c:1.4
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texstate.c Fri Dec 10 10:30:12 2004
@@ -0,0 +1,3249 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/main/texstate.c,v 1.4 2004/12/10 15:30:12 alanh Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file texstate.c
+ *
+ * Texture state handling.
+ */
+
+#include "glheader.h"
+#include "colormac.h"
+#include "colortab.h"
+#include "context.h"
+#include "enums.h"
+#include "extensions.h"
+#include "macros.h"
+#include "nvfragprog.h"
+#include "texobj.h"
+#include "teximage.h"
+#include "texstate.h"
+#include "mtypes.h"
+#include "math/m_xform.h"
+#include "math/m_matrix.h"
+
+
+
+#ifdef SPECIALCAST
+/* Needed for an Amiga compiler */
+#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X))
+#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X))
+#else
+/* all other compilers */
+#define ENUM_TO_FLOAT(X) ((GLfloat)(X))
+#define ENUM_TO_DOUBLE(X) ((GLdouble)(X))
+#endif
+
+/**
+ * Default texture combine environment state. This is used to initialize
+ * a context's texture units and as the basis for converting "classic"
+ * texture environmnets to ARB_texture_env_combine style values.
+ */
+static const struct gl_tex_env_combine_state default_combine_state = {
+ GL_MODULATE, GL_MODULATE,
+ { GL_TEXTURE, GL_PREVIOUS, GL_CONSTANT },
+ { GL_TEXTURE, GL_PREVIOUS, GL_CONSTANT },
+ { GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_ALPHA },
+ { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA },
+ 0, 0,
+ 2, 2
+};
+
+
+void
+_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst )
+{
+ GLuint i;
+
+ ASSERT(src);
+ ASSERT(dst);
+
+ dst->Texture.CurrentUnit = src->Texture.CurrentUnit;
+ dst->Texture._GenFlags = src->Texture._GenFlags;
+ dst->Texture._TexGenEnabled = src->Texture._TexGenEnabled;
+ dst->Texture._TexMatEnabled = src->Texture._TexMatEnabled;
+ dst->Texture.SharedPalette = src->Texture.SharedPalette;
+
+ /* per-unit state */
+ for (i = 0; i < src->Const.MaxTextureUnits; i++) {
+ dst->Texture.Unit[i].Enabled = src->Texture.Unit[i].Enabled;
+ dst->Texture.Unit[i].EnvMode = src->Texture.Unit[i].EnvMode;
+ COPY_4V(dst->Texture.Unit[i].EnvColor, src->Texture.Unit[i].EnvColor);
+ dst->Texture.Unit[i].TexGenEnabled = src->Texture.Unit[i].TexGenEnabled;
+ dst->Texture.Unit[i].GenModeS = src->Texture.Unit[i].GenModeS;
+ dst->Texture.Unit[i].GenModeT = src->Texture.Unit[i].GenModeT;
+ dst->Texture.Unit[i].GenModeR = src->Texture.Unit[i].GenModeR;
+ dst->Texture.Unit[i].GenModeQ = src->Texture.Unit[i].GenModeQ;
+ dst->Texture.Unit[i]._GenBitS = src->Texture.Unit[i]._GenBitS;
+ dst->Texture.Unit[i]._GenBitT = src->Texture.Unit[i]._GenBitT;
+ dst->Texture.Unit[i]._GenBitR = src->Texture.Unit[i]._GenBitR;
+ dst->Texture.Unit[i]._GenBitQ = src->Texture.Unit[i]._GenBitQ;
+ dst->Texture.Unit[i]._GenFlags = src->Texture.Unit[i]._GenFlags;
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneS, src->Texture.Unit[i].ObjectPlaneS);
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneT, src->Texture.Unit[i].ObjectPlaneT);
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneR, src->Texture.Unit[i].ObjectPlaneR);
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneQ, src->Texture.Unit[i].ObjectPlaneQ);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneS, src->Texture.Unit[i].EyePlaneS);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneT, src->Texture.Unit[i].EyePlaneT);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneR, src->Texture.Unit[i].EyePlaneR);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneQ, src->Texture.Unit[i].EyePlaneQ);
+ dst->Texture.Unit[i].LodBias = src->Texture.Unit[i].LodBias;
+
+ /* GL_EXT_texture_env_combine */
+ dst->Texture.Unit[i].Combine.ModeRGB = src->Texture.Unit[i].Combine.ModeRGB;
+ dst->Texture.Unit[i].Combine.ModeA = src->Texture.Unit[i].Combine.ModeA;
+ COPY_3V(dst->Texture.Unit[i].Combine.SourceRGB, src->Texture.Unit[i].Combine.SourceRGB);
+ COPY_3V(dst->Texture.Unit[i].Combine.SourceA, src->Texture.Unit[i].Combine.SourceA);
+ COPY_3V(dst->Texture.Unit[i].Combine.OperandRGB, src->Texture.Unit[i].Combine.OperandRGB);
+ COPY_3V(dst->Texture.Unit[i].Combine.OperandA, src->Texture.Unit[i].Combine.OperandA);
+ dst->Texture.Unit[i].Combine.ScaleShiftRGB = src->Texture.Unit[i].Combine.ScaleShiftRGB;
+ dst->Texture.Unit[i].Combine.ScaleShiftA = src->Texture.Unit[i].Combine.ScaleShiftA;
+
+ /* texture object state */
+ _mesa_copy_texture_object(dst->Texture.Unit[i].Current1D,
+ src->Texture.Unit[i].Current1D);
+ _mesa_copy_texture_object(dst->Texture.Unit[i].Current2D,
+ src->Texture.Unit[i].Current2D);
+ _mesa_copy_texture_object(dst->Texture.Unit[i].Current3D,
+ src->Texture.Unit[i].Current3D);
+ _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentCubeMap,
+ src->Texture.Unit[i].CurrentCubeMap);
+ _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentRect,
+ src->Texture.Unit[i].CurrentRect);
+ }
+}
+
+
+/*
+ * For debugging
+ */
+void
+_mesa_print_texunit_state( GLcontext *ctx, GLuint unit )
+{
+ const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit;
+ _mesa_printf("Texture Unit %d\n", unit);
+ _mesa_printf(" GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode));
+ _mesa_printf(" GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB));
+ _mesa_printf(" GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA));
+ _mesa_printf(" GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[0]));
+ _mesa_printf(" GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[1]));
+ _mesa_printf(" GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[2]));
+ _mesa_printf(" GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[0]));
+ _mesa_printf(" GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[1]));
+ _mesa_printf(" GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[2]));
+ _mesa_printf(" GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[0]));
+ _mesa_printf(" GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[1]));
+ _mesa_printf(" GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[2]));
+ _mesa_printf(" GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[0]));
+ _mesa_printf(" GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[1]));
+ _mesa_printf(" GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[2]));
+ _mesa_printf(" GL_RGB_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftRGB);
+ _mesa_printf(" GL_ALPHA_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftA);
+ _mesa_printf(" GL_TEXTURE_ENV_COLOR = (%f, %f, %f, %f)\n", texUnit->EnvColor[0], texUnit->EnvColor[1], texUnit->EnvColor[2], texUnit->EnvColor[3]);
+}
+
+
+
+/**********************************************************************/
+/* Texture Environment */
+/**********************************************************************/
+
+/**
+ * Convert "classic" texture environment to ARB_texture_env_combine style
+ * environments.
+ *
+ * \param state texture_env_combine state vector to be filled-in.
+ * \param mode Classic texture environment mode (i.e., \c GL_REPLACE,
+ * \c GL_BLEND, \c GL_DECAL, etc.).
+ * \param texBaseFormat Base format of the texture associated with the
+ * texture unit.
+ */
+static void
+calculate_derived_texenv( struct gl_tex_env_combine_state *state,
+ GLenum mode, GLenum texBaseFormat )
+{
+ GLenum mode_rgb;
+ GLenum mode_a;
+
+ *state = default_combine_state;
+
+ switch (texBaseFormat) {
+ case GL_ALPHA:
+ state->SourceRGB[0] = GL_PREVIOUS;
+ break;
+
+ case GL_LUMINANCE_ALPHA:
+ case GL_INTENSITY:
+ case GL_RGBA:
+ break;
+
+ case GL_LUMINANCE:
+ case GL_RGB:
+ case GL_YCBCR_MESA:
+ state->SourceA[0] = GL_PREVIOUS;
+ break;
+
+ default:
+ _mesa_problem(NULL, "Invalid texBaseFormat in calculate_derived_texenv");
+ return;
+ }
+
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ mode_rgb = (texBaseFormat == GL_ALPHA) ? GL_REPLACE : mode;
+ mode_a = mode;
+ break;
+
+ case GL_DECAL:
+ mode_rgb = GL_INTERPOLATE;
+ mode_a = GL_REPLACE;
+
+ state->SourceA[0] = GL_PREVIOUS;
+
+ /* Having alpha / luminance / intensity textures replace using the
+ * incoming fragment color matches the definition in NV_texture_shader.
+ * The 1.5 spec simply marks these as "undefined".
+ */
+ switch (texBaseFormat) {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_INTENSITY:
+ state->SourceRGB[0] = GL_PREVIOUS;
+ break;
+ case GL_RGB:
+ case GL_YCBCR_MESA:
+ mode_rgb = GL_REPLACE;
+ break;
+ case GL_RGBA:
+ state->SourceRGB[2] = GL_TEXTURE;
+ break;
+ }
+ break;
+
+ case GL_BLEND:
+ mode_rgb = GL_INTERPOLATE;
+ mode_a = GL_MODULATE;
+
+ switch (texBaseFormat) {
+ case GL_ALPHA:
+ mode_rgb = GL_REPLACE;
+ break;
+ case GL_INTENSITY:
+ mode_a = GL_INTERPOLATE;
+ state->SourceA[0] = GL_CONSTANT;
+ state->OperandA[2] = GL_SRC_ALPHA;
+ /* FALLTHROUGH */
+ case GL_LUMINANCE:
+ case GL_RGB:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGBA:
+ case GL_YCBCR_MESA:
+ state->SourceRGB[2] = GL_TEXTURE;
+ state->SourceA[2] = GL_TEXTURE;
+ state->SourceRGB[0] = GL_CONSTANT;
+ state->OperandRGB[2] = GL_SRC_COLOR;
+ break;
+ }
+ break;
+
+ case GL_ADD:
+ mode_rgb = (texBaseFormat == GL_ALPHA) ? GL_REPLACE : GL_ADD;
+ mode_a = (texBaseFormat == GL_INTENSITY) ? GL_ADD : GL_MODULATE;
+ break;
+
+ default:
+ _mesa_problem(NULL,
+ "Invalid texture env mode in calculate_derived_texenv");
+ return;
+ }
+
+ state->ModeRGB = (state->SourceRGB[0] != GL_PREVIOUS)
+ ? mode_rgb : GL_REPLACE;
+ state->ModeA = (state->SourceA[0] != GL_PREVIOUS)
+ ? mode_a : GL_REPLACE;
+}
+
+
+void GLAPIENTRY
+_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+#define TE_ERROR(errCode, msg, value) \
+ _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
+
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ {
+ const GLenum mode = (GLenum) (GLint) *param;
+ if (texUnit->EnvMode == mode)
+ return;
+ if (mode == GL_MODULATE ||
+ mode == GL_BLEND ||
+ mode == GL_DECAL ||
+ mode == GL_REPLACE ||
+ (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) ||
+ (mode == GL_COMBINE &&
+ (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine))) {
+ /* legal */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->EnvMode = mode;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ }
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ {
+ GLfloat tmp[4];
+ tmp[0] = CLAMP( param[0], 0.0F, 1.0F );
+ tmp[1] = CLAMP( param[1], 0.0F, 1.0F );
+ tmp[2] = CLAMP( param[2], 0.0F, 1.0F );
+ tmp[3] = CLAMP( param[3], 0.0F, 1.0F );
+ if (TEST_EQ_4V(tmp, texUnit->EnvColor))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EnvColor, tmp);
+ }
+ break;
+ case GL_COMBINE_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum mode = (GLenum) (GLint) *param;
+ if (texUnit->Combine.ModeRGB == mode)
+ return;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_INTERPOLATE:
+ /* OK */
+ break;
+ case GL_SUBTRACT:
+ if (!ctx->Extensions.ARB_texture_env_combine) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ if (!ctx->Extensions.EXT_texture_env_dot3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
+ if (!ctx->Extensions.ARB_texture_env_dot3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ if (!ctx->Extensions.ATI_texture_env_combine3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ModeRGB = mode;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_COMBINE_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum mode = (GLenum) (GLint) *param;
+ if (texUnit->Combine.ModeA == mode)
+ return;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_INTERPOLATE:
+ /* OK */
+ break;
+ case GL_SUBTRACT:
+ if (!ctx->Extensions.ARB_texture_env_combine) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ if (!ctx->Extensions.ATI_texture_env_combine3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ModeA = mode;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_SOURCE0_RGB:
+ case GL_SOURCE1_RGB:
+ case GL_SOURCE2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum source = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_SOURCE0_RGB;
+ if (texUnit->Combine.SourceRGB[s] == source)
+ return;
+ if (source == GL_TEXTURE ||
+ source == GL_CONSTANT ||
+ source == GL_PRIMARY_COLOR ||
+ source == GL_PREVIOUS ||
+ (ctx->Extensions.ARB_texture_env_crossbar &&
+ source >= GL_TEXTURE0 &&
+ source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
+ (ctx->Extensions.ATI_texture_env_combine3 &&
+ (source == GL_ZERO || source == GL_ONE))) {
+ /* legal */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.SourceRGB[s] = source;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_SOURCE0_ALPHA:
+ case GL_SOURCE1_ALPHA:
+ case GL_SOURCE2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum source = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_SOURCE0_ALPHA;
+ if (texUnit->Combine.SourceA[s] == source)
+ return;
+ if (source == GL_TEXTURE ||
+ source == GL_CONSTANT ||
+ source == GL_PRIMARY_COLOR ||
+ source == GL_PREVIOUS ||
+ (ctx->Extensions.ARB_texture_env_crossbar &&
+ source >= GL_TEXTURE0 &&
+ source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
+ (ctx->Extensions.ATI_texture_env_combine3 &&
+ (source == GL_ZERO || source == GL_ONE))) {
+ /* legal */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.SourceA[s] = source;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND0_RGB:
+ case GL_OPERAND1_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_OPERAND0_RGB;
+ if (texUnit->Combine.OperandRGB[s] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandRGB[s] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND0_ALPHA:
+ case GL_OPERAND1_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandRGB[2] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_COLOR: /* ARB combine only */
+ case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandRGB[2] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandA[2] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandA[2] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_RGB_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ GLuint newshift;
+ if (*param == 1.0) {
+ newshift = 0;
+ }
+ else if (*param == 2.0) {
+ newshift = 1;
+ }
+ else if (*param == 4.0) {
+ newshift = 2;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
+ return;
+ }
+ if (texUnit->Combine.ScaleShiftRGB == newshift)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ScaleShiftRGB = newshift;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ GLuint newshift;
+ if (*param == 1.0) {
+ newshift = 0;
+ }
+ else if (*param == 2.0) {
+ newshift = 1;
+ }
+ else if (*param == 4.0) {
+ newshift = 2;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" );
+ return;
+ }
+ if (texUnit->Combine.ScaleShiftA == newshift)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ScaleShiftA = newshift;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ if (texUnit->LodBias == param[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->LodBias = param[0];
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite
+ && !ctx->Extensions.ARB_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ const GLenum value = (GLenum) param[0];
+ if (value == GL_TRUE || value == GL_FALSE) {
+ /* It's kind of weird to set point state via glTexEnv,
+ * but that's what the spec calls for.
+ */
+ const GLboolean state = (GLboolean) value;
+ if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value);
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n",
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(pname),
+ *param,
+ _mesa_lookup_enum_by_nr((GLenum) (GLint) *param));
+
+ /* Tell device driver about the new texture environment */
+ if (ctx->Driver.TexEnv) {
+ (*ctx->Driver.TexEnv)( ctx, target, pname, param );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
+{
+ _mesa_TexEnvfv( target, pname, ¶m );
+}
+
+
+
+void GLAPIENTRY
+_mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) param;
+ p[1] = p[2] = p[3] = 0.0;
+ _mesa_TexEnvfv( target, pname, p );
+}
+
+
+void GLAPIENTRY
+_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
+{
+ GLfloat p[4];
+ if (pname == GL_TEXTURE_ENV_COLOR) {
+ p[0] = INT_TO_FLOAT( param[0] );
+ p[1] = INT_TO_FLOAT( param[1] );
+ p[2] = INT_TO_FLOAT( param[2] );
+ p[3] = INT_TO_FLOAT( param[3] );
+ }
+ else {
+ p[0] = (GLfloat) param[0];
+ p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */
+ }
+ _mesa_TexEnvfv( target, pname, p );
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = ENUM_TO_FLOAT(texUnit->EnvMode);
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ COPY_4FV( params, texUnit->EnvColor );
+ break;
+ case GL_COMBINE_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.ModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.ModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.SourceRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE1_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.SourceRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.SourceRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.SourceA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE1_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.SourceA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.SourceA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.OperandRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND1_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.OperandRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.OperandRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.OperandA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND1_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.OperandA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.OperandA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftRGB == 0)
+ *params = 1.0;
+ else if (texUnit->Combine.ScaleShiftRGB == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftA == 0)
+ *params = 1.0;
+ else if (texUnit->Combine.ScaleShiftA == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname=0x%x)", pname);
+ }
+ }
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ *params = texUnit->LodBias;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite
+ && !ctx->Extensions.ARB_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = (GLint) texUnit->EnvMode;
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
+ params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
+ params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
+ params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
+ break;
+ case GL_COMBINE_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.ModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.ModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.SourceRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.SourceRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.SourceRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.SourceA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.SourceA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.SourceA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.OperandRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.OperandRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.OperandRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.OperandA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.OperandA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.OperandA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftRGB == 0)
+ *params = 1;
+ else if (texUnit->Combine.ScaleShiftRGB == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftA == 0)
+ *params = 1;
+ else if (texUnit->Combine.ScaleShiftA == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname=0x%x)",
+ pname);
+ }
+ }
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ *params = (GLint) texUnit->LodBias;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite
+ && !ctx->Extensions.ARB_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+}
+
+
+
+
+/**********************************************************************/
+/* Texture Parameters */
+/**********************************************************************/
+
+static GLboolean
+_mesa_validate_texture_wrap_mode(GLcontext * ctx,
+ GLenum target, GLenum eparam)
+{
+ const struct gl_extensions * const e = & ctx->Extensions;
+
+ if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
+ (eparam == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) {
+ /* any texture target */
+ return GL_TRUE;
+ }
+ else if (target != GL_TEXTURE_RECTANGLE_NV &&
+ (eparam == GL_REPEAT ||
+ (eparam == GL_MIRRORED_REPEAT &&
+ e->ARB_texture_mirrored_repeat) ||
+ (eparam == GL_MIRROR_CLAMP_EXT &&
+ (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
+ (eparam == GL_MIRROR_CLAMP_TO_EDGE_EXT &&
+ (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
+ (eparam == GL_MIRROR_CLAMP_TO_BORDER_EXT &&
+ (e->EXT_texture_mirror_clamp)))) {
+ /* non-rectangle texture */
+ return GL_TRUE;
+ }
+
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return GL_FALSE;
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
+{
+ _mesa_TexParameterfv(target, pname, ¶m);
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ GLenum eparam = (GLenum) (GLint) params[0];
+ struct gl_texture_object *texObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexParameter %s %s %.1f(%s)...\n",
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(pname),
+ *params,
+ _mesa_lookup_enum_by_nr(eparam));
+
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ texObj = texUnit->Current1D;
+ break;
+ case GL_TEXTURE_2D:
+ texObj = texUnit->Current2D;
+ break;
+ case GL_TEXTURE_3D:
+ texObj = texUnit->Current3D;
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->CurrentCubeMap;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->CurrentRect;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_MIN_FILTER:
+ /* A small optimization */
+ if (texObj->MinFilter == eparam)
+ return;
+ if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinFilter = eparam;
+ }
+ else if ((eparam==GL_NEAREST_MIPMAP_NEAREST ||
+ eparam==GL_LINEAR_MIPMAP_NEAREST ||
+ eparam==GL_NEAREST_MIPMAP_LINEAR ||
+ eparam==GL_LINEAR_MIPMAP_LINEAR) &&
+ texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinFilter = eparam;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ /* A small optimization */
+ if (texObj->MagFilter == eparam)
+ return;
+
+ if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MagFilter = eparam;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ break;
+ case GL_TEXTURE_WRAP_S:
+ if (texObj->WrapS == eparam)
+ return;
+ if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapS = eparam;
+ }
+ else {
+ return;
+ }
+ break;
+ case GL_TEXTURE_WRAP_T:
+ if (texObj->WrapT == eparam)
+ return;
+ if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapT = eparam;
+ }
+ else {
+ return;
+ }
+ break;
+ case GL_TEXTURE_WRAP_R:
+ if (texObj->WrapR == eparam)
+ return;
+ if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapR = eparam;
+ }
+ else {
+ return;
+ }
+ break;
+ case GL_TEXTURE_BORDER_COLOR:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->BorderColor[RCOMP] = params[0];
+ texObj->BorderColor[GCOMP] = params[1];
+ texObj->BorderColor[BCOMP] = params[2];
+ texObj->BorderColor[ACOMP] = params[3];
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]);
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (texObj->MinLod == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinLod = params[0];
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (texObj->MaxLod == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MaxLod = params[0];
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (params[0] < 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->BaseLevel = (GLint) params[0];
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (params[0] < 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MaxLevel = (GLint) params[0];
+ break;
+ case GL_TEXTURE_PRIORITY:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->Priority = CLAMP( params[0], 0.0F, 1.0F );
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ if (params[0] < 1.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MaxAnisotropy = params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ GLenum op = (GLenum) params[0];
+ if (op == GL_TEXTURE_LEQUAL_R_SGIX ||
+ op == GL_TEXTURE_GEQUAL_R_SGIX) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareOperator = op;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)");
+ return;
+ }
+ break;
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ if (ctx->Extensions.SGIX_shadow_ambient) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)");
+ return;
+ }
+ break;
+ case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->Extensions.SGIS_generate_mipmap) {
+ texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ const GLenum mode = (GLenum) params[0];
+ if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareMode = mode;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode);
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ const GLenum func = (GLenum) params[0];
+ if (func == GL_LEQUAL || func == GL_GEQUAL) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFunc = func;
+ }
+ else if (ctx->Extensions.EXT_shadow_funcs &&
+ (func == GL_EQUAL ||
+ func == GL_NOTEQUAL ||
+ func == GL_LESS ||
+ func == GL_GREATER ||
+ func == GL_ALWAYS ||
+ func == GL_NEVER)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFunc = func;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)");
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)");
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ const GLenum result = (GLenum) params[0];
+ if (result == GL_LUMINANCE || result == GL_INTENSITY
+ || result == GL_ALPHA) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->DepthMode = result;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)");
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_LOD_BIAS:
+ /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias*/
+ if (ctx->Extensions.EXT_texture_lod_bias) {
+ if (texObj->LodBias != params[0]) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->LodBias = params[0];
+ }
+ }
+ break;
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=0x%x)", pname);
+ return;
+ }
+
+ texObj->Complete = GL_FALSE;
+
+ if (ctx->Driver.TexParameter) {
+ (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameteri( GLenum target, GLenum pname, GLint param )
+{
+ GLfloat fparam[4];
+ if (pname == GL_TEXTURE_PRIORITY)
+ fparam[0] = INT_TO_FLOAT(param);
+ else
+ fparam[0] = (GLfloat) param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0;
+ _mesa_TexParameterfv(target, pname, fparam);
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+ if (pname == GL_TEXTURE_BORDER_COLOR) {
+ fparam[0] = INT_TO_FLOAT(params[0]);
+ fparam[1] = INT_TO_FLOAT(params[1]);
+ fparam[2] = INT_TO_FLOAT(params[2]);
+ fparam[3] = INT_TO_FLOAT(params[3]);
+ }
+ else {
+ if (pname == GL_TEXTURE_PRIORITY)
+ fparam[0] = INT_TO_FLOAT(params[0]);
+ else
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
+ }
+ _mesa_TexParameterfv(target, pname, fparam);
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params )
+{
+ GLint iparam;
+ _mesa_GetTexLevelParameteriv( target, level, pname, &iparam );
+ *params = (GLfloat) iparam;
+}
+
+
+static GLuint
+tex_image_dimensions(GLcontext *ctx, GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_PROXY_TEXTURE_1D:
+ return 1;
+ case GL_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_2D:
+ return 2;
+ case GL_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_3D:
+ return 3;
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ return ctx->Extensions.ARB_texture_cube_map ? 2 : 0;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle ? 2 : 0;
+ default:
+ _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()");
+ return 0;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ const struct gl_texture_image *img = NULL;
+ GLuint dimensions;
+ GLboolean isProxy;
+ GLint maxLevels;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ /* this will catch bad target values */
+ dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */
+ if (dimensions == 0) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
+ return;
+ }
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_PROXY_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_2D:
+ maxLevels = ctx->Const.MaxTextureLevels;
+ break;
+ case GL_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_3D:
+ maxLevels = ctx->Const.Max3DTextureLevels;
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ maxLevels = 1;
+ break;
+ default:
+ _mesa_problem(ctx, "switch in _mesa_GetTexLevelParameter");
+ return;
+ }
+
+ if (level < 0 || level >= maxLevels) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );
+ return;
+ }
+
+ img = _mesa_select_tex_image(ctx, texUnit, target, level);
+ if (!img || !img->TexFormat) {
+ /* undefined texture image */
+ if (pname == GL_TEXTURE_COMPONENTS)
+ *params = 1;
+ else
+ *params = 0;
+ return;
+ }
+
+ isProxy = (target == GL_PROXY_TEXTURE_1D) ||
+ (target == GL_PROXY_TEXTURE_2D) ||
+ (target == GL_PROXY_TEXTURE_3D) ||
+ (target == GL_PROXY_TEXTURE_CUBE_MAP) ||
+ (target == GL_PROXY_TEXTURE_RECTANGLE_NV);
+
+ switch (pname) {
+ case GL_TEXTURE_WIDTH:
+ *params = img->Width;
+ return;
+ case GL_TEXTURE_HEIGHT:
+ *params = img->Height;
+ return;
+ case GL_TEXTURE_DEPTH:
+ *params = img->Depth;
+ return;
+ case GL_TEXTURE_INTERNAL_FORMAT:
+ *params = img->IntFormat;
+ return;
+ case GL_TEXTURE_BORDER:
+ *params = img->Border;
+ return;
+ case GL_TEXTURE_RED_SIZE:
+ if (img->Format == GL_RGB || img->Format == GL_RGBA)
+ *params = img->TexFormat->RedBits;
+ else
+ *params = 0;
+ return;
+ case GL_TEXTURE_GREEN_SIZE:
+ if (img->Format == GL_RGB || img->Format == GL_RGBA)
+ *params = img->TexFormat->GreenBits;
+ else
+ *params = 0;
+ return;
+ case GL_TEXTURE_BLUE_SIZE:
+ if (img->Format == GL_RGB || img->Format == GL_RGBA)
+ *params = img->TexFormat->BlueBits;
+ else
+ *params = 0;
+ return;
+ case GL_TEXTURE_ALPHA_SIZE:
+ if (img->Format == GL_ALPHA || img->Format == GL_LUMINANCE_ALPHA ||
+ img->Format == GL_RGBA)
+ *params = img->TexFormat->AlphaBits;
+ else
+ *params = 0;
+ return;
+ case GL_TEXTURE_INTENSITY_SIZE:
+ if (img->Format != GL_INTENSITY)
+ *params = 0;
+ else if (img->TexFormat->IntensityBits > 0)
+ *params = img->TexFormat->IntensityBits;
+ else /* intensity probably stored as rgb texture */
+ *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
+ return;
+ case GL_TEXTURE_LUMINANCE_SIZE:
+ if (img->Format != GL_LUMINANCE &&
+ img->Format != GL_LUMINANCE_ALPHA)
+ *params = 0;
+ else if (img->TexFormat->LuminanceBits > 0)
+ *params = img->TexFormat->LuminanceBits;
+ else /* luminance probably stored as rgb texture */
+ *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
+ return;
+ case GL_TEXTURE_INDEX_SIZE_EXT:
+ if (img->Format == GL_COLOR_INDEX)
+ *params = img->TexFormat->IndexBits;
+ else
+ *params = 0;
+ return;
+ case GL_DEPTH_BITS:
+ /* XXX this isn't in the GL_SGIX_depth_texture spec
+ * but seems appropriate.
+ */
+ if (ctx->Extensions.SGIX_depth_texture)
+ *params = img->TexFormat->DepthBits;
+ else
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ return;
+
+ /* GL_ARB_texture_compression */
+ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
+ if (ctx->Extensions.ARB_texture_compression) {
+ if (img->IsCompressed && !isProxy)
+ *params = img->CompressedSize;
+ else
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ case GL_TEXTURE_COMPRESSED:
+ if (ctx->Extensions.ARB_texture_compression) {
+ *params = (GLint) img->IsCompressed;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+
+ /* GL_ARB_texture_float */
+ case GL_TEXTURE_RED_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ case GL_TEXTURE_GREEN_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ case GL_TEXTURE_BLUE_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ case GL_TEXTURE_ALPHA_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ case GL_TEXTURE_LUMINANCE_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ case GL_TEXTURE_INTENSITY_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ case GL_TEXTURE_DEPTH_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ return;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_object *obj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ obj = _mesa_select_tex_object(ctx, texUnit, target);
+ if (!obj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = ENUM_TO_FLOAT(obj->MagFilter);
+ return;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = ENUM_TO_FLOAT(obj->MinFilter);
+ return;
+ case GL_TEXTURE_WRAP_S:
+ *params = ENUM_TO_FLOAT(obj->WrapS);
+ return;
+ case GL_TEXTURE_WRAP_T:
+ *params = ENUM_TO_FLOAT(obj->WrapT);
+ return;
+ case GL_TEXTURE_WRAP_R:
+ *params = ENUM_TO_FLOAT(obj->WrapR);
+ return;
+ case GL_TEXTURE_BORDER_COLOR:
+ params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
+ params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
+ params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
+ params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
+ return;
+ case GL_TEXTURE_RESIDENT:
+ {
+ GLboolean resident;
+ if (ctx->Driver.IsTextureResident)
+ resident = ctx->Driver.IsTextureResident(ctx, obj);
+ else
+ resident = GL_TRUE;
+ *params = ENUM_TO_FLOAT(resident);
+ }
+ return;
+ case GL_TEXTURE_PRIORITY:
+ *params = obj->Priority;
+ return;
+ case GL_TEXTURE_MIN_LOD:
+ *params = obj->MinLod;
+ return;
+ case GL_TEXTURE_MAX_LOD:
+ *params = obj->MaxLod;
+ return;
+ case GL_TEXTURE_BASE_LEVEL:
+ *params = (GLfloat) obj->BaseLevel;
+ return;
+ case GL_TEXTURE_MAX_LEVEL:
+ *params = (GLfloat) obj->MaxLevel;
+ return;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ *params = obj->MaxAnisotropy;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLfloat) obj->CompareFlag;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLfloat) obj->CompareOperator;
+ return;
+ }
+ break;
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ if (ctx->Extensions.SGIX_shadow_ambient) {
+ *params = obj->ShadowAmbient;
+ return;
+ }
+ break;
+ case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->Extensions.SGIS_generate_mipmap) {
+ *params = (GLfloat) obj->GenerateMipmap;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLfloat) obj->CompareMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLfloat) obj->CompareFunc;
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ *params = (GLfloat) obj->DepthMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_LOD_BIAS:
+ if (ctx->Extensions.EXT_texture_lod_bias) {
+ *params = obj->LodBias;
+ return;
+ }
+ break;
+ default:
+ ; /* silence warnings */
+ }
+ /* If we get here, pname was an unrecognized enum */
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)",
+ pname);
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_object *obj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ obj = _mesa_select_tex_object(ctx, texUnit, target);
+ if (!obj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = (GLint) obj->MagFilter;
+ return;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = (GLint) obj->MinFilter;
+ return;
+ case GL_TEXTURE_WRAP_S:
+ *params = (GLint) obj->WrapS;
+ return;
+ case GL_TEXTURE_WRAP_T:
+ *params = (GLint) obj->WrapT;
+ return;
+ case GL_TEXTURE_WRAP_R:
+ *params = (GLint) obj->WrapR;
+ return;
+ case GL_TEXTURE_BORDER_COLOR:
+ {
+ GLfloat b[4];
+ b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
+ b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
+ b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
+ b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
+ params[0] = FLOAT_TO_INT(b[0]);
+ params[1] = FLOAT_TO_INT(b[1]);
+ params[2] = FLOAT_TO_INT(b[2]);
+ params[3] = FLOAT_TO_INT(b[3]);
+ }
+ return;
+ case GL_TEXTURE_RESIDENT:
+ {
+ GLboolean resident;
+ if (ctx->Driver.IsTextureResident)
+ resident = ctx->Driver.IsTextureResident(ctx, obj);
+ else
+ resident = GL_TRUE;
+ *params = (GLint) resident;
+ }
+ return;
+ case GL_TEXTURE_PRIORITY:
+ *params = FLOAT_TO_INT(obj->Priority);
+ return;
+ case GL_TEXTURE_MIN_LOD:
+ *params = (GLint) obj->MinLod;
+ return;
+ case GL_TEXTURE_MAX_LOD:
+ *params = (GLint) obj->MaxLod;
+ return;
+ case GL_TEXTURE_BASE_LEVEL:
+ *params = obj->BaseLevel;
+ return;
+ case GL_TEXTURE_MAX_LEVEL:
+ *params = obj->MaxLevel;
+ return;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ *params = (GLint) obj->MaxAnisotropy;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLint) obj->CompareFlag;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLint) obj->CompareOperator;
+ return;
+ }
+ break;
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ if (ctx->Extensions.SGIX_shadow_ambient) {
+ *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient);
+ return;
+ }
+ break;
+ case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->Extensions.SGIS_generate_mipmap) {
+ *params = (GLint) obj->GenerateMipmap;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLint) obj->CompareMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLint) obj->CompareFunc;
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ *params = (GLint) obj->DepthMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_LOD_BIAS:
+ if (ctx->Extensions.EXT_texture_lod_bias) {
+ *params = (GLint) obj->LodBias;
+ return;
+ }
+ break;
+ default:
+ ; /* silence warnings */
+ }
+ /* If we get here, pname was an unrecognized enum */
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname);
+}
+
+
+
+
+/**********************************************************************/
+/* Texture Coord Generation */
+/**********************************************************************/
+
+#if FEATURE_texgen
+void GLAPIENTRY
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint tUnit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n",
+ _mesa_lookup_enum_by_nr(coord),
+ _mesa_lookup_enum_by_nr(pname),
+ *params,
+ _mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLuint bits;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bits = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_EYE_LINEAR:
+ bits = TEXGEN_EYE_LINEAR;
+ break;
+ case GL_REFLECTION_MAP_NV:
+ bits = TEXGEN_REFLECTION_MAP_NV;
+ break;
+ case GL_NORMAL_MAP_NV:
+ bits = TEXGEN_NORMAL_MAP_NV;
+ break;
+ case GL_SPHERE_MAP:
+ bits = TEXGEN_SPHERE_MAP;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeS == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeS = mode;
+ texUnit->_GenBitS = bits;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneS, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->ObjectPlaneS[0] = params[0];
+ texUnit->ObjectPlaneS[1] = params[1];
+ texUnit->ObjectPlaneS[2] = params[2];
+ texUnit->ObjectPlaneS[3] = params[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+
+ /* Transform plane equation by the inverse modelview matrix */
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneS, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneS, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLuint bitt;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bitt = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_EYE_LINEAR:
+ bitt = TEXGEN_EYE_LINEAR;
+ break;
+ case GL_REFLECTION_MAP_NV:
+ bitt = TEXGEN_REFLECTION_MAP_NV;
+ break;
+ case GL_NORMAL_MAP_NV:
+ bitt = TEXGEN_NORMAL_MAP_NV;
+ break;
+ case GL_SPHERE_MAP:
+ bitt = TEXGEN_SPHERE_MAP;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeT == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeT = mode;
+ texUnit->_GenBitT = bitt;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneT, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->ObjectPlaneT[0] = params[0];
+ texUnit->ObjectPlaneT[1] = params[1];
+ texUnit->ObjectPlaneT[2] = params[2];
+ texUnit->ObjectPlaneT[3] = params[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneT, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneT, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLuint bitr;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bitr = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_REFLECTION_MAP_NV:
+ bitr = TEXGEN_REFLECTION_MAP_NV;
+ break;
+ case GL_NORMAL_MAP_NV:
+ bitr = TEXGEN_NORMAL_MAP_NV;
+ break;
+ case GL_EYE_LINEAR:
+ bitr = TEXGEN_EYE_LINEAR;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeR == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeR = mode;
+ texUnit->_GenBitR = bitr;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneR, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->ObjectPlaneR[0] = params[0];
+ texUnit->ObjectPlaneR[1] = params[1];
+ texUnit->ObjectPlaneR[2] = params[2];
+ texUnit->ObjectPlaneR[3] = params[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneR, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneR, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLuint bitq;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bitq = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_EYE_LINEAR:
+ bitq = TEXGEN_EYE_LINEAR;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeQ == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeQ = mode;
+ texUnit->_GenBitQ = bitq;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->ObjectPlaneQ[0] = params[0];
+ texUnit->ObjectPlaneQ[1] = params[1];
+ texUnit->ObjectPlaneQ[2] = params[2];
+ texUnit->ObjectPlaneQ[3] = params[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneQ, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" );
+ return;
+ }
+
+ if (ctx->Driver.TexGen)
+ ctx->Driver.TexGen( ctx, coord, pname, params );
+}
+
+
+void GLAPIENTRY
+_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ if (pname == GL_TEXTURE_GEN_MODE) {
+ p[1] = p[2] = p[3] = 0.0F;
+ }
+ else {
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ }
+ _mesa_TexGenfv(coord, pname, p);
+}
+
+
+void GLAPIENTRY
+_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
+{
+ GLfloat p = (GLfloat) param;
+ _mesa_TexGenfv( coord, pname, &p );
+}
+
+
+void GLAPIENTRY
+_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ if (pname == GL_TEXTURE_GEN_MODE) {
+ p[1] = p[2] = p[3] = 0.0F;
+ }
+ else {
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ }
+ _mesa_TexGenfv( coord, pname, p );
+}
+
+
+void GLAPIENTRY
+_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
+{
+ _mesa_TexGenfv(coord, pname, ¶m);
+}
+
+
+void GLAPIENTRY
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+ _mesa_TexGeniv( coord, pname, ¶m );
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint tUnit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneS );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneS );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneT );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneT );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneR );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneR );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneQ );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneQ );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" );
+ return;
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint tUnit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeS);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneS );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneS );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeT);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneT );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneT );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeR);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneR );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneR );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneQ );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneQ );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" );
+ return;
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint tUnit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeS;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneS[0];
+ params[1] = (GLint) texUnit->ObjectPlaneS[1];
+ params[2] = (GLint) texUnit->ObjectPlaneS[2];
+ params[3] = (GLint) texUnit->ObjectPlaneS[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneS[0];
+ params[1] = (GLint) texUnit->EyePlaneS[1];
+ params[2] = (GLint) texUnit->EyePlaneS[2];
+ params[3] = (GLint) texUnit->EyePlaneS[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeT;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneT[0];
+ params[1] = (GLint) texUnit->ObjectPlaneT[1];
+ params[2] = (GLint) texUnit->ObjectPlaneT[2];
+ params[3] = (GLint) texUnit->ObjectPlaneT[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneT[0];
+ params[1] = (GLint) texUnit->EyePlaneT[1];
+ params[2] = (GLint) texUnit->EyePlaneT[2];
+ params[3] = (GLint) texUnit->EyePlaneT[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeR;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneR[0];
+ params[1] = (GLint) texUnit->ObjectPlaneR[1];
+ params[2] = (GLint) texUnit->ObjectPlaneR[2];
+ params[3] = (GLint) texUnit->ObjectPlaneR[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneR[0];
+ params[1] = (GLint) texUnit->EyePlaneR[1];
+ params[2] = (GLint) texUnit->EyePlaneR[2];
+ params[3] = (GLint) texUnit->EyePlaneR[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeQ;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneQ[0];
+ params[1] = (GLint) texUnit->ObjectPlaneQ[1];
+ params[2] = (GLint) texUnit->ObjectPlaneQ[2];
+ params[3] = (GLint) texUnit->ObjectPlaneQ[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneQ[0];
+ params[1] = (GLint) texUnit->EyePlaneQ[1];
+ params[2] = (GLint) texUnit->EyePlaneQ[2];
+ params[3] = (GLint) texUnit->EyePlaneQ[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" );
+ return;
+ }
+}
+#endif
+
+/* GL_ARB_multitexture */
+void GLAPIENTRY
+_mesa_ActiveTextureARB( GLenum target )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const GLuint texUnit = target - GL_TEXTURE0;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glActiveTexture %s\n",
+ _mesa_lookup_enum_by_nr(target));
+
+ /* Cater for texture unit 0 is first, therefore use >= */
+ if (texUnit >= ctx->Const.MaxTextureUnits) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(target)");
+ return;
+ }
+
+ if (ctx->Texture.CurrentUnit == texUnit)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+
+ ctx->Texture.CurrentUnit = texUnit;
+ if (ctx->Transform.MatrixMode == GL_TEXTURE) {
+ /* update current stack pointer */
+ ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
+ }
+
+ if (ctx->Driver.ActiveTexture) {
+ (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
+ }
+}
+
+
+/* GL_ARB_multitexture */
+void GLAPIENTRY
+_mesa_ClientActiveTextureARB( GLenum target )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint texUnit = target - GL_TEXTURE0;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (texUnit > ctx->Const.MaxTextureUnits) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(target)");
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.ActiveTexture = texUnit;
+}
+
+
+
+/**********************************************************************/
+/* Pixel Texgen Extensions */
+/**********************************************************************/
+
+void GLAPIENTRY
+_mesa_PixelTexGenSGIX(GLenum mode)
+{
+ GLenum newRgbSource, newAlphaSource;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (mode) {
+ case GL_NONE:
+ newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ break;
+ case GL_ALPHA:
+ newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ newAlphaSource = GL_CURRENT_RASTER_COLOR;
+ break;
+ case GL_RGB:
+ newRgbSource = GL_CURRENT_RASTER_COLOR;
+ newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ break;
+ case GL_RGBA:
+ newRgbSource = GL_CURRENT_RASTER_COLOR;
+ newAlphaSource = GL_CURRENT_RASTER_COLOR;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)");
+ return;
+ }
+
+ if (newRgbSource == ctx->Pixel.FragmentRgbSource &&
+ newAlphaSource == ctx->Pixel.FragmentAlphaSource)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.FragmentRgbSource = newRgbSource;
+ ctx->Pixel.FragmentAlphaSource = newAlphaSource;
+}
+
+
+void GLAPIENTRY
+_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value)
+{
+ _mesa_PixelTexGenParameteriSGIS(target, (GLint) value);
+}
+
+
+void GLAPIENTRY
+_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value)
+{
+ _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value);
+}
+
+
+void GLAPIENTRY
+_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)");
+ return;
+ }
+
+ switch (target) {
+ case GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS:
+ if (ctx->Pixel.FragmentRgbSource == (GLenum) value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.FragmentRgbSource = (GLenum) value;
+ break;
+ case GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS:
+ if (ctx->Pixel.FragmentAlphaSource == (GLenum) value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.FragmentAlphaSource = (GLenum) value;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value)
+{
+ _mesa_PixelTexGenParameteriSGIS(target, *value);
+}
+
+
+void GLAPIENTRY
+_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) {
+ *value = (GLfloat) ctx->Pixel.FragmentRgbSource;
+ }
+ else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) {
+ *value = (GLfloat) ctx->Pixel.FragmentAlphaSource;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) {
+ *value = (GLint) ctx->Pixel.FragmentRgbSource;
+ }
+ else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) {
+ *value = (GLint) ctx->Pixel.FragmentAlphaSource;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)");
+ }
+}
+
+
+
+/**********************************************************************/
+/***** State management *****/
+/**********************************************************************/
+
+
+/**
+ * \note This routine refers to derived texture attribute values to
+ * compute the ENABLE_TEXMAT flags, but is only called on
+ * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
+ * flags are updated by _mesa_update_textures(), below.
+ *
+ * \param ctx GL context.
+ */
+static void
+update_texture_matrices( GLcontext *ctx )
+{
+ GLuint i;
+
+ ctx->Texture._TexMatEnabled = 0;
+
+ for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
+ if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) {
+ _math_matrix_analyse( ctx->TextureMatrixStack[i].Top );
+
+ if (ctx->Texture.Unit[i]._ReallyEnabled &&
+ ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
+ ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
+
+ if (ctx->Driver.TextureMatrix)
+ ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top);
+ }
+ }
+}
+
+
+
+
+/**
+ * \note This routine refers to derived texture matrix values to
+ * compute the ENABLE_TEXMAT flags, but is only called on
+ * _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
+ * flags are updated by _mesa_update_texture_matrices, above.
+ *
+ * \param ctx GL context.
+ */
+static void
+update_texture_state( GLcontext *ctx )
+{
+ GLuint unit;
+
+ ctx->NewState |= _NEW_TEXTURE; /* TODO: only set this if there are
+ * actual changes.
+ */
+
+ ctx->Texture._EnabledUnits = 0;
+ ctx->Texture._GenFlags = 0;
+ ctx->Texture._TexMatEnabled = 0;
+ ctx->Texture._TexGenEnabled = 0;
+
+ /* Update texture unit state.
+ * XXX this loop should probably be broken into separate loops for
+ * texture coord units and texture image units.
+ */
+ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint enableBits;
+
+ texUnit->_Current = NULL;
+ texUnit->_ReallyEnabled = 0;
+ texUnit->_GenFlags = 0;
+
+ /* Get the bitmask of texture enables */
+ if (ctx->FragmentProgram._Enabled) {
+ enableBits = ctx->FragmentProgram.Current->TexturesUsed[unit];
+ }
+ else {
+ if (!texUnit->Enabled)
+ continue;
+ enableBits = texUnit->Enabled;
+ }
+
+ /* Look for the highest-priority texture target that's enabled and
+ * complete. That's the one we'll use for texturing. If we're using
+ * a fragment program we're guaranteed that bitcount(enabledBits) <= 1.
+ */
+ if (enableBits & TEXTURE_CUBE_BIT) {
+ struct gl_texture_object *texObj = texUnit->CurrentCubeMap;
+ if (!texObj->Complete) {
+ _mesa_test_texobj_completeness(ctx, texObj);
+ }
+ if (texObj->Complete) {
+ texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT;
+ texUnit->_Current = texObj;
+ }
+ }
+
+ if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_3D_BIT)) {
+ struct gl_texture_object *texObj = texUnit->Current3D;
+ if (!texObj->Complete) {
+ _mesa_test_texobj_completeness(ctx, texObj);
+ }
+ if (texObj->Complete) {
+ texUnit->_ReallyEnabled = TEXTURE_3D_BIT;
+ texUnit->_Current = texObj;
+ }
+ }
+
+ if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_RECT_BIT)) {
+ struct gl_texture_object *texObj = texUnit->CurrentRect;
+ if (!texObj->Complete) {
+ _mesa_test_texobj_completeness(ctx, texObj);
+ }
+ if (texObj->Complete) {
+ texUnit->_ReallyEnabled = TEXTURE_RECT_BIT;
+ texUnit->_Current = texObj;
+ }
+ }
+
+ if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_2D_BIT)) {
+ struct gl_texture_object *texObj = texUnit->Current2D;
+ if (!texObj->Complete) {
+ _mesa_test_texobj_completeness(ctx, texObj);
+ }
+ if (texObj->Complete) {
+ texUnit->_ReallyEnabled = TEXTURE_2D_BIT;
+ texUnit->_Current = texObj;
+ }
+ }
+
+ if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_1D_BIT)) {
+ struct gl_texture_object *texObj = texUnit->Current1D;
+ if (!texObj->Complete) {
+ _mesa_test_texobj_completeness(ctx, texObj);
+ }
+ if (texObj->Complete) {
+ texUnit->_ReallyEnabled = TEXTURE_1D_BIT;
+ texUnit->_Current = texObj;
+ }
+ }
+
+ if (!texUnit->_ReallyEnabled) {
+ continue;
+ }
+
+ if (texUnit->_ReallyEnabled)
+ ctx->Texture._EnabledUnits |= (1 << unit);
+
+ if (texUnit->EnvMode == GL_COMBINE) {
+ texUnit->_CurrentCombine = & texUnit->Combine;
+ }
+ else {
+ GLenum format = texUnit->_Current->Image[0][0]->Format;
+ if (format == GL_COLOR_INDEX) {
+ format = GL_RGBA; /* a bit of a hack */
+ }
+ else if (format == GL_DEPTH_COMPONENT) {
+ format = texUnit->_Current->DepthMode;
+ }
+ calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format);
+ texUnit->_CurrentCombine = & texUnit->_EnvMode;
+ }
+
+ switch (texUnit->_CurrentCombine->ModeRGB) {
+ case GL_REPLACE:
+ texUnit->_CurrentCombine->_NumArgsRGB = 1;
+ break;
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_SUBTRACT:
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ texUnit->_CurrentCombine->_NumArgsRGB = 2;
+ break;
+ case GL_INTERPOLATE:
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ texUnit->_CurrentCombine->_NumArgsRGB = 3;
+ break;
+ default:
+ texUnit->_CurrentCombine->_NumArgsRGB = 0;
+ _mesa_problem(ctx, "invalid RGB combine mode in update_texture_state");
+ return;
+ }
+
+ switch (texUnit->_CurrentCombine->ModeA) {
+ case GL_REPLACE:
+ texUnit->_CurrentCombine->_NumArgsA = 1;
+ break;
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_SUBTRACT:
+ texUnit->_CurrentCombine->_NumArgsA = 2;
+ break;
+ case GL_INTERPOLATE:
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ texUnit->_CurrentCombine->_NumArgsA = 3;
+ break;
+ default:
+ texUnit->_CurrentCombine->_NumArgsA = 0;
+ _mesa_problem(ctx, "invalid Alpha combine mode in update_texture_state");
+ break;
+ }
+
+ if (texUnit->TexGenEnabled) {
+ if (texUnit->TexGenEnabled & S_BIT) {
+ texUnit->_GenFlags |= texUnit->_GenBitS;
+ }
+ if (texUnit->TexGenEnabled & T_BIT) {
+ texUnit->_GenFlags |= texUnit->_GenBitT;
+ }
+ if (texUnit->TexGenEnabled & Q_BIT) {
+ texUnit->_GenFlags |= texUnit->_GenBitQ;
+ }
+ if (texUnit->TexGenEnabled & R_BIT) {
+ texUnit->_GenFlags |= texUnit->_GenBitR;
+ }
+
+ ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
+ ctx->Texture._GenFlags |= texUnit->_GenFlags;
+ }
+
+ if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
+ ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
+ }
+
+ ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits;
+ /* Fragment programs may need texture coordinates but not the
+ * corresponding texture images.
+ */
+ if (ctx->FragmentProgram._Enabled) {
+ ctx->Texture._EnabledCoordUnits |=
+ (ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0);
+ }
+}
+
+
+void _mesa_update_texture( GLcontext *ctx, GLuint new_state )
+{
+ if (new_state & _NEW_TEXTURE_MATRIX)
+ update_texture_matrices( ctx );
+
+ if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM))
+ update_texture_state( ctx );
+}
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+/**
+ * Allocate the proxy textures for the given context.
+ *
+ * \param ctx the context to allocate proxies for.
+ *
+ * \return GL_TRUE on success, or GL_FALSE on failure
+ *
+ * If run out of memory part way through the allocations, clean up and return
+ * GL_FALSE.
+ */
+static GLboolean
+alloc_proxy_textures( GLcontext *ctx )
+{
+ ctx->Texture.Proxy1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D);
+ if (!ctx->Texture.Proxy1D)
+ goto cleanup;
+
+ ctx->Texture.Proxy2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D);
+ if (!ctx->Texture.Proxy2D)
+ goto cleanup;
+
+ ctx->Texture.Proxy3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D);
+ if (!ctx->Texture.Proxy3D)
+ goto cleanup;
+
+ ctx->Texture.ProxyCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB);
+ if (!ctx->Texture.ProxyCubeMap)
+ goto cleanup;
+
+ ctx->Texture.ProxyRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV);
+ if (!ctx->Texture.ProxyRect)
+ goto cleanup;
+
+ return GL_TRUE;
+
+ cleanup:
+ if (ctx->Texture.Proxy1D)
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D);
+ if (ctx->Texture.Proxy2D)
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D);
+ if (ctx->Texture.Proxy3D)
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D);
+ if (ctx->Texture.ProxyCubeMap)
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap);
+ if (ctx->Texture.ProxyRect)
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect);
+ return GL_FALSE;
+}
+
+
+/**
+ * Initialize a texture unit.
+ *
+ * \param ctx GL context.
+ * \param unit texture unit number to be initialized.
+ */
+static void
+init_texture_unit( GLcontext *ctx, GLuint unit )
+{
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+
+ texUnit->EnvMode = GL_MODULATE;
+ ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 );
+
+ texUnit->Combine = default_combine_state;
+ texUnit->_EnvMode = default_combine_state;
+ texUnit->_CurrentCombine = & texUnit->_EnvMode;
+
+ texUnit->TexGenEnabled = 0;
+ texUnit->GenModeS = GL_EYE_LINEAR;
+ texUnit->GenModeT = GL_EYE_LINEAR;
+ texUnit->GenModeR = GL_EYE_LINEAR;
+ texUnit->GenModeQ = GL_EYE_LINEAR;
+ texUnit->_GenBitS = TEXGEN_EYE_LINEAR;
+ texUnit->_GenBitT = TEXGEN_EYE_LINEAR;
+ texUnit->_GenBitR = TEXGEN_EYE_LINEAR;
+ texUnit->_GenBitQ = TEXGEN_EYE_LINEAR;
+
+ /* Yes, these plane coefficients are correct! */
+ ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 );
+ ASSIGN_4V( texUnit->ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 );
+ ASSIGN_4V( texUnit->ObjectPlaneR, 0.0, 0.0, 0.0, 0.0 );
+ ASSIGN_4V( texUnit->ObjectPlaneQ, 0.0, 0.0, 0.0, 0.0 );
+ ASSIGN_4V( texUnit->EyePlaneS, 1.0, 0.0, 0.0, 0.0 );
+ ASSIGN_4V( texUnit->EyePlaneT, 0.0, 1.0, 0.0, 0.0 );
+ ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 );
+ ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 );
+
+ texUnit->Current1D = ctx->Shared->Default1D;
+ texUnit->Current2D = ctx->Shared->Default2D;
+ texUnit->Current3D = ctx->Shared->Default3D;
+ texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
+ texUnit->CurrentRect = ctx->Shared->DefaultRect;
+}
+
+
+GLboolean _mesa_init_texture( GLcontext * ctx )
+{
+ int i;
+
+ assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
+ assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
+
+ /* Effectively bind the default textures to all texture units */
+ ctx->Shared->Default1D->RefCount += MAX_TEXTURE_UNITS;
+ ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS;
+ ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS;
+ ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS;
+ ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS;
+
+ /* Texture group */
+ ctx->Texture.CurrentUnit = 0; /* multitexture */
+ ctx->Texture._EnabledUnits = 0;
+ for (i=0; iTexture.SharedPalette = GL_FALSE;
+ _mesa_init_colortable(&ctx->Texture.Palette);
+
+ /* Allocate proxy textures */
+ if (!alloc_proxy_textures( ctx ))
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
+void _mesa_free_texture_data( GLcontext *ctx )
+{
+ int i;
+
+ /* Free proxy texture objects */
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D );
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D );
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D );
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap );
+ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect );
+
+ for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
+ _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable );
+}
Index: xc/extras/Mesa/src/mesa/main/texstate.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texstate.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texstate.h Thu Apr 8 05:17:51 2004
@@ -0,0 +1,192 @@
+/**
+ * \file texstate.h
+ * Texture state management.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXSTATE_H
+#define TEXSTATE_H
+
+
+#include "mtypes.h"
+
+
+extern void
+_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst );
+
+extern void
+_mesa_print_texunit_state( GLcontext *ctx, GLuint unit );
+
+
+/**
+ * \name Called from API
+ */
+/*@{*/
+
+extern void GLAPIENTRY
+_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params );
+
+
+extern void GLAPIENTRY
+_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param );
+
+extern void GLAPIENTRY
+_mesa_TexEnvi( GLenum target, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );
+
+
+extern void GLAPIENTRY
+_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param );
+
+
+extern void GLAPIENTRY
+_mesa_TexParameteri( GLenum target, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params );
+
+
+extern void GLAPIENTRY
+_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param );
+
+extern void GLAPIENTRY
+_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params );
+
+extern void GLAPIENTRY
+_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params );
+
+
+/*
+ * GL_ARB_multitexture
+ */
+extern void GLAPIENTRY
+_mesa_ActiveTextureARB( GLenum target );
+
+extern void GLAPIENTRY
+_mesa_ClientActiveTextureARB( GLenum target );
+
+
+/*
+ * Pixel Texture Extensions
+ */
+
+extern void GLAPIENTRY
+_mesa_PixelTexGenSGIX(GLenum mode);
+
+extern void GLAPIENTRY
+_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value);
+
+#ifdef VMS
+#define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv
+#endif
+extern void GLAPIENTRY
+_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value);
+
+#ifdef VMS
+#define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv
+#endif
+extern void GLAPIENTRY
+_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value);
+
+#ifdef VMS
+#define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv
+#endif
+extern void GLAPIENTRY
+_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value);
+
+#ifdef VMS
+#define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv
+#endif
+extern void GLAPIENTRY
+_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value);
+
+/*@}*/
+
+
+/**
+ * \name Initialization, state maintenance
+ */
+/*@{*/
+
+extern void
+_mesa_update_texture( GLcontext *ctx, GLuint new_state );
+
+extern GLboolean
+_mesa_init_texture( GLcontext *ctx );
+
+extern void
+_mesa_free_texture_data( GLcontext *ctx );
+
+/*@}*/
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/texstore.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texstore.c:1.5
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texstore.c Wed Dec 15 10:40:29 2004
@@ -0,0 +1,3515 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/main/texstore.c,v 1.5 2004/12/15 15:40:29 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Brian Paul
+ */
+
+/*
+ * The GL texture image functions in teximage.c basically just do
+ * error checking and data structure allocation. They in turn call
+ * device driver functions which actually copy/convert/store the user's
+ * texture image data.
+ *
+ * However, most device drivers will be able to use the fallback functions
+ * in this file. That is, most drivers will have the following bit of
+ * code:
+ * ctx->Driver.TexImage1D = _mesa_store_teximage1d;
+ * ctx->Driver.TexImage2D = _mesa_store_teximage2d;
+ * ctx->Driver.TexImage3D = _mesa_store_teximage3d;
+ * etc...
+ *
+ * Texture image processing is actually kind of complicated. We have to do:
+ * Format/type conversions
+ * pixel unpacking
+ * pixel transfer (scale, bais, lookup, convolution!, etc)
+ *
+ * These functions can handle most everything, including processing full
+ * images and sub-images.
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "colormac.h"
+#include "context.h"
+#include "convolve.h"
+#include "image.h"
+#include "macros.h"
+#include "imports.h"
+#include "texcompress.h"
+#include "texformat.h"
+#include "teximage.h"
+#include "texstore.h"
+
+
+static const GLint ZERO = 1000, ONE = 1001;
+
+/**
+ * When promoting texture formats (see below) we need to compute the
+ * mapping of dest components back to source components.
+ * This function does that.
+ * \param logicalBaseFormat the logical format of the texture
+ * \param textureBaseFormat the final texture format
+ * \return map[4] the four mapping values
+ */
+static void
+compute_component_mapping(GLenum logicalBaseFormat, GLenum textureBaseFormat,
+ GLint map[4])
+{
+ /* compute mapping from dest components back to src components */
+ switch (textureBaseFormat) {
+ case GL_RGB:
+ case GL_RGBA:
+ switch (logicalBaseFormat) {
+ case GL_LUMINANCE:
+ map[0] = map[1] = map[2] = 0;
+ if (textureBaseFormat == GL_RGBA)
+ map[3] = ONE;
+ break;
+ case GL_ALPHA:
+ ASSERT(textureBaseFormat == GL_RGBA);
+ map[0] = map[1] = map[2] = ZERO;
+ map[3] = 0;
+ break;
+ case GL_INTENSITY:
+ map[0] = map[1] = map[2] = 0;
+ if (textureBaseFormat == GL_RGBA)
+ map[3] = 0;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ ASSERT(textureBaseFormat == GL_RGBA);
+ map[0] = map[1] = map[2] = 0;
+ map[3] = 1;
+ break;
+ case GL_RGB:
+ ASSERT(textureBaseFormat == GL_RGBA);
+ map[0] = 0;
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = ONE;
+ break;
+ default:
+ _mesa_problem(NULL, "Unexpected logicalBaseFormat");
+ map[0] = map[1] = map[2] = map[3] = 0;
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ switch (logicalBaseFormat) {
+ case GL_LUMINANCE:
+ map[0] = 0;
+ map[1] = ONE;
+ break;
+ case GL_ALPHA:
+ map[0] = ZERO;
+ map[1] = 0;
+ break;
+ case GL_INTENSITY:
+ map[0] = 0;
+ map[1] = 0;
+ break;
+ default:
+ _mesa_problem(NULL, "Unexpected logicalBaseFormat");
+ map[0] = map[1] = 0;
+ }
+ }
+}
+
+
+/**
+ * Make a temporary (color) texture image with GLfloat components.
+ * Apply all needed pixel unpacking and pixel transfer operations.
+ * Note that there are both logicalBaseFormat and textureBaseFormat parameters.
+ * Suppose the user specifies GL_LUMINANCE as the internal texture format
+ * but the graphics hardware doesn't support luminance textures. So, might
+ * use an RGB hardware format instead.
+ * If logicalBaseFormat != textureBaseFormat we have some extra work to do.
+ *
+ * \param ctx the rendering context
+ * \param dims image dimensions: 1, 2 or 3
+ * \param logicalBaseFormat basic texture derived from the user's
+ * internal texture format value
+ * \param textureBaseFormat the actual basic format of the texture
+ * \param srcWidth source image width
+ * \param srcHeight source image height
+ * \param srcDepth source image depth
+ * \param srcFormat source image format
+ * \param srcType source image type
+ * \param srcAddr source image address
+ * \param srcPacking source image pixel packing
+ * \return resulting image with format = textureBaseFormat and type = GLfloat.
+ */
+static GLfloat *
+make_temp_float_image(GLcontext *ctx, GLuint dims,
+ GLenum logicalBaseFormat,
+ GLenum textureBaseFormat,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *srcAddr,
+ const struct gl_pixelstore_attrib *srcPacking)
+{
+ GLuint transferOps = ctx->_ImageTransferState;
+ GLfloat *tempImage;
+
+ ASSERT(dims >= 1 && dims <= 3);
+
+ ASSERT(logicalBaseFormat == GL_RGBA ||
+ logicalBaseFormat == GL_RGB ||
+ logicalBaseFormat == GL_LUMINANCE_ALPHA ||
+ logicalBaseFormat == GL_LUMINANCE ||
+ logicalBaseFormat == GL_ALPHA ||
+ logicalBaseFormat == GL_INTENSITY ||
+ logicalBaseFormat == GL_COLOR_INDEX ||
+ logicalBaseFormat == GL_DEPTH_COMPONENT);
+
+ ASSERT(textureBaseFormat == GL_RGBA ||
+ textureBaseFormat == GL_RGB ||
+ textureBaseFormat == GL_LUMINANCE_ALPHA ||
+ textureBaseFormat == GL_LUMINANCE ||
+ textureBaseFormat == GL_ALPHA ||
+ textureBaseFormat == GL_INTENSITY ||
+ textureBaseFormat == GL_COLOR_INDEX ||
+ textureBaseFormat == GL_DEPTH_COMPONENT);
+
+ /* conventional color image */
+
+ if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) ||
+ (dims >= 2 && ctx->Pixel.Convolution2DEnabled) ||
+ (dims >= 2 && ctx->Pixel.Separable2DEnabled)) {
+ /* need image convolution */
+ const GLuint preConvTransferOps
+ = (transferOps & IMAGE_PRE_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT;
+ const GLuint postConvTransferOps
+ = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT;
+ GLint img, row;
+ GLint convWidth, convHeight;
+ GLfloat *convImage;
+
+ /* pre-convolution image buffer (3D) */
+ tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+ * 4 * sizeof(GLfloat));
+ if (!tempImage)
+ return NULL;
+
+ /* post-convolution image buffer (2D) */
+ convImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight
+ * 4 * sizeof(GLfloat));
+ if (!convImage) {
+ _mesa_free(tempImage);
+ return NULL;
+ }
+
+ /* loop over 3D image slices */
+ for (img = 0; img < srcDepth; img++) {
+ GLfloat *dst = tempImage + img * (srcWidth * srcHeight * 4);
+
+ /* unpack and do transfer ops up to convolution */
+ for (row = 0; row < srcHeight; row++) {
+ const GLvoid *src = _mesa_image_address(srcPacking,
+ srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, img, row, 0);
+ _mesa_unpack_color_span_float(ctx, srcWidth, GL_RGBA, dst,
+ srcFormat, srcType, src,
+ srcPacking,
+ preConvTransferOps);
+ dst += srcWidth * 4;
+ }
+
+ /* do convolution */
+ {
+ GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4);
+ convWidth = srcWidth;
+ convHeight = srcHeight;
+ if (dims == 1) {
+ ASSERT(ctx->Pixel.Convolution1DEnabled);
+ _mesa_convolve_1d_image(ctx, &convWidth, src, convImage);
+ }
+ else {
+ if (ctx->Pixel.Convolution2DEnabled) {
+ _mesa_convolve_2d_image(ctx, &convWidth, &convHeight,
+ src, convImage);
+ }
+ else {
+ ASSERT(ctx->Pixel.Separable2DEnabled);
+ _mesa_convolve_sep_image(ctx, &convWidth, &convHeight,
+ src, convImage);
+ }
+ }
+ }
+
+ /* do post-convolution transfer and pack into tempImage */
+ {
+ const GLint logComponents
+ = _mesa_components_in_format(logicalBaseFormat);
+ const GLfloat *src = convImage;
+ GLfloat *dst = tempImage + img * (convWidth * convHeight * 4);
+ for (row = 0; row < convHeight; row++) {
+ _mesa_pack_rgba_span_float(ctx, convWidth,
+ (const GLfloat (*)[4]) src,
+ logicalBaseFormat, GL_FLOAT,
+ dst, &ctx->DefaultPacking,
+ postConvTransferOps);
+ src += convWidth * 4;
+ dst += convWidth * logComponents;
+ }
+ }
+ } /* loop over 3D image slices */
+
+ _mesa_free(convImage);
+
+ /* might need these below */
+ srcWidth = convWidth;
+ srcHeight = convHeight;
+ }
+ else {
+ /* no convolution */
+ const GLint components = _mesa_components_in_format(logicalBaseFormat);
+ const GLint srcStride = _mesa_image_row_stride(srcPacking,
+ srcWidth, srcFormat, srcType);
+ GLfloat *dst;
+ GLint img, row;
+
+ tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+ * components * sizeof(GLfloat));
+ if (!tempImage)
+ return NULL;
+
+ dst = tempImage;
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *src
+ = (const GLubyte *) _mesa_image_address(srcPacking, srcAddr,
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
+ for (row = 0; row < srcHeight; row++) {
+ _mesa_unpack_color_span_float(ctx, srcWidth, logicalBaseFormat,
+ dst, srcFormat, srcType, src,
+ srcPacking, transferOps);
+ dst += srcWidth * components;
+ src += srcStride;
+ }
+ }
+ }
+
+ if (logicalBaseFormat != textureBaseFormat) {
+ /* more work */
+ GLint texComponents = _mesa_components_in_format(textureBaseFormat);
+ GLint logComponents = _mesa_components_in_format(logicalBaseFormat);
+ GLfloat *newImage;
+ GLint i, n;
+ GLint map[4];
+
+ /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */
+ ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA ||
+ textureBaseFormat == GL_LUMINANCE_ALPHA);
+
+ /* The actual texture format should have at least as many components
+ * as the logical texture format.
+ */
+ ASSERT(texComponents >= logComponents);
+
+ newImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+ * texComponents * sizeof(GLfloat));
+ if (!newImage) {
+ _mesa_free(tempImage);
+ return NULL;
+ }
+
+ compute_component_mapping(logicalBaseFormat, textureBaseFormat, map);
+
+ n = srcWidth * srcHeight * srcDepth;
+ for (i = 0; i < n; i++) {
+ GLint k;
+ for (k = 0; k < texComponents; k++) {
+ GLint j = map[k];
+ if (j == ZERO)
+ newImage[i * texComponents + k] = 0.0F;
+ else if (j == ONE)
+ newImage[i * texComponents + k] = 1.0F;
+ else
+ newImage[i * texComponents + k] = tempImage[i * logComponents + j];
+ }
+ }
+
+ _mesa_free(tempImage);
+ tempImage = newImage;
+ }
+
+ return tempImage;
+}
+
+
+/**
+ * Make a temporary (color) texture image with GLchan components.
+ * Apply all needed pixel unpacking and pixel transfer operations.
+ * Note that there are both logicalBaseFormat and textureBaseFormat parameters.
+ * Suppose the user specifies GL_LUMINANCE as the internal texture format
+ * but the graphics hardware doesn't support luminance textures. So, might
+ * use an RGB hardware format instead.
+ * If logicalBaseFormat != textureBaseFormat we have some extra work to do.
+ *
+ * \param ctx the rendering context
+ * \param dims image dimensions: 1, 2 or 3
+ * \param logicalBaseFormat basic texture derived from the user's
+ * internal texture format value
+ * \param textureBaseFormat the actual basic format of the texture
+ * \param srcWidth source image width
+ * \param srcHeight source image height
+ * \param srcDepth source image depth
+ * \param srcFormat source image format
+ * \param srcType source image type
+ * \param srcAddr source image address
+ * \param srcPacking source image pixel packing
+ * \return resulting image with format = textureBaseFormat and type = GLchan.
+ */
+GLchan *
+_mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
+ GLenum logicalBaseFormat,
+ GLenum textureBaseFormat,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *srcAddr,
+ const struct gl_pixelstore_attrib *srcPacking)
+{
+ GLuint transferOps = ctx->_ImageTransferState;
+ const GLint components = _mesa_components_in_format(logicalBaseFormat);
+ GLboolean freeSrcImage = GL_FALSE;
+ GLint img, row;
+ GLchan *tempImage, *dst;
+
+ ASSERT(dims >= 1 && dims <= 3);
+
+ ASSERT(logicalBaseFormat == GL_RGBA ||
+ logicalBaseFormat == GL_RGB ||
+ logicalBaseFormat == GL_LUMINANCE_ALPHA ||
+ logicalBaseFormat == GL_LUMINANCE ||
+ logicalBaseFormat == GL_ALPHA ||
+ logicalBaseFormat == GL_INTENSITY);
+
+ ASSERT(textureBaseFormat == GL_RGBA ||
+ textureBaseFormat == GL_RGB ||
+ textureBaseFormat == GL_LUMINANCE_ALPHA ||
+ textureBaseFormat == GL_LUMINANCE ||
+ textureBaseFormat == GL_ALPHA ||
+ textureBaseFormat == GL_INTENSITY);
+
+ if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) ||
+ (dims >= 2 && ctx->Pixel.Convolution2DEnabled) ||
+ (dims >= 2 && ctx->Pixel.Separable2DEnabled)) {
+ /* get convolved image */
+ GLfloat *convImage = make_temp_float_image(ctx, dims,
+ logicalBaseFormat,
+ logicalBaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType,
+ srcAddr, srcPacking);
+ if (!convImage)
+ return NULL;
+ /* the convolved image is our new source image */
+ srcAddr = convImage;
+ srcFormat = logicalBaseFormat;
+ srcType = GL_FLOAT;
+ srcPacking = &ctx->DefaultPacking;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ transferOps = 0;
+ freeSrcImage = GL_TRUE;
+ }
+
+ /* unpack and transfer the source image */
+ tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+ * components * sizeof(GLchan));
+ if (!tempImage)
+ return NULL;
+
+ dst = tempImage;
+ for (img = 0; img < srcDepth; img++) {
+ const GLint srcStride = _mesa_image_row_stride(srcPacking,
+ srcWidth, srcFormat,
+ srcType);
+ const GLubyte *src
+ = (const GLubyte *) _mesa_image_address(srcPacking, srcAddr,
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
+ for (row = 0; row < srcHeight; row++) {
+ _mesa_unpack_color_span_chan(ctx, srcWidth, logicalBaseFormat, dst,
+ srcFormat, srcType, src, srcPacking,
+ transferOps);
+ dst += srcWidth * components;
+ src += srcStride;
+ }
+ }
+
+ /* If we made a temporary image for convolution, free it here */
+ if (freeSrcImage) {
+ _mesa_free((void *) srcAddr);
+ }
+
+ if (logicalBaseFormat != textureBaseFormat) {
+ /* one more conversion step */
+ GLint texComponents = _mesa_components_in_format(textureBaseFormat);
+ GLint logComponents = _mesa_components_in_format(logicalBaseFormat);
+ GLchan *newImage;
+ GLint i, n;
+ GLint map[4];
+
+ /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */
+ ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA ||
+ textureBaseFormat == GL_LUMINANCE_ALPHA);
+
+ /* The actual texture format should have at least as many components
+ * as the logical texture format.
+ */
+ ASSERT(texComponents >= logComponents);
+
+ newImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+ * texComponents * sizeof(GLchan));
+ if (!newImage) {
+ _mesa_free(tempImage);
+ return NULL;
+ }
+
+ compute_component_mapping(logicalBaseFormat, textureBaseFormat, map);
+
+ n = srcWidth * srcHeight * srcDepth;
+ for (i = 0; i < n; i++) {
+ GLint k;
+ for (k = 0; k < texComponents; k++) {
+ GLint j = map[k];
+ if (j == ZERO)
+ newImage[i * texComponents + k] = 0;
+ else if (j == ONE)
+ newImage[i * texComponents + k] = CHAN_MAX;
+ else
+ newImage[i * texComponents + k] = tempImage[i * logComponents + j];
+ }
+ }
+
+ _mesa_free(tempImage);
+ tempImage = newImage;
+ }
+
+ return tempImage;
+}
+
+
+
+/**
+ * Teximage storage routine for when a simple memcpy will do.
+ * No pixel transfer operations or special texel encodings allowed.
+ * 1D, 2D and 3D images supported.
+ */
+static void
+memcpy_texture(const struct gl_texture_format *dstFormat,
+ GLvoid *dstAddr,
+ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
+ GLint dstRowStride, GLint dstImageStride,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *srcAddr,
+ const struct gl_pixelstore_attrib *srcPacking)
+{
+ const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth,
+ srcFormat, srcType);
+ const GLint srcImageStride = _mesa_image_image_stride(srcPacking,
+ srcWidth, srcHeight, srcFormat, srcType);
+ const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(srcPacking,
+ srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0);
+ const GLint bytesPerRow = srcWidth * dstFormat->TexelBytes;
+ const GLint bytesPerImage = srcHeight * bytesPerRow;
+ const GLint bytesPerTexture = srcDepth * bytesPerImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+
+ if (dstRowStride == srcRowStride &&
+ dstRowStride == bytesPerRow &&
+ ((dstImageStride == srcImageStride &&
+ dstImageStride == bytesPerImage) ||
+ (srcDepth == 1))) {
+ /* one big memcpy */
+ _mesa_memcpy(dstImage, srcImage, bytesPerTexture);
+ }
+ else {
+ GLint img, row;
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *srcRow = srcImage;
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ _mesa_memcpy(dstRow, srcRow, bytesPerRow);
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ srcImage += srcImageStride;
+ dstImage += dstImageStride;
+ }
+ }
+}
+
+
+
+/**
+ * Store an image in any of the formats:
+ * _mesa_texformat_rgba
+ * _mesa_texformat_rgb
+ * _mesa_texformat_alpha
+ * _mesa_texformat_luminance
+ * _mesa_texformat_luminance_alpha
+ * _mesa_texformat_intensity
+ *
+ * \param dims either 1 or 2 or 3
+ * \param baseInternalFormat user-specified base internal format
+ * \param dstFormat destination Mesa texture format
+ * \param dstAddr destination image address
+ * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
+ * \param dstRowStride destination image row stride, in bytes
+ * \param dstImageStride destination image layer stride, in bytes
+ * \param srcWidth/Height/Depth source image size, in pixels
+ * \param srcFormat incoming image format
+ * \param srcType incoming image data type
+ * \param srcAddr source image address
+ * \param srcPacking source image packing parameters
+ */
+GLboolean
+_mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
+ GLenum baseInternalFormat,
+ const struct gl_texture_format *dstFormat,
+ GLvoid *dstAddr,
+ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
+ GLint dstRowStride, GLint dstImageStride,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *srcAddr,
+ const struct gl_pixelstore_attrib *srcPacking)
+{
+ const GLint components = _mesa_components_in_format(baseInternalFormat);
+
+ ASSERT(dstFormat == &_mesa_texformat_rgba ||
+ dstFormat == &_mesa_texformat_rgb ||
+ dstFormat == &_mesa_texformat_alpha ||
+ dstFormat == &_mesa_texformat_luminance ||
+ dstFormat == &_mesa_texformat_luminance_alpha ||
+ dstFormat == &_mesa_texformat_intensity);
+ ASSERT(baseInternalFormat == GL_RGBA ||
+ baseInternalFormat == GL_RGB ||
+ baseInternalFormat == GL_ALPHA ||
+ baseInternalFormat == GL_LUMINANCE ||
+ baseInternalFormat == GL_LUMINANCE_ALPHA ||
+ baseInternalFormat == GL_INTENSITY);
+ ASSERT(dstFormat->TexelBytes == components * sizeof(GLchan));
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == srcFormat &&
+ srcType == CHAN_TYPE) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_rgb &&
+ srcFormat == GL_RGBA &&
+ srcType == CHAN_TYPE) {
+ /* extract RGB from RGBA */
+ int img, row, col;
+ GLchan *dstImage = (GLchan *) (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ for (img = 0; img < srcDepth; img++) {
+ const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
+ srcWidth, srcFormat, srcType);
+ GLchan *srcRow = (GLchan *) _mesa_image_address(srcPacking, srcAddr,
+ srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
+ GLchan *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col * 3 + RCOMP] = srcRow[col * 4 + RCOMP];
+ dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP];
+ dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP];
+ }
+ dstRow += dstRowStride;
+ srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride);
+ }
+ dstImage += dstImageStride;
+ }
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLint bytesPerRow;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ bytesPerRow = srcWidth * components * sizeof(GLchan);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ _mesa_memcpy(dstRow, src, bytesPerRow);
+ dstRow += dstRowStride;
+ src += srcWidth * components;
+ }
+ dstImage += dstImageStride;
+ }
+
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+/**
+ * Store a floating point depth component texture image.
+ */
+GLboolean
+_mesa_texstore_depth_component_float32(STORE_PARAMS)
+{
+ (void) dims;
+ ASSERT(dstFormat == &_mesa_texformat_depth_component_float32);
+ ASSERT(dstFormat->TexelBytes == sizeof(GLfloat));
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == GL_DEPTH_COMPONENT &&
+ srcFormat == GL_DEPTH_COMPONENT &&
+ srcType == GL_FLOAT) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row;
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ const GLvoid *src = _mesa_image_address(srcPacking,
+ srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
+ _mesa_unpack_depth_span(ctx, srcWidth, (GLfloat *) dstRow,
+ srcType, src, srcPacking);
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ }
+ return GL_TRUE;
+}
+
+
+/**
+ * Store a 16-bit integer depth component texture image.
+ */
+GLboolean
+_mesa_texstore_depth_component16(STORE_PARAMS)
+{
+ (void) dims;
+ ASSERT(dstFormat == &_mesa_texformat_depth_component16);
+ ASSERT(dstFormat->TexelBytes == sizeof(GLushort));
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == GL_DEPTH_COMPONENT &&
+ srcFormat == GL_DEPTH_COMPONENT &&
+ srcType == GL_UNSIGNED_SHORT) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLfloat depthTemp[MAX_WIDTH];
+ const GLvoid *src = _mesa_image_address(srcPacking,
+ srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
+ GLushort *dst16 = (GLushort *) dstRow;
+ _mesa_unpack_depth_span(ctx, srcWidth, depthTemp,
+ srcType, src, srcPacking);
+ for (col = 0; col < srcWidth; col++) {
+ dst16[col] = (GLushort) (depthTemp[col] * 65535.0F);
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ }
+ return GL_TRUE;
+}
+
+
+/**
+ * Store an rgb565 or rgb565_rev texture image.
+ */
+GLboolean
+_mesa_texstore_rgb565(STORE_PARAMS)
+{
+ ASSERT(dstFormat == &_mesa_texformat_rgb565 ||
+ dstFormat == &_mesa_texformat_rgb565_rev);
+ ASSERT(dstFormat->TexelBytes == 2);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_rgb565 &&
+ baseInternalFormat == GL_RGB &&
+ srcFormat == GL_RGB &&
+ srcType == GL_UNSIGNED_SHORT_5_6_5) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == GL_RGB &&
+ srcFormat == GL_RGB &&
+ srcType == GL_UNSIGNED_BYTE &&
+ dims == 2) {
+ /* do optimized tex store */
+ const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth,
+ srcFormat, srcType);
+ const GLubyte *src = (const GLubyte *)
+ _mesa_image_address(srcPacking, srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, 0, 0, 0);
+ GLubyte *dst = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint row, col;
+ for (row = 0; row < srcHeight; row++) {
+ const GLubyte *srcUB = (const GLubyte *) src;
+ GLushort *dstUS = (GLushort *) dst;
+ /* check for byteswapped format */
+ if (dstFormat == &_mesa_texformat_rgb565) {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] );
+ srcUB += 3;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_565_REV( srcUB[0], srcUB[1], srcUB[2] );
+ srcUB += 3;
+ }
+ }
+ dst += dstRowStride;
+ src += srcRowStride;
+ }
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLushort *dstUS = (GLushort *) dstRow;
+ /* check for byteswapped format */
+ if (dstFormat == &_mesa_texformat_rgb565) {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 3;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_565_REV( CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 3;
+ }
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_texstore_rgba8888(STORE_PARAMS)
+{
+ ASSERT(dstFormat == &_mesa_texformat_rgba8888 ||
+ dstFormat == &_mesa_texformat_rgba8888_rev);
+ ASSERT(dstFormat->TexelBytes == 4);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_rgba8888 &&
+ baseInternalFormat == GL_RGBA &&
+ ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
+ (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV))) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *dstUI = (GLuint *) dstRow;
+ if (dstFormat == &_mesa_texformat_rgba8888) {
+ for (col = 0; col < srcWidth; col++) {
+ dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]),
+ CHAN_TO_UBYTE(src[ACOMP]) );
+ src += 4;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]),
+ CHAN_TO_UBYTE(src[ACOMP]) );
+ src += 4;
+ }
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_texstore_argb8888(STORE_PARAMS)
+{
+ const GLuint ui = 1;
+ const GLubyte littleEndian = *((const GLubyte *) &ui);
+
+ ASSERT(dstFormat == &_mesa_texformat_argb8888 ||
+ dstFormat == &_mesa_texformat_argb8888_rev);
+ ASSERT(dstFormat->TexelBytes == 4);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb8888 &&
+ baseInternalFormat == GL_RGBA &&
+ srcFormat == GL_BGRA &&
+ ((srcType == GL_UNSIGNED_BYTE && littleEndian) ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) {
+ /* simple memcpy path (little endian) */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb8888_rev &&
+ baseInternalFormat == GL_RGBA &&
+ srcFormat == GL_BGRA &&
+ ((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
+ srcType == GL_UNSIGNED_INT_8_8_8_8)) {
+ /* simple memcpy path (big endian) */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *dstUI = (GLuint *) dstRow;
+ if (dstFormat == &_mesa_texformat_argb8888) {
+ for (col = 0; col < srcWidth; col++) {
+ dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]),
+ CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 4;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[ACOMP]),
+ CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 4;
+ }
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_texstore_rgb888(STORE_PARAMS)
+{
+ const GLuint ui = 1;
+ const GLubyte littleEndian = *((const GLubyte *) &ui);
+
+ ASSERT(dstFormat == &_mesa_texformat_rgb888);
+ ASSERT(dstFormat->TexelBytes == 3);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == GL_RGB &&
+ srcFormat == GL_BGR &&
+ srcType == GL_UNSIGNED_BYTE &&
+ littleEndian) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ srcFormat == GL_RGBA &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* extract RGB from RGBA */
+ int img, row, col;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ for (img = 0; img < srcDepth; img++) {
+ const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
+ srcWidth, srcFormat, srcType);
+ GLubyte *srcRow = (GLubyte *) _mesa_image_address(srcPacking, srcAddr,
+ srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP];
+ dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP];
+ dstRow[col * 3 + 2] = srcRow[col * 4 + RCOMP];
+ }
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = (const GLchan *) tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+#if 0
+ if (littleEndian) {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);
+ dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);
+ dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]);
+ srcUB += 3;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col * 3 + 0] = srcUB[BCOMP];
+ dstRow[col * 3 + 1] = srcUB[GCOMP];
+ dstRow[col * 3 + 2] = srcUB[RCOMP];
+ srcUB += 3;
+ }
+ }
+#else
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[BCOMP]);
+ dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);
+ dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[RCOMP]);
+ src += 3;
+ }
+#endif
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_texstore_bgr888(STORE_PARAMS)
+{
+ const GLuint ui = 1;
+ const GLubyte littleEndian = *((const GLubyte *) &ui);
+
+ ASSERT(dstFormat == &_mesa_texformat_bgr888);
+ ASSERT(dstFormat->TexelBytes == 3);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == GL_RGB &&
+ srcFormat == GL_RGB &&
+ srcType == GL_UNSIGNED_BYTE &&
+ littleEndian) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ srcFormat == GL_RGBA &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* extract BGR from RGBA */
+ int img, row, col;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ for (img = 0; img < srcDepth; img++) {
+ const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
+ srcWidth, srcFormat, srcType);
+ GLubyte *srcRow = (GLubyte *) _mesa_image_address(srcPacking, srcAddr,
+ srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP];
+ dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP];
+ dstRow[col * 3 + 2] = srcRow[col * 4 + BCOMP];
+ }
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = (const GLchan *) tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);
+ dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);
+ dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]);
+ src += 3;
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_texstore_argb4444(STORE_PARAMS)
+{
+ ASSERT(dstFormat == &_mesa_texformat_argb4444 ||
+ dstFormat == &_mesa_texformat_argb4444_rev);
+ ASSERT(dstFormat->TexelBytes == 2);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb4444 &&
+ baseInternalFormat == GL_RGBA &&
+ srcFormat == GL_BGRA &&
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLushort *dstUS = (GLushort *) dstRow;
+ if (dstFormat == &_mesa_texformat_argb4444) {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]),
+ CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 4;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_4444_REV( CHAN_TO_UBYTE(src[ACOMP]),
+ CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 4;
+ }
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+
+GLboolean
+_mesa_texstore_argb1555(STORE_PARAMS)
+{
+ ASSERT(dstFormat == &_mesa_texformat_argb1555 ||
+ dstFormat == &_mesa_texformat_argb1555_rev);
+ ASSERT(dstFormat->TexelBytes == 2);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb1555 &&
+ baseInternalFormat == GL_RGBA &&
+ srcFormat == GL_BGRA &&
+ srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src =tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLushort *dstUS = (GLushort *) dstRow;
+ if (dstFormat == &_mesa_texformat_argb1555) {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]),
+ CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 4;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstUS[col] = PACK_COLOR_1555_REV( CHAN_TO_UBYTE(src[ACOMP]),
+ CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 4;
+ }
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_texstore_al88(STORE_PARAMS)
+{
+ const GLuint ui = 1;
+ const GLubyte littleEndian = *((const GLubyte *) &ui);
+
+ ASSERT(dstFormat == &_mesa_texformat_al88 ||
+ dstFormat == &_mesa_texformat_al88_rev);
+ ASSERT(dstFormat->TexelBytes == 2);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_al88 &&
+ baseInternalFormat == GL_LUMINANCE_ALPHA &&
+ srcFormat == GL_LUMINANCE_ALPHA &&
+ srcType == GL_UNSIGNED_BYTE &&
+ littleEndian) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLushort *dstUS = (GLushort *) dstRow;
+ if (dstFormat == &_mesa_texformat_al88) {
+ for (col = 0; col < srcWidth; col++) {
+ /* src[0] is luminance, src[1] is alpha */
+ dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]),
+ CHAN_TO_UBYTE(src[0]) );
+ src += 2;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ /* src[0] is luminance, src[1] is alpha */
+ dstUS[col] = PACK_COLOR_88_REV( CHAN_TO_UBYTE(src[1]),
+ CHAN_TO_UBYTE(src[0]) );
+ src += 2;
+ }
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_texstore_rgb332(STORE_PARAMS)
+{
+ ASSERT(dstFormat == &_mesa_texformat_rgb332);
+ ASSERT(dstFormat->TexelBytes == 1);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == GL_RGB &&
+ srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE_3_3_2) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]),
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
+ src += 3;
+ }
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+/**
+ * Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8.
+ */
+GLboolean
+_mesa_texstore_a8(STORE_PARAMS)
+{
+ ASSERT(dstFormat == &_mesa_texformat_a8 ||
+ dstFormat == &_mesa_texformat_l8 ||
+ dstFormat == &_mesa_texformat_i8);
+ ASSERT(dstFormat->TexelBytes == 1);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == srcFormat &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLchan *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ for (col = 0; col < srcWidth; col++) {
+ dstRow[col] = CHAN_TO_UBYTE(src[col]);
+ }
+ dstRow += dstRowStride;
+ src += srcWidth;
+ }
+ dstImage += dstImageStride;
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+
+GLboolean
+_mesa_texstore_ci8(STORE_PARAMS)
+{
+ (void) dims; (void) baseInternalFormat;
+ ASSERT(dstFormat == &_mesa_texformat_ci8);
+ ASSERT(dstFormat->TexelBytes == 1);
+ ASSERT(baseInternalFormat == GL_COLOR_INDEX);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ srcFormat == GL_COLOR_INDEX &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row;
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ const GLvoid *src = _mesa_image_address(srcPacking,
+ srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
+ _mesa_unpack_index_span(ctx, srcWidth, GL_UNSIGNED_BYTE, dstRow,
+ srcType, src, srcPacking,
+ ctx->_ImageTransferState);
+ dstRow += dstRowStride;
+ }
+ dstImage += dstImageStride;
+ }
+ }
+ return GL_TRUE;
+}
+
+
+/**
+ * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev.
+ */
+GLboolean
+_mesa_texstore_ycbcr(STORE_PARAMS)
+{
+ const GLuint ui = 1;
+ const GLubyte littleEndian = *((const GLubyte *) &ui);
+ (void) ctx; (void) dims; (void) baseInternalFormat;
+
+ ASSERT((dstFormat == &_mesa_texformat_ycbcr) ||
+ (dstFormat == &_mesa_texformat_ycbcr_rev));
+ ASSERT(dstFormat->TexelBytes == 2);
+ ASSERT(ctx->Extensions.MESA_ycbcr_texture);
+ ASSERT(srcFormat == GL_YCBCR_MESA);
+ ASSERT((srcType == GL_UNSIGNED_SHORT_8_8_MESA) ||
+ (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA));
+ ASSERT(baseInternalFormat == GL_YCBCR_MESA);
+
+ /* always just memcpy since no pixel transfer ops apply */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+
+ /* Check if we need byte swapping */
+ /* XXX the logic here _might_ be wrong */
+ if (srcPacking->SwapBytes ^
+ (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^
+ (dstFormat == &_mesa_texformat_ycbcr_rev) ^
+ !littleEndian) {
+ GLushort *pImage = (GLushort *) ((GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes);
+ GLint img, row;
+ for (img = 0; img < srcDepth; img++) {
+ GLushort *pRow = pImage;
+ for (row = 0; row < srcHeight; row++) {
+ _mesa_swap2(pRow, srcWidth);
+ pRow += dstRowStride;
+ }
+ pImage += dstImageStride;
+ }
+ }
+ return GL_TRUE;
+}
+
+
+
+
+/**
+ * Store an image in any of the formats:
+ * _mesa_texformat_rgba_float32
+ * _mesa_texformat_rgb_float32
+ * _mesa_texformat_alpha_float32
+ * _mesa_texformat_luminance_float32
+ * _mesa_texformat_luminance_alpha_float32
+ * _mesa_texformat_intensity_float32
+ */
+GLboolean
+_mesa_texstore_rgba_float32(STORE_PARAMS)
+{
+ const GLint components = _mesa_components_in_format(baseInternalFormat);
+
+ ASSERT(dstFormat == &_mesa_texformat_rgba_float32 ||
+ dstFormat == &_mesa_texformat_rgb_float32 ||
+ dstFormat == &_mesa_texformat_alpha_float32 ||
+ dstFormat == &_mesa_texformat_luminance_float32 ||
+ dstFormat == &_mesa_texformat_luminance_alpha_float32 ||
+ dstFormat == &_mesa_texformat_intensity_float32);
+ ASSERT(baseInternalFormat == GL_RGBA ||
+ baseInternalFormat == GL_RGB ||
+ baseInternalFormat == GL_ALPHA ||
+ baseInternalFormat == GL_LUMINANCE ||
+ baseInternalFormat == GL_LUMINANCE_ALPHA ||
+ baseInternalFormat == GL_INTENSITY);
+ ASSERT(dstFormat->TexelBytes == components * sizeof(GLfloat));
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == srcFormat &&
+ srcType == GL_FLOAT) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLfloat *tempImage = make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLfloat *src = tempImage;
+ GLint bytesPerRow;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ bytesPerRow = srcWidth * components * sizeof(GLfloat);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dst = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ _mesa_memcpy(dst, src, bytesPerRow);
+ dst += dstRowStride;
+ src += srcWidth * components;
+ }
+ dstImage += dstImageStride;
+ }
+
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+/**
+ * As above, but store 16-bit floats.
+ */
+GLboolean
+_mesa_texstore_rgba_float16(STORE_PARAMS)
+{
+ const GLint components = _mesa_components_in_format(baseInternalFormat);
+
+ ASSERT(dstFormat == &_mesa_texformat_rgba_float16 ||
+ dstFormat == &_mesa_texformat_rgb_float16 ||
+ dstFormat == &_mesa_texformat_alpha_float16 ||
+ dstFormat == &_mesa_texformat_luminance_float16 ||
+ dstFormat == &_mesa_texformat_luminance_alpha_float16 ||
+ dstFormat == &_mesa_texformat_intensity_float16);
+ ASSERT(baseInternalFormat == GL_RGBA ||
+ baseInternalFormat == GL_RGB ||
+ baseInternalFormat == GL_ALPHA ||
+ baseInternalFormat == GL_LUMINANCE ||
+ baseInternalFormat == GL_LUMINANCE_ALPHA ||
+ baseInternalFormat == GL_INTENSITY);
+ ASSERT(dstFormat->TexelBytes == components * sizeof(GLhalfARB));
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == srcFormat &&
+ srcType == GL_HALF_FLOAT_ARB) {
+ /* simple memcpy path */
+ memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageStride,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLfloat *tempImage = make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ dstFormat->BaseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLfloat *src = tempImage;
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstZoffset * dstImageStride
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = dstImage;
+ for (row = 0; row < srcHeight; row++) {
+ GLhalfARB *dstTexel = (GLhalfARB *) dstRow;
+ GLint i;
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = _mesa_float_to_half(src[i]);
+ }
+ dstRow += dstRowStride;
+ src += srcWidth * components;
+ }
+ dstImage += dstImageStride;
+ }
+
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
+
+/**
+ * Validate acces to a PBO for texture data.
+ *
+ * \todo If the PBO is really resident in VRAM, this won't work; the
+ * device driver should check for that and do the right thing.
+ */
+static const GLvoid *
+validate_pbo_teximage( GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *unpack )
+{
+ if (unpack->BufferObj->Name == 0) {
+ /* no PBO */
+ return pixels;
+ }
+ else if (_mesa_validate_pbo_access(unpack, width, height, depth, format,
+ type, pixels)) {
+ return ADD_POINTERS(unpack->BufferObj->Data, pixels);
+ }
+ /* bad access! */
+ return NULL;
+}
+
+
+/**
+ * Validate that unpacking compressed texture image data from a PBO
+ * won't go out of bounds.
+ *
+ * \todo If the PBO is really resident in VRAM, this won't work; the
+ * device driver should check for that and do the right thing.
+ */
+static const GLvoid *
+validate_pbo_compressed_teximage(GLsizei imageSize, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing)
+{
+ if (packing->BufferObj->Name == 0) {
+ /* not using a PBO - return pointer unchanged */
+ return pixels;
+ }
+ else {
+ /* using a PBO */
+ if ((const GLubyte *) pixels + imageSize >
+ (const GLubyte *)(long) packing->BufferObj->Size) {
+ /* out of bounds read! */
+ return NULL;
+ }
+ /* OK! */
+ return ADD_POINTERS(packing->BufferObj->Data, pixels);
+ }
+}
+
+
+
+/*
+ * This is the software fallback for Driver.TexImage1D()
+ * and Driver.CopyTexImage1D().
+ */
+void
+_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ GLint postConvWidth = width;
+ GLint sizeInBytes;
+ (void) border;
+
+ if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
+ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
+ }
+
+ /* choose the texture format */
+ assert(ctx->Driver.ChooseTextureFormat);
+ texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ format, type);
+ assert(texImage->TexFormat);
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
+
+ /* allocate memory */
+ if (texImage->IsCompressed)
+ sizeInBytes = texImage->CompressedSize;
+ else
+ sizeInBytes = postConvWidth * texImage->TexFormat->TexelBytes;
+ texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
+ if (!texImage->Data) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
+ return;
+ }
+
+ pixels = validate_pbo_teximage(width, 1, 1, format, type, pixels, packing);
+ if (!pixels)
+ return;
+
+ {
+ const GLint dstRowStride = 0, dstImageStride = 0;
+ GLboolean success;
+ ASSERT(texImage->TexFormat->StoreImage);
+ success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride, dstImageStride,
+ width, 1, 1,
+ format, type, pixels, packing);
+ if (!success) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
+ return;
+ }
+ }
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+/*
+ * This is the software fallback for Driver.TexImage2D()
+ * and Driver.CopyTexImage2D().
+ * Reasons why a driver might override this function:
+ * - Special memory allocation needs
+ * - Unusual row/image strides
+ * - Special housekeeping
+ */
+void
+_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLenum format, GLenum type, const void *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ GLint postConvWidth = width, postConvHeight = height;
+ GLint texelBytes, sizeInBytes;
+ (void) border;
+
+ if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
+ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
+ &postConvHeight);
+ }
+
+ /* choose the texture format */
+ assert(ctx->Driver.ChooseTextureFormat);
+ texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
+ internalFormat, format, type);
+ assert(texImage->TexFormat);
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
+
+ texelBytes = texImage->TexFormat->TexelBytes;
+
+ /* allocate memory */
+ if (texImage->IsCompressed)
+ sizeInBytes = texImage->CompressedSize;
+ else
+ sizeInBytes = postConvWidth * postConvHeight * texelBytes;
+ texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
+ if (!texImage->Data) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+ return;
+ }
+
+ pixels = validate_pbo_teximage(width, height, 1,
+ format, type, pixels, packing);
+ if (!pixels)
+ return;
+
+ {
+ GLint dstRowStride, dstImageStride = 0;
+ GLboolean success;
+ if (texImage->IsCompressed) {
+ dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width);
+ }
+ else {
+ dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes;
+ }
+ ASSERT(texImage->TexFormat->StoreImage);
+ success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride, dstImageStride,
+ width, height, 1,
+ format, type, pixels, packing);
+ if (!success) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+ return;
+ }
+ }
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+
+/*
+ * This is the software fallback for Driver.TexImage3D()
+ * and Driver.CopyTexImage3D().
+ */
+void
+_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint depth, GLint border,
+ GLenum format, GLenum type, const void *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ GLint texelBytes, sizeInBytes;
+ (void) border;
+
+ /* choose the texture format */
+ assert(ctx->Driver.ChooseTextureFormat);
+ texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
+ internalFormat, format, type);
+ assert(texImage->TexFormat);
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df;
+
+ texelBytes = texImage->TexFormat->TexelBytes;
+
+ /* allocate memory */
+ if (texImage->IsCompressed)
+ sizeInBytes = texImage->CompressedSize;
+ else
+ sizeInBytes = width * height * depth * texelBytes;
+ texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
+ if (!texImage->Data) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
+ return;
+ }
+
+ pixels = validate_pbo_teximage(width, height, depth,
+ format, type, pixels, packing);
+ if (!pixels)
+ return;
+
+ /* unpack image, apply transfer ops and store in texImage->Data */
+ {
+ GLint dstRowStride, dstImageStride;
+ GLboolean success;
+ if (texImage->IsCompressed) {
+ dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width);
+ dstImageStride = 0;
+ }
+ else {
+ dstRowStride = width * texImage->TexFormat->TexelBytes;
+ dstImageStride = dstRowStride * height;
+ }
+ ASSERT(texImage->TexFormat->StoreImage);
+ success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride, dstImageStride,
+ width, height, depth,
+ format, type, pixels, packing);
+ if (!success) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
+ return;
+ }
+ }
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+
+
+/*
+ * This is the software fallback for Driver.TexSubImage1D()
+ * and Driver.CopyTexSubImage1D().
+ */
+void
+_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint width,
+ GLenum format, GLenum type, const void *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ pixels = validate_pbo_teximage(width, 1, 1,
+ format, type, pixels, packing);
+ if (!pixels)
+ return;
+
+ {
+ const GLint dstRowStride = 0, dstImageStride = 0;
+ GLboolean success;
+ ASSERT(texImage->TexFormat->StoreImage);
+ success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, 0, 0, /* offsets */
+ dstRowStride, dstImageStride,
+ width, 1, 1,
+ format, type, pixels, packing);
+ if (!success) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
+ return;
+ }
+ }
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+
+/**
+ * This is the software fallback for Driver.TexSubImage2D()
+ * and Driver.CopyTexSubImage2D().
+ */
+void
+_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint width, GLint height,
+ GLenum format, GLenum type, const void *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ pixels = validate_pbo_teximage(width, height, 1,
+ format, type, pixels, packing);
+ if (!pixels)
+ return;
+
+ {
+ GLint dstRowStride = 0, dstImageStride = 0;
+ GLboolean success;
+ if (texImage->IsCompressed) {
+ dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
+ texImage->Width);
+ }
+ else {
+ dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
+ }
+ ASSERT(texImage->TexFormat->StoreImage);
+ success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, yoffset, 0,
+ dstRowStride, dstImageStride,
+ width, height, 1,
+ format, type, pixels, packing);
+ if (!success) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
+ return;
+ }
+ }
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+/*
+ * This is the software fallback for Driver.TexSubImage3D().
+ * and Driver.CopyTexSubImage3D().
+ */
+void
+_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint width, GLint height, GLint depth,
+ GLenum format, GLenum type, const void *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ pixels = validate_pbo_teximage(width, height, depth,
+ format, type, pixels, packing);
+ if (!pixels)
+ return;
+
+ {
+ GLint dstRowStride, dstImageStride;
+ GLboolean success;
+ if (texImage->IsCompressed) {
+ dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
+ texImage->Width);
+ dstImageStride = 0; /* XXX fix */
+ }
+ else {
+ dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
+ dstImageStride = dstRowStride * texImage->Height;
+ }
+ ASSERT(texImage->TexFormat->StoreImage);
+ success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, yoffset, zoffset,
+ dstRowStride, dstImageStride,
+ width, height, depth,
+ format, type, pixels, packing);
+ if (!success) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
+ return;
+ }
+ }
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+/*
+ * Fallback for Driver.CompressedTexImage1D()
+ */
+void
+_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ /* this space intentionally left blank */
+ (void) ctx;
+ (void) target; (void) level;
+ (void) internalFormat;
+ (void) width; (void) border;
+ (void) imageSize; (void) data;
+ (void) texObj;
+ (void) texImage;
+}
+
+
+
+/*
+ * Fallback for Driver.CompressedTexImage2D()
+ */
+void
+_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ (void) width; (void) height; (void) border;
+
+ /* This is pretty simple, basically just do a memcpy without worrying
+ * about the usual image unpacking or image transfer operations.
+ */
+ ASSERT(texObj);
+ ASSERT(texImage);
+ ASSERT(texImage->Width > 0);
+ ASSERT(texImage->Height > 0);
+ ASSERT(texImage->Depth == 1);
+ ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
+
+ /* choose the texture format */
+ assert(ctx->Driver.ChooseTextureFormat);
+ texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
+ internalFormat, 0, 0);
+ assert(texImage->TexFormat);
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
+
+ /* allocate storage */
+ texImage->Data = MESA_PBUFFER_ALLOC(imageSize);
+ if (!texImage->Data) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
+ return;
+ }
+
+ data = validate_pbo_compressed_teximage(imageSize, data, &ctx->Unpack);
+ if (!data)
+ return;
+
+ /* copy the data */
+ ASSERT(texImage->CompressedSize == (GLuint) imageSize);
+ MEMCPY(texImage->Data, data, imageSize);
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+
+/*
+ * Fallback for Driver.CompressedTexImage3D()
+ */
+void
+_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint depth,
+ GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ /* this space intentionally left blank */
+ (void) ctx;
+ (void) target; (void) level;
+ (void) internalFormat;
+ (void) width; (void) height; (void) depth;
+ (void) border;
+ (void) imageSize; (void) data;
+ (void) texObj;
+ (void) texImage;
+}
+
+
+
+/**
+ * Fallback for Driver.CompressedTexSubImage1D()
+ */
+void
+_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
+ GLint level,
+ GLint xoffset, GLsizei width,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ /* this space intentionally left blank */
+ (void) ctx;
+ (void) target; (void) level;
+ (void) xoffset; (void) width;
+ (void) format;
+ (void) imageSize; (void) data;
+ (void) texObj;
+ (void) texImage;
+}
+
+
+/**
+ * Fallback for Driver.CompressedTexSubImage2D()
+ */
+void
+_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
+ GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ GLint bytesPerRow, destRowStride, srcRowStride;
+ GLint i, rows;
+ GLubyte *dest;
+ const GLubyte *src;
+ (void) format;
+
+ /* these should have been caught sooner */
+ ASSERT((width & 3) == 0 || width == 2 || width == 1);
+ ASSERT((height & 3) == 0 || height == 2 || height == 1);
+ ASSERT((xoffset & 3) == 0);
+ ASSERT((yoffset & 3) == 0);
+
+ data = validate_pbo_compressed_teximage(imageSize, data, &ctx->Unpack);
+ if (!data)
+ return;
+
+ srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width);
+ src = (const GLubyte *) data;
+
+ destRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
+ texImage->Width);
+ dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
+ texImage->IntFormat,
+ texImage->Width,
+ (GLubyte*) texImage->Data);
+
+ bytesPerRow = srcRowStride;
+ rows = height / 4;
+
+ for (i = 0; i < rows; i++) {
+ MEMCPY(dest, src, bytesPerRow);
+ dest += destRowStride;
+ src += srcRowStride;
+ }
+
+ /* GL_SGIS_generate_mipmap */
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ _mesa_generate_mipmap(ctx, target,
+ &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+ texObj);
+ }
+}
+
+
+/**
+ * Fallback for Driver.CompressedTexSubImage3D()
+ */
+void
+_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
+ GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ /* this space intentionally left blank */
+ (void) ctx;
+ (void) target; (void) level;
+ (void) xoffset; (void) yoffset; (void) zoffset;
+ (void) width; (void) height; (void) depth;
+ (void) format;
+ (void) imageSize; (void) data;
+ (void) texObj;
+ (void) texImage;
+}
+
+
+/*
+ * Average together two rows of a source image to produce a single new
+ * row in the dest image. It's legal for the two source rows to point
+ * to the same data. The source width must be equal to either the
+ * dest width or two times the dest width.
+ */
+static void
+do_row(const struct gl_texture_format *format, GLint srcWidth,
+ const GLvoid *srcRowA, const GLvoid *srcRowB,
+ GLint dstWidth, GLvoid *dstRow)
+{
+ const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1;
+ const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2;
+
+ /* This assertion is no longer valid with non-power-of-2 textures
+ assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth);
+ */
+
+ switch (format->MesaFormat) {
+ case MESA_FORMAT_RGBA:
+ {
+ GLuint i, j, k;
+ const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA;
+ const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB;
+ GLchan (*dst)[4] = (GLchan (*)[4]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) / 4;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) / 4;
+ dst[i][2] = (rowA[j][2] + rowA[k][2] +
+ rowB[j][2] + rowB[k][2]) / 4;
+ dst[i][3] = (rowA[j][3] + rowA[k][3] +
+ rowB[j][3] + rowB[k][3]) / 4;
+ }
+ }
+ return;
+ case MESA_FORMAT_RGB:
+ {
+ GLuint i, j, k;
+ const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA;
+ const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB;
+ GLchan (*dst)[3] = (GLchan (*)[3]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) / 4;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) / 4;
+ dst[i][2] = (rowA[j][2] + rowA[k][2] +
+ rowB[j][2] + rowB[k][2]) / 4;
+ }
+ }
+ return;
+ case MESA_FORMAT_ALPHA:
+ case MESA_FORMAT_LUMINANCE:
+ case MESA_FORMAT_INTENSITY:
+ {
+ GLuint i, j, k;
+ const GLchan *rowA = (const GLchan *) srcRowA;
+ const GLchan *rowB = (const GLchan *) srcRowB;
+ GLchan *dst = (GLchan *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
+ }
+ }
+ return;
+ case MESA_FORMAT_LUMINANCE_ALPHA:
+ {
+ GLuint i, j, k;
+ const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA;
+ const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB;
+ GLchan (*dst)[2] = (GLchan (*)[2]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) / 4;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) / 4;
+ }
+ }
+ return;
+ case MESA_FORMAT_DEPTH_COMPONENT_FLOAT32:
+ {
+ GLuint i, j, k;
+ const GLfloat *rowA = (const GLfloat *) srcRowA;
+ const GLfloat *rowB = (const GLfloat *) srcRowB;
+ GLfloat *dst = (GLfloat *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F;
+ }
+ }
+ return;
+ case MESA_FORMAT_DEPTH_COMPONENT16:
+ {
+ GLuint i, j, k;
+ const GLushort *rowA = (const GLushort *) srcRowA;
+ const GLushort *rowB = (const GLushort *) srcRowB;
+ GLushort *dst = (GLushort *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
+ }
+ }
+ return;
+ /* Begin hardware formats */
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_ARGB8888_REV:
+ {
+ GLuint i, j, k;
+ const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA;
+ const GLubyte (*rowB)[4] = (const GLubyte (*)[4]) srcRowB;
+ GLubyte (*dst)[4] = (GLubyte (*)[4]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) / 4;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) / 4;
+ dst[i][2] = (rowA[j][2] + rowA[k][2] +
+ rowB[j][2] + rowB[k][2]) / 4;
+ dst[i][3] = (rowA[j][3] + rowA[k][3] +
+ rowB[j][3] + rowB[k][3]) / 4;
+ }
+ }
+ return;
+ case MESA_FORMAT_RGB888:
+ case MESA_FORMAT_BGR888:
+ {
+ GLuint i, j, k;
+ const GLubyte (*rowA)[3] = (const GLubyte (*)[3]) srcRowA;
+ const GLubyte (*rowB)[3] = (const GLubyte (*)[3]) srcRowB;
+ GLubyte (*dst)[3] = (GLubyte (*)[3]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) / 4;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) / 4;
+ dst[i][2] = (rowA[j][2] + rowA[k][2] +
+ rowB[j][2] + rowB[k][2]) / 4;
+ }
+ }
+ return;
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_RGB565_REV:
+ {
+ GLuint i, j, k;
+ const GLushort *rowA = (const GLushort *) srcRowA;
+ const GLushort *rowB = (const GLushort *) srcRowB;
+ GLushort *dst = (GLushort *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ const GLint rowAr0 = rowA[j] & 0x1f;
+ const GLint rowAr1 = rowA[k] & 0x1f;
+ const GLint rowBr0 = rowB[j] & 0x1f;
+ const GLint rowBr1 = rowB[k] & 0x1f;
+ const GLint rowAg0 = (rowA[j] >> 5) & 0x3f;
+ const GLint rowAg1 = (rowA[k] >> 5) & 0x3f;
+ const GLint rowBg0 = (rowB[j] >> 5) & 0x3f;
+ const GLint rowBg1 = (rowB[k] >> 5) & 0x3f;
+ const GLint rowAb0 = (rowA[j] >> 11) & 0x1f;
+ const GLint rowAb1 = (rowA[k] >> 11) & 0x1f;
+ const GLint rowBb0 = (rowB[j] >> 11) & 0x1f;
+ const GLint rowBb1 = (rowB[k] >> 11) & 0x1f;
+ const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
+ const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
+ const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
+ dst[i] = (blue << 11) | (green << 5) | red;
+ }
+ }
+ return;
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB4444_REV:
+ {
+ GLuint i, j, k;
+ const GLushort *rowA = (const GLushort *) srcRowA;
+ const GLushort *rowB = (const GLushort *) srcRowB;
+ GLushort *dst = (GLushort *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ const GLint rowAr0 = rowA[j] & 0xf;
+ const GLint rowAr1 = rowA[k] & 0xf;
+ const GLint rowBr0 = rowB[j] & 0xf;
+ const GLint rowBr1 = rowB[k] & 0xf;
+ const GLint rowAg0 = (rowA[j] >> 4) & 0xf;
+ const GLint rowAg1 = (rowA[k] >> 4) & 0xf;
+ const GLint rowBg0 = (rowB[j] >> 4) & 0xf;
+ const GLint rowBg1 = (rowB[k] >> 4) & 0xf;
+ const GLint rowAb0 = (rowA[j] >> 8) & 0xf;
+ const GLint rowAb1 = (rowA[k] >> 8) & 0xf;
+ const GLint rowBb0 = (rowB[j] >> 8) & 0xf;
+ const GLint rowBb1 = (rowB[k] >> 8) & 0xf;
+ const GLint rowAa0 = (rowA[j] >> 12) & 0xf;
+ const GLint rowAa1 = (rowA[k] >> 12) & 0xf;
+ const GLint rowBa0 = (rowB[j] >> 12) & 0xf;
+ const GLint rowBa1 = (rowB[k] >> 12) & 0xf;
+ const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
+ const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
+ const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
+ const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
+ dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red;
+ }
+ }
+ return;
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_ARGB1555_REV: /* XXX broken? */
+ {
+ GLuint i, j, k;
+ const GLushort *rowA = (const GLushort *) srcRowA;
+ const GLushort *rowB = (const GLushort *) srcRowB;
+ GLushort *dst = (GLushort *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ const GLint rowAr0 = rowA[j] & 0x1f;
+ const GLint rowAr1 = rowA[k] & 0x1f;
+ const GLint rowBr0 = rowB[j] & 0x1f;
+ const GLint rowBr1 = rowB[k] & 0xf;
+ const GLint rowAg0 = (rowA[j] >> 5) & 0x1f;
+ const GLint rowAg1 = (rowA[k] >> 5) & 0x1f;
+ const GLint rowBg0 = (rowB[j] >> 5) & 0x1f;
+ const GLint rowBg1 = (rowB[k] >> 5) & 0x1f;
+ const GLint rowAb0 = (rowA[j] >> 10) & 0x1f;
+ const GLint rowAb1 = (rowA[k] >> 10) & 0x1f;
+ const GLint rowBb0 = (rowB[j] >> 10) & 0x1f;
+ const GLint rowBb1 = (rowB[k] >> 10) & 0x1f;
+ const GLint rowAa0 = (rowA[j] >> 15) & 0x1;
+ const GLint rowAa1 = (rowA[k] >> 15) & 0x1;
+ const GLint rowBa0 = (rowB[j] >> 15) & 0x1;
+ const GLint rowBa1 = (rowB[k] >> 15) & 0x1;
+ const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
+ const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
+ const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
+ const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
+ dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
+ }
+ }
+ return;
+ case MESA_FORMAT_AL88:
+ case MESA_FORMAT_AL88_REV:
+ {
+ GLuint i, j, k;
+ const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA;
+ const GLubyte (*rowB)[2] = (const GLubyte (*)[2]) srcRowB;
+ GLubyte (*dst)[2] = (GLubyte (*)[2]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) >> 2;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) >> 2;
+ }
+ }
+ return;
+ case MESA_FORMAT_RGB332:
+ {
+ GLuint i, j, k;
+ const GLubyte *rowA = (const GLubyte *) srcRowA;
+ const GLubyte *rowB = (const GLubyte *) srcRowB;
+ GLubyte *dst = (GLubyte *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ const GLint rowAr0 = rowA[j] & 0x3;
+ const GLint rowAr1 = rowA[k] & 0x3;
+ const GLint rowBr0 = rowB[j] & 0x3;
+ const GLint rowBr1 = rowB[k] & 0x3;
+ const GLint rowAg0 = (rowA[j] >> 2) & 0x7;
+ const GLint rowAg1 = (rowA[k] >> 2) & 0x7;
+ const GLint rowBg0 = (rowB[j] >> 2) & 0x7;
+ const GLint rowBg1 = (rowB[k] >> 2) & 0x7;
+ const GLint rowAb0 = (rowA[j] >> 5) & 0x7;
+ const GLint rowAb1 = (rowA[k] >> 5) & 0x7;
+ const GLint rowBb0 = (rowB[j] >> 5) & 0x7;
+ const GLint rowBb1 = (rowB[k] >> 5) & 0x7;
+ const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
+ const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
+ const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
+ dst[i] = (blue << 5) | (green << 2) | red;
+ }
+ }
+ return;
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ case MESA_FORMAT_CI8:
+ {
+ GLuint i, j, k;
+ const GLubyte *rowA = (const GLubyte *) srcRowA;
+ const GLubyte *rowB = (const GLubyte *) srcRowB;
+ GLubyte *dst = (GLubyte *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2;
+ }
+ }
+ return;
+ case MESA_FORMAT_RGBA_FLOAT32:
+ {
+ GLuint i, j, k;
+ const GLfloat (*rowA)[4] = (const GLfloat (*)[4]) srcRowA;
+ const GLfloat (*rowB)[4] = (const GLfloat (*)[4]) srcRowB;
+ GLfloat (*dst)[4] = (GLfloat (*)[4]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) * 0.25F;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) * 0.25F;
+ dst[i][2] = (rowA[j][2] + rowA[k][2] +
+ rowB[j][2] + rowB[k][2]) * 0.25F;
+ dst[i][3] = (rowA[j][3] + rowA[k][3] +
+ rowB[j][3] + rowB[k][3]) * 0.25F;
+ }
+ }
+ return;
+ case MESA_FORMAT_RGBA_FLOAT16:
+ {
+ GLuint i, j, k, comp;
+ const GLhalfARB (*rowA)[4] = (const GLhalfARB (*)[4]) srcRowA;
+ const GLhalfARB (*rowB)[4] = (const GLhalfARB (*)[4]) srcRowB;
+ GLhalfARB (*dst)[4] = (GLhalfARB (*)[4]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ for (comp = 0; comp < 4; comp++) {
+ GLfloat aj, ak, bj, bk;
+ aj = _mesa_half_to_float(rowA[j][comp]);
+ ak = _mesa_half_to_float(rowA[k][comp]);
+ bj = _mesa_half_to_float(rowB[j][comp]);
+ bk = _mesa_half_to_float(rowB[k][comp]);
+ dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
+ }
+ }
+ }
+ return;
+ case MESA_FORMAT_RGB_FLOAT32:
+ {
+ GLuint i, j, k;
+ const GLfloat (*rowA)[3] = (const GLfloat (*)[3]) srcRowA;
+ const GLfloat (*rowB)[3] = (const GLfloat (*)[3]) srcRowB;
+ GLfloat (*dst)[3] = (GLfloat (*)[3]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) * 0.25F;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) * 0.25F;
+ dst[i][2] = (rowA[j][2] + rowA[k][2] +
+ rowB[j][2] + rowB[k][2]) * 0.25F;
+ }
+ }
+ return;
+ case MESA_FORMAT_RGB_FLOAT16:
+ {
+ GLuint i, j, k, comp;
+ const GLhalfARB (*rowA)[3] = (const GLhalfARB (*)[3]) srcRowA;
+ const GLhalfARB (*rowB)[3] = (const GLhalfARB (*)[3]) srcRowB;
+ GLhalfARB (*dst)[3] = (GLhalfARB (*)[3]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ for (comp = 0; comp < 3; comp++) {
+ GLfloat aj, ak, bj, bk;
+ aj = _mesa_half_to_float(rowA[j][comp]);
+ ak = _mesa_half_to_float(rowA[k][comp]);
+ bj = _mesa_half_to_float(rowB[j][comp]);
+ bk = _mesa_half_to_float(rowB[k][comp]);
+ dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
+ }
+ }
+ }
+ return;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
+ {
+ GLuint i, j, k;
+ const GLfloat (*rowA)[2] = (const GLfloat (*)[2]) srcRowA;
+ const GLfloat (*rowB)[2] = (const GLfloat (*)[2]) srcRowB;
+ GLfloat (*dst)[2] = (GLfloat (*)[2]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i][0] = (rowA[j][0] + rowA[k][0] +
+ rowB[j][0] + rowB[k][0]) * 0.25F;
+ dst[i][1] = (rowA[j][1] + rowA[k][1] +
+ rowB[j][1] + rowB[k][1]) * 0.25F;
+ }
+ }
+ return;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
+ {
+ GLuint i, j, k, comp;
+ const GLhalfARB (*rowA)[2] = (const GLhalfARB (*)[2]) srcRowA;
+ const GLhalfARB (*rowB)[2] = (const GLhalfARB (*)[2]) srcRowB;
+ GLhalfARB (*dst)[2] = (GLhalfARB (*)[2]) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ for (comp = 0; comp < 2; comp++) {
+ GLfloat aj, ak, bj, bk;
+ aj = _mesa_half_to_float(rowA[j][comp]);
+ ak = _mesa_half_to_float(rowA[k][comp]);
+ bj = _mesa_half_to_float(rowB[j][comp]);
+ bk = _mesa_half_to_float(rowB[k][comp]);
+ dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
+ }
+ }
+ }
+ return;
+ case MESA_FORMAT_ALPHA_FLOAT32:
+ case MESA_FORMAT_LUMINANCE_FLOAT32:
+ case MESA_FORMAT_INTENSITY_FLOAT32:
+ {
+ GLuint i, j, k;
+ const GLfloat *rowA = (const GLfloat *) srcRowA;
+ const GLfloat *rowB = (const GLfloat *) srcRowB;
+ GLfloat *dst = (GLfloat *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F;
+ }
+ }
+ return;
+ case MESA_FORMAT_ALPHA_FLOAT16:
+ case MESA_FORMAT_LUMINANCE_FLOAT16:
+ case MESA_FORMAT_INTENSITY_FLOAT16:
+ {
+ GLuint i, j, k;
+ const GLhalfARB *rowA = (const GLhalfARB *) srcRowA;
+ const GLhalfARB *rowB = (const GLhalfARB *) srcRowB;
+ GLhalfARB *dst = (GLhalfARB *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ GLfloat aj, ak, bj, bk;
+ aj = _mesa_half_to_float(rowA[j]);
+ ak = _mesa_half_to_float(rowA[k]);
+ bj = _mesa_half_to_float(rowB[j]);
+ bk = _mesa_half_to_float(rowB[k]);
+ dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
+ }
+ }
+ return;
+
+ default:
+ _mesa_problem(NULL, "bad format in do_row()");
+ }
+}
+
+
+/*
+ * These functions generate a 1/2-size mipmap image from a source image.
+ * Texture borders are handled by copying or averaging the source image's
+ * border texels, depending on the scale-down factor.
+ */
+
+static void
+make_1d_mipmap(const struct gl_texture_format *format, GLint border,
+ GLint srcWidth, const GLubyte *srcPtr,
+ GLint dstWidth, GLubyte *dstPtr)
+{
+ const GLint bpt = format->TexelBytes;
+ const GLubyte *src;
+ GLubyte *dst;
+
+ /* skip the border pixel, if any */
+ src = srcPtr + border * bpt;
+ dst = dstPtr + border * bpt;
+
+ /* we just duplicate the input row, kind of hack, saves code */
+ do_row(format, srcWidth - 2 * border, src, src,
+ dstWidth - 2 * border, dst);
+
+ if (border) {
+ /* copy left-most pixel from source */
+ MEMCPY(dstPtr, srcPtr, bpt);
+ /* copy right-most pixel from source */
+ MEMCPY(dstPtr + (dstWidth - 1) * bpt,
+ srcPtr + (srcWidth - 1) * bpt,
+ bpt);
+ }
+}
+
+
+static void
+make_2d_mipmap(const struct gl_texture_format *format, GLint border,
+ GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr,
+ GLint dstWidth, GLint dstHeight, GLubyte *dstPtr)
+{
+ const GLint bpt = format->TexelBytes;
+ const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
+ const GLint dstWidthNB = dstWidth - 2 * border;
+ const GLint dstHeightNB = dstHeight - 2 * border;
+ const GLint srcRowStride = bpt * srcWidth;
+ const GLint dstRowStride = bpt * dstWidth;
+ const GLubyte *srcA, *srcB;
+ GLubyte *dst;
+ GLint row;
+
+ /* Compute src and dst pointers, skipping any border */
+ srcA = srcPtr + border * ((srcWidth + 1) * bpt);
+ if (srcHeight > 1)
+ srcB = srcA + srcRowStride;
+ else
+ srcB = srcA;
+ dst = dstPtr + border * ((dstWidth + 1) * bpt);
+
+ for (row = 0; row < dstHeightNB; row++) {
+ do_row(format, srcWidthNB, srcA, srcB,
+ dstWidthNB, dst);
+ srcA += 2 * srcRowStride;
+ srcB += 2 * srcRowStride;
+ dst += dstRowStride;
+ }
+
+ /* This is ugly but probably won't be used much */
+ if (border > 0) {
+ /* fill in dest border */
+ /* lower-left border pixel */
+ MEMCPY(dstPtr, srcPtr, bpt);
+ /* lower-right border pixel */
+ MEMCPY(dstPtr + (dstWidth - 1) * bpt,
+ srcPtr + (srcWidth - 1) * bpt, bpt);
+ /* upper-left border pixel */
+ MEMCPY(dstPtr + dstWidth * (dstHeight - 1) * bpt,
+ srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt);
+ /* upper-right border pixel */
+ MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt,
+ srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt);
+ /* lower border */
+ do_row(format, srcWidthNB,
+ srcPtr + bpt,
+ srcPtr + bpt,
+ dstWidthNB, dstPtr + bpt);
+ /* upper border */
+ do_row(format, srcWidthNB,
+ srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt,
+ srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt,
+ dstWidthNB,
+ dstPtr + (dstWidth * (dstHeight - 1) + 1) * bpt);
+ /* left and right borders */
+ if (srcHeight == dstHeight) {
+ /* copy border pixel from src to dst */
+ for (row = 1; row < srcHeight; row++) {
+ MEMCPY(dstPtr + dstWidth * row * bpt,
+ srcPtr + srcWidth * row * bpt, bpt);
+ MEMCPY(dstPtr + (dstWidth * row + dstWidth - 1) * bpt,
+ srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt);
+ }
+ }
+ else {
+ /* average two src pixels each dest pixel */
+ for (row = 0; row < dstHeightNB; row += 2) {
+ do_row(format, 1,
+ srcPtr + (srcWidth * (row * 2 + 1)) * bpt,
+ srcPtr + (srcWidth * (row * 2 + 2)) * bpt,
+ 1, dstPtr + (dstWidth * row + 1) * bpt);
+ do_row(format, 1,
+ srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt,
+ srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt,
+ 1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt);
+ }
+ }
+ }
+}
+
+
+static void
+make_3d_mipmap(const struct gl_texture_format *format, GLint border,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ const GLubyte *srcPtr,
+ GLint dstWidth, GLint dstHeight, GLint dstDepth,
+ GLubyte *dstPtr)
+{
+ const GLint bpt = format->TexelBytes;
+ const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
+ const GLint srcDepthNB = srcDepth - 2 * border;
+ const GLint dstWidthNB = dstWidth - 2 * border;
+ const GLint dstHeightNB = dstHeight - 2 * border;
+ const GLint dstDepthNB = dstDepth - 2 * border;
+ GLvoid *tmpRowA, *tmpRowB;
+ GLint img, row;
+ GLint bytesPerSrcImage, bytesPerDstImage;
+ GLint bytesPerSrcRow, bytesPerDstRow;
+ GLint srcImageOffset, srcRowOffset;
+
+ (void) srcDepthNB; /* silence warnings */
+
+ /* Need two temporary row buffers */
+ tmpRowA = MALLOC(srcWidth * bpt);
+ if (!tmpRowA)
+ return;
+ tmpRowB = MALLOC(srcWidth * bpt);
+ if (!tmpRowB) {
+ FREE(tmpRowA);
+ return;
+ }
+
+ bytesPerSrcImage = srcWidth * srcHeight * bpt;
+ bytesPerDstImage = dstWidth * dstHeight * bpt;
+
+ bytesPerSrcRow = srcWidth * bpt;
+ bytesPerDstRow = dstWidth * bpt;
+
+ /* Offset between adjacent src images to be averaged together */
+ srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage;
+
+ /* Offset between adjacent src rows to be averaged together */
+ srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt;
+
+ /*
+ * Need to average together up to 8 src pixels for each dest pixel.
+ * Break that down into 3 operations:
+ * 1. take two rows from source image and average them together.
+ * 2. take two rows from next source image and average them together.
+ * 3. take the two averaged rows and average them for the final dst row.
+ */
+
+ /*
+ _mesa_printf("mip3d %d x %d x %d -> %d x %d x %d\n",
+ srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth);
+ */
+
+ for (img = 0; img < dstDepthNB; img++) {
+ /* first source image pointer, skipping border */
+ const GLubyte *imgSrcA = srcPtr
+ + (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border
+ + img * (bytesPerSrcImage + srcImageOffset);
+ /* second source image pointer, skipping border */
+ const GLubyte *imgSrcB = imgSrcA + srcImageOffset;
+ /* address of the dest image, skipping border */
+ GLubyte *imgDst = dstPtr
+ + (bytesPerDstImage + bytesPerDstRow + border) * bpt * border
+ + img * bytesPerDstImage;
+
+ /* setup the four source row pointers and the dest row pointer */
+ const GLubyte *srcImgARowA = imgSrcA;
+ const GLubyte *srcImgARowB = imgSrcA + srcRowOffset;
+ const GLubyte *srcImgBRowA = imgSrcB;
+ const GLubyte *srcImgBRowB = imgSrcB + srcRowOffset;
+ GLubyte *dstImgRow = imgDst;
+
+ for (row = 0; row < dstHeightNB; row++) {
+ /* Average together two rows from first src image */
+ do_row(format, srcWidthNB, srcImgARowA, srcImgARowB,
+ srcWidthNB, tmpRowA);
+ /* Average together two rows from second src image */
+ do_row(format, srcWidthNB, srcImgBRowA, srcImgBRowB,
+ srcWidthNB, tmpRowB);
+ /* Average together the temp rows to make the final row */
+ do_row(format, srcWidthNB, tmpRowA, tmpRowB,
+ dstWidthNB, dstImgRow);
+ /* advance to next rows */
+ srcImgARowA += bytesPerSrcRow + srcRowOffset;
+ srcImgARowB += bytesPerSrcRow + srcRowOffset;
+ srcImgBRowA += bytesPerSrcRow + srcRowOffset;
+ srcImgBRowB += bytesPerSrcRow + srcRowOffset;
+ dstImgRow += bytesPerDstRow;
+ }
+ }
+
+ FREE(tmpRowA);
+ FREE(tmpRowB);
+
+ /* Luckily we can leverage the make_2d_mipmap() function here! */
+ if (border > 0) {
+ /* do front border image */
+ make_2d_mipmap(format, 1, srcWidth, srcHeight, srcPtr,
+ dstWidth, dstHeight, dstPtr);
+ /* do back border image */
+ make_2d_mipmap(format, 1, srcWidth, srcHeight,
+ srcPtr + bytesPerSrcImage * (srcDepth - 1),
+ dstWidth, dstHeight,
+ dstPtr + bytesPerDstImage * (dstDepth - 1));
+ /* do four remaining border edges that span the image slices */
+ if (srcDepth == dstDepth) {
+ /* just copy border pixels from src to dst */
+ for (img = 0; img < dstDepthNB; img++) {
+ const GLubyte *src;
+ GLubyte *dst;
+
+ /* do border along [img][row=0][col=0] */
+ src = srcPtr + (img + 1) * bytesPerSrcImage;
+ dst = dstPtr + (img + 1) * bytesPerDstImage;
+ MEMCPY(dst, src, bpt);
+
+ /* do border along [img][row=dstHeight-1][col=0] */
+ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ + (srcHeight - 1) * bytesPerSrcRow;
+ dst = dstPtr + (img + 1) * bytesPerDstImage
+ + (dstHeight - 1) * bytesPerDstRow;
+ MEMCPY(dst, src, bpt);
+
+ /* do border along [img][row=0][col=dstWidth-1] */
+ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ + (srcWidth - 1) * bpt;
+ dst = dstPtr + (img + 1) * bytesPerDstImage
+ + (dstWidth - 1) * bpt;
+ MEMCPY(dst, src, bpt);
+
+ /* do border along [img][row=dstHeight-1][col=dstWidth-1] */
+ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ + (bytesPerSrcImage - bpt);
+ dst = dstPtr + (img + 1) * bytesPerDstImage
+ + (bytesPerDstImage - bpt);
+ MEMCPY(dst, src, bpt);
+ }
+ }
+ else {
+ /* average border pixels from adjacent src image pairs */
+ ASSERT(srcDepthNB == 2 * dstDepthNB);
+ for (img = 0; img < dstDepthNB; img++) {
+ const GLubyte *src;
+ GLubyte *dst;
+
+ /* do border along [img][row=0][col=0] */
+ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage;
+ dst = dstPtr + (img + 1) * bytesPerDstImage;
+ do_row(format, 1, src, src + srcImageOffset, 1, dst);
+
+ /* do border along [img][row=dstHeight-1][col=0] */
+ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ + (srcHeight - 1) * bytesPerSrcRow;
+ dst = dstPtr + (img + 1) * bytesPerDstImage
+ + (dstHeight - 1) * bytesPerDstRow;
+ do_row(format, 1, src, src + srcImageOffset, 1, dst);
+
+ /* do border along [img][row=0][col=dstWidth-1] */
+ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ + (srcWidth - 1) * bpt;
+ dst = dstPtr + (img + 1) * bytesPerDstImage
+ + (dstWidth - 1) * bpt;
+ do_row(format, 1, src, src + srcImageOffset, 1, dst);
+
+ /* do border along [img][row=dstHeight-1][col=dstWidth-1] */
+ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ + (bytesPerSrcImage - bpt);
+ dst = dstPtr + (img + 1) * bytesPerDstImage
+ + (bytesPerDstImage - bpt);
+ do_row(format, 1, src, src + srcImageOffset, 1, dst);
+ }
+ }
+ }
+}
+
+
+/*
+ * For GL_SGIX_generate_mipmap:
+ * Generate a complete set of mipmaps from texObj's base-level image.
+ * Stop at texObj's MaxLevel or when we get to the 1x1 texture.
+ */
+void
+_mesa_generate_mipmap(GLcontext *ctx, GLenum target,
+ const struct gl_texture_unit *texUnit,
+ struct gl_texture_object *texObj)
+{
+ const struct gl_texture_image *srcImage;
+ const struct gl_texture_format *convertFormat;
+ const GLubyte *srcData = NULL;
+ GLubyte *dstData = NULL;
+ GLint level, maxLevels;
+
+ ASSERT(texObj);
+ srcImage = texObj->Image[0][texObj->BaseLevel];
+ ASSERT(srcImage);
+
+ maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
+ ASSERT(maxLevels > 0); /* bad target */
+
+ /* Find convertFormat - the format that do_row() will process */
+ if (srcImage->IsCompressed) {
+ /* setup for compressed textures */
+ GLuint row;
+ GLint components, size;
+ GLchan *dst;
+
+ assert(texObj->Target == GL_TEXTURE_2D);
+
+ if (srcImage->Format == GL_RGB) {
+ convertFormat = &_mesa_texformat_rgb;
+ components = 3;
+ }
+ else if (srcImage->Format == GL_RGBA) {
+ convertFormat = &_mesa_texformat_rgba;
+ components = 4;
+ }
+ else {
+ _mesa_problem(ctx, "bad srcImage->Format in _mesa_generate_mipmaps");
+ return;
+ }
+
+ /* allocate storage for uncompressed GL_RGB or GL_RGBA images */
+ size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE)
+ * srcImage->Width * srcImage->Height * srcImage->Depth + 20;
+ /* 20 extra bytes, just be safe when calling last FetchTexel */
+ srcData = (GLubyte *) MALLOC(size);
+ if (!srcData) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
+ return;
+ }
+ dstData = (GLubyte *) MALLOC(size / 2); /* 1/4 would probably be OK */
+ if (!dstData) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
+ FREE((void *) srcData);
+ return;
+ }
+
+ /* decompress base image here */
+ dst = (GLchan *) srcData;
+ for (row = 0; row < srcImage->Height; row++) {
+ GLuint col;
+ for (col = 0; col < srcImage->Width; col++) {
+ srcImage->FetchTexelc(srcImage, col, row, 0, dst);
+ dst += components;
+ }
+ }
+ }
+ else {
+ /* uncompressed */
+ convertFormat = srcImage->TexFormat;
+ }
+
+ for (level = texObj->BaseLevel; level < texObj->MaxLevel
+ && level < maxLevels - 1; level++) {
+ /* generate image[level+1] from image[level] */
+ const struct gl_texture_image *srcImage;
+ struct gl_texture_image *dstImage;
+ GLint srcWidth, srcHeight, srcDepth;
+ GLint dstWidth, dstHeight, dstDepth;
+ GLint border, bytesPerTexel;
+
+ /* get src image parameters */
+ srcImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+ ASSERT(srcImage);
+ srcWidth = srcImage->Width;
+ srcHeight = srcImage->Height;
+ srcDepth = srcImage->Depth;
+ border = srcImage->Border;
+
+ /* compute next (level+1) image size */
+ if (srcWidth - 2 * border > 1) {
+ dstWidth = (srcWidth - 2 * border) / 2 + 2 * border;
+ }
+ else {
+ dstWidth = srcWidth; /* can't go smaller */
+ }
+ if (srcHeight - 2 * border > 1) {
+ dstHeight = (srcHeight - 2 * border) / 2 + 2 * border;
+ }
+ else {
+ dstHeight = srcHeight; /* can't go smaller */
+ }
+ if (srcDepth - 2 * border > 1) {
+ dstDepth = (srcDepth - 2 * border) / 2 + 2 * border;
+ }
+ else {
+ dstDepth = srcDepth; /* can't go smaller */
+ }
+
+ if (dstWidth == srcWidth &&
+ dstHeight == srcHeight &&
+ dstDepth == srcDepth) {
+ /* all done */
+ if (srcImage->IsCompressed) {
+ FREE((void *) srcData);
+ FREE(dstData);
+ }
+ return;
+ }
+
+ /* get dest gl_texture_image */
+ dstImage = _mesa_get_tex_image(ctx, texUnit, target, level + 1);
+ if (!dstImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
+ return;
+ }
+
+ /* Free old image data */
+ if (dstImage->Data)
+ MESA_PBUFFER_FREE(dstImage->Data);
+
+ /* initialize new image */
+ _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
+ dstDepth, border, srcImage->IntFormat);
+ dstImage->DriverData = NULL;
+ dstImage->TexFormat = srcImage->TexFormat;
+ dstImage->FetchTexelc = srcImage->FetchTexelc;
+ dstImage->FetchTexelf = srcImage->FetchTexelf;
+ ASSERT(dstImage->TexFormat);
+ ASSERT(dstImage->FetchTexelc);
+ ASSERT(dstImage->FetchTexelf);
+
+ /* Alloc new teximage data buffer.
+ * Setup src and dest data pointers.
+ */
+ if (dstImage->IsCompressed) {
+ ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/
+ dstImage->Data = MESA_PBUFFER_ALLOC(dstImage->CompressedSize);
+ if (!dstImage->Data) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
+ return;
+ }
+ /* srcData and dstData are already set */
+ ASSERT(srcData);
+ ASSERT(dstData);
+ }
+ else {
+ bytesPerTexel = srcImage->TexFormat->TexelBytes;
+ ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
+ dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth
+ * bytesPerTexel);
+ if (!dstImage->Data) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
+ return;
+ }
+ srcData = (const GLubyte *) srcImage->Data;
+ dstData = (GLubyte *) dstImage->Data;
+ }
+
+ /*
+ * We use simple 2x2 averaging to compute the next mipmap level.
+ */
+ switch (target) {
+ case GL_TEXTURE_1D:
+ make_1d_mipmap(convertFormat, border,
+ srcWidth, srcData,
+ dstWidth, dstData);
+ break;
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ make_2d_mipmap(convertFormat, border,
+ srcWidth, srcHeight, srcData,
+ dstWidth, dstHeight, dstData);
+ break;
+ case GL_TEXTURE_3D:
+ make_3d_mipmap(convertFormat, border,
+ srcWidth, srcHeight, srcDepth, srcData,
+ dstWidth, dstHeight, dstDepth, dstData);
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ /* no mipmaps, do nothing */
+ break;
+ default:
+ _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps");
+ return;
+ }
+
+ if (dstImage->IsCompressed) {
+ GLubyte *temp;
+ /* compress image from dstData into dstImage->Data */
+ const GLenum srcFormat = convertFormat->BaseFormat;
+ GLint dstRowStride = _mesa_compressed_row_stride(srcImage->IntFormat,
+ dstWidth);
+ ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
+ dstImage->TexFormat->StoreImage(ctx, 2, dstImage->Format,
+ dstImage->TexFormat,
+ dstImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride, 0, /* strides */
+ dstWidth, dstHeight, 1, /* size */
+ srcFormat, CHAN_TYPE,
+ dstData, /* src data, actually */
+ &ctx->DefaultPacking);
+ /* swap src and dest pointers */
+ temp = (GLubyte *) srcData;
+ srcData = dstData;
+ dstData = temp;
+ }
+
+ } /* loop over mipmap levels */
+}
+
+
+/**
+ * Helper function for drivers which need to rescale texture images to
+ * certain aspect ratios.
+ * Nearest filtering only (for broken hardware that can't support
+ * all aspect ratios). This can be made a lot faster, but I don't
+ * really care enough...
+ */
+void _mesa_rescale_teximage2d( GLuint bytesPerPixel, GLuint dstRowStride,
+ GLint srcWidth, GLint srcHeight,
+ GLint dstWidth, GLint dstHeight,
+ const GLvoid *srcImage, GLvoid *dstImage )
+{
+ GLint row, col;
+
+#define INNER_LOOP( TYPE, HOP, WOP ) \
+ for ( row = 0 ; row < dstHeight ; row++ ) { \
+ GLint srcRow = row HOP hScale; \
+ for ( col = 0 ; col < dstWidth ; col++ ) { \
+ GLint srcCol = col WOP wScale; \
+ dst[col] = src[srcRow * srcWidth + srcCol]; \
+ } \
+ dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \
+ } \
+
+#define RESCALE_IMAGE( TYPE ) \
+do { \
+ const TYPE *src = (const TYPE *)srcImage; \
+ TYPE *dst = (TYPE *)dstImage; \
+ \
+ if ( srcHeight <= dstHeight ) { \
+ const GLint hScale = dstHeight / srcHeight; \
+ if ( srcWidth <= dstWidth ) { \
+ const GLint wScale = dstWidth / srcWidth; \
+ INNER_LOOP( TYPE, /, / ); \
+ } \
+ else { \
+ const GLint wScale = srcWidth / dstWidth; \
+ INNER_LOOP( TYPE, /, * ); \
+ } \
+ } \
+ else { \
+ const GLint hScale = srcHeight / dstHeight; \
+ if ( srcWidth <= dstWidth ) { \
+ const GLint wScale = dstWidth / srcWidth; \
+ INNER_LOOP( TYPE, *, / ); \
+ } \
+ else { \
+ const GLint wScale = srcWidth / dstWidth; \
+ INNER_LOOP( TYPE, *, * ); \
+ } \
+ } \
+} while (0)
+
+ switch ( bytesPerPixel ) {
+ case 4:
+ RESCALE_IMAGE( GLuint );
+ break;
+
+ case 2:
+ RESCALE_IMAGE( GLushort );
+ break;
+
+ case 1:
+ RESCALE_IMAGE( GLubyte );
+ break;
+ default:
+ _mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d");
+ }
+}
+
+
+/**
+ * Upscale an image by replication, not (typical) stretching.
+ * We use this when the image width or height is less than a
+ * certain size (4, 8) and we need to upscale an image.
+ */
+void
+_mesa_upscale_teximage2d (GLsizei inWidth, GLsizei inHeight,
+ GLsizei outWidth, GLsizei outHeight,
+ GLint comps, const GLchan *src, GLint srcRowStride,
+ GLchan *dest )
+{
+ GLint i, j, k;
+
+ ASSERT(outWidth >= inWidth);
+ ASSERT(outHeight >= inHeight);
+#if 0
+ ASSERT(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2);
+ ASSERT((outWidth & 3) == 0);
+ ASSERT((outHeight & 3) == 0);
+#endif
+
+ for (i = 0; i < outHeight; i++) {
+ const GLint ii = i % inHeight;
+ for (j = 0; j < outWidth; j++) {
+ const GLint jj = j % inWidth;
+ for (k = 0; k < comps; k++) {
+ dest[(i * outWidth + j) * comps + k]
+ = src[ii * srcRowStride + jj * comps + k];
+ }
+ }
+ }
+}
Index: xc/extras/Mesa/src/mesa/main/texstore.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/texstore.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:28 2005
+++ xc/extras/Mesa/src/mesa/main/texstore.h Fri Dec 10 10:05:17 2004
@@ -0,0 +1,227 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texstore.h
+ * Texture image storage routines.
+ *
+ * \author Brian Paul
+ */
+
+
+#ifndef TEXSTORE_H
+#define TEXSTORE_H
+
+
+#include "mtypes.h"
+
+/* Macro just to save some typing */
+#define STORE_PARAMS \
+ GLcontext *ctx, GLuint dims, \
+ GLenum baseInternalFormat, \
+ const struct gl_texture_format *dstFormat, \
+ GLvoid *dstAddr, \
+ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
+ GLint dstRowStride, GLint dstImageStride, \
+ GLint srcWidth, GLint srcHeight, GLint srcDepth, \
+ GLenum srcFormat, GLenum srcType, \
+ const GLvoid *srcAddr, \
+ const struct gl_pixelstore_attrib *srcPacking
+
+
+extern GLboolean _mesa_texstore_rgba(STORE_PARAMS);
+extern GLboolean _mesa_texstore_color_index(STORE_PARAMS);
+extern GLboolean _mesa_texstore_depth_component16(STORE_PARAMS);
+extern GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgba8888(STORE_PARAMS);
+extern GLboolean _mesa_texstore_argb8888(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgb888(STORE_PARAMS);
+extern GLboolean _mesa_texstore_bgr888(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgb565(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgb565_rev(STORE_PARAMS);
+extern GLboolean _mesa_texstore_argb4444(STORE_PARAMS);
+extern GLboolean _mesa_texstore_argb4444_rev(STORE_PARAMS);
+extern GLboolean _mesa_texstore_argb1555(STORE_PARAMS);
+extern GLboolean _mesa_texstore_argb1555_rev(STORE_PARAMS);
+extern GLboolean _mesa_texstore_al88(STORE_PARAMS);
+extern GLboolean _mesa_texstore_al88_rev(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgb332(STORE_PARAMS);
+extern GLboolean _mesa_texstore_a8(STORE_PARAMS);
+extern GLboolean _mesa_texstore_ci8(STORE_PARAMS);
+extern GLboolean _mesa_texstore_ycbcr(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgb_fxt1(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgba_fxt1(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgb_dxt1(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgba_dxt1(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgba_dxt3(STORE_PARAMS);
+extern GLboolean _mesa_texstore_rgba_dxt5(STORE_PARAMS);
+
+
+extern GLchan *
+_mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
+ GLenum logicalBaseFormat,
+ GLenum textureBaseFormat,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *srcAddr,
+ const struct gl_pixelstore_attrib *srcPacking);
+
+
+extern void
+_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint depth, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint width,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint width, GLint height,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint width, GLint height, GLint depth,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+extern void
+_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+extern void
+_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint depth,
+ GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
+ GLint level,
+ GLint xoffset, GLsizei width,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+extern void
+_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
+ GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+extern void
+_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
+ GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_generate_mipmap(GLcontext *ctx, GLenum target,
+ const struct gl_texture_unit *texUnit,
+ struct gl_texture_object *texObj);
+
+
+extern void
+_mesa_rescale_teximage2d(GLuint bytesPerPixel, GLuint dstRowStride,
+ GLint srcWidth, GLint srcHeight,
+ GLint dstWidth, GLint dstHeight,
+ const GLvoid *srcImage, GLvoid *dstImage);
+
+extern void
+_mesa_upscale_teximage2d( GLsizei inWidth, GLsizei inHeight,
+ GLsizei outWidth, GLsizei outHeight,
+ GLint comps, const GLchan *src, GLint srcRowStride,
+ GLchan *dest );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/varray.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/varray.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/main/varray.c Fri Dec 10 10:05:26 2004
@@ -0,0 +1,994 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "bufferobj.h"
+#include "context.h"
+#include "enable.h"
+#include "enums.h"
+#include "dlist.h"
+#include "texstate.h"
+#include "mtypes.h"
+#include "varray.h"
+
+
+#ifndef GL_BOOLEAN
+#define GL_BOOLEAN 0x9999
+#endif
+
+
+/**
+ * Update the fields of a vertex array structure.
+ * We need to do a few special things for arrays that live in
+ * vertex buffer objects.
+ */
+static void
+update_array(GLcontext *ctx, struct gl_client_array *array,
+ GLuint dirtyFlag, GLsizei elementSize,
+ GLint size, GLenum type,
+ GLsizei stride, GLboolean normalized, const GLvoid *ptr)
+{
+ array->Size = size;
+ array->Type = type;
+ array->Stride = stride;
+ array->StrideB = stride ? stride : elementSize;
+ array->Normalized = normalized;
+ array->Ptr = (const GLubyte *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ array->BufferObj->RefCount--;
+ if (array->BufferObj->RefCount <= 0) {
+ ASSERT(array->BufferObj->Name);
+ _mesa_remove_buffer_object( ctx, array->BufferObj );
+ (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj );
+ }
+ array->BufferObj = ctx->Array.ArrayBufferObj;
+ array->BufferObj->RefCount++;
+ /* Compute the index of the last array element that's inside the buffer.
+ * Later in glDrawArrays we'll check if start + count > _MaxElement to
+ * be sure we won't go out of bounds.
+ */
+ if (ctx->Array.ArrayBufferObj->Name)
+ array->_MaxElement = ((GLsizeiptrARB) ctx->Array.ArrayBufferObj->Size
+ - (GLsizeiptrARB) array->Ptr) / array->StrideB;
+ else
+#endif
+ array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
+
+ ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= dirtyFlag;
+}
+
+
+void GLAPIENTRY
+_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ GLsizei elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (size < 2 || size > 4) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" );
+ return;
+ }
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(stride)" );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
+ _mesa_debug(ctx, "glVertexPointer( sz %d type %s stride %d )\n", size,
+ _mesa_lookup_enum_by_nr( type ), stride);
+
+ /* always need to check that is legal */
+ switch (type) {
+ case GL_SHORT:
+ elementSize = size * sizeof(GLshort);
+ break;
+ case GL_INT:
+ elementSize = size * sizeof(GLint);
+ break;
+ case GL_FLOAT:
+ elementSize = size * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = size * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.Vertex, _NEW_ARRAY_VERTEX,
+ elementSize, size, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.VertexPointer)
+ ctx->Driver.VertexPointer( ctx, size, type, stride, ptr );
+}
+
+
+void GLAPIENTRY
+_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
+{
+ GLsizei elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
+ _mesa_debug(ctx, "glNormalPointer( type %s stride %d )\n",
+ _mesa_lookup_enum_by_nr( type ), stride);
+
+ switch (type) {
+ case GL_BYTE:
+ elementSize = 3 * sizeof(GLbyte);
+ break;
+ case GL_SHORT:
+ elementSize = 3 * sizeof(GLshort);
+ break;
+ case GL_INT:
+ elementSize = 3 * sizeof(GLint);
+ break;
+ case GL_FLOAT:
+ elementSize = 3 * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = 3 * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.Normal, _NEW_ARRAY_NORMAL,
+ elementSize, 3, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.NormalPointer)
+ ctx->Driver.NormalPointer( ctx, type, stride, ptr );
+}
+
+
+void GLAPIENTRY
+_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ GLsizei elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (size < 3 || size > 4) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
+ return;
+ }
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
+ _mesa_debug(ctx, "glColorPointer( sz %d type %s stride %d )\n", size,
+ _mesa_lookup_enum_by_nr( type ), stride);
+
+ switch (type) {
+ case GL_BYTE:
+ elementSize = size * sizeof(GLbyte);
+ break;
+ case GL_UNSIGNED_BYTE:
+ elementSize = size * sizeof(GLubyte);
+ break;
+ case GL_SHORT:
+ elementSize = size * sizeof(GLshort);
+ break;
+ case GL_UNSIGNED_SHORT:
+ elementSize = size * sizeof(GLushort);
+ break;
+ case GL_INT:
+ elementSize = size * sizeof(GLint);
+ break;
+ case GL_UNSIGNED_INT:
+ elementSize = size * sizeof(GLuint);
+ break;
+ case GL_FLOAT:
+ elementSize = size * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = size * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.Color, _NEW_ARRAY_COLOR0,
+ elementSize, size, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.ColorPointer)
+ ctx->Driver.ColorPointer( ctx, size, type, stride, ptr );
+}
+
+
+void GLAPIENTRY
+_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ GLint elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" );
+ return;
+ }
+
+ switch (type) {
+ case GL_FLOAT:
+ elementSize = sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.FogCoord, _NEW_ARRAY_FOGCOORD,
+ elementSize, 1, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.FogCoordPointer)
+ ctx->Driver.FogCoordPointer( ctx, type, stride, ptr );
+}
+
+
+void GLAPIENTRY
+_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ GLsizei elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" );
+ return;
+ }
+
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ elementSize = sizeof(GLubyte);
+ break;
+ case GL_SHORT:
+ elementSize = sizeof(GLshort);
+ break;
+ case GL_INT:
+ elementSize = sizeof(GLint);
+ break;
+ case GL_FLOAT:
+ elementSize = sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.Index, _NEW_ARRAY_INDEX,
+ elementSize, 1, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.IndexPointer)
+ ctx->Driver.IndexPointer( ctx, type, stride, ptr );
+}
+
+
+void GLAPIENTRY
+_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr)
+{
+ GLsizei elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (size != 3 && size != 4) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(size)" );
+ return;
+ }
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(stride)" );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
+ _mesa_debug(ctx, "glSecondaryColorPointer( sz %d type %s stride %d )\n",
+ size, _mesa_lookup_enum_by_nr( type ), stride);
+
+ switch (type) {
+ case GL_BYTE:
+ elementSize = size * sizeof(GLbyte);
+ break;
+ case GL_UNSIGNED_BYTE:
+ elementSize = size * sizeof(GLubyte);
+ break;
+ case GL_SHORT:
+ elementSize = size * sizeof(GLshort);
+ break;
+ case GL_UNSIGNED_SHORT:
+ elementSize = size * sizeof(GLushort);
+ break;
+ case GL_INT:
+ elementSize = size * sizeof(GLint);
+ break;
+ case GL_UNSIGNED_INT:
+ elementSize = size * sizeof(GLuint);
+ break;
+ case GL_FLOAT:
+ elementSize = size * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = size * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.SecondaryColor, _NEW_ARRAY_COLOR1,
+ elementSize, size, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.SecondaryColorPointer)
+ ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr );
+}
+
+
+void GLAPIENTRY
+_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GLint elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ const GLuint unit = ctx->Array.ActiveTexture;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (size < 1 || size > 4) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" );
+ return;
+ }
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(stride)" );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
+ _mesa_debug(ctx, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n",
+ unit, size, _mesa_lookup_enum_by_nr( type ), stride);
+
+ /* always need to check that is legal */
+ switch (type) {
+ case GL_SHORT:
+ elementSize = size * sizeof(GLshort);
+ break;
+ case GL_INT:
+ elementSize = size * sizeof(GLint);
+ break;
+ case GL_FLOAT:
+ elementSize = size * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = size * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.TexCoord[unit], _NEW_ARRAY_TEXCOORD(unit),
+ elementSize, size, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.TexCoordPointer)
+ ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr );
+}
+
+
+void GLAPIENTRY
+_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.EdgeFlag, _NEW_ARRAY_EDGEFLAG,
+ sizeof(GLboolean), 1, GL_BOOLEAN, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.EdgeFlagPointer)
+ ctx->Driver.EdgeFlagPointer( ctx, stride, ptr );
+}
+
+
+#if FEATURE_NV_vertex_program
+void GLAPIENTRY
+_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr)
+{
+ GLsizei elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= VERT_ATTRIB_MAX) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)");
+ return;
+ }
+
+ if (size < 1 || size > 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size)");
+ return;
+ }
+
+ if (stride < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(stride)");
+ return;
+ }
+
+ if (type == GL_UNSIGNED_BYTE && size != 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)");
+ return;
+ }
+
+ /* check for valid 'type' and compute StrideB right away */
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ elementSize = size * sizeof(GLubyte);
+ break;
+ case GL_SHORT:
+ elementSize = size * sizeof(GLshort);
+ break;
+ case GL_FLOAT:
+ elementSize = size * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = size * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerNV(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index),
+ elementSize, size, type, stride, GL_FALSE, ptr);
+
+ if (ctx->Driver.VertexAttribPointer)
+ ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
+}
+#endif
+
+
+#if FEATURE_ARB_vertex_program
+void GLAPIENTRY
+_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
+ GLboolean normalized,
+ GLsizei stride, const GLvoid *ptr)
+{
+ GLsizei elementSize;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.MaxVertexProgramAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)");
+ return;
+ }
+
+ if (size < 1 || size > 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size)");
+ return;
+ }
+
+ if (stride < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(stride)");
+ return;
+ }
+
+ if (type == GL_UNSIGNED_BYTE && size != 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size!=4)");
+ return;
+ }
+
+ /* check for valid 'type' and compute StrideB right away */
+ /* NOTE: more types are supported here than in the NV extension */
+ switch (type) {
+ case GL_BYTE:
+ elementSize = size * sizeof(GLbyte);
+ break;
+ case GL_UNSIGNED_BYTE:
+ elementSize = size * sizeof(GLubyte);
+ break;
+ case GL_SHORT:
+ elementSize = size * sizeof(GLshort);
+ break;
+ case GL_UNSIGNED_SHORT:
+ elementSize = size * sizeof(GLushort);
+ break;
+ case GL_INT:
+ elementSize = size * sizeof(GLint);
+ break;
+ case GL_UNSIGNED_INT:
+ elementSize = size * sizeof(GLuint);
+ break;
+ case GL_FLOAT:
+ elementSize = size * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ elementSize = size * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerARB(type)" );
+ return;
+ }
+
+ update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index),
+ elementSize, size, type, stride, normalized, ptr);
+
+ /* XXX fix
+ if (ctx->Driver.VertexAttribPointer)
+ ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
+ */
+}
+#endif
+
+
+void GLAPIENTRY
+_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_VertexPointer(size, type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_NormalPointer(type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_ColorPointer(size, type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_IndexPointer(type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ (void) count;
+ _mesa_TexCoordPointer(size, type, stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
+{
+ (void) count;
+ _mesa_EdgeFlagPointer(stride, ptr);
+}
+
+
+void GLAPIENTRY
+_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLboolean tflag, cflag, nflag; /* enable/disable flags */
+ GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */
+ GLenum ctype = 0; /* color type */
+ GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */
+ const GLint toffset = 0; /* always zero */
+ GLint defstride; /* default stride */
+ GLint c, f;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ f = sizeof(GLfloat);
+ c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f);
+
+ if (stride < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" );
+ return;
+ }
+
+ switch (format) {
+ case GL_V2F:
+ tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 0; vcomps = 2;
+ voffset = 0;
+ defstride = 2*f;
+ break;
+ case GL_V3F:
+ tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 0; vcomps = 3;
+ voffset = 0;
+ defstride = 3*f;
+ break;
+ case GL_C4UB_V2F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 4; vcomps = 2;
+ ctype = GL_UNSIGNED_BYTE;
+ coffset = 0;
+ voffset = c;
+ defstride = c + 2*f;
+ break;
+ case GL_C4UB_V3F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 4; vcomps = 3;
+ ctype = GL_UNSIGNED_BYTE;
+ coffset = 0;
+ voffset = c;
+ defstride = c + 3*f;
+ break;
+ case GL_C3F_V3F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 0; ccomps = 3; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 0;
+ voffset = 3*f;
+ defstride = 6*f;
+ break;
+ case GL_N3F_V3F:
+ tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_TRUE;
+ tcomps = 0; ccomps = 0; vcomps = 3;
+ noffset = 0;
+ voffset = 3*f;
+ defstride = 6*f;
+ break;
+ case GL_C4F_N3F_V3F:
+ tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_TRUE;
+ tcomps = 0; ccomps = 4; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 0;
+ noffset = 4*f;
+ voffset = 7*f;
+ defstride = 10*f;
+ break;
+ case GL_T2F_V3F:
+ tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 2; ccomps = 0; vcomps = 3;
+ voffset = 2*f;
+ defstride = 5*f;
+ break;
+ case GL_T4F_V4F:
+ tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
+ tcomps = 4; ccomps = 0; vcomps = 4;
+ voffset = 4*f;
+ defstride = 8*f;
+ break;
+ case GL_T2F_C4UB_V3F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 2; ccomps = 4; vcomps = 3;
+ ctype = GL_UNSIGNED_BYTE;
+ coffset = 2*f;
+ voffset = c+2*f;
+ defstride = c+5*f;
+ break;
+ case GL_T2F_C3F_V3F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
+ tcomps = 2; ccomps = 3; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 2*f;
+ voffset = 5*f;
+ defstride = 8*f;
+ break;
+ case GL_T2F_N3F_V3F:
+ tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_TRUE;
+ tcomps = 2; ccomps = 0; vcomps = 3;
+ noffset = 2*f;
+ voffset = 5*f;
+ defstride = 8*f;
+ break;
+ case GL_T2F_C4F_N3F_V3F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
+ tcomps = 2; ccomps = 4; vcomps = 3;
+ ctype = GL_FLOAT;
+ coffset = 2*f;
+ noffset = 6*f;
+ voffset = 9*f;
+ defstride = 12*f;
+ break;
+ case GL_T4F_C4F_N3F_V4F:
+ tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
+ tcomps = 4; ccomps = 4; vcomps = 4;
+ ctype = GL_FLOAT;
+ coffset = 4*f;
+ noffset = 8*f;
+ voffset = 11*f;
+ defstride = 15*f;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glInterleavedArrays(format)" );
+ return;
+ }
+
+ if (stride==0) {
+ stride = defstride;
+ }
+
+ _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY );
+ _mesa_DisableClientState( GL_INDEX_ARRAY );
+
+ /* Texcoords */
+ if (tflag) {
+ _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
+ _mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
+ (GLubyte *) pointer + toffset );
+ }
+ else {
+ _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
+ }
+
+ /* Color */
+ if (cflag) {
+ _mesa_EnableClientState( GL_COLOR_ARRAY );
+ _mesa_ColorPointer( ccomps, ctype, stride,
+ (GLubyte *) pointer + coffset );
+ }
+ else {
+ _mesa_DisableClientState( GL_COLOR_ARRAY );
+ }
+
+
+ /* Normals */
+ if (nflag) {
+ _mesa_EnableClientState( GL_NORMAL_ARRAY );
+ _mesa_NormalPointer( GL_FLOAT, stride, (GLubyte *) pointer + noffset );
+ }
+ else {
+ _mesa_DisableClientState( GL_NORMAL_ARRAY );
+ }
+
+ /* Vertices */
+ _mesa_EnableClientState( GL_VERTEX_ARRAY );
+ _mesa_VertexPointer( vcomps, GL_FLOAT, stride,
+ (GLubyte *) pointer + voffset );
+}
+
+
+void GLAPIENTRY
+_mesa_LockArraysEXT(GLint first, GLsizei count)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glLockArrays %d %d\n", first, count);
+
+ if (first == 0 && count > 0 &&
+ count <= (GLint) ctx->Const.MaxArrayLockSize) {
+ ctx->Array.LockFirst = first;
+ ctx->Array.LockCount = count;
+ }
+ else {
+ ctx->Array.LockFirst = 0;
+ ctx->Array.LockCount = 0;
+ }
+
+ ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_ALL;
+
+ if (ctx->Driver.LockArraysEXT)
+ ctx->Driver.LockArraysEXT( ctx, first, count );
+}
+
+
+void GLAPIENTRY
+_mesa_UnlockArraysEXT( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glUnlockArrays\n");
+
+ ctx->Array.LockFirst = 0;
+ ctx->Array.LockCount = 0;
+ ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_ALL;
+
+ if (ctx->Driver.UnlockArraysEXT)
+ ctx->Driver.UnlockArraysEXT( ctx );
+}
+
+
+/* GL_EXT_multi_draw_arrays */
+/* Somebody forgot to spec the first and count parameters as const! */
+void GLAPIENTRY
+_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first,
+ GLsizei *count, GLsizei primcount )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ for (i = 0; i < primcount; i++) {
+ if (count[i] > 0) {
+ (ctx->Exec->DrawArrays)(mode, first[i], count[i]);
+ }
+ }
+}
+
+
+/* GL_EXT_multi_draw_arrays */
+void GLAPIENTRY
+_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
+ const GLvoid **indices, GLsizei primcount )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ for (i = 0; i < primcount; i++) {
+ if (count[i] > 0) {
+ (ctx->Exec->DrawElements)(mode, count[i], type, indices[i]);
+ }
+ }
+}
+
+
+/* GL_IBM_multimode_draw_arrays */
+void GLAPIENTRY
+_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
+ const GLsizei * count,
+ GLsizei primcount, GLint modestride )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ for ( i = 0 ; i < primcount ; i++ ) {
+ if ( count[i] > 0 ) {
+ GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
+ (ctx->Exec->DrawArrays)( m, first[i], count[i] );
+ }
+ }
+}
+
+
+/* GL_IBM_multimode_draw_arrays */
+void GLAPIENTRY
+_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
+ GLenum type, const GLvoid * const * indices,
+ GLsizei primcount, GLint modestride )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* XXX not sure about ARB_vertex_buffer_object handling here */
+
+ for ( i = 0 ; i < primcount ; i++ ) {
+ if ( count[i] > 0 ) {
+ GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
+ (ctx->Exec->DrawElements)( m, count[i], type, indices[i] );
+ }
+ }
+}
+
+
+/**********************************************************************/
+/***** Initialization *****/
+/**********************************************************************/
+
+void
+_mesa_init_varray( GLcontext * ctx )
+{
+ GLuint i;
+
+ /* Vertex arrays */
+ ctx->Array.Vertex.Size = 4;
+ ctx->Array.Vertex.Type = GL_FLOAT;
+ ctx->Array.Vertex.Stride = 0;
+ ctx->Array.Vertex.StrideB = 0;
+ ctx->Array.Vertex.Ptr = NULL;
+ ctx->Array.Vertex.Enabled = GL_FALSE;
+ ctx->Array.Vertex.Flags = CA_CLIENT_DATA;
+ ctx->Array.Normal.Type = GL_FLOAT;
+ ctx->Array.Normal.Stride = 0;
+ ctx->Array.Normal.StrideB = 0;
+ ctx->Array.Normal.Ptr = NULL;
+ ctx->Array.Normal.Enabled = GL_FALSE;
+ ctx->Array.Normal.Flags = CA_CLIENT_DATA;
+ ctx->Array.Color.Size = 4;
+ ctx->Array.Color.Type = GL_FLOAT;
+ ctx->Array.Color.Stride = 0;
+ ctx->Array.Color.StrideB = 0;
+ ctx->Array.Color.Ptr = NULL;
+ ctx->Array.Color.Enabled = GL_FALSE;
+ ctx->Array.Color.Flags = CA_CLIENT_DATA;
+ ctx->Array.SecondaryColor.Size = 4;
+ ctx->Array.SecondaryColor.Type = GL_FLOAT;
+ ctx->Array.SecondaryColor.Stride = 0;
+ ctx->Array.SecondaryColor.StrideB = 0;
+ ctx->Array.SecondaryColor.Ptr = NULL;
+ ctx->Array.SecondaryColor.Enabled = GL_FALSE;
+ ctx->Array.SecondaryColor.Flags = CA_CLIENT_DATA;
+ ctx->Array.FogCoord.Size = 1;
+ ctx->Array.FogCoord.Type = GL_FLOAT;
+ ctx->Array.FogCoord.Stride = 0;
+ ctx->Array.FogCoord.StrideB = 0;
+ ctx->Array.FogCoord.Ptr = NULL;
+ ctx->Array.FogCoord.Enabled = GL_FALSE;
+ ctx->Array.FogCoord.Flags = CA_CLIENT_DATA;
+ ctx->Array.Index.Type = GL_FLOAT;
+ ctx->Array.Index.Stride = 0;
+ ctx->Array.Index.StrideB = 0;
+ ctx->Array.Index.Ptr = NULL;
+ ctx->Array.Index.Enabled = GL_FALSE;
+ ctx->Array.Index.Flags = CA_CLIENT_DATA;
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+ ctx->Array.TexCoord[i].Size = 4;
+ ctx->Array.TexCoord[i].Type = GL_FLOAT;
+ ctx->Array.TexCoord[i].Stride = 0;
+ ctx->Array.TexCoord[i].StrideB = 0;
+ ctx->Array.TexCoord[i].Ptr = NULL;
+ ctx->Array.TexCoord[i].Enabled = GL_FALSE;
+ ctx->Array.TexCoord[i].Flags = CA_CLIENT_DATA;
+ }
+ ctx->Array.EdgeFlag.Stride = 0;
+ ctx->Array.EdgeFlag.StrideB = 0;
+ ctx->Array.EdgeFlag.Ptr = NULL;
+ ctx->Array.EdgeFlag.Enabled = GL_FALSE;
+ ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA;
+ ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ ctx->Array.VertexAttrib[i].Size = 4;
+ ctx->Array.VertexAttrib[i].Type = GL_FLOAT;
+ ctx->Array.VertexAttrib[i].Stride = 0;
+ ctx->Array.VertexAttrib[i].StrideB = 0;
+ ctx->Array.VertexAttrib[i].Ptr = NULL;
+ ctx->Array.VertexAttrib[i].Enabled = GL_FALSE;
+ ctx->Array.VertexAttrib[i].Flags = CA_CLIENT_DATA;
+ }
+}
Index: xc/extras/Mesa/src/mesa/main/varray.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/varray.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/main/varray.h Thu Apr 8 05:17:52 2004
@@ -0,0 +1,160 @@
+/**
+ * \file varray.h
+ * Vertex arrays.
+ *
+ * \if subset
+ * (No-op)
+ *
+ * \endif
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef VARRAY_H
+#define VARRAY_H
+
+
+#include "mtypes.h"
+
+#if _HAVE_FULL_GL
+
+extern void GLAPIENTRY
+_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr);
+
+extern void GLAPIENTRY
+_mesa_UnlockArraysEXT( void );
+
+extern void GLAPIENTRY
+_mesa_LockArraysEXT(GLint first, GLsizei count);
+
+
+extern void GLAPIENTRY
+_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
+
+
+extern void GLAPIENTRY
+_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer);
+
+
+extern void GLAPIENTRY
+_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
+ GLboolean normalized, GLsizei stride,
+ const GLvoid *pointer);
+
+
+extern void GLAPIENTRY
+_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
+
+
+extern void GLAPIENTRY
+_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first,
+ GLsizei *count, GLsizei primcount );
+
+extern void GLAPIENTRY
+_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
+ const GLvoid **indices, GLsizei primcount );
+
+
+extern void GLAPIENTRY
+_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
+ const GLsizei * count,
+ GLsizei primcount, GLint modestride );
+
+
+extern void GLAPIENTRY
+_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
+ GLenum type, const GLvoid * const * indices,
+ GLsizei primcount, GLint modestride );
+
+
+extern void
+_mesa_init_varray( GLcontext * ctx );
+
+#else
+
+/** No-op */
+#define _mesa_init_varray( c ) ((void)0)
+
+#endif
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/version.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/version.h:1.1.1.5
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/main/version.h Fri Dec 10 10:32:30 2004
@@ -0,0 +1,52 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef VERSION_H
+#define VERSION_H
+
+
+/* Mesa version */
+#define MESA_MAJOR 6
+#define MESA_MINOR 2
+#define MESA_PATCH 1
+#define MESA_VERSION_STRING "6.2.1"
+
+/* To make version comparison easy */
+#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#define MESA_VERSION_CODE MESA_VERSION(MESA_MAJOR, MESA_MINOR, MESA_PATCH)
+
+
+/* OpenGL API version */
+#define OPENGL_MAJOR 1
+#define OPENGL_MINOR 5
+#define OPENGL_PATCH 0
+#define OPENGL_VERSION_STRING "1.5"
+
+/* To make version comparison easy */
+#define OPENGL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#define OPENGL_VERSION_CODE OPENGL_VERSION(OPENGL_MAJOR, OPENGL_MINOR, OPENGL_PATCH)
+
+
+#endif /* VERSION_H */
Index: xc/extras/Mesa/src/mesa/main/vsnprintf.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/vsnprintf.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/main/vsnprintf.c Thu Apr 8 05:17:52 2004
@@ -0,0 +1,165 @@
+/*
+ * Revision 12: http://theos.com/~deraadt/snprintf.c
+ *
+ * Copyright (c) 1997 Theo de Raadt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __VMS
+# include
+#endif
+#include
+#include
+#include
+#include
+#if __STDC__
+#include
+#include
+#else
+#include
+#endif
+#include
+#include
+#include
+
+#ifndef roundup
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+#endif
+
+#ifdef __sgi
+#define size_t ssize_t
+#endif
+
+static int pgsize;
+static char *curobj;
+static int caught;
+static sigjmp_buf bail;
+
+#define EXTRABYTES 2 /* XXX: why 2? you don't want to know */
+
+static char *
+msetup(str, n)
+ char *str;
+ size_t n;
+{
+ char *e;
+
+ if (n == 0)
+ return NULL;
+ if (pgsize == 0)
+ pgsize = getpagesize();
+ curobj = (char *)malloc(n + EXTRABYTES + pgsize * 2);
+ if (curobj == NULL)
+ return NULL;
+ e = curobj + n + EXTRABYTES;
+ e = (char *)roundup((unsigned long)e, pgsize);
+ if (mprotect(e, pgsize, PROT_NONE) == -1) {
+ free(curobj);
+ curobj = NULL;
+ return NULL;
+ }
+ e = e - n - EXTRABYTES;
+ *e = '\0';
+ return (e);
+}
+
+static void
+ mcatch( int a )
+{
+ siglongjmp(bail, 1);
+}
+
+static void
+mcleanup(str, n, p)
+ char *str;
+ size_t n;
+ char *p;
+{
+ strncpy(str, p, n-1);
+ str[n-1] = '\0';
+ if (mprotect((caddr_t)(p + n + EXTRABYTES), pgsize,
+ PROT_READ|PROT_WRITE|PROT_EXEC) == -1)
+ mprotect((caddr_t)(p + n + EXTRABYTES), pgsize,
+ PROT_READ|PROT_WRITE);
+ free(curobj);
+}
+
+int
+#if __STDC__
+vsnprintf(char *str, size_t n, char const *fmt, va_list ap)
+#else
+vsnprintf(str, n, fmt, ap)
+ char *str;
+ size_t n;
+ char *fmt;
+ char *ap;
+#endif
+{
+ struct sigaction osa, nsa;
+ char *p;
+ int ret = n + 1; /* if we bail, indicated we overflowed */
+
+ memset(&nsa, 0, sizeof nsa);
+ nsa.sa_handler = mcatch;
+ sigemptyset(&nsa.sa_mask);
+
+ p = msetup(str, n);
+ if (p == NULL) {
+ *str = '\0';
+ return 0;
+ }
+ if (sigsetjmp(bail, 1) == 0) {
+ if (sigaction(SIGSEGV, &nsa, &osa) == -1) {
+ mcleanup(str, n, p);
+ return (0);
+ }
+ ret = vsprintf(p, fmt, ap);
+ }
+ mcleanup(str, n, p);
+ (void) sigaction(SIGSEGV, &osa, NULL);
+ return (ret);
+}
+
+int
+#if __STDC__
+snprintf(char *str, size_t n, char const *fmt, ...)
+#else
+snprintf(str, n, fmt, va_alist)
+ char *str;
+ size_t n;
+ char *fmt;
+ va_dcl
+#endif
+{
+ va_list ap;
+#if __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
+
+ return (vsnprintf(str, n, fmt, ap));
+ va_end(ap);
+}
+
+
+
Index: xc/extras/Mesa/src/mesa/main/vtxfmt.c
diff -u /dev/null xc/extras/Mesa/src/mesa/main/vtxfmt.c:1.1.1.4
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/main/vtxfmt.c Fri Dec 10 10:32:28 2004
@@ -0,0 +1,176 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Keith Whitwell
+ * Gareth Hughes
+ */
+
+#include "glheader.h"
+#include "api_loopback.h"
+#include "context.h"
+#include "imports.h"
+#include "mtypes.h"
+#include "state.h"
+#include "vtxfmt.h"
+
+
+/* The neutral vertex format. This wraps all tnl module functions,
+ * verifying that the currently-installed module is valid and then
+ * installing the function pointers in a lazy fashion. It records the
+ * function pointers that have been swapped out, which allows a fast
+ * restoration of the neutral module in almost all cases -- a typical
+ * app might only require 4-6 functions to be modified from the neutral
+ * baseline, and only restoring these is certainly preferable to doing
+ * the entire module's 60 or so function pointers.
+ */
+
+#define PRE_LOOPBACK( FUNC ) \
+{ \
+ GET_CURRENT_CONTEXT(ctx); \
+ struct gl_tnl_module *tnl = &(ctx->TnlModule); \
+ typedef void (*func_ptr_t)(void); \
+ \
+ ASSERT( tnl->Current ); \
+ ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \
+ \
+ /* Save the swapped function's dispatch entry so it can be */ \
+ /* restored later. */ \
+ tnl->Swapped[tnl->SwapCount][0] = (void *)&(ctx->Exec->FUNC); \
+ *(func_ptr_t *)(tnl->Swapped[tnl->SwapCount]+1) = (func_ptr_t)TAG(FUNC); \
+ tnl->SwapCount++; \
+ \
+ if ( 0 ) \
+ _mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \
+ \
+ /* Install the tnl function pointer. */ \
+ ctx->Exec->FUNC = tnl->Current->FUNC; \
+}
+
+#define TAG(x) neutral_##x
+#include "vtxfmt_tmp.h"
+
+
+
+static void
+install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
+{
+ tab->ArrayElement = vfmt->ArrayElement;
+ tab->Color3f = vfmt->Color3f;
+ tab->Color3fv = vfmt->Color3fv;
+ tab->Color4f = vfmt->Color4f;
+ tab->Color4fv = vfmt->Color4fv;
+ tab->EdgeFlag = vfmt->EdgeFlag;
+ tab->EdgeFlagv = vfmt->EdgeFlagv;
+ tab->EvalCoord1f = vfmt->EvalCoord1f;
+ tab->EvalCoord1fv = vfmt->EvalCoord1fv;
+ tab->EvalCoord2f = vfmt->EvalCoord2f;
+ tab->EvalCoord2fv = vfmt->EvalCoord2fv;
+ tab->EvalPoint1 = vfmt->EvalPoint1;
+ tab->EvalPoint2 = vfmt->EvalPoint2;
+ tab->FogCoordfEXT = vfmt->FogCoordfEXT;
+ tab->FogCoordfvEXT = vfmt->FogCoordfvEXT;
+ tab->Indexf = vfmt->Indexf;
+ tab->Indexfv = vfmt->Indexfv;
+ tab->Materialfv = vfmt->Materialfv;
+ tab->MultiTexCoord1fARB = vfmt->MultiTexCoord1fARB;
+ tab->MultiTexCoord1fvARB = vfmt->MultiTexCoord1fvARB;
+ tab->MultiTexCoord2fARB = vfmt->MultiTexCoord2fARB;
+ tab->MultiTexCoord2fvARB = vfmt->MultiTexCoord2fvARB;
+ tab->MultiTexCoord3fARB = vfmt->MultiTexCoord3fARB;
+ tab->MultiTexCoord3fvARB = vfmt->MultiTexCoord3fvARB;
+ tab->MultiTexCoord4fARB = vfmt->MultiTexCoord4fARB;
+ tab->MultiTexCoord4fvARB = vfmt->MultiTexCoord4fvARB;
+ tab->Normal3f = vfmt->Normal3f;
+ tab->Normal3fv = vfmt->Normal3fv;
+ tab->SecondaryColor3fEXT = vfmt->SecondaryColor3fEXT;
+ tab->SecondaryColor3fvEXT = vfmt->SecondaryColor3fvEXT;
+ tab->TexCoord1f = vfmt->TexCoord1f;
+ tab->TexCoord1fv = vfmt->TexCoord1fv;
+ tab->TexCoord2f = vfmt->TexCoord2f;
+ tab->TexCoord2fv = vfmt->TexCoord2fv;
+ tab->TexCoord3f = vfmt->TexCoord3f;
+ tab->TexCoord3fv = vfmt->TexCoord3fv;
+ tab->TexCoord4f = vfmt->TexCoord4f;
+ tab->TexCoord4fv = vfmt->TexCoord4fv;
+ tab->Vertex2f = vfmt->Vertex2f;
+ tab->Vertex2fv = vfmt->Vertex2fv;
+ tab->Vertex3f = vfmt->Vertex3f;
+ tab->Vertex3fv = vfmt->Vertex3fv;
+ tab->Vertex4f = vfmt->Vertex4f;
+ tab->Vertex4fv = vfmt->Vertex4fv;
+ tab->CallList = vfmt->CallList;
+ tab->CallLists = vfmt->CallLists;
+ tab->Begin = vfmt->Begin;
+ tab->End = vfmt->End;
+ tab->VertexAttrib1fNV = vfmt->VertexAttrib1fNV;
+ tab->VertexAttrib1fvNV = vfmt->VertexAttrib1fvNV;
+ tab->VertexAttrib2fNV = vfmt->VertexAttrib2fNV;
+ tab->VertexAttrib2fvNV = vfmt->VertexAttrib2fvNV;
+ tab->VertexAttrib3fNV = vfmt->VertexAttrib3fNV;
+ tab->VertexAttrib3fvNV = vfmt->VertexAttrib3fvNV;
+ tab->VertexAttrib4fNV = vfmt->VertexAttrib4fNV;
+ tab->VertexAttrib4fvNV = vfmt->VertexAttrib4fvNV;
+ tab->Rectf = vfmt->Rectf;
+ tab->DrawArrays = vfmt->DrawArrays;
+ tab->DrawElements = vfmt->DrawElements;
+ tab->DrawRangeElements = vfmt->DrawRangeElements;
+ tab->EvalMesh1 = vfmt->EvalMesh1;
+ tab->EvalMesh2 = vfmt->EvalMesh2;
+ ASSERT(tab->EvalMesh2);
+}
+
+
+void _mesa_init_exec_vtxfmt( GLcontext *ctx )
+{
+ install_vtxfmt( ctx->Exec, &neutral_vtxfmt );
+ ctx->TnlModule.SwapCount = 0;
+}
+
+
+void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+{
+ ctx->TnlModule.Current = vfmt;
+ _mesa_restore_exec_vtxfmt( ctx );
+}
+
+
+void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+{
+ install_vtxfmt( ctx->Save, vfmt );
+}
+
+
+void _mesa_restore_exec_vtxfmt( GLcontext *ctx )
+{
+ struct gl_tnl_module *tnl = &(ctx->TnlModule);
+ GLuint i;
+
+ /* Restore the neutral tnl module wrapper.
+ */
+ for ( i = 0 ; i < tnl->SwapCount ; i++ ) {
+ *(void **)tnl->Swapped[i][0] = tnl->Swapped[i][1];
+ }
+
+ tnl->SwapCount = 0;
+}
Index: xc/extras/Mesa/src/mesa/main/vtxfmt.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/vtxfmt.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/main/vtxfmt.h Thu Jun 10 10:23:57 2004
@@ -0,0 +1,43 @@
+/**
+ * \file vtxfmt.h
+ *
+ * \author Keith Whitwell
+ * \author Gareth Hughes
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _VTXFMT_H_
+#define _VTXFMT_H_
+
+extern void _mesa_init_exec_vtxfmt( GLcontext *ctx );
+
+extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt );
+extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt );
+
+extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx );
+
+#endif
Index: xc/extras/Mesa/src/mesa/main/vtxfmt_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/main/vtxfmt_tmp.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/main/vtxfmt_tmp.h Fri Dec 10 10:05:12 2004
@@ -0,0 +1,478 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes
+ */
+
+#ifndef PRE_LOOPBACK
+#define PRE_LOOPBACK( FUNC )
+#endif
+
+static void GLAPIENTRY TAG(ArrayElement)( GLint i )
+{
+ PRE_LOOPBACK( ArrayElement );
+ GL_CALL(ArrayElement)( i );
+}
+
+static void GLAPIENTRY TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b )
+{
+ PRE_LOOPBACK( Color3f );
+ GL_CALL(Color3f)( r, g, b );
+}
+
+static void GLAPIENTRY TAG(Color3fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( Color3fv );
+ GL_CALL(Color3fv)( v );
+}
+
+static void GLAPIENTRY TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
+{
+ PRE_LOOPBACK( Color4f );
+ GL_CALL(Color4f)( r, g, b, a );
+}
+
+static void GLAPIENTRY TAG(Color4fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( Color4fv );
+ GL_CALL(Color4fv)( v );
+}
+
+static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e )
+{
+ PRE_LOOPBACK( EdgeFlag );
+ GL_CALL(EdgeFlag)( e );
+}
+
+static void GLAPIENTRY TAG(EdgeFlagv)( const GLboolean *v )
+{
+ PRE_LOOPBACK( EdgeFlagv );
+ GL_CALL(EdgeFlagv)( v );
+}
+
+static void GLAPIENTRY TAG(EvalCoord1f)( GLfloat s )
+{
+ PRE_LOOPBACK( EvalCoord1f );
+ GL_CALL(EvalCoord1f)( s );
+}
+
+static void GLAPIENTRY TAG(EvalCoord1fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( EvalCoord1fv );
+ GL_CALL(EvalCoord1fv)( v );
+}
+
+static void GLAPIENTRY TAG(EvalCoord2f)( GLfloat s, GLfloat t )
+{
+ PRE_LOOPBACK( EvalCoord2f );
+ GL_CALL(EvalCoord2f)( s, t );
+}
+
+static void GLAPIENTRY TAG(EvalCoord2fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( EvalCoord2fv );
+ GL_CALL(EvalCoord2fv)( v );
+}
+
+static void GLAPIENTRY TAG(EvalPoint1)( GLint i )
+{
+ PRE_LOOPBACK( EvalPoint1 );
+ GL_CALL(EvalPoint1)( i );
+}
+
+static void GLAPIENTRY TAG(EvalPoint2)( GLint i, GLint j )
+{
+ PRE_LOOPBACK( EvalPoint2 );
+ GL_CALL(EvalPoint2)( i, j );
+}
+
+static void GLAPIENTRY TAG(FogCoordfEXT)( GLfloat f )
+{
+ PRE_LOOPBACK( FogCoordfEXT );
+ GL_CALL(FogCoordfEXT)( f );
+}
+
+static void GLAPIENTRY TAG(FogCoordfvEXT)( const GLfloat *v )
+{
+ PRE_LOOPBACK( FogCoordfvEXT );
+ GL_CALL(FogCoordfvEXT)( v );
+}
+
+static void GLAPIENTRY TAG(Indexf)( GLfloat f )
+{
+ PRE_LOOPBACK( Indexf );
+ GL_CALL(Indexf)( f );
+}
+
+static void GLAPIENTRY TAG(Indexfv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( Indexfv );
+ GL_CALL(Indexfv)( v );
+}
+
+static void GLAPIENTRY TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v )
+{
+ PRE_LOOPBACK( Materialfv );
+ GL_CALL(Materialfv)( face, pname, v );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord1fARB)( GLenum target, GLfloat a )
+{
+ PRE_LOOPBACK( MultiTexCoord1fARB );
+ GL_CALL(MultiTexCoord1fARB)( target, a );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord1fvARB)( GLenum target, const GLfloat *tc )
+{
+ PRE_LOOPBACK( MultiTexCoord1fvARB );
+ GL_CALL(MultiTexCoord1fvARB)( target, tc );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord2fARB)( GLenum target, GLfloat s, GLfloat t )
+{
+ PRE_LOOPBACK( MultiTexCoord2fARB );
+ GL_CALL(MultiTexCoord2fARB)( target, s, t );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord2fvARB)( GLenum target, const GLfloat *tc )
+{
+ PRE_LOOPBACK( MultiTexCoord2fvARB );
+ GL_CALL(MultiTexCoord2fvARB)( target, tc );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord3fARB)( GLenum target, GLfloat s,
+ GLfloat t, GLfloat r )
+{
+ PRE_LOOPBACK( MultiTexCoord3fARB );
+ GL_CALL(MultiTexCoord3fARB)( target, s, t, r );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord3fvARB)( GLenum target, const GLfloat *tc )
+{
+ PRE_LOOPBACK( MultiTexCoord3fvARB );
+ GL_CALL(MultiTexCoord3fvARB)( target, tc );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s,
+ GLfloat t, GLfloat r, GLfloat q )
+{
+ PRE_LOOPBACK( MultiTexCoord4fARB );
+ GL_CALL(MultiTexCoord4fARB)( target, s, t, r, q );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *tc )
+{
+ PRE_LOOPBACK( MultiTexCoord4fvARB );
+ GL_CALL(MultiTexCoord4fvARB)( target, tc );
+}
+
+static void GLAPIENTRY TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z )
+{
+ PRE_LOOPBACK( Normal3f );
+ GL_CALL(Normal3f)( x, y, z );
+}
+
+static void GLAPIENTRY TAG(Normal3fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( Normal3fv );
+ GL_CALL(Normal3fv)( v );
+}
+
+static void GLAPIENTRY TAG(SecondaryColor3fEXT)( GLfloat r, GLfloat g, GLfloat b )
+{
+ PRE_LOOPBACK( SecondaryColor3fEXT );
+ GL_CALL(SecondaryColor3fEXT)( r, g, b );
+}
+
+static void GLAPIENTRY TAG(SecondaryColor3fvEXT)( const GLfloat *v )
+{
+ PRE_LOOPBACK( SecondaryColor3fvEXT );
+ GL_CALL(SecondaryColor3fvEXT)( v );
+}
+
+static void GLAPIENTRY TAG(TexCoord1f)( GLfloat s )
+{
+ PRE_LOOPBACK( TexCoord1f );
+ GL_CALL(TexCoord1f)( s );
+}
+
+static void GLAPIENTRY TAG(TexCoord1fv)( const GLfloat *tc )
+{
+ PRE_LOOPBACK( TexCoord1fv );
+ GL_CALL(TexCoord1fv)( tc );
+}
+
+static void GLAPIENTRY TAG(TexCoord2f)( GLfloat s, GLfloat t )
+{
+ PRE_LOOPBACK( TexCoord2f );
+ GL_CALL(TexCoord2f)( s, t );
+}
+
+static void GLAPIENTRY TAG(TexCoord2fv)( const GLfloat *tc )
+{
+ PRE_LOOPBACK( TexCoord2fv );
+ GL_CALL(TexCoord2fv)( tc );
+}
+
+static void GLAPIENTRY TAG(TexCoord3f)( GLfloat s, GLfloat t, GLfloat r )
+{
+ PRE_LOOPBACK( TexCoord3f );
+ GL_CALL(TexCoord3f)( s, t, r );
+}
+
+static void GLAPIENTRY TAG(TexCoord3fv)( const GLfloat *tc )
+{
+ PRE_LOOPBACK( TexCoord3fv );
+ GL_CALL(TexCoord3fv)( tc );
+}
+
+static void GLAPIENTRY TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q )
+{
+ PRE_LOOPBACK( TexCoord4f );
+ GL_CALL(TexCoord4f)( s, t, r, q );
+}
+
+static void GLAPIENTRY TAG(TexCoord4fv)( const GLfloat *tc )
+{
+ PRE_LOOPBACK( TexCoord4fv );
+ GL_CALL(TexCoord4fv)( tc );
+}
+
+static void GLAPIENTRY TAG(Vertex2f)( GLfloat x, GLfloat y )
+{
+ PRE_LOOPBACK( Vertex2f );
+ GL_CALL(Vertex2f)( x, y );
+}
+
+static void GLAPIENTRY TAG(Vertex2fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( Vertex2fv );
+ GL_CALL(Vertex2fv)( v );
+}
+
+static void GLAPIENTRY TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z )
+{
+ PRE_LOOPBACK( Vertex3f );
+ GL_CALL(Vertex3f)( x, y, z );
+}
+
+static void GLAPIENTRY TAG(Vertex3fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( Vertex3fv );
+ GL_CALL(Vertex3fv)( v );
+}
+
+static void GLAPIENTRY TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ PRE_LOOPBACK( Vertex4f );
+ GL_CALL(Vertex4f)( x, y, z, w );
+}
+
+static void GLAPIENTRY TAG(Vertex4fv)( const GLfloat *v )
+{
+ PRE_LOOPBACK( Vertex4fv );
+ GL_CALL(Vertex4fv)( v );
+}
+
+static void GLAPIENTRY TAG(CallList)( GLuint i )
+{
+ PRE_LOOPBACK( CallList );
+ GL_CALL(CallList)( i );
+}
+
+static void GLAPIENTRY TAG(CallLists)( GLsizei sz, GLenum type, const GLvoid *v )
+{
+ PRE_LOOPBACK( CallLists );
+ GL_CALL(CallLists)( sz, type, v );
+}
+
+static void GLAPIENTRY TAG(Begin)( GLenum mode )
+{
+ PRE_LOOPBACK( Begin );
+ GL_CALL(Begin)( mode );
+}
+
+static void GLAPIENTRY TAG(End)( void )
+{
+ PRE_LOOPBACK( End );
+ GL_CALL(End)();
+}
+
+static void GLAPIENTRY TAG(Rectf)( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
+{
+ PRE_LOOPBACK( Rectf );
+ GL_CALL(Rectf)( x1, y1, x2, y2 );
+}
+
+static void GLAPIENTRY TAG(DrawArrays)( GLenum mode, GLint start, GLsizei count )
+{
+ PRE_LOOPBACK( DrawArrays );
+ GL_CALL(DrawArrays)( mode, start, count );
+}
+
+static void GLAPIENTRY TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices )
+{
+ PRE_LOOPBACK( DrawElements );
+ GL_CALL(DrawElements)( mode, count, type, indices );
+}
+
+static void GLAPIENTRY TAG(DrawRangeElements)( GLenum mode, GLuint start,
+ GLuint end, GLsizei count,
+ GLenum type, const GLvoid *indices )
+{
+ PRE_LOOPBACK( DrawRangeElements );
+ GL_CALL(DrawRangeElements)( mode, start, end, count, type, indices );
+}
+
+static void GLAPIENTRY TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 )
+{
+ PRE_LOOPBACK( EvalMesh1 );
+ GL_CALL(EvalMesh1)( mode, i1, i2 );
+}
+
+static void GLAPIENTRY TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2,
+ GLint j1, GLint j2 )
+{
+ PRE_LOOPBACK( EvalMesh2 );
+ GL_CALL(EvalMesh2)( mode, i1, i2, j1, j2 );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x )
+{
+ PRE_LOOPBACK( VertexAttrib1fNV );
+ GL_CALL(VertexAttrib1fNV)( index, x );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib1fvNV)( GLuint index, const GLfloat *v )
+{
+ PRE_LOOPBACK( VertexAttrib1fvNV );
+ GL_CALL(VertexAttrib1fvNV)( index, v );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y )
+{
+ PRE_LOOPBACK( VertexAttrib2fNV );
+ GL_CALL(VertexAttrib2fNV)( index, x, y );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fvNV)( GLuint index, const GLfloat *v )
+{
+ PRE_LOOPBACK( VertexAttrib2fvNV );
+ GL_CALL(VertexAttrib2fvNV)( index, v );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z )
+{
+ PRE_LOOPBACK( VertexAttrib3fNV );
+ GL_CALL(VertexAttrib3fNV)( index, x, y, z );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fvNV)( GLuint index, const GLfloat *v )
+{
+ PRE_LOOPBACK( VertexAttrib3fvNV );
+ GL_CALL(VertexAttrib3fvNV)( index, v );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ PRE_LOOPBACK( VertexAttrib4fNV );
+ GL_CALL(VertexAttrib4fNV)( index, x, y, z, w );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v )
+{
+ PRE_LOOPBACK( VertexAttrib4fvNV );
+ GL_CALL(VertexAttrib4fvNV)( index, v );
+}
+
+
+static GLvertexformat TAG(vtxfmt) = {
+ TAG(ArrayElement),
+ TAG(Color3f),
+ TAG(Color3fv),
+ TAG(Color4f),
+ TAG(Color4fv),
+ TAG(EdgeFlag),
+ TAG(EdgeFlagv),
+ TAG(EvalCoord1f),
+ TAG(EvalCoord1fv),
+ TAG(EvalCoord2f),
+ TAG(EvalCoord2fv),
+ TAG(EvalPoint1),
+ TAG(EvalPoint2),
+ TAG(FogCoordfEXT),
+ TAG(FogCoordfvEXT),
+ TAG(Indexf),
+ TAG(Indexfv),
+ TAG(Materialfv),
+ TAG(MultiTexCoord1fARB),
+ TAG(MultiTexCoord1fvARB),
+ TAG(MultiTexCoord2fARB),
+ TAG(MultiTexCoord2fvARB),
+ TAG(MultiTexCoord3fARB),
+ TAG(MultiTexCoord3fvARB),
+ TAG(MultiTexCoord4fARB),
+ TAG(MultiTexCoord4fvARB),
+ TAG(Normal3f),
+ TAG(Normal3fv),
+ TAG(SecondaryColor3fEXT),
+ TAG(SecondaryColor3fvEXT),
+ TAG(TexCoord1f),
+ TAG(TexCoord1fv),
+ TAG(TexCoord2f),
+ TAG(TexCoord2fv),
+ TAG(TexCoord3f),
+ TAG(TexCoord3fv),
+ TAG(TexCoord4f),
+ TAG(TexCoord4fv),
+ TAG(Vertex2f),
+ TAG(Vertex2fv),
+ TAG(Vertex3f),
+ TAG(Vertex3fv),
+ TAG(Vertex4f),
+ TAG(Vertex4fv),
+ TAG(CallList),
+ TAG(CallLists),
+ TAG(Begin),
+ TAG(End),
+ TAG(VertexAttrib1fNV),
+ TAG(VertexAttrib1fvNV),
+ TAG(VertexAttrib2fNV),
+ TAG(VertexAttrib2fvNV),
+ TAG(VertexAttrib3fNV),
+ TAG(VertexAttrib3fvNV),
+ TAG(VertexAttrib4fNV),
+ TAG(VertexAttrib4fvNV),
+ TAG(Rectf),
+ TAG(DrawArrays),
+ TAG(DrawElements),
+ TAG(DrawRangeElements),
+ TAG(EvalMesh1),
+ TAG(EvalMesh2)
+};
+
+#undef TAG
+#undef PRE_LOOPBACK
Index: xc/extras/Mesa/src/mesa/math/m_clip_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_clip_tmp.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_clip_tmp.h Fri Dec 10 10:05:26 2004
@@ -0,0 +1,243 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+/* KW: a clever asm implementation would nestle integer versions
+ * of the outcode calculation underneath the division. Gcc won't
+ * do this, strangely enough, so I only do the divide in
+ * the case where the cliptest passes. This isn't essential,
+ * and an asm implementation needn't replicate that behaviour.
+ *
+ * \param clip_vec vector of incoming clip-space coords
+ * \param proj_vec vector of resultant NDC-space projected coords
+ * \param clipMask resulting array of clip flags
+ * \param orMask bitwise-OR of clipMask values
+ * \param andMask bitwise-AND of clipMask values
+ * \return proj_vec pointer
+ */
+static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec,
+ GLvector4f *proj_vec,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+ const GLuint count = clip_vec->count;
+ GLuint c = 0;
+ GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start;
+ GLubyte tmpAndMask = *andMask;
+ GLubyte tmpOrMask = *orMask;
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat cx = from[0];
+ const GLfloat cy = from[1];
+ const GLfloat cz = from[2];
+ const GLfloat cw = from[3];
+#if defined(macintosh) || defined(__powerpc__)
+ /* on powerpc cliptest is 17% faster in this way. */
+ GLuint mask;
+ mask = (((cw < cx) << CLIP_RIGHT_SHIFT));
+ mask |= (((cw < -cx) << CLIP_LEFT_SHIFT));
+ mask |= (((cw < cy) << CLIP_TOP_SHIFT));
+ mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT));
+ mask |= (((cw < cz) << CLIP_FAR_SHIFT));
+ mask |= (((cw < -cz) << CLIP_NEAR_SHIFT));
+#else /* !defined(macintosh)) */
+ GLubyte mask = 0;
+ if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT;
+ if ( cx + cw < 0) mask |= CLIP_LEFT_BIT;
+ if (-cy + cw < 0) mask |= CLIP_TOP_BIT;
+ if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT;
+ if (-cz + cw < 0) mask |= CLIP_FAR_BIT;
+ if ( cz + cw < 0) mask |= CLIP_NEAR_BIT;
+#endif /* defined(macintosh) */
+
+ clipMask[i] = mask;
+ if (mask) {
+ c++;
+ tmpAndMask &= mask;
+ tmpOrMask |= mask;
+ vProj[i][0] = 0;
+ vProj[i][1] = 0;
+ vProj[i][2] = 0;
+ vProj[i][3] = 1;
+ } else {
+ GLfloat oow = 1.0F / cw;
+ vProj[i][0] = cx * oow;
+ vProj[i][1] = cy * oow;
+ vProj[i][2] = cz * oow;
+ vProj[i][3] = oow;
+ }
+ }
+
+ *orMask = tmpOrMask;
+ *andMask = (GLubyte) (c < count ? 0 : tmpAndMask);
+
+ proj_vec->flags |= VEC_SIZE_4;
+ proj_vec->size = 4;
+ proj_vec->count = clip_vec->count;
+ return proj_vec;
+}
+
+
+
+/*
+ * \param clip_vec vector of incoming clip-space coords
+ * \param proj_vec vector of resultant NDC-space projected coords
+ * \param clipMask resulting array of clip flags
+ * \param orMask bitwise-OR of clipMask values
+ * \param andMask bitwise-AND of clipMask values
+ * \return clip_vec pointer
+ */
+static GLvector4f * _XFORMAPI TAG(cliptest_np_points4)( GLvector4f *clip_vec,
+ GLvector4f *proj_vec,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLuint count = clip_vec->count;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+ GLuint c = 0;
+ GLubyte tmpAndMask = *andMask;
+ GLubyte tmpOrMask = *orMask;
+ GLuint i;
+ (void) proj_vec;
+ STRIDE_LOOP {
+ const GLfloat cx = from[0];
+ const GLfloat cy = from[1];
+ const GLfloat cz = from[2];
+ const GLfloat cw = from[3];
+#if defined(macintosh) || defined(__powerpc__)
+ /* on powerpc cliptest is 17% faster in this way. */
+ GLuint mask;
+ mask = (((cw < cx) << CLIP_RIGHT_SHIFT));
+ mask |= (((cw < -cx) << CLIP_LEFT_SHIFT));
+ mask |= (((cw < cy) << CLIP_TOP_SHIFT));
+ mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT));
+ mask |= (((cw < cz) << CLIP_FAR_SHIFT));
+ mask |= (((cw < -cz) << CLIP_NEAR_SHIFT));
+#else /* !defined(macintosh)) */
+ GLubyte mask = 0;
+ if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT;
+ if ( cx + cw < 0) mask |= CLIP_LEFT_BIT;
+ if (-cy + cw < 0) mask |= CLIP_TOP_BIT;
+ if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT;
+ if (-cz + cw < 0) mask |= CLIP_FAR_BIT;
+ if ( cz + cw < 0) mask |= CLIP_NEAR_BIT;
+#endif /* defined(macintosh) */
+
+ clipMask[i] = mask;
+ if (mask) {
+ c++;
+ tmpAndMask &= mask;
+ tmpOrMask |= mask;
+ }
+ }
+
+ *orMask = tmpOrMask;
+ *andMask = (GLubyte) (c < count ? 0 : tmpAndMask);
+ return clip_vec;
+}
+
+
+static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec,
+ GLvector4f *proj_vec,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLuint count = clip_vec->count;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+ GLubyte tmpOrMask = *orMask;
+ GLubyte tmpAndMask = *andMask;
+ GLuint i;
+ (void) proj_vec;
+ STRIDE_LOOP {
+ const GLfloat cx = from[0], cy = from[1], cz = from[2];
+ GLubyte mask = 0;
+ if (cx > 1.0) mask |= CLIP_RIGHT_BIT;
+ else if (cx < -1.0) mask |= CLIP_LEFT_BIT;
+ if (cy > 1.0) mask |= CLIP_TOP_BIT;
+ else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT;
+ if (cz > 1.0) mask |= CLIP_FAR_BIT;
+ else if (cz < -1.0) mask |= CLIP_NEAR_BIT;
+ clipMask[i] = mask;
+ tmpOrMask |= mask;
+ tmpAndMask &= mask;
+ }
+
+ *orMask = tmpOrMask;
+ *andMask = tmpAndMask;
+ return clip_vec;
+}
+
+
+static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec,
+ GLvector4f *proj_vec,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLuint count = clip_vec->count;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+ GLubyte tmpOrMask = *orMask;
+ GLubyte tmpAndMask = *andMask;
+ GLuint i;
+ (void) proj_vec;
+ STRIDE_LOOP {
+ const GLfloat cx = from[0], cy = from[1];
+ GLubyte mask = 0;
+ if (cx > 1.0) mask |= CLIP_RIGHT_BIT;
+ else if (cx < -1.0) mask |= CLIP_LEFT_BIT;
+ if (cy > 1.0) mask |= CLIP_TOP_BIT;
+ else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT;
+ clipMask[i] = mask;
+ tmpOrMask |= mask;
+ tmpAndMask &= mask;
+ }
+
+ *orMask = tmpOrMask;
+ *andMask = tmpAndMask;
+ return clip_vec;
+}
+
+
+static void TAG(init_c_cliptest)( void )
+{
+ _mesa_clip_tab[4] = TAG(cliptest_points4);
+ _mesa_clip_tab[3] = TAG(cliptest_points3);
+ _mesa_clip_tab[2] = TAG(cliptest_points2);
+
+ _mesa_clip_np_tab[4] = TAG(cliptest_np_points4);
+ _mesa_clip_np_tab[3] = TAG(cliptest_points3);
+ _mesa_clip_np_tab[2] = TAG(cliptest_points2);
+}
Index: xc/extras/Mesa/src/mesa/math/m_copy_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_copy_tmp.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_copy_tmp.h Thu Apr 8 05:17:52 2004
@@ -0,0 +1,86 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+#define COPY_FUNC( BITS ) \
+static void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f ) \
+{ \
+ GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \
+ GLfloat *from = f->start; \
+ GLuint stride = f->stride; \
+ GLuint count = f->count; \
+ GLuint i; \
+ \
+ if (BITS) \
+ STRIDE_LOOP { \
+ if (BITS&1) t[i][0] = from[0]; \
+ if (BITS&2) t[i][1] = from[1]; \
+ if (BITS&4) t[i][2] = from[2]; \
+ if (BITS&8) t[i][3] = from[3]; \
+ } \
+}
+
+/* We got them all here:
+ */
+COPY_FUNC( 0x0 ) /* noop */
+COPY_FUNC( 0x1 )
+COPY_FUNC( 0x2 )
+COPY_FUNC( 0x3 )
+COPY_FUNC( 0x4 )
+COPY_FUNC( 0x5 )
+COPY_FUNC( 0x6 )
+COPY_FUNC( 0x7 )
+COPY_FUNC( 0x8 )
+COPY_FUNC( 0x9 )
+COPY_FUNC( 0xa )
+COPY_FUNC( 0xb )
+COPY_FUNC( 0xc )
+COPY_FUNC( 0xd )
+COPY_FUNC( 0xe )
+COPY_FUNC( 0xf )
+
+static void TAG2(init_copy, 0)( void )
+{
+ _mesa_copy_tab[0x0] = TAG2(copy, 0x0);
+ _mesa_copy_tab[0x1] = TAG2(copy, 0x1);
+ _mesa_copy_tab[0x2] = TAG2(copy, 0x2);
+ _mesa_copy_tab[0x3] = TAG2(copy, 0x3);
+ _mesa_copy_tab[0x4] = TAG2(copy, 0x4);
+ _mesa_copy_tab[0x5] = TAG2(copy, 0x5);
+ _mesa_copy_tab[0x6] = TAG2(copy, 0x6);
+ _mesa_copy_tab[0x7] = TAG2(copy, 0x7);
+ _mesa_copy_tab[0x8] = TAG2(copy, 0x8);
+ _mesa_copy_tab[0x9] = TAG2(copy, 0x9);
+ _mesa_copy_tab[0xa] = TAG2(copy, 0xa);
+ _mesa_copy_tab[0xb] = TAG2(copy, 0xb);
+ _mesa_copy_tab[0xc] = TAG2(copy, 0xc);
+ _mesa_copy_tab[0xd] = TAG2(copy, 0xd);
+ _mesa_copy_tab[0xe] = TAG2(copy, 0xe);
+ _mesa_copy_tab[0xf] = TAG2(copy, 0xf);
+}
Index: xc/extras/Mesa/src/mesa/math/m_debug.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_debug.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_debug.h Thu Apr 8 05:17:52 2004
@@ -0,0 +1,42 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes
+ */
+
+#ifndef __M_DEBUG_H__
+#define __M_DEBUG_H__
+
+extern void _math_test_all_transform_functions( char *description );
+extern void _math_test_all_normal_transform_functions( char *description );
+extern void _math_test_all_cliptest_functions( char *description );
+
+/* Deprecated?
+ */
+extern void _math_test_all_vertex_functions( char *description );
+
+extern char *mesa_profile;
+
+#endif
Index: xc/extras/Mesa/src/mesa/math/m_debug_clip.c
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_debug_clip.c:1.3
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_debug_clip.c Fri Dec 10 10:30:13 2004
@@ -0,0 +1,371 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes
+ */
+
+#include "glheader.h"
+#include "context.h"
+#include "macros.h"
+#include "imports.h"
+
+#include "m_matrix.h"
+#include "m_xform.h"
+
+#include "m_debug.h"
+#include "m_debug_util.h"
+
+#ifdef __UNIXOS2__
+/* The linker doesn't like empty files */
+static char dummy;
+#endif
+
+#ifdef DEBUG /* This code only used for debugging */
+
+static clip_func *clip_tab[2] = {
+ _mesa_clip_tab,
+ _mesa_clip_np_tab
+};
+static char *cnames[2] = {
+ "_mesa_clip_tab",
+ "_mesa_clip_np_tab"
+};
+#ifdef RUN_DEBUG_BENCHMARK
+static char *cstrings[2] = {
+ "clip, perspective divide",
+ "clip, no divide"
+};
+#endif
+
+
+/* =============================================================
+ * Reference cliptests
+ */
+
+static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec,
+ GLvector4f *proj_vec,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLuint count = clip_vec->count;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+ GLuint c = 0;
+ GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start;
+ GLubyte tmpAndMask = *andMask;
+ GLubyte tmpOrMask = *orMask;
+ GLuint i;
+ for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) {
+ const GLfloat cx = from[0];
+ const GLfloat cy = from[1];
+ const GLfloat cz = from[2];
+ const GLfloat cw = from[3];
+ GLubyte mask = 0;
+ if ( -cx + cw < 0 ) mask |= CLIP_RIGHT_BIT;
+ if ( cx + cw < 0 ) mask |= CLIP_LEFT_BIT;
+ if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT;
+ if ( cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT;
+ if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT;
+ if ( cz + cw < 0 ) mask |= CLIP_NEAR_BIT;
+ clipMask[i] = mask;
+ if ( mask ) {
+ c++;
+ tmpAndMask &= mask;
+ tmpOrMask |= mask;
+ vProj[i][0] = 0;
+ vProj[i][1] = 0;
+ vProj[i][2] = 0;
+ vProj[i][3] = 1;
+ } else {
+ GLfloat oow = 1.0F / cw;
+ vProj[i][0] = cx * oow;
+ vProj[i][1] = cy * oow;
+ vProj[i][2] = cz * oow;
+ vProj[i][3] = oow;
+ }
+ }
+
+ *orMask = tmpOrMask;
+ *andMask = (GLubyte) (c < count ? 0 : tmpAndMask);
+
+ proj_vec->flags |= VEC_SIZE_4;
+ proj_vec->size = 4;
+ proj_vec->count = clip_vec->count;
+ return proj_vec;
+}
+
+/* Keep these here for now, even though we don't use them...
+ */
+static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec,
+ GLvector4f *proj_vec,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLuint count = clip_vec->count;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+
+ GLubyte tmpOrMask = *orMask;
+ GLubyte tmpAndMask = *andMask;
+ GLuint i;
+ for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) {
+ const GLfloat cx = from[0], cy = from[1], cz = from[2];
+ GLubyte mask = 0;
+ if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT;
+ else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT;
+ if ( cy > 1.0 ) mask |= CLIP_TOP_BIT;
+ else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT;
+ if ( cz > 1.0 ) mask |= CLIP_FAR_BIT;
+ else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT;
+ clipMask[i] = mask;
+ tmpOrMask |= mask;
+ tmpAndMask &= mask;
+ }
+
+ *orMask = tmpOrMask;
+ *andMask = tmpAndMask;
+ return clip_vec;
+}
+
+static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec,
+ GLvector4f *proj_vec,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLuint count = clip_vec->count;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+
+ GLubyte tmpOrMask = *orMask;
+ GLubyte tmpAndMask = *andMask;
+ GLuint i;
+ for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) {
+ const GLfloat cx = from[0], cy = from[1];
+ GLubyte mask = 0;
+ if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT;
+ else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT;
+ if ( cy > 1.0 ) mask |= CLIP_TOP_BIT;
+ else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT;
+ clipMask[i] = mask;
+ tmpOrMask |= mask;
+ tmpAndMask &= mask;
+ }
+
+ *orMask = tmpOrMask;
+ *andMask = tmpAndMask;
+ return clip_vec;
+}
+
+static clip_func ref_cliptest[5] = {
+ 0,
+ 0,
+ ref_cliptest_points2,
+ ref_cliptest_points3,
+ ref_cliptest_points4
+};
+
+
+/* =============================================================
+ * Cliptest tests
+ */
+
+ALIGN16(static GLfloat, s[TEST_COUNT][4]);
+ALIGN16(static GLfloat, d[TEST_COUNT][4]);
+ALIGN16(static GLfloat, r[TEST_COUNT][4]);
+
+
+static int test_cliptest_function( clip_func func, int np,
+ int psize, long *cycles )
+{
+ GLvector4f source[1], dest[1], ref[1];
+ GLubyte dm[TEST_COUNT], dco, dca;
+ GLubyte rm[TEST_COUNT], rco, rca;
+ int i, j;
+#ifdef RUN_DEBUG_BENCHMARK
+ int cycle_i; /* the counter for the benchmarks we run */
+#endif
+
+ (void) cycles;
+
+ if ( psize > 4 ) {
+ _mesa_problem( NULL, "test_cliptest_function called with psize > 4\n" );
+ return 0;
+ }
+
+ for ( i = 0 ; i < TEST_COUNT ; i++) {
+ ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 );
+ ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 );
+ for ( j = 0 ; j < psize ; j++ )
+ s[i][j] = rnd();
+ }
+
+ source->data = (GLfloat(*)[4])s;
+ source->start = (GLfloat *)s;
+ source->count = TEST_COUNT;
+ source->stride = sizeof(s[0]);
+ source->size = 4;
+ source->flags = 0;
+
+ dest->data = (GLfloat(*)[4])d;
+ dest->start = (GLfloat *)d;
+ dest->count = TEST_COUNT;
+ dest->stride = sizeof(float[4]);
+ dest->size = 0;
+ dest->flags = 0;
+
+ ref->data = (GLfloat(*)[4])r;
+ ref->start = (GLfloat *)r;
+ ref->count = TEST_COUNT;
+ ref->stride = sizeof(float[4]);
+ ref->size = 0;
+ ref->flags = 0;
+
+ dco = rco = 0;
+ dca = rca = CLIP_ALL_BITS;
+
+ ref_cliptest[psize]( source, ref, rm, &rco, &rca );
+
+ if ( mesa_profile ) {
+ BEGIN_RACE( *cycles );
+ func( source, dest, dm, &dco, &dca );
+ END_RACE( *cycles );
+ }
+ else {
+ func( source, dest, dm, &dco, &dca );
+ }
+
+ if ( dco != rco ) {
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco );
+ return 0;
+ }
+ if ( dca != rca ) {
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca );
+ return 0;
+ }
+ for ( i = 0 ; i < TEST_COUNT ; i++ ) {
+ if ( dm[i] != rm[i] ) {
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "(i = %i)\n", i );
+ _mesa_printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] );
+ return 0;
+ }
+ }
+
+ /* Only verify output on projected points4 case. FIXME: Do we need
+ * to test other cases?
+ */
+ if ( np || psize < 4 )
+ return 1;
+
+ for ( i = 0 ; i < TEST_COUNT ; i++ ) {
+ for ( j = 0 ; j < 4 ; j++ ) {
+ if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) {
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n",
+ i, j, dm[i], rm[i] );
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][0], r[i][0], r[i][0]-d[i][0],
+ MAX_PRECISION - significand_match( d[i][0], r[i][0] ) );
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][1], r[i][1], r[i][1]-d[i][1],
+ MAX_PRECISION - significand_match( d[i][1], r[i][1] ) );
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][2], r[i][2], r[i][2]-d[i][2],
+ MAX_PRECISION - significand_match( d[i][2], r[i][2] ) );
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][3], r[i][3], r[i][3]-d[i][3],
+ MAX_PRECISION - significand_match( d[i][3], r[i][3] ) );
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+void _math_test_all_cliptest_functions( char *description )
+{
+ int np, psize;
+ long benchmark_tab[2][4];
+ static int first_time = 1;
+
+ if ( first_time ) {
+ first_time = 0;
+ mesa_profile = _mesa_getenv( "MESA_PROFILE" );
+ }
+
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile ) {
+ if ( !counter_overhead ) {
+ INIT_COUNTER();
+ _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead );
+ }
+ _mesa_printf( "cliptest results after hooking in %s functions:\n", description );
+ }
+#endif
+
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile ) {
+ _mesa_printf( "\n\t" );
+ for ( psize = 2 ; psize <= 4 ; psize++ ) {
+ _mesa_printf( " p%d\t", psize );
+ }
+ _mesa_printf( "\n--------------------------------------------------------\n\t" );
+ }
+#endif
+
+ for ( np = 0 ; np < 2 ; np++ ) {
+ for ( psize = 2 ; psize <= 4 ; psize++ ) {
+ clip_func func = clip_tab[np][psize];
+ long *cycles = &(benchmark_tab[np][psize-1]);
+
+ if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) {
+ char buf[100];
+ _mesa_sprintf( buf, "%s[%d] failed test (%s)",
+ cnames[np], psize, description );
+ _mesa_problem( NULL, buf );
+ }
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile )
+ _mesa_printf( " %li\t", benchmark_tab[np][psize-1] );
+#endif
+ }
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile )
+ _mesa_printf( " | [%s]\n\t", cstrings[np] );
+#endif
+ }
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile )
+ _mesa_printf( "\n" );
+#endif
+}
+
+
+#endif /* DEBUG */
Index: xc/extras/Mesa/src/mesa/math/m_debug_norm.c
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_debug_norm.c:1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_debug_norm.c Wed Apr 14 07:17:46 2004
@@ -0,0 +1,384 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes
+ */
+
+#include "glheader.h"
+#include "context.h"
+#include "macros.h"
+#include "imports.h"
+
+#include "m_matrix.h"
+#include "m_xform.h"
+
+#include "m_debug.h"
+#include "m_debug_util.h"
+
+
+#ifdef __UNIXOS2__
+/* The linker doesn't like empty files */
+static char dummy;
+#endif
+
+#ifdef DEBUG /* This code only used for debugging */
+
+
+static int m_norm_identity[16] = {
+ ONE, NIL, NIL, NIL,
+ NIL, ONE, NIL, NIL,
+ NIL, NIL, ONE, NIL,
+ NIL, NIL, NIL, NIL
+};
+static int m_norm_general[16] = {
+ VAR, VAR, VAR, NIL,
+ VAR, VAR, VAR, NIL,
+ VAR, VAR, VAR, NIL,
+ NIL, NIL, NIL, NIL
+};
+static int m_norm_no_rot[16] = {
+ VAR, NIL, NIL, NIL,
+ NIL, VAR, NIL, NIL,
+ NIL, NIL, VAR, NIL,
+ NIL, NIL, NIL, NIL
+};
+static int *norm_templates[8] = {
+ m_norm_no_rot,
+ m_norm_no_rot,
+ m_norm_no_rot,
+ m_norm_general,
+ m_norm_general,
+ m_norm_general,
+ m_norm_identity,
+ m_norm_identity
+};
+static int norm_types[8] = {
+ NORM_TRANSFORM_NO_ROT,
+ NORM_TRANSFORM_NO_ROT | NORM_RESCALE,
+ NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE,
+ NORM_TRANSFORM,
+ NORM_TRANSFORM | NORM_RESCALE,
+ NORM_TRANSFORM | NORM_NORMALIZE,
+ NORM_RESCALE,
+ NORM_NORMALIZE
+};
+static int norm_scale_types[8] = { /* rescale factor */
+ NIL, /* NIL disables rescaling */
+ VAR,
+ NIL,
+ NIL,
+ VAR,
+ NIL,
+ VAR,
+ NIL
+};
+static int norm_normalize_types[8] = { /* normalizing ?? (no = 0) */
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 1,
+ 0,
+ 1
+};
+static char *norm_strings[8] = {
+ "NORM_TRANSFORM_NO_ROT",
+ "NORM_TRANSFORM_NO_ROT | NORM_RESCALE",
+ "NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE",
+ "NORM_TRANSFORM",
+ "NORM_TRANSFORM | NORM_RESCALE",
+ "NORM_TRANSFORM | NORM_NORMALIZE",
+ "NORM_RESCALE",
+ "NORM_NORMALIZE"
+};
+
+
+/* =============================================================
+ * Reference transformations
+ */
+
+static void ref_norm_transform_rescale( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLuint i;
+ const GLfloat *s = in->start;
+ const GLfloat *m = mat->inv;
+ GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start;
+
+ (void) lengths;
+
+ for ( i = 0 ; i < in->count ; i++ ) {
+ GLfloat t[3];
+
+ TRANSFORM_NORMAL( t, s, m );
+ SCALE_SCALAR_3V( out[i], scale, t );
+
+ s = (GLfloat *)((char *)s + in->stride);
+ }
+}
+
+static void ref_norm_transform_normalize( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLuint i;
+ const GLfloat *s = in->start;
+ const GLfloat *m = mat->inv;
+ GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start;
+
+ for ( i = 0 ; i < in->count ; i++ ) {
+ GLfloat t[3];
+
+ TRANSFORM_NORMAL( t, s, m );
+
+ if ( !lengths ) {
+ GLfloat len = LEN_SQUARED_3FV( t );
+ if ( len > 1e-20 ) {
+ /* Hmmm, don't know how we could test the precalculated
+ * length case...
+ */
+ scale = 1.0 / sqrt( len );
+ SCALE_SCALAR_3V( out[i], scale, t );
+ } else {
+ out[i][0] = out[i][1] = out[i][2] = 0;
+ }
+ } else {
+ scale = lengths[i];;
+ SCALE_SCALAR_3V( out[i], scale, t );
+ }
+
+ s = (GLfloat *)((char *)s + in->stride);
+ }
+}
+
+
+/* =============================================================
+ * Normal transformation tests
+ */
+
+static void init_matrix( GLfloat *m )
+{
+ m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0;
+ m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0;
+ m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0;
+ m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0;
+}
+
+
+static int test_norm_function( normal_func func, int mtype, long *cycles )
+{
+ GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1];
+ GLmatrix mat[1];
+ GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4];
+ GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT];
+ GLfloat scale;
+ GLfloat *m;
+ int i, j;
+#ifdef RUN_DEBUG_BENCHMARK
+ int cycle_i; /* the counter for the benchmarks we run */
+#endif
+
+ (void) cycles;
+
+ mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
+ mat->inv = m = mat->m;
+
+ init_matrix( m );
+
+ scale = 1.0F + rnd () * norm_scale_types[mtype];
+
+ for ( i = 0 ; i < 4 ; i++ ) {
+ for ( j = 0 ; j < 4 ; j++ ) {
+ switch ( norm_templates[mtype][i * 4 + j] ) {
+ case NIL:
+ m[j * 4 + i] = 0.0;
+ break;
+ case ONE:
+ m[j * 4 + i] = 1.0;
+ break;
+ case NEG:
+ m[j * 4 + i] = -1.0;
+ break;
+ case VAR:
+ break;
+ default:
+ abort();
+ }
+ }
+ }
+
+ for ( i = 0 ; i < TEST_COUNT ; i++ ) {
+ ASSIGN_3V( d[i], 0.0, 0.0, 0.0 );
+ ASSIGN_3V( s[i], 0.0, 0.0, 0.0 );
+ ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 );
+ for ( j = 0 ; j < 3 ; j++ )
+ s[i][j] = rnd();
+ length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) );
+ }
+
+ source->data = (GLfloat(*)[4]) s;
+ source->start = (GLfloat *) s;
+ source->count = TEST_COUNT;
+ source->stride = sizeof(s[0]);
+ source->flags = 0;
+
+ dest->data = d;
+ dest->start = (GLfloat *) d;
+ dest->count = TEST_COUNT;
+ dest->stride = sizeof(float[4]);
+ dest->flags = 0;
+
+ dest2->data = d2;
+ dest2->start = (GLfloat *) d2;
+ dest2->count = TEST_COUNT;
+ dest2->stride = sizeof(float[4]);
+ dest2->flags = 0;
+
+ ref->data = r;
+ ref->start = (GLfloat *) r;
+ ref->count = TEST_COUNT;
+ ref->stride = sizeof(float[4]);
+ ref->flags = 0;
+
+ ref2->data = r2;
+ ref2->start = (GLfloat *) r2;
+ ref2->count = TEST_COUNT;
+ ref2->stride = sizeof(float[4]);
+ ref2->flags = 0;
+
+ if ( norm_normalize_types[mtype] == 0 ) {
+ ref_norm_transform_rescale( mat, scale, source, NULL, ref );
+ } else {
+ ref_norm_transform_normalize( mat, scale, source, NULL, ref );
+ ref_norm_transform_normalize( mat, scale, source, length, ref2 );
+ }
+
+ if ( mesa_profile ) {
+ BEGIN_RACE( *cycles );
+ func( mat, scale, source, NULL, dest );
+ END_RACE( *cycles );
+ func( mat, scale, source, length, dest2 );
+ } else {
+ func( mat, scale, source, NULL, dest );
+ func( mat, scale, source, length, dest2 );
+ }
+
+ for ( i = 0 ; i < TEST_COUNT ; i++ ) {
+ for ( j = 0 ; j < 3 ; j++ ) {
+ if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) {
+ _mesa_printf( "-----------------------------\n" );
+ _mesa_printf( "(i = %i, j = %i)\n", i, j );
+ _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n",
+ d[i][0], r[i][0], r[i][0]/d[i][0],
+ MAX_PRECISION - significand_match( d[i][0], r[i][0] ) );
+ _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n",
+ d[i][1], r[i][1], r[i][1]/d[i][1],
+ MAX_PRECISION - significand_match( d[i][1], r[i][1] ) );
+ _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n",
+ d[i][2], r[i][2], r[i][2]/d[i][2],
+ MAX_PRECISION - significand_match( d[i][2], r[i][2] ) );
+ return 0;
+ }
+
+ if ( norm_normalize_types[mtype] != 0 ) {
+ if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) {
+ _mesa_printf( "------------------- precalculated length case ------\n" );
+ _mesa_printf( "(i = %i, j = %i)\n", i, j );
+ _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n",
+ d2[i][0], r2[i][0], r2[i][0]/d2[i][0],
+ MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) );
+ _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n",
+ d2[i][1], r2[i][1], r2[i][1]/d2[i][1],
+ MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) );
+ _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n",
+ d2[i][2], r2[i][2], r2[i][2]/d2[i][2],
+ MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) );
+ return 0;
+ }
+ }
+ }
+ }
+
+ ALIGN_FREE( mat->m );
+ return 1;
+}
+
+void _math_test_all_normal_transform_functions( char *description )
+{
+ int mtype;
+ long benchmark_tab[0xf];
+ static int first_time = 1;
+
+ if ( first_time ) {
+ first_time = 0;
+ mesa_profile = getenv( "MESA_PROFILE" );
+ }
+
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile ) {
+ if ( !counter_overhead ) {
+ INIT_COUNTER();
+ _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead );
+ }
+ _mesa_printf( "normal transform results after hooking in %s functions:\n",
+ description );
+ _mesa_printf( "\n-------------------------------------------------------\n" );
+ }
+#endif
+
+ for ( mtype = 0 ; mtype < 8 ; mtype++ ) {
+ normal_func func = _mesa_normal_tab[norm_types[mtype]];
+ long *cycles = &benchmark_tab[mtype];
+
+ if ( test_norm_function( func, mtype, cycles ) == 0 ) {
+ char buf[100];
+ _mesa_sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)",
+ norm_strings[mtype], description );
+ _mesa_problem( NULL, buf );
+ }
+
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile ) {
+ _mesa_printf( " %li\t", benchmark_tab[mtype] );
+ _mesa_printf( " | [%s]\n", norm_strings[mtype] );
+ }
+#endif
+ }
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile ) {
+ _mesa_printf( "\n" );
+ fflush( stdout );
+ }
+#endif
+}
+
+
+#endif /* DEBUG */
Index: xc/extras/Mesa/src/mesa/math/m_debug_util.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_debug_util.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_debug_util.h Fri Dec 10 10:05:26 2004
@@ -0,0 +1,282 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes
+ */
+
+#ifndef __M_DEBUG_UTIL_H__
+#define __M_DEBUG_UTIL_H__
+
+
+#ifdef DEBUG /* This code only used for debugging */
+
+
+/* Comment this out to deactivate the cycle counter.
+ * NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher)
+ * (hope, you don't try to debug Mesa on a 386 ;)
+ */
+#if defined(__GNUC__) && \
+ ((defined(__i386__) && defined(USE_X86_ASM)) || \
+ (defined(__sparc__) && defined(USE_SPARC_ASM)))
+#define RUN_DEBUG_BENCHMARK
+#endif
+
+#define TEST_COUNT 128 /* size of the tested vector array */
+
+#define REQUIRED_PRECISION 10 /* allow 4 bits to miss */
+#define MAX_PRECISION 24 /* max. precision possible */
+
+
+#ifdef RUN_DEBUG_BENCHMARK
+/* Overhead of profiling counter in cycles. Automatically adjusted to
+ * your machine at run time - counter initialization should give very
+ * consistent results.
+ */
+extern long counter_overhead;
+
+/* This is the value of the environment variable MESA_PROFILE, and is
+ * used to determine if we should benchmark the functions as well as
+ * verify their correctness.
+ */
+extern char *mesa_profile;
+
+/* Modify the the number of tests if you like.
+ * We take the minimum of all results, because every error should be
+ * positive (time used by other processes, task switches etc).
+ * It is assumed that all calculations are done in the cache.
+ */
+
+#if defined(__i386__)
+
+#if 1 /* PPro, PII, PIII version */
+
+/* Profiling on the P6 architecture requires a little more work, due to
+ * the internal out-of-order execution. We must perform a serializing
+ * 'cpuid' instruction before and after the 'rdtsc' instructions to make
+ * sure no other uops are executed when we sample the timestamp counter.
+ */
+#define INIT_COUNTER() \
+ do { \
+ int cycle_i; \
+ counter_overhead = LONG_MAX; \
+ for ( cycle_i = 0 ; cycle_i < 8 ; cycle_i++ ) { \
+ long cycle_tmp1 = 0, cycle_tmp2 = 0; \
+ __asm__ __volatile__ ( "push %%ebx \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "rdtsc \n" \
+ "mov %%eax, %0 \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "pop %%ebx \n" \
+ "push %%ebx \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "rdtsc \n" \
+ "mov %%eax, %1 \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "pop %%ebx \n" \
+ : "=m" (cycle_tmp1), "=m" (cycle_tmp2) \
+ : : "eax", "ecx", "edx" ); \
+ if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \
+ counter_overhead = cycle_tmp2 - cycle_tmp1; \
+ } \
+ } \
+ } while (0)
+
+#define BEGIN_RACE(x) \
+ x = LONG_MAX; \
+ for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \
+ long cycle_tmp1 = 0, cycle_tmp2 = 0; \
+ __asm__ __volatile__ ( "push %%ebx \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "rdtsc \n" \
+ "mov %%eax, %0 \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "pop %%ebx \n" \
+ : "=m" (cycle_tmp1) \
+ : : "eax", "ecx", "edx" );
+
+#define END_RACE(x) \
+ __asm__ __volatile__ ( "push %%ebx \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "rdtsc \n" \
+ "mov %%eax, %0 \n" \
+ "xor %%eax, %%eax \n" \
+ "cpuid \n" \
+ "pop %%ebx \n" \
+ : "=m" (cycle_tmp2) \
+ : : "eax", "ecx", "edx" ); \
+ if ( x > (cycle_tmp2 - cycle_tmp1) ) { \
+ x = cycle_tmp2 - cycle_tmp1; \
+ } \
+ } \
+ x -= counter_overhead;
+
+#else /* PPlain, PMMX version */
+
+/* To ensure accurate results, we stall the pipelines with the
+ * non-pairable 'cdq' instruction. This ensures all the code being
+ * profiled is complete when the 'rdtsc' instruction executes.
+ */
+#define INIT_COUNTER(x) \
+ do { \
+ int cycle_i; \
+ x = LONG_MAX; \
+ for ( cycle_i = 0 ; cycle_i < 32 ; cycle_i++ ) { \
+ long cycle_tmp1, cycle_tmp2, dummy; \
+ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \
+ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \
+ if ( x > (cycle_tmp2 - cycle_tmp1) ) \
+ x = cycle_tmp2 - cycle_tmp1; \
+ } \
+ } while (0)
+
+#define BEGIN_RACE(x) \
+ x = LONG_MAX; \
+ for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \
+ long cycle_tmp1, cycle_tmp2, dummy; \
+ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \
+ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) );
+
+
+#define END_RACE(x) \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "cdq" ); \
+ __asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \
+ if ( x > (cycle_tmp2 - cycle_tmp1) ) \
+ x = cycle_tmp2 - cycle_tmp1; \
+ } \
+ x -= counter_overhead;
+
+#endif
+
+#elif defined(__sparc__)
+
+#define INIT_COUNTER() \
+ do { counter_overhead = 5; } while(0)
+
+#define BEGIN_RACE(x) \
+x = LONG_MAX; \
+for (cycle_i = 0; cycle_i <10; cycle_i++) { \
+ register long cycle_tmp1 asm("l0"); \
+ register long cycle_tmp2 asm("l1"); \
+ /* rd %tick, %l0 */ \
+ __asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */
+
+#define END_RACE(x) \
+ /* rd %tick, %l1 */ \
+ __asm__ __volatile__ (".word 0xa3410000" : "=r" (cycle_tmp2)); \
+ if (x > (cycle_tmp2-cycle_tmp1)) x = cycle_tmp2 - cycle_tmp1; \
+} \
+x -= counter_overhead;
+
+#else
+#error Your processor is not supported for RUN_XFORM_BENCHMARK
+#endif
+
+#else
+
+#define BEGIN_RACE(x)
+#define END_RACE(x)
+
+#endif
+
+
+/* =============================================================
+ * Helper functions
+ */
+
+static GLfloat rnd( void )
+{
+ GLfloat f = (GLfloat)rand() / (GLfloat)RAND_MAX;
+ GLfloat gran = (GLfloat)(1 << 13);
+
+ f = (GLfloat)(GLint)(f * gran) / gran;
+
+ return f * 2.0 - 1.0;
+}
+
+static int significand_match( GLfloat a, GLfloat b )
+{
+ GLfloat d = a - b;
+ int a_ex, b_ex, d_ex;
+
+ if ( d == 0.0F ) {
+ return MAX_PRECISION; /* Exact match */
+ }
+
+ if ( a == 0.0F || b == 0.0F ) {
+ /* It would probably be better to check if the
+ * non-zero number is denormalized and return
+ * the index of the highest set bit here.
+ */
+ return 0;
+ }
+
+ frexp( a, &a_ex );
+ frexp( b, &b_ex );
+ frexp( d, &d_ex );
+
+ if ( a_ex < b_ex ) {
+ return a_ex - d_ex;
+ } else {
+ return b_ex - d_ex;
+ }
+}
+
+enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 };
+
+/* Ensure our arrays are correctly aligned.
+ */
+#if defined(__GNUC__)
+# define ALIGN16(type, array) type array __attribute__ ((aligned (16)))
+#elif defined(__MSC__)
+# define ALIGN16(type, array) type array __declspec(align(16)) /* GH: Does this work? */
+#elif defined(__WATCOMC__)
+# define ALIGN16(type, array) /* Watcom does not support this */
+#elif defined(__xlC__)
+# define ALIGN16(type, array) type __align (16) array
+#else
+# warning "ALIGN16 will not 16-byte align!\n"
+# define ALIGN16
+#endif
+
+
+#endif /* DEBUG */
+
+#endif /* __M_DEBUG_UTIL_H__ */
Index: xc/extras/Mesa/src/mesa/math/m_debug_xform.c
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_debug_xform.c:1.3
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_debug_xform.c Fri Dec 10 10:30:13 2004
@@ -0,0 +1,338 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Updated for P6 architecture by Gareth Hughes.
+ */
+
+#include "glheader.h"
+#include "context.h"
+#include "macros.h"
+#include "imports.h"
+
+#include "m_matrix.h"
+#include "m_xform.h"
+
+#include "m_debug.h"
+#include "m_debug_util.h"
+
+#ifdef __UNIXOS2__
+/* The linker doesn't like empty files */
+static char dummy;
+#endif
+
+#ifdef DEBUG /* This code only used for debugging */
+
+
+/* Overhead of profiling counter in cycles. Automatically adjusted to
+ * your machine at run time - counter initialization should give very
+ * consistent results.
+ */
+long counter_overhead = 0;
+
+/* This is the value of the environment variable MESA_PROFILE, and is
+ * used to determine if we should benchmark the functions as well as
+ * verify their correctness.
+ */
+char *mesa_profile = NULL;
+
+
+static int m_general[16] = {
+ VAR, VAR, VAR, VAR,
+ VAR, VAR, VAR, VAR,
+ VAR, VAR, VAR, VAR,
+ VAR, VAR, VAR, VAR
+};
+static int m_identity[16] = {
+ ONE, NIL, NIL, NIL,
+ NIL, ONE, NIL, NIL,
+ NIL, NIL, ONE, NIL,
+ NIL, NIL, NIL, ONE
+};
+static int m_2d[16] = {
+ VAR, VAR, NIL, VAR,
+ VAR, VAR, NIL, VAR,
+ NIL, NIL, ONE, NIL,
+ NIL, NIL, NIL, ONE
+};
+static int m_2d_no_rot[16] = {
+ VAR, NIL, NIL, VAR,
+ NIL, VAR, NIL, VAR,
+ NIL, NIL, ONE, NIL,
+ NIL, NIL, NIL, ONE
+};
+static int m_3d[16] = {
+ VAR, VAR, VAR, VAR,
+ VAR, VAR, VAR, VAR,
+ VAR, VAR, VAR, VAR,
+ NIL, NIL, NIL, ONE
+};
+static int m_3d_no_rot[16] = {
+ VAR, NIL, NIL, VAR,
+ NIL, VAR, NIL, VAR,
+ NIL, NIL, VAR, VAR,
+ NIL, NIL, NIL, ONE
+};
+static int m_perspective[16] = {
+ VAR, NIL, VAR, NIL,
+ NIL, VAR, VAR, NIL,
+ NIL, NIL, VAR, VAR,
+ NIL, NIL, NEG, NIL
+};
+static int *templates[7] = {
+ m_general,
+ m_identity,
+ m_3d_no_rot,
+ m_perspective,
+ m_2d,
+ m_2d_no_rot,
+ m_3d
+};
+static enum GLmatrixtype mtypes[7] = {
+ MATRIX_GENERAL,
+ MATRIX_IDENTITY,
+ MATRIX_3D_NO_ROT,
+ MATRIX_PERSPECTIVE,
+ MATRIX_2D,
+ MATRIX_2D_NO_ROT,
+ MATRIX_3D
+};
+static char *mstrings[7] = {
+ "MATRIX_GENERAL",
+ "MATRIX_IDENTITY",
+ "MATRIX_3D_NO_ROT",
+ "MATRIX_PERSPECTIVE",
+ "MATRIX_2D",
+ "MATRIX_2D_NO_ROT",
+ "MATRIX_3D"
+};
+
+
+/* =============================================================
+ * Reference transformations
+ */
+
+static void ref_transform( GLvector4f *dst,
+ const GLmatrix *mat,
+ const GLvector4f *src )
+{
+ GLuint i;
+ GLfloat *s = (GLfloat *)src->start;
+ GLfloat (*d)[4] = (GLfloat (*)[4])dst->start;
+ const GLfloat *m = mat->m;
+
+ for ( i = 0 ; i < src->count ; i++ ) {
+ TRANSFORM_POINT( d[i], m, s );
+ s = (GLfloat *)((char *)s + src->stride);
+ }
+}
+
+
+/* =============================================================
+ * Vertex transformation tests
+ */
+
+static void init_matrix( GLfloat *m )
+{
+ m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0;
+ m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0;
+ m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0;
+ m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0;
+}
+
+ALIGN16(static GLfloat, s[TEST_COUNT][4]);
+ALIGN16(static GLfloat, d[TEST_COUNT][4]);
+ALIGN16(static GLfloat, r[TEST_COUNT][4]);
+
+static int test_transform_function( transform_func func, int psize,
+ int mtype, long *cycles )
+{
+ GLvector4f source[1], dest[1], ref[1];
+ GLmatrix mat[1];
+ GLfloat *m;
+ int i, j;
+#ifdef RUN_DEBUG_BENCHMARK
+ int cycle_i; /* the counter for the benchmarks we run */
+#endif
+
+ (void) cycles;
+
+ if ( psize > 4 ) {
+ _mesa_problem( NULL, "test_transform_function called with psize > 4\n" );
+ return 0;
+ }
+
+ mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
+ mat->type = mtypes[mtype];
+
+ m = mat->m;
+ ASSERT( ((GLuint)m & 15) == 0 );
+
+ init_matrix( m );
+
+ for ( i = 0 ; i < 4 ; i++ ) {
+ for ( j = 0 ; j < 4 ; j++ ) {
+ switch ( templates[mtype][i * 4 + j] ) {
+ case NIL:
+ m[j * 4 + i] = 0.0;
+ break;
+ case ONE:
+ m[j * 4 + i] = 1.0;
+ break;
+ case NEG:
+ m[j * 4 + i] = -1.0;
+ break;
+ case VAR:
+ break;
+ default:
+ abort();
+ }
+ }
+ }
+
+ for ( i = 0 ; i < TEST_COUNT ; i++) {
+ ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 );
+ ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 );
+ for ( j = 0 ; j < psize ; j++ )
+ s[i][j] = rnd();
+ }
+
+ source->data = (GLfloat(*)[4])s;
+ source->start = (GLfloat *)s;
+ source->count = TEST_COUNT;
+ source->stride = sizeof(s[0]);
+ source->size = 4;
+ source->flags = 0;
+
+ dest->data = (GLfloat(*)[4])d;
+ dest->start = (GLfloat *)d;
+ dest->count = TEST_COUNT;
+ dest->stride = sizeof(float[4]);
+ dest->size = 0;
+ dest->flags = 0;
+
+ ref->data = (GLfloat(*)[4])r;
+ ref->start = (GLfloat *)r;
+ ref->count = TEST_COUNT;
+ ref->stride = sizeof(float[4]);
+ ref->size = 0;
+ ref->flags = 0;
+
+ ref_transform( ref, mat, source );
+
+ if ( mesa_profile ) {
+ BEGIN_RACE( *cycles );
+ func( dest, mat->m, source );
+ END_RACE( *cycles );
+ }
+ else {
+ func( dest, mat->m, source );
+ }
+
+ for ( i = 0 ; i < TEST_COUNT ; i++ ) {
+ for ( j = 0 ; j < 4 ; j++ ) {
+ if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) {
+ _mesa_printf("-----------------------------\n" );
+ _mesa_printf("(i = %i, j = %i)\n", i, j );
+ _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][0], r[i][0], r[i][0]-d[i][0],
+ MAX_PRECISION - significand_match( d[i][0], r[i][0] ) );
+ _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][1], r[i][1], r[i][1]-d[i][1],
+ MAX_PRECISION - significand_match( d[i][1], r[i][1] ) );
+ _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][2], r[i][2], r[i][2]-d[i][2],
+ MAX_PRECISION - significand_match( d[i][2], r[i][2] ) );
+ _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n",
+ d[i][3], r[i][3], r[i][3]-d[i][3],
+ MAX_PRECISION - significand_match( d[i][3], r[i][3] ) );
+ return 0;
+ }
+ }
+ }
+
+ ALIGN_FREE( mat->m );
+ return 1;
+}
+
+void _math_test_all_transform_functions( char *description )
+{
+ int psize, mtype;
+ long benchmark_tab[4][7];
+ static int first_time = 1;
+
+ if ( first_time ) {
+ first_time = 0;
+ mesa_profile = getenv( "MESA_PROFILE" );
+ }
+
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile ) {
+ if ( !counter_overhead ) {
+ INIT_COUNTER();
+ _mesa_printf("counter overhead: %ld cycles\n\n", counter_overhead );
+ }
+ _mesa_printf("transform results after hooking in %s functions:\n", description );
+ }
+#endif
+
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile ) {
+ _mesa_printf("\n" );
+ for ( psize = 1 ; psize <= 4 ; psize++ ) {
+ _mesa_printf(" p%d\t", psize );
+ }
+ _mesa_printf("\n--------------------------------------------------------\n" );
+ }
+#endif
+
+ for ( mtype = 0 ; mtype < 7 ; mtype++ ) {
+ for ( psize = 1 ; psize <= 4 ; psize++ ) {
+ transform_func func = _mesa_transform_tab[psize][mtypes[mtype]];
+ long *cycles = &(benchmark_tab[psize-1][mtype]);
+
+ if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) {
+ char buf[100];
+ _mesa_sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)",
+ psize, mstrings[mtype], description );
+ _mesa_problem( NULL, buf );
+ }
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile )
+ _mesa_printf(" %li\t", benchmark_tab[psize-1][mtype] );
+#endif
+ }
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile )
+ _mesa_printf(" | [%s]\n", mstrings[mtype] );
+#endif
+ }
+#ifdef RUN_DEBUG_BENCHMARK
+ if ( mesa_profile )
+ _mesa_printf( "\n" );
+#endif
+}
+
+
+#endif /* DEBUG */
Index: xc/extras/Mesa/src/mesa/math/m_dotprod_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_dotprod_tmp.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_dotprod_tmp.h Thu Apr 8 05:17:53 2004
@@ -0,0 +1,102 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+/* Note - respects the stride of the output vector.
+ */
+static void TAG(dotprod_vec2)( GLfloat *out,
+ GLuint outstride,
+ const GLvector4f *coord_vec,
+ const GLfloat plane[4] )
+{
+ GLuint stride = coord_vec->stride;
+ GLfloat *coord = coord_vec->start;
+ GLuint count = coord_vec->count;
+
+ GLuint i;
+
+ const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3];
+
+ for (i=0;istride;
+ GLfloat *coord = coord_vec->start;
+ GLuint count = coord_vec->count;
+
+ GLuint i;
+
+ const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
+ const GLfloat plane3 = plane[3];
+
+ for (i=0;istride;
+ GLfloat *coord = coord_vec->start;
+ GLuint count = coord_vec->count;
+ GLuint i;
+
+ const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
+ const GLfloat plane3 = plane[3];
+
+ for (i=0;i= 2) {
+ bincoeff = (GLfloat) (order - 1);
+ s = 1.0F - t;
+
+ for (k = 0; k < dim; k++)
+ out[k] = s * cp[k] + bincoeff * t * cp[dim + k];
+
+ for (i = 2, cp += 2 * dim, powert = t * t; i < order;
+ i++, powert *= t, cp += dim) {
+ bincoeff *= (GLfloat) (order - i);
+ bincoeff *= inv_tab[i];
+
+ for (k = 0; k < dim; k++)
+ out[k] = s * out[k] + bincoeff * powert * cp[k];
+ }
+ }
+ else { /* order=1 -> constant curve */
+
+ for (k = 0; k < dim; k++)
+ out[k] = cp[k];
+ }
+}
+
+/*
+ * Tensor product Bezier surfaces
+ *
+ * Again the Horner scheme is used to compute a point on a
+ * TP Bezier surface. First a control polygon for a curve
+ * on the surface in one parameter direction is computed,
+ * then the point on the curve for the other parameter
+ * direction is evaluated.
+ *
+ * To store the curve control polygon additional storage
+ * for max(uorder,vorder) points is needed in the
+ * control net cn.
+ */
+
+void
+_math_horner_bezier_surf(GLfloat * cn, GLfloat * out, GLfloat u, GLfloat v,
+ GLuint dim, GLuint uorder, GLuint vorder)
+{
+ GLfloat *cp = cn + uorder * vorder * dim;
+ GLuint i, uinc = vorder * dim;
+
+ if (vorder > uorder) {
+ if (uorder >= 2) {
+ GLfloat s, poweru, bincoeff;
+ GLuint j, k;
+
+ /* Compute the control polygon for the surface-curve in u-direction */
+ for (j = 0; j < vorder; j++) {
+ GLfloat *ucp = &cn[j * dim];
+
+ /* Each control point is the point for parameter u on a */
+ /* curve defined by the control polygons in u-direction */
+ bincoeff = (GLfloat) (uorder - 1);
+ s = 1.0F - u;
+
+ for (k = 0; k < dim; k++)
+ cp[j * dim + k] = s * ucp[k] + bincoeff * u * ucp[uinc + k];
+
+ for (i = 2, ucp += 2 * uinc, poweru = u * u; i < uorder;
+ i++, poweru *= u, ucp += uinc) {
+ bincoeff *= (GLfloat) (uorder - i);
+ bincoeff *= inv_tab[i];
+
+ for (k = 0; k < dim; k++)
+ cp[j * dim + k] =
+ s * cp[j * dim + k] + bincoeff * poweru * ucp[k];
+ }
+ }
+
+ /* Evaluate curve point in v */
+ _math_horner_bezier_curve(cp, out, v, dim, vorder);
+ }
+ else /* uorder=1 -> cn defines a curve in v */
+ _math_horner_bezier_curve(cn, out, v, dim, vorder);
+ }
+ else { /* vorder <= uorder */
+
+ if (vorder > 1) {
+ GLuint i;
+
+ /* Compute the control polygon for the surface-curve in u-direction */
+ for (i = 0; i < uorder; i++, cn += uinc) {
+ /* For constant i all cn[i][j] (j=0..vorder) are located */
+ /* on consecutive memory locations, so we can use */
+ /* horner_bezier_curve to compute the control points */
+
+ _math_horner_bezier_curve(cn, &cp[i * dim], v, dim, vorder);
+ }
+
+ /* Evaluate curve point in u */
+ _math_horner_bezier_curve(cp, out, u, dim, uorder);
+ }
+ else /* vorder=1 -> cn defines a curve in u */
+ _math_horner_bezier_curve(cn, out, u, dim, uorder);
+ }
+}
+
+/*
+ * The direct de Casteljau algorithm is used when a point on the
+ * surface and the tangent directions spanning the tangent plane
+ * should be computed (this is needed to compute normals to the
+ * surface). In this case the de Casteljau algorithm approach is
+ * nicer because a point and the partial derivatives can be computed
+ * at the same time. To get the correct tangent length du and dv
+ * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1.
+ * Since only the directions are needed, this scaling step is omitted.
+ *
+ * De Casteljau needs additional storage for uorder*vorder
+ * values in the control net cn.
+ */
+
+void
+_math_de_casteljau_surf(GLfloat * cn, GLfloat * out, GLfloat * du,
+ GLfloat * dv, GLfloat u, GLfloat v, GLuint dim,
+ GLuint uorder, GLuint vorder)
+{
+ GLfloat *dcn = cn + uorder * vorder * dim;
+ GLfloat us = 1.0F - u, vs = 1.0F - v;
+ GLuint h, i, j, k;
+ GLuint minorder = uorder < vorder ? uorder : vorder;
+ GLuint uinc = vorder * dim;
+ GLuint dcuinc = vorder;
+
+ /* Each component is evaluated separately to save buffer space */
+ /* This does not drasticaly decrease the performance of the */
+ /* algorithm. If additional storage for (uorder-1)*(vorder-1) */
+ /* points would be available, the components could be accessed */
+ /* in the innermost loop which could lead to less cache misses. */
+
+#define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)]
+#define DCN(I, J) dcn[(I)*dcuinc+(J)]
+ if (minorder < 3) {
+ if (uorder == vorder) {
+ for (k = 0; k < dim; k++) {
+ /* Derivative direction in u */
+ du[k] = vs * (CN(1, 0, k) - CN(0, 0, k)) +
+ v * (CN(1, 1, k) - CN(0, 1, k));
+
+ /* Derivative direction in v */
+ dv[k] = us * (CN(0, 1, k) - CN(0, 0, k)) +
+ u * (CN(1, 1, k) - CN(1, 0, k));
+
+ /* bilinear de Casteljau step */
+ out[k] = us * (vs * CN(0, 0, k) + v * CN(0, 1, k)) +
+ u * (vs * CN(1, 0, k) + v * CN(1, 1, k));
+ }
+ }
+ else if (minorder == uorder) {
+ for (k = 0; k < dim; k++) {
+ /* bilinear de Casteljau step */
+ DCN(1, 0) = CN(1, 0, k) - CN(0, 0, k);
+ DCN(0, 0) = us * CN(0, 0, k) + u * CN(1, 0, k);
+
+ for (j = 0; j < vorder - 1; j++) {
+ /* for the derivative in u */
+ DCN(1, j + 1) = CN(1, j + 1, k) - CN(0, j + 1, k);
+ DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1);
+
+ /* for the `point' */
+ DCN(0, j + 1) = us * CN(0, j + 1, k) + u * CN(1, j + 1, k);
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
+ }
+
+ /* remaining linear de Casteljau steps until the second last step */
+ for (h = minorder; h < vorder - 1; h++)
+ for (j = 0; j < vorder - h; j++) {
+ /* for the derivative in u */
+ DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1);
+
+ /* for the `point' */
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
+ }
+
+ /* derivative direction in v */
+ dv[k] = DCN(0, 1) - DCN(0, 0);
+
+ /* derivative direction in u */
+ du[k] = vs * DCN(1, 0) + v * DCN(1, 1);
+
+ /* last linear de Casteljau step */
+ out[k] = vs * DCN(0, 0) + v * DCN(0, 1);
+ }
+ }
+ else { /* minorder == vorder */
+
+ for (k = 0; k < dim; k++) {
+ /* bilinear de Casteljau step */
+ DCN(0, 1) = CN(0, 1, k) - CN(0, 0, k);
+ DCN(0, 0) = vs * CN(0, 0, k) + v * CN(0, 1, k);
+ for (i = 0; i < uorder - 1; i++) {
+ /* for the derivative in v */
+ DCN(i + 1, 1) = CN(i + 1, 1, k) - CN(i + 1, 0, k);
+ DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1);
+
+ /* for the `point' */
+ DCN(i + 1, 0) = vs * CN(i + 1, 0, k) + v * CN(i + 1, 1, k);
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ }
+
+ /* remaining linear de Casteljau steps until the second last step */
+ for (h = minorder; h < uorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ /* for the derivative in v */
+ DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1);
+
+ /* for the `point' */
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ }
+
+ /* derivative direction in u */
+ du[k] = DCN(1, 0) - DCN(0, 0);
+
+ /* derivative direction in v */
+ dv[k] = us * DCN(0, 1) + u * DCN(1, 1);
+
+ /* last linear de Casteljau step */
+ out[k] = us * DCN(0, 0) + u * DCN(1, 0);
+ }
+ }
+ }
+ else if (uorder == vorder) {
+ for (k = 0; k < dim; k++) {
+ /* first bilinear de Casteljau step */
+ for (i = 0; i < uorder - 1; i++) {
+ DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k);
+ for (j = 0; j < vorder - 1; j++) {
+ DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
+ }
+ }
+
+ /* remaining bilinear de Casteljau steps until the second last step */
+ for (h = 2; h < minorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ for (j = 0; j < vorder - h; j++) {
+ DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
+ }
+ }
+
+ /* derivative direction in u */
+ du[k] = vs * (DCN(1, 0) - DCN(0, 0)) + v * (DCN(1, 1) - DCN(0, 1));
+
+ /* derivative direction in v */
+ dv[k] = us * (DCN(0, 1) - DCN(0, 0)) + u * (DCN(1, 1) - DCN(1, 0));
+
+ /* last bilinear de Casteljau step */
+ out[k] = us * (vs * DCN(0, 0) + v * DCN(0, 1)) +
+ u * (vs * DCN(1, 0) + v * DCN(1, 1));
+ }
+ }
+ else if (minorder == uorder) {
+ for (k = 0; k < dim; k++) {
+ /* first bilinear de Casteljau step */
+ for (i = 0; i < uorder - 1; i++) {
+ DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k);
+ for (j = 0; j < vorder - 1; j++) {
+ DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
+ }
+ }
+
+ /* remaining bilinear de Casteljau steps until the second last step */
+ for (h = 2; h < minorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ for (j = 0; j < vorder - h; j++) {
+ DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
+ }
+ }
+
+ /* last bilinear de Casteljau step */
+ DCN(2, 0) = DCN(1, 0) - DCN(0, 0);
+ DCN(0, 0) = us * DCN(0, 0) + u * DCN(1, 0);
+ for (j = 0; j < vorder - 1; j++) {
+ /* for the derivative in u */
+ DCN(2, j + 1) = DCN(1, j + 1) - DCN(0, j + 1);
+ DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1);
+
+ /* for the `point' */
+ DCN(0, j + 1) = us * DCN(0, j + 1) + u * DCN(1, j + 1);
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
+ }
+
+ /* remaining linear de Casteljau steps until the second last step */
+ for (h = minorder; h < vorder - 1; h++)
+ for (j = 0; j < vorder - h; j++) {
+ /* for the derivative in u */
+ DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1);
+
+ /* for the `point' */
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
+ }
+
+ /* derivative direction in v */
+ dv[k] = DCN(0, 1) - DCN(0, 0);
+
+ /* derivative direction in u */
+ du[k] = vs * DCN(2, 0) + v * DCN(2, 1);
+
+ /* last linear de Casteljau step */
+ out[k] = vs * DCN(0, 0) + v * DCN(0, 1);
+ }
+ }
+ else { /* minorder == vorder */
+
+ for (k = 0; k < dim; k++) {
+ /* first bilinear de Casteljau step */
+ for (i = 0; i < uorder - 1; i++) {
+ DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k);
+ for (j = 0; j < vorder - 1; j++) {
+ DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
+ }
+ }
+
+ /* remaining bilinear de Casteljau steps until the second last step */
+ for (h = 2; h < minorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ for (j = 0; j < vorder - h; j++) {
+ DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
+ }
+ }
+
+ /* last bilinear de Casteljau step */
+ DCN(0, 2) = DCN(0, 1) - DCN(0, 0);
+ DCN(0, 0) = vs * DCN(0, 0) + v * DCN(0, 1);
+ for (i = 0; i < uorder - 1; i++) {
+ /* for the derivative in v */
+ DCN(i + 1, 2) = DCN(i + 1, 1) - DCN(i + 1, 0);
+ DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2);
+
+ /* for the `point' */
+ DCN(i + 1, 0) = vs * DCN(i + 1, 0) + v * DCN(i + 1, 1);
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ }
+
+ /* remaining linear de Casteljau steps until the second last step */
+ for (h = minorder; h < uorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ /* for the derivative in v */
+ DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2);
+
+ /* for the `point' */
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ }
+
+ /* derivative direction in u */
+ du[k] = DCN(1, 0) - DCN(0, 0);
+
+ /* derivative direction in v */
+ dv[k] = us * DCN(0, 2) + u * DCN(1, 2);
+
+ /* last linear de Casteljau step */
+ out[k] = us * DCN(0, 0) + u * DCN(1, 0);
+ }
+ }
+#undef DCN
+#undef CN
+}
+
+
+/*
+ * Do one-time initialization for evaluators.
+ */
+void
+_math_init_eval(void)
+{
+ GLuint i;
+
+ /* KW: precompute 1/x for useful x.
+ */
+ for (i = 1; i < MAX_EVAL_ORDER; i++)
+ inv_tab[i] = 1.0F / i;
+}
Index: xc/extras/Mesa/src/mesa/math/m_eval.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_eval.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_eval.h Thu Apr 8 05:17:53 2004
@@ -0,0 +1,103 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _M_EVAL_H
+#define _M_EVAL_H
+
+#include "glheader.h"
+
+void _math_init_eval( void );
+
+
+/*
+ * Horner scheme for Bezier curves
+ *
+ * Bezier curves can be computed via a Horner scheme.
+ * Horner is numerically less stable than the de Casteljau
+ * algorithm, but it is faster. For curves of degree n
+ * the complexity of Horner is O(n) and de Casteljau is O(n^2).
+ * Since stability is not important for displaying curve
+ * points I decided to use the Horner scheme.
+ *
+ * A cubic Bezier curve with control points b0, b1, b2, b3 can be
+ * written as
+ *
+ * (([3] [3] ) [3] ) [3]
+ * c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3
+ *
+ * [n]
+ * where s=1-t and the binomial coefficients [i]. These can
+ * be computed iteratively using the identity:
+ *
+ * [n] [n ] [n]
+ * [i] = (n-i+1)/i * [i-1] and [0] = 1
+ */
+
+
+void
+_math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t,
+ GLuint dim, GLuint order);
+
+
+/*
+ * Tensor product Bezier surfaces
+ *
+ * Again the Horner scheme is used to compute a point on a
+ * TP Bezier surface. First a control polygon for a curve
+ * on the surface in one parameter direction is computed,
+ * then the point on the curve for the other parameter
+ * direction is evaluated.
+ *
+ * To store the curve control polygon additional storage
+ * for max(uorder,vorder) points is needed in the
+ * control net cn.
+ */
+
+void
+_math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v,
+ GLuint dim, GLuint uorder, GLuint vorder);
+
+
+/*
+ * The direct de Casteljau algorithm is used when a point on the
+ * surface and the tangent directions spanning the tangent plane
+ * should be computed (this is needed to compute normals to the
+ * surface). In this case the de Casteljau algorithm approach is
+ * nicer because a point and the partial derivatives can be computed
+ * at the same time. To get the correct tangent length du and dv
+ * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1.
+ * Since only the directions are needed, this scaling step is omitted.
+ *
+ * De Casteljau needs additional storage for uorder*vorder
+ * values in the control net cn.
+ */
+
+void
+_math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv,
+ GLfloat u, GLfloat v, GLuint dim,
+ GLuint uorder, GLuint vorder);
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/math/m_matrix.c
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_matrix.c:1.1.1.3
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_matrix.c Fri Dec 10 10:05:27 2004
@@ -0,0 +1,1487 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file m_matrix.c
+ * Matrix operations.
+ *
+ * \note
+ * -# 4x4 transformation matrices are stored in memory in column major order.
+ * -# Points/vertices are to be thought of as column vectors.
+ * -# Transformation of a point p by a matrix M is: p' = M * p
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "macros.h"
+#include "imports.h"
+
+#include "m_matrix.h"
+
+
+/**
+ * Names of the corresponding GLmatrixtype values.
+ */
+static const char *types[] = {
+ "MATRIX_GENERAL",
+ "MATRIX_IDENTITY",
+ "MATRIX_3D_NO_ROT",
+ "MATRIX_PERSPECTIVE",
+ "MATRIX_2D",
+ "MATRIX_2D_NO_ROT",
+ "MATRIX_3D"
+};
+
+
+/**
+ * Identity matrix.
+ */
+static GLfloat Identity[16] = {
+ 1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0
+};
+
+
+
+/**********************************************************************/
+/** \name Matrix multiplication */
+/*@{*/
+
+#define A(row,col) a[(col<<2)+row]
+#define B(row,col) b[(col<<2)+row]
+#define P(row,col) product[(col<<2)+row]
+
+/**
+ * Perform a full 4x4 matrix multiplication.
+ *
+ * \param a matrix.
+ * \param b matrix.
+ * \param product will receive the product of \p a and \p b.
+ *
+ * \warning Is assumed that \p product != \p b. \p product == \p a is allowed.
+ *
+ * \note KW: 4*16 = 64 multiplications
+ *
+ * \author This \c matmul was contributed by Thomas Malik
+ */
+static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b )
+{
+ GLint i;
+ for (i = 0; i < 4; i++) {
+ const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
+ P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
+ P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
+ P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
+ P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
+ }
+}
+
+/**
+ * Multiply two matrices known to occupy only the top three rows, such
+ * as typical model matrices, and orthogonal matrices.
+ *
+ * \param a matrix.
+ * \param b matrix.
+ * \param product will receive the product of \p a and \p b.
+ */
+static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b )
+{
+ GLint i;
+ for (i = 0; i < 3; i++) {
+ const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
+ P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0);
+ P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1);
+ P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2);
+ P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3;
+ }
+ P(3,0) = 0;
+ P(3,1) = 0;
+ P(3,2) = 0;
+ P(3,3) = 1;
+}
+
+#undef A
+#undef B
+#undef P
+
+/**
+ * Multiply a matrix by an array of floats with known properties.
+ *
+ * \param mat pointer to a GLmatrix structure containing the left multiplication
+ * matrix, and that will receive the product result.
+ * \param m right multiplication matrix array.
+ * \param flags flags of the matrix \p m.
+ *
+ * Joins both flags and marks the type and inverse as dirty. Calls matmul34()
+ * if both matrices are 3D, or matmul4() otherwise.
+ */
+static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags )
+{
+ mat->flags |= (flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE);
+
+ if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D))
+ matmul34( mat->m, mat->m, m );
+ else
+ matmul4( mat->m, mat->m, m );
+}
+
+/**
+ * Matrix multiplication.
+ *
+ * \param dest destination matrix.
+ * \param a left matrix.
+ * \param b right matrix.
+ *
+ * Joins both flags and marks the type and inverse as dirty. Calls matmul34()
+ * if both matrices are 3D, or matmul4() otherwise.
+ */
+void
+_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b )
+{
+ dest->flags = (a->flags |
+ b->flags |
+ MAT_DIRTY_TYPE |
+ MAT_DIRTY_INVERSE);
+
+ if (TEST_MAT_FLAGS(dest, MAT_FLAGS_3D))
+ matmul34( dest->m, a->m, b->m );
+ else
+ matmul4( dest->m, a->m, b->m );
+}
+
+/**
+ * Matrix multiplication.
+ *
+ * \param dest left and destination matrix.
+ * \param m right matrix array.
+ *
+ * Marks the matrix flags with general flag, and type and inverse dirty flags.
+ * Calls matmul4() for the multiplication.
+ */
+void
+_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *m )
+{
+ dest->flags |= (MAT_FLAG_GENERAL |
+ MAT_DIRTY_TYPE |
+ MAT_DIRTY_INVERSE);
+
+ matmul4( dest->m, dest->m, m );
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Matrix output */
+/*@{*/
+
+/**
+ * Print a matrix array.
+ *
+ * \param m matrix array.
+ *
+ * Called by _math_matrix_print() to print a matrix or its inverse.
+ */
+static void print_matrix_floats( const GLfloat m[16] )
+{
+ int i;
+ for (i=0;i<4;i++) {
+ _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] );
+ }
+}
+
+/**
+ * Dumps the contents of a GLmatrix structure.
+ *
+ * \param m pointer to the GLmatrix structure.
+ */
+void
+_math_matrix_print( const GLmatrix *m )
+{
+ _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags);
+ print_matrix_floats(m->m);
+ _mesa_debug(NULL, "Inverse: \n");
+ if (m->inv) {
+ GLfloat prod[16];
+ print_matrix_floats(m->inv);
+ matmul4(prod, m->m, m->inv);
+ _mesa_debug(NULL, "Mat * Inverse:\n");
+ print_matrix_floats(prod);
+ }
+ else {
+ _mesa_debug(NULL, " - not available\n");
+ }
+}
+
+/*@}*/
+
+
+/**
+ * References an element of 4x4 matrix.
+ *
+ * \param m matrix array.
+ * \param c column of the desired element.
+ * \param r row of the desired element.
+ *
+ * \return value of the desired element.
+ *
+ * Calculate the linear storage index of the element and references it.
+ */
+#define MAT(m,r,c) (m)[(c)*4+(r)]
+
+
+/**********************************************************************/
+/** \name Matrix inversion */
+/*@{*/
+
+/**
+ * Swaps the values of two floating pointer variables.
+ *
+ * Used by invert_matrix_general() to swap the row pointers.
+ */
+#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; }
+
+/**
+ * Compute inverse of 4x4 transformation matrix.
+ *
+ * \param mat pointer to a GLmatrix structure. The matrix inverse will be
+ * stored in the GLmatrix::inv attribute.
+ *
+ * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
+ *
+ * \author
+ * Code contributed by Jacques Leroy jle@star.be
+ *
+ * Calculates the inverse matrix by performing the gaussian matrix reduction
+ * with partial pivoting followed by back/substitution with the loops manually
+ * unrolled.
+ */
+static GLboolean invert_matrix_general( GLmatrix *mat )
+{
+ const GLfloat *m = mat->m;
+ GLfloat *out = mat->inv;
+ GLfloat wtmp[4][8];
+ GLfloat m0, m1, m2, m3, s;
+ GLfloat *r0, *r1, *r2, *r3;
+
+ r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3];
+
+ r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1),
+ r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3),
+ r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0,
+
+ r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1),
+ r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3),
+ r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0,
+
+ r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1),
+ r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3),
+ r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0,
+
+ r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1),
+ r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3),
+ r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0;
+
+ /* choose pivot - or die */
+ if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2);
+ if (fabs(r2[0])>fabs(r1[0])) SWAP_ROWS(r2, r1);
+ if (fabs(r1[0])>fabs(r0[0])) SWAP_ROWS(r1, r0);
+ if (0.0 == r0[0]) return GL_FALSE;
+
+ /* eliminate first variable */
+ m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0];
+ s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s;
+ s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s;
+ s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s;
+ s = r0[4];
+ if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; }
+ s = r0[5];
+ if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; }
+ s = r0[6];
+ if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; }
+ s = r0[7];
+ if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; }
+
+ /* choose pivot - or die */
+ if (fabs(r3[1])>fabs(r2[1])) SWAP_ROWS(r3, r2);
+ if (fabs(r2[1])>fabs(r1[1])) SWAP_ROWS(r2, r1);
+ if (0.0 == r1[1]) return GL_FALSE;
+
+ /* eliminate second variable */
+ m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1];
+ r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2];
+ r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3];
+ s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; }
+ s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; }
+ s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; }
+ s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; }
+
+ /* choose pivot - or die */
+ if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2);
+ if (0.0 == r2[2]) return GL_FALSE;
+
+ /* eliminate third variable */
+ m3 = r3[2]/r2[2];
+ r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4],
+ r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6],
+ r3[7] -= m3 * r2[7];
+
+ /* last check */
+ if (0.0 == r3[3]) return GL_FALSE;
+
+ s = 1.0F/r3[3]; /* now back substitute row 3 */
+ r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s;
+
+ m2 = r2[3]; /* now back substitute row 2 */
+ s = 1.0F/r2[2];
+ r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2),
+ r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
+ m1 = r1[3];
+ r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1,
+ r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
+ m0 = r0[3];
+ r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0,
+ r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
+
+ m1 = r1[2]; /* now back substitute row 1 */
+ s = 1.0F/r1[1];
+ r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1),
+ r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
+ m0 = r0[2];
+ r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0,
+ r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
+
+ m0 = r0[1]; /* now back substitute row 0 */
+ s = 1.0F/r0[0];
+ r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0),
+ r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
+
+ MAT(out,0,0) = r0[4]; MAT(out,0,1) = r0[5],
+ MAT(out,0,2) = r0[6]; MAT(out,0,3) = r0[7],
+ MAT(out,1,0) = r1[4]; MAT(out,1,1) = r1[5],
+ MAT(out,1,2) = r1[6]; MAT(out,1,3) = r1[7],
+ MAT(out,2,0) = r2[4]; MAT(out,2,1) = r2[5],
+ MAT(out,2,2) = r2[6]; MAT(out,2,3) = r2[7],
+ MAT(out,3,0) = r3[4]; MAT(out,3,1) = r3[5],
+ MAT(out,3,2) = r3[6]; MAT(out,3,3) = r3[7];
+
+ return GL_TRUE;
+}
+#undef SWAP_ROWS
+
+/**
+ * Compute inverse of a general 3d transformation matrix.
+ *
+ * \param mat pointer to a GLmatrix structure. The matrix inverse will be
+ * stored in the GLmatrix::inv attribute.
+ *
+ * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
+ *
+ * \author Adapted from graphics gems II.
+ *
+ * Calculates the inverse of the upper left by first calculating its
+ * determinant and multiplying it to the symmetric adjust matrix of each
+ * element. Finally deals with the translation part by transforming the
+ * original translation vector using by the calculated submatrix inverse.
+ */
+static GLboolean invert_matrix_3d_general( GLmatrix *mat )
+{
+ const GLfloat *in = mat->m;
+ GLfloat *out = mat->inv;
+ GLfloat pos, neg, t;
+ GLfloat det;
+
+ /* Calculate the determinant of upper left 3x3 submatrix and
+ * determine if the matrix is singular.
+ */
+ pos = neg = 0.0;
+ t = MAT(in,0,0) * MAT(in,1,1) * MAT(in,2,2);
+ if (t >= 0.0) pos += t; else neg += t;
+
+ t = MAT(in,1,0) * MAT(in,2,1) * MAT(in,0,2);
+ if (t >= 0.0) pos += t; else neg += t;
+
+ t = MAT(in,2,0) * MAT(in,0,1) * MAT(in,1,2);
+ if (t >= 0.0) pos += t; else neg += t;
+
+ t = -MAT(in,2,0) * MAT(in,1,1) * MAT(in,0,2);
+ if (t >= 0.0) pos += t; else neg += t;
+
+ t = -MAT(in,1,0) * MAT(in,0,1) * MAT(in,2,2);
+ if (t >= 0.0) pos += t; else neg += t;
+
+ t = -MAT(in,0,0) * MAT(in,2,1) * MAT(in,1,2);
+ if (t >= 0.0) pos += t; else neg += t;
+
+ det = pos + neg;
+
+ if (det*det < 1e-25)
+ return GL_FALSE;
+
+ det = 1.0F / det;
+ MAT(out,0,0) = ( (MAT(in,1,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,1,2) )*det);
+ MAT(out,0,1) = (- (MAT(in,0,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,0,2) )*det);
+ MAT(out,0,2) = ( (MAT(in,0,1)*MAT(in,1,2) - MAT(in,1,1)*MAT(in,0,2) )*det);
+ MAT(out,1,0) = (- (MAT(in,1,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,1,2) )*det);
+ MAT(out,1,1) = ( (MAT(in,0,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,0,2) )*det);
+ MAT(out,1,2) = (- (MAT(in,0,0)*MAT(in,1,2) - MAT(in,1,0)*MAT(in,0,2) )*det);
+ MAT(out,2,0) = ( (MAT(in,1,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,1,1) )*det);
+ MAT(out,2,1) = (- (MAT(in,0,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,0,1) )*det);
+ MAT(out,2,2) = ( (MAT(in,0,0)*MAT(in,1,1) - MAT(in,1,0)*MAT(in,0,1) )*det);
+
+ /* Do the translation part */
+ MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) +
+ MAT(in,1,3) * MAT(out,0,1) +
+ MAT(in,2,3) * MAT(out,0,2) );
+ MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) +
+ MAT(in,1,3) * MAT(out,1,1) +
+ MAT(in,2,3) * MAT(out,1,2) );
+ MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) +
+ MAT(in,1,3) * MAT(out,2,1) +
+ MAT(in,2,3) * MAT(out,2,2) );
+
+ return GL_TRUE;
+}
+
+/**
+ * Compute inverse of a 3d transformation matrix.
+ *
+ * \param mat pointer to a GLmatrix structure. The matrix inverse will be
+ * stored in the GLmatrix::inv attribute.
+ *
+ * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
+ *
+ * If the matrix is not an angle preserving matrix then calls
+ * invert_matrix_3d_general for the actual calculation. Otherwise calculates
+ * the inverse matrix analyzing and inverting each of the scaling, rotation and
+ * translation parts.
+ */
+static GLboolean invert_matrix_3d( GLmatrix *mat )
+{
+ const GLfloat *in = mat->m;
+ GLfloat *out = mat->inv;
+
+ if (!TEST_MAT_FLAGS(mat, MAT_FLAGS_ANGLE_PRESERVING)) {
+ return invert_matrix_3d_general( mat );
+ }
+
+ if (mat->flags & MAT_FLAG_UNIFORM_SCALE) {
+ GLfloat scale = (MAT(in,0,0) * MAT(in,0,0) +
+ MAT(in,0,1) * MAT(in,0,1) +
+ MAT(in,0,2) * MAT(in,0,2));
+
+ if (scale == 0.0)
+ return GL_FALSE;
+
+ scale = 1.0F / scale;
+
+ /* Transpose and scale the 3 by 3 upper-left submatrix. */
+ MAT(out,0,0) = scale * MAT(in,0,0);
+ MAT(out,1,0) = scale * MAT(in,0,1);
+ MAT(out,2,0) = scale * MAT(in,0,2);
+ MAT(out,0,1) = scale * MAT(in,1,0);
+ MAT(out,1,1) = scale * MAT(in,1,1);
+ MAT(out,2,1) = scale * MAT(in,1,2);
+ MAT(out,0,2) = scale * MAT(in,2,0);
+ MAT(out,1,2) = scale * MAT(in,2,1);
+ MAT(out,2,2) = scale * MAT(in,2,2);
+ }
+ else if (mat->flags & MAT_FLAG_ROTATION) {
+ /* Transpose the 3 by 3 upper-left submatrix. */
+ MAT(out,0,0) = MAT(in,0,0);
+ MAT(out,1,0) = MAT(in,0,1);
+ MAT(out,2,0) = MAT(in,0,2);
+ MAT(out,0,1) = MAT(in,1,0);
+ MAT(out,1,1) = MAT(in,1,1);
+ MAT(out,2,1) = MAT(in,1,2);
+ MAT(out,0,2) = MAT(in,2,0);
+ MAT(out,1,2) = MAT(in,2,1);
+ MAT(out,2,2) = MAT(in,2,2);
+ }
+ else {
+ /* pure translation */
+ MEMCPY( out, Identity, sizeof(Identity) );
+ MAT(out,0,3) = - MAT(in,0,3);
+ MAT(out,1,3) = - MAT(in,1,3);
+ MAT(out,2,3) = - MAT(in,2,3);
+ return GL_TRUE;
+ }
+
+ if (mat->flags & MAT_FLAG_TRANSLATION) {
+ /* Do the translation part */
+ MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) +
+ MAT(in,1,3) * MAT(out,0,1) +
+ MAT(in,2,3) * MAT(out,0,2) );
+ MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) +
+ MAT(in,1,3) * MAT(out,1,1) +
+ MAT(in,2,3) * MAT(out,1,2) );
+ MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) +
+ MAT(in,1,3) * MAT(out,2,1) +
+ MAT(in,2,3) * MAT(out,2,2) );
+ }
+ else {
+ MAT(out,0,3) = MAT(out,1,3) = MAT(out,2,3) = 0.0;
+ }
+
+ return GL_TRUE;
+}
+
+/**
+ * Compute inverse of an identity transformation matrix.
+ *
+ * \param mat pointer to a GLmatrix structure. The matrix inverse will be
+ * stored in the GLmatrix::inv attribute.
+ *
+ * \return always GL_TRUE.
+ *
+ * Simply copies Identity into GLmatrix::inv.
+ */
+static GLboolean invert_matrix_identity( GLmatrix *mat )
+{
+ MEMCPY( mat->inv, Identity, sizeof(Identity) );
+ return GL_TRUE;
+}
+
+/**
+ * Compute inverse of a no-rotation 3d transformation matrix.
+ *
+ * \param mat pointer to a GLmatrix structure. The matrix inverse will be
+ * stored in the GLmatrix::inv attribute.
+ *
+ * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
+ *
+ * Calculates the
+ */
+static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat )
+{
+ const GLfloat *in = mat->m;
+ GLfloat *out = mat->inv;
+
+ if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0 || MAT(in,2,2) == 0 )
+ return GL_FALSE;
+
+ MEMCPY( out, Identity, 16 * sizeof(GLfloat) );
+ MAT(out,0,0) = 1.0F / MAT(in,0,0);
+ MAT(out,1,1) = 1.0F / MAT(in,1,1);
+ MAT(out,2,2) = 1.0F / MAT(in,2,2);
+
+ if (mat->flags & MAT_FLAG_TRANSLATION) {
+ MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0));
+ MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1));
+ MAT(out,2,3) = - (MAT(in,2,3) * MAT(out,2,2));
+ }
+
+ return GL_TRUE;
+}
+
+/**
+ * Compute inverse of a no-rotation 2d transformation matrix.
+ *
+ * \param mat pointer to a GLmatrix structure. The matrix inverse will be
+ * stored in the GLmatrix::inv attribute.
+ *
+ * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
+ *
+ * Calculates the inverse matrix by applying the inverse scaling and
+ * translation to the identity matrix.
+ */
+static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat )
+{
+ const GLfloat *in = mat->m;
+ GLfloat *out = mat->inv;
+
+ if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0)
+ return GL_FALSE;
+
+ MEMCPY( out, Identity, 16 * sizeof(GLfloat) );
+ MAT(out,0,0) = 1.0F / MAT(in,0,0);
+ MAT(out,1,1) = 1.0F / MAT(in,1,1);
+
+ if (mat->flags & MAT_FLAG_TRANSLATION) {
+ MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0));
+ MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1));
+ }
+
+ return GL_TRUE;
+}
+
+#if 0
+/* broken */
+static GLboolean invert_matrix_perspective( GLmatrix *mat )
+{
+ const GLfloat *in = mat->m;
+ GLfloat *out = mat->inv;
+
+ if (MAT(in,2,3) == 0)
+ return GL_FALSE;
+
+ MEMCPY( out, Identity, 16 * sizeof(GLfloat) );
+
+ MAT(out,0,0) = 1.0F / MAT(in,0,0);
+ MAT(out,1,1) = 1.0F / MAT(in,1,1);
+
+ MAT(out,0,3) = MAT(in,0,2);
+ MAT(out,1,3) = MAT(in,1,2);
+
+ MAT(out,2,2) = 0;
+ MAT(out,2,3) = -1;
+
+ MAT(out,3,2) = 1.0F / MAT(in,2,3);
+ MAT(out,3,3) = MAT(in,2,2) * MAT(out,3,2);
+
+ return GL_TRUE;
+}
+#endif
+
+/**
+ * Matrix inversion function pointer type.
+ */
+typedef GLboolean (*inv_mat_func)( GLmatrix *mat );
+
+/**
+ * Table of the matrix inversion functions according to the matrix type.
+ */
+static inv_mat_func inv_mat_tab[7] = {
+ invert_matrix_general,
+ invert_matrix_identity,
+ invert_matrix_3d_no_rot,
+#if 0
+ /* Don't use this function for now - it fails when the projection matrix
+ * is premultiplied by a translation (ala Chromium's tilesort SPU).
+ */
+ invert_matrix_perspective,
+#else
+ invert_matrix_general,
+#endif
+ invert_matrix_3d, /* lazy! */
+ invert_matrix_2d_no_rot,
+ invert_matrix_3d
+};
+
+/**
+ * Compute inverse of a transformation matrix.
+ *
+ * \param mat pointer to a GLmatrix structure. The matrix inverse will be
+ * stored in the GLmatrix::inv attribute.
+ *
+ * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
+ *
+ * Calls the matrix inversion function in inv_mat_tab corresponding to the
+ * given matrix type. In case of failure, updates the MAT_FLAG_SINGULAR flag,
+ * and copies the identity matrix into GLmatrix::inv.
+ */
+static GLboolean matrix_invert( GLmatrix *mat )
+{
+ if (inv_mat_tab[mat->type](mat)) {
+ mat->flags &= ~MAT_FLAG_SINGULAR;
+ return GL_TRUE;
+ } else {
+ mat->flags |= MAT_FLAG_SINGULAR;
+ MEMCPY( mat->inv, Identity, sizeof(Identity) );
+ return GL_FALSE;
+ }
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Matrix generation */
+/*@{*/
+
+/**
+ * Generate a 4x4 transformation matrix from glRotate parameters, and
+ * post-multiply the input matrix by it.
+ *
+ * \author
+ * This function was contributed by Erich Boleyn (erich@uruk.org).
+ * Optimizations contributed by Rudolf Opalla (rudi@khm.de).
+ */
+void
+_math_matrix_rotate( GLmatrix *mat,
+ GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+{
+ GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c;
+ GLfloat m[16];
+ GLboolean optimized;
+
+ s = (GLfloat) sin( angle * DEG2RAD );
+ c = (GLfloat) cos( angle * DEG2RAD );
+
+ MEMCPY(m, Identity, sizeof(GLfloat)*16);
+ optimized = GL_FALSE;
+
+#define M(row,col) m[col*4+row]
+
+ if (x == 0.0F) {
+ if (y == 0.0F) {
+ if (z != 0.0F) {
+ optimized = GL_TRUE;
+ /* rotate only around z-axis */
+ M(0,0) = c;
+ M(1,1) = c;
+ if (z < 0.0F) {
+ M(0,1) = s;
+ M(1,0) = -s;
+ }
+ else {
+ M(0,1) = -s;
+ M(1,0) = s;
+ }
+ }
+ }
+ else if (z == 0.0F) {
+ optimized = GL_TRUE;
+ /* rotate only around y-axis */
+ M(0,0) = c;
+ M(2,2) = c;
+ if (y < 0.0F) {
+ M(0,2) = -s;
+ M(2,0) = s;
+ }
+ else {
+ M(0,2) = s;
+ M(2,0) = -s;
+ }
+ }
+ }
+ else if (y == 0.0F) {
+ if (z == 0.0F) {
+ optimized = GL_TRUE;
+ /* rotate only around x-axis */
+ M(1,1) = c;
+ M(2,2) = c;
+ if (x < 0.0F) {
+ M(1,2) = s;
+ M(2,1) = -s;
+ }
+ else {
+ M(1,2) = -s;
+ M(2,1) = s;
+ }
+ }
+ }
+
+ if (!optimized) {
+ const GLfloat mag = SQRTF(x * x + y * y + z * z);
+
+ if (mag <= 1.0e-4) {
+ /* no rotation, leave mat as-is */
+ return;
+ }
+
+ x /= mag;
+ y /= mag;
+ z /= mag;
+
+
+ /*
+ * Arbitrary axis rotation matrix.
+ *
+ * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied
+ * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation
+ * (which is about the X-axis), and the two composite transforms
+ * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary
+ * from the arbitrary axis to the X-axis then back. They are
+ * all elementary rotations.
+ *
+ * Rz' is a rotation about the Z-axis, to bring the axis vector
+ * into the x-z plane. Then Ry' is applied, rotating about the
+ * Y-axis to bring the axis vector parallel with the X-axis. The
+ * rotation about the X-axis is then performed. Ry and Rz are
+ * simply the respective inverse transforms to bring the arbitrary
+ * axis back to it's original orientation. The first transforms
+ * Rz' and Ry' are considered inverses, since the data from the
+ * arbitrary axis gives you info on how to get to it, not how
+ * to get away from it, and an inverse must be applied.
+ *
+ * The basic calculation used is to recognize that the arbitrary
+ * axis vector (x, y, z), since it is of unit length, actually
+ * represents the sines and cosines of the angles to rotate the
+ * X-axis to the same orientation, with theta being the angle about
+ * Z and phi the angle about Y (in the order described above)
+ * as follows:
+ *
+ * cos ( theta ) = x / sqrt ( 1 - z^2 )
+ * sin ( theta ) = y / sqrt ( 1 - z^2 )
+ *
+ * cos ( phi ) = sqrt ( 1 - z^2 )
+ * sin ( phi ) = z
+ *
+ * Note that cos ( phi ) can further be inserted to the above
+ * formulas:
+ *
+ * cos ( theta ) = x / cos ( phi )
+ * sin ( theta ) = y / sin ( phi )
+ *
+ * ...etc. Because of those relations and the standard trigonometric
+ * relations, it is pssible to reduce the transforms down to what
+ * is used below. It may be that any primary axis chosen will give the
+ * same results (modulo a sign convention) using thie method.
+ *
+ * Particularly nice is to notice that all divisions that might
+ * have caused trouble when parallel to certain planes or
+ * axis go away with care paid to reducing the expressions.
+ * After checking, it does perform correctly under all cases, since
+ * in all the cases of division where the denominator would have
+ * been zero, the numerator would have been zero as well, giving
+ * the expected result.
+ */
+
+ xx = x * x;
+ yy = y * y;
+ zz = z * z;
+ xy = x * y;
+ yz = y * z;
+ zx = z * x;
+ xs = x * s;
+ ys = y * s;
+ zs = z * s;
+ one_c = 1.0F - c;
+
+ /* We already hold the identity-matrix so we can skip some statements */
+ M(0,0) = (one_c * xx) + c;
+ M(0,1) = (one_c * xy) - zs;
+ M(0,2) = (one_c * zx) + ys;
+/* M(0,3) = 0.0F; */
+
+ M(1,0) = (one_c * xy) + zs;
+ M(1,1) = (one_c * yy) + c;
+ M(1,2) = (one_c * yz) - xs;
+/* M(1,3) = 0.0F; */
+
+ M(2,0) = (one_c * zx) - ys;
+ M(2,1) = (one_c * yz) + xs;
+ M(2,2) = (one_c * zz) + c;
+/* M(2,3) = 0.0F; */
+
+/*
+ M(3,0) = 0.0F;
+ M(3,1) = 0.0F;
+ M(3,2) = 0.0F;
+ M(3,3) = 1.0F;
+*/
+ }
+#undef M
+
+ matrix_multf( mat, m, MAT_FLAG_ROTATION );
+}
+
+/**
+ * Apply a perspective projection matrix.
+ *
+ * \param mat matrix to apply the projection.
+ * \param left left clipping plane coordinate.
+ * \param right right clipping plane coordinate.
+ * \param bottom bottom clipping plane coordinate.
+ * \param top top clipping plane coordinate.
+ * \param nearval distance to the near clipping plane.
+ * \param farval distance to the far clipping plane.
+ *
+ * Creates the projection matrix and multiplies it with \p mat, marking the
+ * MAT_FLAG_PERSPECTIVE flag.
+ */
+void
+_math_matrix_frustum( GLmatrix *mat,
+ GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat nearval, GLfloat farval )
+{
+ GLfloat x, y, a, b, c, d;
+ GLfloat m[16];
+
+ x = (2.0F*nearval) / (right-left);
+ y = (2.0F*nearval) / (top-bottom);
+ a = (right+left) / (right-left);
+ b = (top+bottom) / (top-bottom);
+ c = -(farval+nearval) / ( farval-nearval);
+ d = -(2.0F*farval*nearval) / (farval-nearval); /* error? */
+
+#define M(row,col) m[col*4+row]
+ M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F;
+ M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F;
+ M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d;
+ M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F;
+#undef M
+
+ matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE );
+}
+
+/**
+ * Apply an orthographic projection matrix.
+ *
+ * \param mat matrix to apply the projection.
+ * \param left left clipping plane coordinate.
+ * \param right right clipping plane coordinate.
+ * \param bottom bottom clipping plane coordinate.
+ * \param top top clipping plane coordinate.
+ * \param nearval distance to the near clipping plane.
+ * \param farval distance to the far clipping plane.
+ *
+ * Creates the projection matrix and multiplies it with \p mat, marking the
+ * MAT_FLAG_GENERAL_SCALE and MAT_FLAG_TRANSLATION flags.
+ */
+void
+_math_matrix_ortho( GLmatrix *mat,
+ GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat nearval, GLfloat farval )
+{
+ GLfloat m[16];
+
+#define M(row,col) m[col*4+row]
+ M(0,0) = 2.0F / (right-left);
+ M(0,1) = 0.0F;
+ M(0,2) = 0.0F;
+ M(0,3) = -(right+left) / (right-left);
+
+ M(1,0) = 0.0F;
+ M(1,1) = 2.0F / (top-bottom);
+ M(1,2) = 0.0F;
+ M(1,3) = -(top+bottom) / (top-bottom);
+
+ M(2,0) = 0.0F;
+ M(2,1) = 0.0F;
+ M(2,2) = -2.0F / (farval-nearval);
+ M(2,3) = -(farval+nearval) / (farval-nearval);
+
+ M(3,0) = 0.0F;
+ M(3,1) = 0.0F;
+ M(3,2) = 0.0F;
+ M(3,3) = 1.0F;
+#undef M
+
+ matrix_multf( mat, m, (MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION));
+}
+
+/**
+ * Multiply a matrix with a general scaling matrix.
+ *
+ * \param mat matrix.
+ * \param x x axis scale factor.
+ * \param y y axis scale factor.
+ * \param z z axis scale factor.
+ *
+ * Multiplies in-place the elements of \p mat by the scale factors. Checks if
+ * the scales factors are roughly the same, marking the MAT_FLAG_UNIFORM_SCALE
+ * flag, or MAT_FLAG_GENERAL_SCALE. Marks the MAT_DIRTY_TYPE and
+ * MAT_DIRTY_INVERSE dirty flags.
+ */
+void
+_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
+{
+ GLfloat *m = mat->m;
+ m[0] *= x; m[4] *= y; m[8] *= z;
+ m[1] *= x; m[5] *= y; m[9] *= z;
+ m[2] *= x; m[6] *= y; m[10] *= z;
+ m[3] *= x; m[7] *= y; m[11] *= z;
+
+ if (fabs(x - y) < 1e-8 && fabs(x - z) < 1e-8)
+ mat->flags |= MAT_FLAG_UNIFORM_SCALE;
+ else
+ mat->flags |= MAT_FLAG_GENERAL_SCALE;
+
+ mat->flags |= (MAT_DIRTY_TYPE |
+ MAT_DIRTY_INVERSE);
+}
+
+/**
+ * Multiply a matrix with a translation matrix.
+ *
+ * \param mat matrix.
+ * \param x translation vector x coordinate.
+ * \param y translation vector y coordinate.
+ * \param z translation vector z coordinate.
+ *
+ * Adds the translation coordinates to the elements of \p mat in-place. Marks
+ * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE
+ * dirty flags.
+ */
+void
+_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
+{
+ GLfloat *m = mat->m;
+ m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
+ m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
+ m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
+ m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
+
+ mat->flags |= (MAT_FLAG_TRANSLATION |
+ MAT_DIRTY_TYPE |
+ MAT_DIRTY_INVERSE);
+}
+
+/**
+ * Set a matrix to the identity matrix.
+ *
+ * \param mat matrix.
+ *
+ * Copies ::Identity into \p GLmatrix::m, and into GLmatrix::inv if not NULL.
+ * Sets the matrix type to identity, and clear the dirty flags.
+ */
+void
+_math_matrix_set_identity( GLmatrix *mat )
+{
+ MEMCPY( mat->m, Identity, 16*sizeof(GLfloat) );
+
+ if (mat->inv)
+ MEMCPY( mat->inv, Identity, 16*sizeof(GLfloat) );
+
+ mat->type = MATRIX_IDENTITY;
+ mat->flags &= ~(MAT_DIRTY_FLAGS|
+ MAT_DIRTY_TYPE|
+ MAT_DIRTY_INVERSE);
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Matrix analysis */
+/*@{*/
+
+#define ZERO(x) (1<m;
+ GLuint mask = 0;
+ GLuint i;
+
+ for (i = 0 ; i < 16 ; i++) {
+ if (m[i] == 0.0) mask |= (1<flags &= ~MAT_FLAGS_GEOMETRY;
+
+ /* Check for translation - no-one really cares
+ */
+ if ((mask & MASK_NO_TRX) != MASK_NO_TRX)
+ mat->flags |= MAT_FLAG_TRANSLATION;
+
+ /* Do the real work
+ */
+ if (mask == (GLuint) MASK_IDENTITY) {
+ mat->type = MATRIX_IDENTITY;
+ }
+ else if ((mask & MASK_2D_NO_ROT) == (GLuint) MASK_2D_NO_ROT) {
+ mat->type = MATRIX_2D_NO_ROT;
+
+ if ((mask & MASK_NO_2D_SCALE) != MASK_NO_2D_SCALE)
+ mat->flags |= MAT_FLAG_GENERAL_SCALE;
+ }
+ else if ((mask & MASK_2D) == (GLuint) MASK_2D) {
+ GLfloat mm = DOT2(m, m);
+ GLfloat m4m4 = DOT2(m+4,m+4);
+ GLfloat mm4 = DOT2(m,m+4);
+
+ mat->type = MATRIX_2D;
+
+ /* Check for scale */
+ if (SQ(mm-1) > SQ(1e-6) ||
+ SQ(m4m4-1) > SQ(1e-6))
+ mat->flags |= MAT_FLAG_GENERAL_SCALE;
+
+ /* Check for rotation */
+ if (SQ(mm4) > SQ(1e-6))
+ mat->flags |= MAT_FLAG_GENERAL_3D;
+ else
+ mat->flags |= MAT_FLAG_ROTATION;
+
+ }
+ else if ((mask & MASK_3D_NO_ROT) == (GLuint) MASK_3D_NO_ROT) {
+ mat->type = MATRIX_3D_NO_ROT;
+
+ /* Check for scale */
+ if (SQ(m[0]-m[5]) < SQ(1e-6) &&
+ SQ(m[0]-m[10]) < SQ(1e-6)) {
+ if (SQ(m[0]-1.0) > SQ(1e-6)) {
+ mat->flags |= MAT_FLAG_UNIFORM_SCALE;
+ }
+ }
+ else {
+ mat->flags |= MAT_FLAG_GENERAL_SCALE;
+ }
+ }
+ else if ((mask & MASK_3D) == (GLuint) MASK_3D) {
+ GLfloat c1 = DOT3(m,m);
+ GLfloat c2 = DOT3(m+4,m+4);
+ GLfloat c3 = DOT3(m+8,m+8);
+ GLfloat d1 = DOT3(m, m+4);
+ GLfloat cp[3];
+
+ mat->type = MATRIX_3D;
+
+ /* Check for scale */
+ if (SQ(c1-c2) < SQ(1e-6) && SQ(c1-c3) < SQ(1e-6)) {
+ if (SQ(c1-1.0) > SQ(1e-6))
+ mat->flags |= MAT_FLAG_UNIFORM_SCALE;
+ /* else no scale at all */
+ }
+ else {
+ mat->flags |= MAT_FLAG_GENERAL_SCALE;
+ }
+
+ /* Check for rotation */
+ if (SQ(d1) < SQ(1e-6)) {
+ CROSS3( cp, m, m+4 );
+ SUB_3V( cp, cp, (m+8) );
+ if (LEN_SQUARED_3FV(cp) < SQ(1e-6))
+ mat->flags |= MAT_FLAG_ROTATION;
+ else
+ mat->flags |= MAT_FLAG_GENERAL_3D;
+ }
+ else {
+ mat->flags |= MAT_FLAG_GENERAL_3D; /* shear, etc */
+ }
+ }
+ else if ((mask & MASK_PERSPECTIVE) == MASK_PERSPECTIVE && m[11]==-1.0F) {
+ mat->type = MATRIX_PERSPECTIVE;
+ mat->flags |= MAT_FLAG_GENERAL;
+ }
+ else {
+ mat->type = MATRIX_GENERAL;
+ mat->flags |= MAT_FLAG_GENERAL;
+ }
+}
+
+/**
+ * Analyze a matrix given that its flags are accurate.
+ *
+ * This is the more common operation, hopefully.
+ */
+static void analyse_from_flags( GLmatrix *mat )
+{
+ const GLfloat *m = mat->m;
+
+ if (TEST_MAT_FLAGS(mat, 0)) {
+ mat->type = MATRIX_IDENTITY;
+ }
+ else if (TEST_MAT_FLAGS(mat, (MAT_FLAG_TRANSLATION |
+ MAT_FLAG_UNIFORM_SCALE |
+ MAT_FLAG_GENERAL_SCALE))) {
+ if ( m[10]==1.0F && m[14]==0.0F ) {
+ mat->type = MATRIX_2D_NO_ROT;
+ }
+ else {
+ mat->type = MATRIX_3D_NO_ROT;
+ }
+ }
+ else if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) {
+ if ( m[ 8]==0.0F
+ && m[ 9]==0.0F
+ && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F) {
+ mat->type = MATRIX_2D;
+ }
+ else {
+ mat->type = MATRIX_3D;
+ }
+ }
+ else if ( m[4]==0.0F && m[12]==0.0F
+ && m[1]==0.0F && m[13]==0.0F
+ && m[2]==0.0F && m[6]==0.0F
+ && m[3]==0.0F && m[7]==0.0F && m[11]==-1.0F && m[15]==0.0F) {
+ mat->type = MATRIX_PERSPECTIVE;
+ }
+ else {
+ mat->type = MATRIX_GENERAL;
+ }
+}
+
+/**
+ * Analyze and update a matrix.
+ *
+ * \param mat matrix.
+ *
+ * If the matrix type is dirty then calls either analyse_from_scratch() or
+ * analyse_from_flags() to determine its type, according to whether the flags
+ * are dirty or not, respectively. If the matrix has an inverse and it's dirty
+ * then calls matrix_invert(). Finally clears the dirty flags.
+ */
+void
+_math_matrix_analyse( GLmatrix *mat )
+{
+ if (mat->flags & MAT_DIRTY_TYPE) {
+ if (mat->flags & MAT_DIRTY_FLAGS)
+ analyse_from_scratch( mat );
+ else
+ analyse_from_flags( mat );
+ }
+
+ if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) {
+ matrix_invert( mat );
+ }
+
+ mat->flags &= ~(MAT_DIRTY_FLAGS|
+ MAT_DIRTY_TYPE|
+ MAT_DIRTY_INVERSE);
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Matrix setup */
+/*@{*/
+
+/**
+ * Copy a matrix.
+ *
+ * \param to destination matrix.
+ * \param from source matrix.
+ *
+ * Copies all fields in GLmatrix, creating an inverse array if necessary.
+ */
+void
+_math_matrix_copy( GLmatrix *to, const GLmatrix *from )
+{
+ MEMCPY( to->m, from->m, sizeof(Identity) );
+ to->flags = from->flags;
+ to->type = from->type;
+
+ if (to->inv != 0) {
+ if (from->inv == 0) {
+ matrix_invert( to );
+ }
+ else {
+ MEMCPY(to->inv, from->inv, sizeof(GLfloat)*16);
+ }
+ }
+}
+
+/**
+ * Loads a matrix array into GLmatrix.
+ *
+ * \param m matrix array.
+ * \param mat matrix.
+ *
+ * Copies \p m into GLmatrix::m and marks the MAT_FLAG_GENERAL and MAT_DIRTY
+ * flags.
+ */
+void
+_math_matrix_loadf( GLmatrix *mat, const GLfloat *m )
+{
+ MEMCPY( mat->m, m, 16*sizeof(GLfloat) );
+ mat->flags = (MAT_FLAG_GENERAL | MAT_DIRTY);
+}
+
+/**
+ * Matrix constructor.
+ *
+ * \param m matrix.
+ *
+ * Initialize the GLmatrix fields.
+ */
+void
+_math_matrix_ctr( GLmatrix *m )
+{
+ m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
+ if (m->m)
+ MEMCPY( m->m, Identity, sizeof(Identity) );
+ m->inv = NULL;
+ m->type = MATRIX_IDENTITY;
+ m->flags = 0;
+}
+
+/**
+ * Matrix destructor.
+ *
+ * \param m matrix.
+ *
+ * Frees the data in a GLmatrix.
+ */
+void
+_math_matrix_dtr( GLmatrix *m )
+{
+ if (m->m) {
+ ALIGN_FREE( m->m );
+ m->m = NULL;
+ }
+ if (m->inv) {
+ ALIGN_FREE( m->inv );
+ m->inv = NULL;
+ }
+}
+
+/**
+ * Allocate a matrix inverse.
+ *
+ * \param m matrix.
+ *
+ * Allocates the matrix inverse, GLmatrix::inv, and sets it to Identity.
+ */
+void
+_math_matrix_alloc_inv( GLmatrix *m )
+{
+ if (!m->inv) {
+ m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
+ if (m->inv)
+ MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) );
+ }
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Matrix transpose */
+/*@{*/
+
+/**
+ * Transpose a GLfloat matrix.
+ *
+ * \param to destination array.
+ * \param from source array.
+ */
+void
+_math_transposef( GLfloat to[16], const GLfloat from[16] )
+{
+ to[0] = from[0];
+ to[1] = from[4];
+ to[2] = from[8];
+ to[3] = from[12];
+ to[4] = from[1];
+ to[5] = from[5];
+ to[6] = from[9];
+ to[7] = from[13];
+ to[8] = from[2];
+ to[9] = from[6];
+ to[10] = from[10];
+ to[11] = from[14];
+ to[12] = from[3];
+ to[13] = from[7];
+ to[14] = from[11];
+ to[15] = from[15];
+}
+
+/**
+ * Transpose a GLdouble matrix.
+ *
+ * \param to destination array.
+ * \param from source array.
+ */
+void
+_math_transposed( GLdouble to[16], const GLdouble from[16] )
+{
+ to[0] = from[0];
+ to[1] = from[4];
+ to[2] = from[8];
+ to[3] = from[12];
+ to[4] = from[1];
+ to[5] = from[5];
+ to[6] = from[9];
+ to[7] = from[13];
+ to[8] = from[2];
+ to[9] = from[6];
+ to[10] = from[10];
+ to[11] = from[14];
+ to[12] = from[3];
+ to[13] = from[7];
+ to[14] = from[11];
+ to[15] = from[15];
+}
+
+/**
+ * Transpose a GLdouble matrix and convert to GLfloat.
+ *
+ * \param to destination array.
+ * \param from source array.
+ */
+void
+_math_transposefd( GLfloat to[16], const GLdouble from[16] )
+{
+ to[0] = (GLfloat) from[0];
+ to[1] = (GLfloat) from[4];
+ to[2] = (GLfloat) from[8];
+ to[3] = (GLfloat) from[12];
+ to[4] = (GLfloat) from[1];
+ to[5] = (GLfloat) from[5];
+ to[6] = (GLfloat) from[9];
+ to[7] = (GLfloat) from[13];
+ to[8] = (GLfloat) from[2];
+ to[9] = (GLfloat) from[6];
+ to[10] = (GLfloat) from[10];
+ to[11] = (GLfloat) from[14];
+ to[12] = (GLfloat) from[3];
+ to[13] = (GLfloat) from[7];
+ to[14] = (GLfloat) from[11];
+ to[15] = (GLfloat) from[15];
+}
+
+/*@}*/
+
Index: xc/extras/Mesa/src/mesa/math/m_matrix.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_matrix.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_matrix.h Fri Dec 10 10:05:27 2004
@@ -0,0 +1,251 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file math/m_matrix.h
+ * Defines basic structures for matrix-handling.
+ */
+
+#ifndef _M_MATRIX_H
+#define _M_MATRIX_H
+
+
+
+/**
+ * \name Symbolic names to some of the entries in the matrix
+ *
+ * These are handy for the viewport mapping, which is expressed as a matrix.
+ */
+/*@{*/
+#define MAT_SX 0
+#define MAT_SY 5
+#define MAT_SZ 10
+#define MAT_TX 12
+#define MAT_TY 13
+#define MAT_TZ 14
+/*@}*/
+
+
+/**
+ * \defgroup MatFlags MAT_FLAG_XXX-flags
+ *
+ * Bitmasks to indicate different kinds of 4x4 matrices in GLmatrix::flags
+ * It would be nice to make all these flags private to m_matrix.c
+ */
+/*@{*/
+#define MAT_FLAG_IDENTITY 0 /**< is an identity matrix flag.
+ * (Not actually used - the identity
+ * matrix is identified by the absense
+ * of all other flags.)
+ */
+#define MAT_FLAG_GENERAL 0x1 /**< is a general matrix flag */
+#define MAT_FLAG_ROTATION 0x2 /**< is a rotation matrix flag */
+#define MAT_FLAG_TRANSLATION 0x4 /**< is a translation matrix flag */
+#define MAT_FLAG_UNIFORM_SCALE 0x8 /**< is an uniform scaling matrix flag */
+#define MAT_FLAG_GENERAL_SCALE 0x10 /**< is a general scaling matrix flag */
+#define MAT_FLAG_GENERAL_3D 0x20 /**< general 3D matrix flag */
+#define MAT_FLAG_PERSPECTIVE 0x40 /**< is a perspective proj matrix flag */
+#define MAT_FLAG_SINGULAR 0x80 /**< is a singular matrix flag */
+#define MAT_DIRTY_TYPE 0x100 /**< matrix type is dirty */
+#define MAT_DIRTY_FLAGS 0x200 /**< matrix flags are dirty */
+#define MAT_DIRTY_INVERSE 0x400 /**< matrix inverse is dirty */
+
+/** angle preserving matrix flags mask */
+#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \
+ MAT_FLAG_TRANSLATION | \
+ MAT_FLAG_UNIFORM_SCALE)
+
+/** length preserving matrix flags mask */
+#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \
+ MAT_FLAG_TRANSLATION)
+
+/** 3D (non-perspective) matrix flags mask */
+#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \
+ MAT_FLAG_TRANSLATION | \
+ MAT_FLAG_UNIFORM_SCALE | \
+ MAT_FLAG_GENERAL_SCALE | \
+ MAT_FLAG_GENERAL_3D)
+
+/** geometry related matrix flags mask */
+#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \
+ MAT_FLAG_ROTATION | \
+ MAT_FLAG_TRANSLATION | \
+ MAT_FLAG_UNIFORM_SCALE | \
+ MAT_FLAG_GENERAL_SCALE | \
+ MAT_FLAG_GENERAL_3D | \
+ MAT_FLAG_PERSPECTIVE | \
+ MAT_FLAG_SINGULAR)
+
+/** dirty matrix flags mask */
+#define MAT_DIRTY (MAT_DIRTY_TYPE | \
+ MAT_DIRTY_FLAGS | \
+ MAT_DIRTY_INVERSE)
+
+/*@}*/
+
+
+/**
+ * Test geometry related matrix flags.
+ *
+ * \param mat a pointer to a GLmatrix structure.
+ * \param a flags mask.
+ *
+ * \returns non-zero if all geometry related matrix flags are contained within
+ * the mask, or zero otherwise.
+ */
+#define TEST_MAT_FLAGS(mat, a) \
+ ((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0)
+
+
+/**
+ * Different kinds of 4x4 transformation matrices.
+ * We use these to select specific optimized vertex transformation routines.
+ */
+enum GLmatrixtype {
+ MATRIX_GENERAL, /**< general 4x4 matrix */
+ MATRIX_IDENTITY, /**< identity matrix */
+ MATRIX_3D_NO_ROT, /**< orthogonal projection and others... */
+ MATRIX_PERSPECTIVE, /**< perspective projection matrix */
+ MATRIX_2D, /**< 2-D transformation */
+ MATRIX_2D_NO_ROT, /**< 2-D scale & translate only */
+ MATRIX_3D /**< 3-D transformation */
+} ;
+
+/**
+ * Matrix type to represent 4x4 transformation matrices.
+ */
+typedef struct {
+ GLfloat *m; /**< 16 matrix elements (16-byte aligned) */
+ GLfloat *inv; /**< optional 16-element inverse (16-byte aligned) */
+ GLuint flags; /**< possible values determined by (of \link
+ * MatFlags MAT_FLAG_* flags\endlink)
+ */
+ enum GLmatrixtype type;
+} GLmatrix;
+
+
+
+
+extern void
+_math_matrix_ctr( GLmatrix *m );
+
+extern void
+_math_matrix_dtr( GLmatrix *m );
+
+extern void
+_math_matrix_alloc_inv( GLmatrix *m );
+
+extern void
+_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b );
+
+extern void
+_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *b );
+
+extern void
+_math_matrix_loadf( GLmatrix *mat, const GLfloat *m );
+
+extern void
+_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z );
+
+extern void
+_math_matrix_rotate( GLmatrix *m, GLfloat angle,
+ GLfloat x, GLfloat y, GLfloat z );
+
+extern void
+_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z );
+
+extern void
+_math_matrix_ortho( GLmatrix *mat,
+ GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat nearval, GLfloat farval );
+
+extern void
+_math_matrix_frustum( GLmatrix *mat,
+ GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat nearval, GLfloat farval );
+
+extern void
+_math_matrix_set_identity( GLmatrix *dest );
+
+extern void
+_math_matrix_copy( GLmatrix *to, const GLmatrix *from );
+
+extern void
+_math_matrix_analyse( GLmatrix *mat );
+
+extern void
+_math_matrix_print( const GLmatrix *m );
+
+
+
+/**
+ * \name Related functions that don't actually operate on GLmatrix structs
+ */
+/*@{*/
+
+extern void
+_math_transposef( GLfloat to[16], const GLfloat from[16] );
+
+extern void
+_math_transposed( GLdouble to[16], const GLdouble from[16] );
+
+extern void
+_math_transposefd( GLfloat to[16], const GLdouble from[16] );
+
+
+/*
+ * Transform a point (column vector) by a matrix: Q = M * P
+ */
+#define TRANSFORM_POINT( Q, M, P ) \
+ Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; \
+ Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; \
+ Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; \
+ Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3];
+
+
+#define TRANSFORM_POINT3( Q, M, P ) \
+ Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; \
+ Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; \
+ Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; \
+ Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15];
+
+
+/*
+ * Transform a normal (row vector) by a matrix: [NX NY NZ] = N * MAT
+ */
+#define TRANSFORM_NORMAL( TO, N, MAT ) \
+do { \
+ TO[0] = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2]; \
+ TO[1] = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6]; \
+ TO[2] = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10]; \
+} while (0)
+
+
+/*@}*/
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/math/m_norm_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_norm_tmp.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_norm_tmp.h Thu Apr 8 05:17:53 2004
@@ -0,0 +1,390 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+/* Functions to tranform a vector of normals. This includes applying
+ * the transformation matrix, rescaling and normalization.
+ */
+
+/*
+ * mat - the 4x4 transformation matrix
+ * scale - uniform scale factor of the transformation matrix (not always used)
+ * in - the source vector of normals
+ * lengths - length of each incoming normal (may be NULL) (a display list
+ * optimization)
+ * dest - the destination vector of normals
+ */
+static void _XFORMAPI
+TAG(transform_normalize_normals)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ const GLfloat *m = mat->inv;
+ GLfloat m0 = m[0], m4 = m[4], m8 = m[8];
+ GLfloat m1 = m[1], m5 = m[5], m9 = m[9];
+ GLfloat m2 = m[2], m6 = m[6], m10 = m[10];
+ GLuint i;
+
+ if (!lengths) {
+ STRIDE_LOOP {
+ GLfloat tx, ty, tz;
+ {
+ const GLfloat ux = from[0], uy = from[1], uz = from[2];
+ tx = ux * m0 + uy * m1 + uz * m2;
+ ty = ux * m4 + uy * m5 + uz * m6;
+ tz = ux * m8 + uy * m9 + uz * m10;
+ }
+ {
+ GLdouble len = tx*tx + ty*ty + tz*tz;
+ if (len > 1e-20) {
+ GLfloat scale = INV_SQRTF(len);
+ out[i][0] = tx * scale;
+ out[i][1] = ty * scale;
+ out[i][2] = tz * scale;
+ }
+ else {
+ out[i][0] = out[i][1] = out[i][2] = 0;
+ }
+ }
+ }
+ }
+ else {
+ if (scale != 1.0) {
+ m0 *= scale, m4 *= scale, m8 *= scale;
+ m1 *= scale, m5 *= scale, m9 *= scale;
+ m2 *= scale, m6 *= scale, m10 *= scale;
+ }
+
+ STRIDE_LOOP {
+ GLfloat tx, ty, tz;
+ {
+ const GLfloat ux = from[0], uy = from[1], uz = from[2];
+ tx = ux * m0 + uy * m1 + uz * m2;
+ ty = ux * m4 + uy * m5 + uz * m6;
+ tz = ux * m8 + uy * m9 + uz * m10;
+ }
+ {
+ GLfloat len = lengths[i];
+ out[i][0] = tx * len;
+ out[i][1] = ty * len;
+ out[i][2] = tz * len;
+ }
+ }
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ const GLfloat *m = mat->inv;
+ GLfloat m0 = m[0];
+ GLfloat m5 = m[5];
+ GLfloat m10 = m[10];
+ GLuint i;
+
+ if (!lengths) {
+ STRIDE_LOOP {
+ GLfloat tx, ty, tz;
+ {
+ const GLfloat ux = from[0], uy = from[1], uz = from[2];
+ tx = ux * m0 ;
+ ty = uy * m5 ;
+ tz = uz * m10;
+ }
+ {
+ GLdouble len = tx*tx + ty*ty + tz*tz;
+ if (len > 1e-20) {
+ GLfloat scale = INV_SQRTF(len);
+ out[i][0] = tx * scale;
+ out[i][1] = ty * scale;
+ out[i][2] = tz * scale;
+ }
+ else {
+ out[i][0] = out[i][1] = out[i][2] = 0;
+ }
+ }
+ }
+ }
+ else {
+ m0 *= scale;
+ m5 *= scale;
+ m10 *= scale;
+
+ STRIDE_LOOP {
+ GLfloat tx, ty, tz;
+ {
+ const GLfloat ux = from[0], uy = from[1], uz = from[2];
+ tx = ux * m0 ;
+ ty = uy * m5 ;
+ tz = uz * m10;
+ }
+ {
+ GLfloat len = lengths[i];
+ out[i][0] = tx * len;
+ out[i][1] = ty * len;
+ out[i][2] = tz * len;
+ }
+ }
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ const GLfloat *m = mat->inv;
+ const GLfloat m0 = scale*m[0];
+ const GLfloat m5 = scale*m[5];
+ const GLfloat m10 = scale*m[10];
+ GLuint i;
+
+ (void) lengths;
+
+ STRIDE_LOOP {
+ GLfloat ux = from[0], uy = from[1], uz = from[2];
+ out[i][0] = ux * m0;
+ out[i][1] = uy * m5;
+ out[i][2] = uz * m10;
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(transform_rescale_normals)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ /* Since we are unlikely to have < 3 vertices in the buffer,
+ * it makes sense to pre-multiply by scale.
+ */
+ const GLfloat *m = mat->inv;
+ const GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8];
+ const GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9];
+ const GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10];
+ GLuint i;
+
+ (void) lengths;
+
+ STRIDE_LOOP {
+ GLfloat ux = from[0], uy = from[1], uz = from[2];
+ out[i][0] = ux * m0 + uy * m1 + uz * m2;
+ out[i][1] = ux * m4 + uy * m5 + uz * m6;
+ out[i][2] = ux * m8 + uy * m9 + uz * m10;
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(transform_normals_no_rot)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ const GLfloat *m = mat->inv;
+ const GLfloat m0 = m[0];
+ const GLfloat m5 = m[5];
+ const GLfloat m10 = m[10];
+ GLuint i;
+
+ (void) scale;
+ (void) lengths;
+
+ STRIDE_LOOP {
+ GLfloat ux = from[0], uy = from[1], uz = from[2];
+ out[i][0] = ux * m0;
+ out[i][1] = uy * m5;
+ out[i][2] = uz * m10;
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(transform_normals)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ const GLfloat *m = mat->inv;
+ const GLfloat m0 = m[0], m4 = m[4], m8 = m[8];
+ const GLfloat m1 = m[1], m5 = m[5], m9 = m[9];
+ const GLfloat m2 = m[2], m6 = m[6], m10 = m[10];
+ GLuint i;
+
+ (void) scale;
+ (void) lengths;
+
+ STRIDE_LOOP {
+ GLfloat ux = from[0], uy = from[1], uz = from[2];
+ out[i][0] = ux * m0 + uy * m1 + uz * m2;
+ out[i][1] = ux * m4 + uy * m5 + uz * m6;
+ out[i][2] = ux * m8 + uy * m9 + uz * m10;
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(normalize_normals)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ GLuint i;
+
+ (void) mat;
+ (void) scale;
+
+ if (lengths) {
+ STRIDE_LOOP {
+ const GLfloat x = from[0], y = from[1], z = from[2];
+ GLfloat invlen = lengths[i];
+ out[i][0] = x * invlen;
+ out[i][1] = y * invlen;
+ out[i][2] = z * invlen;
+ }
+ }
+ else {
+ STRIDE_LOOP {
+ const GLfloat x = from[0], y = from[1], z = from[2];
+ GLdouble len = x * x + y * y + z * z;
+ if (len > 1e-50) {
+ len = INV_SQRTF(len);
+ out[i][0] = (GLfloat)(x * len);
+ out[i][1] = (GLfloat)(y * len);
+ out[i][2] = (GLfloat)(z * len);
+ }
+ else {
+ out[i][0] = x;
+ out[i][1] = y;
+ out[i][2] = z;
+ }
+ }
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(rescale_normals)( const GLmatrix *mat,
+ GLfloat scale,
+ const GLvector4f *in,
+ const GLfloat *lengths,
+ GLvector4f *dest )
+{
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
+ const GLfloat *from = in->start;
+ const GLuint stride = in->stride;
+ const GLuint count = in->count;
+ GLuint i;
+
+ (void) mat;
+ (void) lengths;
+
+ STRIDE_LOOP {
+ SCALE_SCALAR_3V( out[i], scale, from );
+ }
+ dest->count = in->count;
+}
+
+
+static void _XFORMAPI
+TAG(init_c_norm_transform)( void )
+{
+ _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =
+ TAG(transform_normals_no_rot);
+
+ _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =
+ TAG(transform_rescale_normals_no_rot);
+
+ _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =
+ TAG(transform_normalize_normals_no_rot);
+
+ _mesa_normal_tab[NORM_TRANSFORM] =
+ TAG(transform_normals);
+
+ _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =
+ TAG(transform_rescale_normals);
+
+ _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =
+ TAG(transform_normalize_normals);
+
+ _mesa_normal_tab[NORM_RESCALE] =
+ TAG(rescale_normals);
+
+ _mesa_normal_tab[NORM_NORMALIZE] =
+ TAG(normalize_normals);
+}
Index: xc/extras/Mesa/src/mesa/math/m_trans_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_trans_tmp.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_trans_tmp.h Thu Apr 8 05:17:53 2004
@@ -0,0 +1,287 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+/* KW: This file also included by tnl/trans_elt.c to build code
+ * specific to the implementation of array-elements in the
+ * tnl module.
+ */
+
+
+#ifdef DEST_4F
+static void DEST_4F( GLfloat (*t)[4],
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
+ const GLubyte *first = f;
+ GLuint i;
+
+ (void) first;
+ (void) start;
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
+ if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
+ if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
+ if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0;
+ }
+ }
+}
+#endif
+
+
+
+#ifdef DEST_4FC
+static void DEST_4FC( GLfloat (*t)[4],
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
+ const GLubyte *first = f;
+ GLuint i;
+
+ (void) first;
+ (void) start;
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ if (SZ >= 1) t[i][0] = TRX_4FC(f, 0);
+ if (SZ >= 2) t[i][1] = TRX_4FC(f, 1);
+ if (SZ >= 3) t[i][2] = TRX_4FC(f, 2);
+ if (SZ == 4) t[i][3] = TRX_4FC(f, 3); else t[i][3] = 1.0;
+ }
+ }
+}
+#endif
+
+
+#ifdef DEST_3F
+static void DEST_3F( GLfloat (*t)[3],
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
+ const GLubyte *first = f;
+ GLuint i;
+ (void) first;
+ (void) start;
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ t[i][0] = TRX_3F(f, 0);
+ t[i][1] = TRX_3F(f, 1);
+ t[i][2] = TRX_3F(f, 2);
+ }
+ }
+}
+#endif
+
+#ifdef DEST_1F
+static void DEST_1F( GLfloat *t,
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
+ const GLubyte *first = f;
+ GLuint i;
+ (void) first;
+ (void) start;
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ t[i] = TRX_1F(f, 0);
+ }
+ }
+}
+#endif
+
+#ifdef DEST_4UB
+static void DEST_4UB( GLubyte (*t)[4],
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
+ const GLubyte *first = f;
+ GLuint i;
+ (void) start;
+ (void) first;
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ if (SZ >= 1) TRX_UB(t[i][0], f, 0);
+ if (SZ >= 2) TRX_UB(t[i][1], f, 1);
+ if (SZ >= 3) TRX_UB(t[i][2], f, 2);
+ if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
+ }
+ }
+}
+#endif
+
+
+#ifdef DEST_4US
+static void DEST_4US( GLushort (*t)[4],
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride);
+ const GLubyte *first = f;
+ GLuint i;
+ (void) start;
+ (void) first;
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ if (SZ >= 1) TRX_US(t[i][0], f, 0);
+ if (SZ >= 2) TRX_US(t[i][1], f, 1);
+ if (SZ >= 3) TRX_US(t[i][2], f, 2);
+ if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535;
+ }
+ }
+}
+#endif
+
+
+#ifdef DEST_1UB
+static void DEST_1UB( GLubyte *t,
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
+ const GLubyte *first = f;
+ GLuint i;
+ (void) start;
+ (void) first;
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ TRX_UB(t[i], f, 0);
+ }
+ }
+}
+#endif
+
+
+#ifdef DEST_1UI
+static void DEST_1UI( GLuint *t,
+ CONST void *ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
+ const GLubyte *first = f;
+ GLuint i;
+ (void) start;
+ (void) first;
+
+ for (i = DST_START ; i < n ; i++, NEXT_F) {
+ CHECK {
+ NEXT_F2;
+ t[i] = TRX_UI(f, 0);
+ }
+ }
+}
+#endif
+
+
+static void INIT(void)
+{
+#ifdef DEST_1UI
+ ASSERT(SZ == 1);
+ TAB(_1ui)[SRC_IDX] = DEST_1UI;
+#endif
+#ifdef DEST_1UB
+ ASSERT(SZ == 1);
+ TAB(_1ub)[SRC_IDX] = DEST_1UB;
+#endif
+#ifdef DEST_1F
+ ASSERT(SZ == 1);
+ TAB(_1f)[SRC_IDX] = DEST_1F;
+#endif
+#ifdef DEST_3F
+ ASSERT(SZ == 3);
+ TAB(_3f)[SRC_IDX] = DEST_3F;
+#endif
+#ifdef DEST_4UB
+ TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB;
+#endif
+#ifdef DEST_4US
+ TAB(_4us)[SZ][SRC_IDX] = DEST_4US;
+#endif
+#ifdef DEST_4F
+ TAB(_4f)[SZ][SRC_IDX] = DEST_4F;
+#endif
+#ifdef DEST_4FC
+ TAB(_4fc)[SZ][SRC_IDX] = DEST_4FC;
+#endif
+
+}
+
+
+#ifdef INIT
+#undef INIT
+#endif
+#ifdef DEST_1UI
+#undef DEST_1UI
+#endif
+#ifdef DEST_1UB
+#undef DEST_1UB
+#endif
+#ifdef DEST_4UB
+#undef DEST_4UB
+#endif
+#ifdef DEST_4US
+#undef DEST_4US
+#endif
+#ifdef DEST_3F
+#undef DEST_3F
+#endif
+#ifdef DEST_4F
+#undef DEST_4F
+#endif
+#ifdef DEST_4FC
+#undef DEST_4FC
+#endif
+#ifdef DEST_1F
+#undef DEST_1F
+#endif
+#ifdef SZ
+#undef SZ
+#endif
+#ifdef TAG
+#undef TAG
+#endif
+
Index: xc/extras/Mesa/src/mesa/math/m_translate.c
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_translate.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_translate.c Thu Apr 8 05:17:53 2004
@@ -0,0 +1,718 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+#include "glheader.h"
+#include "mtypes.h" /* GLchan hack */
+#include "colormac.h"
+
+#include "m_translate.h"
+
+
+
+typedef void (*trans_1f_func)(GLfloat *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLuint start,
+ GLuint n );
+
+typedef void (*trans_1ui_func)(GLuint *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLuint start,
+ GLuint n );
+
+typedef void (*trans_1ub_func)(GLubyte *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLuint start,
+ GLuint n );
+
+typedef void (*trans_4ub_func)(GLubyte (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLuint start,
+ GLuint n );
+
+typedef void (*trans_4us_func)(GLushort (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLuint start,
+ GLuint n );
+
+typedef void (*trans_4f_func)(GLfloat (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLuint start,
+ GLuint n );
+
+typedef void (*trans_3f_func)(GLfloat (*to)[3],
+ CONST void *ptr,
+ GLuint stride,
+ GLuint start,
+ GLuint n );
+
+
+
+
+#define TYPE_IDX(t) ((t) & 0xf)
+#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */
+
+
+/* This macro is used on other systems, so undefine it for this module */
+
+#undef CHECK
+
+static trans_1f_func _math_trans_1f_tab[MAX_TYPES];
+static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES];
+static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES];
+static trans_3f_func _math_trans_3f_tab[MAX_TYPES];
+static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES];
+static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES];
+static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES];
+static trans_4f_func _math_trans_4fc_tab[5][MAX_TYPES];
+
+
+#define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt])
+
+
+#define TAB(x) _math_trans##x##_tab
+#define ARGS GLuint start, GLuint n
+#define SRC_START start
+#define DST_START 0
+#define STRIDE stride
+#define NEXT_F f += stride
+#define NEXT_F2
+#define CHECK
+
+
+
+
+/* GL_BYTE
+ */
+#define SRC GLbyte
+#define SRC_IDX TYPE_IDX(GL_BYTE)
+#define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) )
+#define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) )
+#define TRX_4FC(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) )
+#define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) )
+#define TRX_US(ch, f,n) ch = BYTE_TO_USHORT( PTR_ELT(f,n) )
+#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n))
+
+
+#define SZ 4
+#define INIT init_trans_4_GLbyte_raw
+#define DEST_4F trans_4_GLbyte_4f_raw
+#define DEST_4FC trans_4_GLbyte_4fc_raw
+#define DEST_4UB trans_4_GLbyte_4ub_raw
+#define DEST_4US trans_4_GLbyte_4us_raw
+#include "m_trans_tmp.h"
+
+#define SZ 3
+#define INIT init_trans_3_GLbyte_raw
+#define DEST_4F trans_3_GLbyte_4f_raw
+#define DEST_4FC trans_3_GLbyte_4fc_raw
+#define DEST_4UB trans_3_GLbyte_4ub_raw
+#define DEST_4US trans_3_GLbyte_4us_raw
+#define DEST_3F trans_3_GLbyte_3f_raw
+#include "m_trans_tmp.h"
+
+#define SZ 2
+#define INIT init_trans_2_GLbyte_raw
+#define DEST_4F trans_2_GLbyte_4f_raw
+#define DEST_4FC trans_2_GLbyte_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 1
+#define INIT init_trans_1_GLbyte_raw
+#define DEST_4F trans_1_GLbyte_4f_raw
+#define DEST_4FC trans_1_GLbyte_4fc_raw
+#define DEST_1UB trans_1_GLbyte_1ub_raw
+#define DEST_1UI trans_1_GLbyte_1ui_raw
+#include "m_trans_tmp.h"
+
+#undef SRC
+#undef TRX_3F
+#undef TRX_4F
+#undef TRX_4FC
+#undef TRX_UB
+#undef TRX_US
+#undef TRX_UI
+#undef SRC_IDX
+
+
+/* GL_UNSIGNED_BYTE
+ */
+#define SRC GLubyte
+#define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE)
+#define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n))
+#define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n))
+#define TRX_4FC(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n))
+#define TRX_UB(ub, f,n) ub = PTR_ELT(f,n)
+#define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n))
+#define TRX_UI(f,n) (GLuint)PTR_ELT(f,n)
+
+/* 4ub->4ub handled in special case below.
+ */
+#define SZ 4
+#define INIT init_trans_4_GLubyte_raw
+#define DEST_4F trans_4_GLubyte_4f_raw
+#define DEST_4FC trans_4_GLubyte_4fc_raw
+#define DEST_4US trans_4_GLubyte_4us_raw
+#include "m_trans_tmp.h"
+
+
+#define SZ 3
+#define INIT init_trans_3_GLubyte_raw
+#define DEST_4UB trans_3_GLubyte_4ub_raw
+#define DEST_4US trans_3_GLubyte_4us_raw
+#define DEST_3F trans_3_GLubyte_3f_raw
+#define DEST_4F trans_3_GLubyte_4f_raw
+#define DEST_4FC trans_3_GLubyte_4fc_raw
+#include "m_trans_tmp.h"
+
+
+#define SZ 1
+#define INIT init_trans_1_GLubyte_raw
+#define DEST_1UI trans_1_GLubyte_1ui_raw
+#define DEST_1UB trans_1_GLubyte_1ub_raw
+#include "m_trans_tmp.h"
+
+#undef SRC
+#undef SRC_IDX
+#undef TRX_3F
+#undef TRX_4F
+#undef TRX_4FC
+#undef TRX_UB
+#undef TRX_US
+#undef TRX_UI
+
+
+/* GL_SHORT
+ */
+#define SRC GLshort
+#define SRC_IDX TYPE_IDX(GL_SHORT)
+#define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) )
+#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n))
+#define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n))
+#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n))
+
+
+#define SZ 4
+#define INIT init_trans_4_GLshort_raw
+#define DEST_4F trans_4_GLshort_4f_raw
+#define DEST_4FC trans_4_GLshort_4fc_raw
+#define DEST_4UB trans_4_GLshort_4ub_raw
+#define DEST_4US trans_4_GLshort_4us_raw
+#include "m_trans_tmp.h"
+
+#define SZ 3
+#define INIT init_trans_3_GLshort_raw
+#define DEST_4F trans_3_GLshort_4f_raw
+#define DEST_4FC trans_3_GLshort_4fc_raw
+#define DEST_4UB trans_3_GLshort_4ub_raw
+#define DEST_4US trans_3_GLshort_4us_raw
+#define DEST_3F trans_3_GLshort_3f_raw
+#include "m_trans_tmp.h"
+
+#define SZ 2
+#define INIT init_trans_2_GLshort_raw
+#define DEST_4F trans_2_GLshort_4f_raw
+#define DEST_4FC trans_2_GLshort_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 1
+#define INIT init_trans_1_GLshort_raw
+#define DEST_4F trans_1_GLshort_4f_raw
+#define DEST_4FC trans_1_GLshort_4fc_raw
+#define DEST_1UB trans_1_GLshort_1ub_raw
+#define DEST_1UI trans_1_GLshort_1ui_raw
+#include "m_trans_tmp.h"
+
+
+#undef SRC
+#undef SRC_IDX
+#undef TRX_3F
+#undef TRX_4F
+#undef TRX_4FC
+#undef TRX_UB
+#undef TRX_US
+#undef TRX_UI
+
+
+/* GL_UNSIGNED_SHORT
+ */
+#define SRC GLushort
+#define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT)
+#define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) )
+#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8)
+#define TRX_US(us,f,n) us = (GLushort) (PTR_ELT(f,n) >> 8)
+#define TRX_UI(f,n) (GLuint) PTR_ELT(f,n)
+
+
+#define SZ 4
+#define INIT init_trans_4_GLushort_raw
+#define DEST_4F trans_4_GLushort_4f_raw
+#define DEST_4FC trans_4_GLushort_4fc_raw
+#define DEST_4UB trans_4_GLushort_4ub_raw
+#define DEST_4US trans_4_GLushort_4us_raw
+#include "m_trans_tmp.h"
+
+#define SZ 3
+#define INIT init_trans_3_GLushort_raw
+#define DEST_4F trans_3_GLushort_4f_raw
+#define DEST_4FC trans_3_GLushort_4fc_raw
+#define DEST_4UB trans_3_GLushort_4ub_raw
+#define DEST_4US trans_3_GLushort_4us_raw
+#define DEST_3F trans_3_GLushort_3f_raw
+#include "m_trans_tmp.h"
+
+#define SZ 2
+#define INIT init_trans_2_GLushort_raw
+#define DEST_4F trans_2_GLushort_4f_raw
+#define DEST_4FC trans_2_GLushort_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 1
+#define INIT init_trans_1_GLushort_raw
+#define DEST_4F trans_1_GLushort_4f_raw
+#define DEST_4FC trans_1_GLushort_4fc_raw
+#define DEST_1UB trans_1_GLushort_1ub_raw
+#define DEST_1UI trans_1_GLushort_1ui_raw
+#include "m_trans_tmp.h"
+
+#undef SRC
+#undef SRC_IDX
+#undef TRX_3F
+#undef TRX_4F
+#undef TRX_4FC
+#undef TRX_UB
+#undef TRX_US
+#undef TRX_UI
+
+
+/* GL_INT
+ */
+#define SRC GLint
+#define SRC_IDX TYPE_IDX(GL_INT)
+#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) )
+#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n))
+#define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n))
+#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n))
+
+
+#define SZ 4
+#define INIT init_trans_4_GLint_raw
+#define DEST_4F trans_4_GLint_4f_raw
+#define DEST_4FC trans_4_GLint_4fc_raw
+#define DEST_4UB trans_4_GLint_4ub_raw
+#define DEST_4US trans_4_GLint_4us_raw
+#include "m_trans_tmp.h"
+
+#define SZ 3
+#define INIT init_trans_3_GLint_raw
+#define DEST_4F trans_3_GLint_4f_raw
+#define DEST_4FC trans_3_GLint_4fc_raw
+#define DEST_4UB trans_3_GLint_4ub_raw
+#define DEST_4US trans_3_GLint_4us_raw
+#define DEST_3F trans_3_GLint_3f_raw
+#include "m_trans_tmp.h"
+
+#define SZ 2
+#define INIT init_trans_2_GLint_raw
+#define DEST_4F trans_2_GLint_4f_raw
+#define DEST_4FC trans_2_GLint_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 1
+#define INIT init_trans_1_GLint_raw
+#define DEST_4F trans_1_GLint_4f_raw
+#define DEST_4FC trans_1_GLint_4fc_raw
+#define DEST_1UB trans_1_GLint_1ub_raw
+#define DEST_1UI trans_1_GLint_1ui_raw
+#include "m_trans_tmp.h"
+
+
+#undef SRC
+#undef SRC_IDX
+#undef TRX_3F
+#undef TRX_4F
+#undef TRX_4FC
+#undef TRX_UB
+#undef TRX_US
+#undef TRX_UI
+
+
+/* GL_UNSIGNED_INT
+ */
+#define SRC GLuint
+#define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT)
+#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) )
+#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) )
+#define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24)
+#define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16)
+#define TRX_UI(f,n) PTR_ELT(f,n)
+
+
+#define SZ 4
+#define INIT init_trans_4_GLuint_raw
+#define DEST_4F trans_4_GLuint_4f_raw
+#define DEST_4FC trans_4_GLuint_4fc_raw
+#define DEST_4UB trans_4_GLuint_4ub_raw
+#define DEST_4US trans_4_GLuint_4us_raw
+#include "m_trans_tmp.h"
+
+#define SZ 3
+#define INIT init_trans_3_GLuint_raw
+#define DEST_4F trans_3_GLuint_4f_raw
+#define DEST_4FC trans_3_GLuint_4fc_raw
+#define DEST_4UB trans_3_GLuint_4ub_raw
+#define DEST_4US trans_3_GLuint_4us_raw
+#define DEST_3F trans_3_GLuint_3f_raw
+#include "m_trans_tmp.h"
+
+#define SZ 2
+#define INIT init_trans_2_GLuint_raw
+#define DEST_4F trans_2_GLuint_4f_raw
+#define DEST_4FC trans_2_GLuint_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 1
+#define INIT init_trans_1_GLuint_raw
+#define DEST_4F trans_1_GLuint_4f_raw
+#define DEST_4FC trans_1_GLuint_4fc_raw
+#define DEST_1UB trans_1_GLuint_1ub_raw
+#define DEST_1UI trans_1_GLuint_1ui_raw
+#include "m_trans_tmp.h"
+
+#undef SRC
+#undef SRC_IDX
+#undef TRX_3F
+#undef TRX_4F
+#undef TRX_4FC
+#undef TRX_UB
+#undef TRX_US
+#undef TRX_UI
+
+
+/* GL_DOUBLE
+ */
+#define SRC GLdouble
+#define SRC_IDX TYPE_IDX(GL_DOUBLE)
+#define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n)
+#define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n)
+#define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n)
+#define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n))
+#define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n))
+#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n)
+#define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n)
+
+
+#define SZ 4
+#define INIT init_trans_4_GLdouble_raw
+#define DEST_4F trans_4_GLdouble_4f_raw
+#define DEST_4FC trans_4_GLdouble_4fc_raw
+#define DEST_4UB trans_4_GLdouble_4ub_raw
+#define DEST_4US trans_4_GLdouble_4us_raw
+#include "m_trans_tmp.h"
+
+#define SZ 3
+#define INIT init_trans_3_GLdouble_raw
+#define DEST_4F trans_3_GLdouble_4f_raw
+#define DEST_4FC trans_3_GLdouble_4fc_raw
+#define DEST_4UB trans_3_GLdouble_4ub_raw
+#define DEST_4US trans_3_GLdouble_4us_raw
+#define DEST_3F trans_3_GLdouble_3f_raw
+#include "m_trans_tmp.h"
+
+#define SZ 2
+#define INIT init_trans_2_GLdouble_raw
+#define DEST_4F trans_2_GLdouble_4f_raw
+#define DEST_4FC trans_2_GLdouble_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 1
+#define INIT init_trans_1_GLdouble_raw
+#define DEST_4F trans_1_GLdouble_4f_raw
+#define DEST_4FC trans_1_GLdouble_4fc_raw
+#define DEST_1UB trans_1_GLdouble_1ub_raw
+#define DEST_1UI trans_1_GLdouble_1ui_raw
+#define DEST_1F trans_1_GLdouble_1f_raw
+#include "m_trans_tmp.h"
+
+#undef SRC
+#undef SRC_IDX
+
+/* GL_FLOAT
+ */
+#define SRC GLfloat
+#define SRC_IDX TYPE_IDX(GL_FLOAT)
+#define SZ 4
+#define INIT init_trans_4_GLfloat_raw
+#define DEST_4UB trans_4_GLfloat_4ub_raw
+#define DEST_4US trans_4_GLfloat_4us_raw
+#define DEST_4F trans_4_GLfloat_4f_raw
+#define DEST_4FC trans_4_GLfloat_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 3
+#define INIT init_trans_3_GLfloat_raw
+#define DEST_4F trans_3_GLfloat_4f_raw
+#define DEST_4FC trans_3_GLfloat_4fc_raw
+#define DEST_4UB trans_3_GLfloat_4ub_raw
+#define DEST_4US trans_3_GLfloat_4us_raw
+#define DEST_3F trans_3_GLfloat_3f_raw
+#include "m_trans_tmp.h"
+
+#define SZ 2
+#define INIT init_trans_2_GLfloat_raw
+#define DEST_4F trans_2_GLfloat_4f_raw
+#define DEST_4FC trans_2_GLfloat_4fc_raw
+#include "m_trans_tmp.h"
+
+#define SZ 1
+#define INIT init_trans_1_GLfloat_raw
+#define DEST_4F trans_1_GLfloat_4f_raw
+#define DEST_4FC trans_1_GLfloat_4fc_raw
+#define DEST_1UB trans_1_GLfloat_1ub_raw
+#define DEST_1UI trans_1_GLfloat_1ui_raw
+#define DEST_1F trans_1_GLfloat_1f_raw
+
+#include "m_trans_tmp.h"
+
+#undef SRC
+#undef SRC_IDX
+#undef TRX_3F
+#undef TRX_4F
+#undef TRX_4FC
+#undef TRX_UB
+#undef TRX_US
+#undef TRX_UI
+
+
+static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4],
+ CONST void *Ptr,
+ GLuint stride,
+ ARGS )
+{
+ const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride;
+ GLuint i;
+
+ if (((((long) f | (long) stride)) & 3L) == 0L) {
+ /* Aligned.
+ */
+ for (i = DST_START ; i < n ; i++, f += stride) {
+ COPY_4UBV( t[i], f );
+ }
+ } else {
+ for (i = DST_START ; i < n ; i++, f += stride) {
+ t[i][0] = f[0];
+ t[i][1] = f[1];
+ t[i][2] = f[2];
+ t[i][3] = f[3];
+ }
+ }
+}
+
+
+static void init_translate_raw(void)
+{
+ MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) );
+ MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) );
+ MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) );
+ MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) );
+ MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) );
+ MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) );
+ MEMSET( TAB(_4fc), 0, sizeof(TAB(_4fc)) );
+
+ init_trans_4_GLbyte_raw();
+ init_trans_3_GLbyte_raw();
+ init_trans_2_GLbyte_raw();
+ init_trans_1_GLbyte_raw();
+ init_trans_1_GLubyte_raw();
+ init_trans_3_GLubyte_raw();
+ init_trans_4_GLubyte_raw();
+ init_trans_4_GLshort_raw();
+ init_trans_3_GLshort_raw();
+ init_trans_2_GLshort_raw();
+ init_trans_1_GLshort_raw();
+ init_trans_4_GLushort_raw();
+ init_trans_3_GLushort_raw();
+ init_trans_2_GLushort_raw();
+ init_trans_1_GLushort_raw();
+ init_trans_4_GLint_raw();
+ init_trans_3_GLint_raw();
+ init_trans_2_GLint_raw();
+ init_trans_1_GLint_raw();
+ init_trans_4_GLuint_raw();
+ init_trans_3_GLuint_raw();
+ init_trans_2_GLuint_raw();
+ init_trans_1_GLuint_raw();
+ init_trans_4_GLdouble_raw();
+ init_trans_3_GLdouble_raw();
+ init_trans_2_GLdouble_raw();
+ init_trans_1_GLdouble_raw();
+ init_trans_4_GLfloat_raw();
+ init_trans_3_GLfloat_raw();
+ init_trans_2_GLfloat_raw();
+ init_trans_1_GLfloat_raw();
+
+ TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw;
+}
+
+
+#undef TAB
+#ifdef CLASS
+#undef CLASS
+#endif
+#undef ARGS
+#undef CHECK
+#undef SRC_START
+#undef DST_START
+#undef NEXT_F
+#undef NEXT_F2
+
+
+
+
+
+void _math_init_translate( void )
+{
+ init_translate_raw();
+}
+
+
+
+void _math_trans_1f(GLfloat *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
+
+void _math_trans_1ui(GLuint *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
+
+void _math_trans_1ub(GLubyte *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
+
+
+void _math_trans_4ub(GLubyte (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
+
+void _math_trans_4chan( GLchan (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n )
+{
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ _math_trans_4ub( to, ptr, stride, type, size, start, n );
+#elif CHAN_TYPE == GL_UNSIGNED_SHORT
+ _math_trans_4us( to, ptr, stride, type, size, start, n );
+#elif CHAN_TYPE == GL_FLOAT
+ _math_trans_4fc( to, ptr, stride, type, size, start, n );
+#endif
+}
+
+void _math_trans_4us(GLushort (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
+
+void _math_trans_4f(GLfloat (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
+
+void _math_trans_4fc(GLfloat (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_4fc_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
+
+void _math_trans_3f(GLfloat (*to)[3],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n )
+{
+ _math_trans_3f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
+}
Index: xc/extras/Mesa/src/mesa/math/m_translate.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_translate.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_translate.h Thu Apr 8 05:17:53 2004
@@ -0,0 +1,106 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _M_TRANSLATE_H_
+#define _M_TRANSLATE_H_
+
+#include "config.h"
+#include "mtypes.h" /* hack for GLchan */
+
+
+
+extern void _math_trans_1f(GLfloat *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_1ui(GLuint *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_1ub(GLubyte *to,
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_4ub(GLubyte (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_4chan( GLchan (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_4us(GLushort (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_4f(GLfloat (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_4fc(GLfloat (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n );
+
+extern void _math_trans_3f(GLfloat (*to)[3],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint start,
+ GLuint n );
+
+extern void _math_init_translate( void );
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/math/m_vector.c
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_vector.c:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_vector.c Thu Apr 8 05:17:53 2004
@@ -0,0 +1,190 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "macros.h"
+#include "imports.h"
+
+#include "m_vector.h"
+
+
+
+/*
+ * Given a vector [count][4] of floats, set all the [][elt] values
+ * to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3).
+ */
+void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt )
+{
+ static const GLubyte elem_bits[4] = {
+ VEC_DIRTY_0,
+ VEC_DIRTY_1,
+ VEC_DIRTY_2,
+ VEC_DIRTY_3
+ };
+ static const GLfloat clean[4] = { 0, 0, 0, 1 };
+ const GLfloat v = clean[elt];
+ GLfloat (*data)[4] = (GLfloat (*)[4])vec->start;
+ GLuint i;
+
+ for (i = 0 ; i < count ; i++)
+ data[i][elt] = v;
+
+ vec->flags &= ~elem_bits[elt];
+}
+
+static const GLubyte size_bits[5] = {
+ 0,
+ VEC_SIZE_1,
+ VEC_SIZE_2,
+ VEC_SIZE_3,
+ VEC_SIZE_4,
+};
+
+
+
+/*
+ * Initialize GLvector objects.
+ * Input: v - the vector object to initialize.
+ * flags - bitwise-OR of VEC_* flags
+ * storage - pointer to storage for the vector's data
+ */
+
+
+void _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] )
+{
+ v->stride = 4 * sizeof(GLfloat);
+ v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */
+ v->data = storage;
+ v->start = (GLfloat *) storage;
+ v->count = 0;
+ v->flags = size_bits[4] | flags ;
+}
+
+
+
+
+/*
+ * Initialize GLvector objects and allocate storage.
+ * Input: v - the vector object
+ * sz - unused????
+ * flags - bitwise-OR of VEC_* flags
+ * count - number of elements to allocate in vector
+ * alignment - desired memory alignment for the data (in bytes)
+ */
+
+
+void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count,
+ GLuint alignment )
+{
+ v->stride = 4 * sizeof(GLfloat);
+ v->size = 2;
+ v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment );
+ v->start = (GLfloat *) v->storage;
+ v->data = (GLfloat (*)[4]) v->storage;
+ v->count = 0;
+ v->flags = size_bits[4] | flags | VEC_MALLOC ;
+}
+
+
+
+
+/*
+ * Vector deallocation. Free whatever memory is pointed to by the
+ * vector's storage field if the VEC_MALLOC flag is set.
+ * DO NOT free the GLvector object itself, though.
+ */
+
+
+void _mesa_vector4f_free( GLvector4f *v )
+{
+ if (v->flags & VEC_MALLOC) {
+ ALIGN_FREE( v->storage );
+ v->data = NULL;
+ v->start = NULL;
+ v->storage = NULL;
+ v->flags &= ~VEC_MALLOC;
+ }
+}
+
+
+/*
+ * For debugging
+ */
+void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling )
+{
+ GLfloat c[4] = { 0, 0, 0, 1 };
+ const char *templates[5] = {
+ "%d:\t0, 0, 0, 1\n",
+ "%d:\t%f, 0, 0, 1\n",
+ "%d:\t%f, %f, 0, 1\n",
+ "%d:\t%f, %f, %f, 1\n",
+ "%d:\t%f, %f, %f, %f\n"
+ };
+
+ const char *t = templates[v->size];
+ GLfloat *d = (GLfloat *)v->data;
+ GLuint j, i = 0, count;
+
+ _mesa_printf("data-start\n");
+ for ( ; d != v->start ; STRIDE_F(d, v->stride), i++)
+ _mesa_printf(t, i, d[0], d[1], d[2], d[3]);
+
+ _mesa_printf("start-count(%u)\n", v->count);
+ count = i + v->count;
+
+ if (culling) {
+ for ( ; i < count ; STRIDE_F(d, v->stride), i++)
+ if (cullmask[i])
+ _mesa_printf(t, i, d[0], d[1], d[2], d[3]);
+ }
+ else {
+ for ( ; i < count ; STRIDE_F(d, v->stride), i++)
+ _mesa_printf(t, i, d[0], d[1], d[2], d[3]);
+ }
+
+ for (j = v->size ; j < 4; j++) {
+ if ((v->flags & (1<data ;
+ i < count && d[j] == c[j] ;
+ i++, STRIDE_F(d, v->stride)) {};
+
+ if (i == count)
+ _mesa_printf(" --> ok\n");
+ else
+ _mesa_printf(" --> Failed at %u ******\n", i);
+ }
+ }
+}
+
+
Index: xc/extras/Mesa/src/mesa/math/m_vector.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_vector.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_vector.h Thu Apr 8 05:17:54 2004
@@ -0,0 +1,95 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+#ifndef _M_VECTOR_H_
+#define _M_VECTOR_H_
+
+#include "glheader.h"
+#include "mtypes.h" /* hack for GLchan */
+
+
+#define VEC_DIRTY_0 0x1
+#define VEC_DIRTY_1 0x2
+#define VEC_DIRTY_2 0x4
+#define VEC_DIRTY_3 0x8
+#define VEC_MALLOC 0x10 /* storage field points to self-allocated mem*/
+#define VEC_NOT_WRITEABLE 0x40 /* writable elements to hold clipped data */
+#define VEC_BAD_STRIDE 0x100 /* matches tnl's prefered stride */
+
+
+#define VEC_SIZE_1 VEC_DIRTY_0
+#define VEC_SIZE_2 (VEC_DIRTY_0|VEC_DIRTY_1)
+#define VEC_SIZE_3 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2)
+#define VEC_SIZE_4 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2|VEC_DIRTY_3)
+
+
+
+/* Wrap all the information about vectors up in a struct. Has
+ * additional fields compared to the other vectors to help us track of
+ * different vertex sizes, and whether we need to clean columns out
+ * because they contain non-(0,0,0,1) values.
+ *
+ * The start field is used to reserve data for copied vertices at the
+ * end of _mesa_transform_vb, and avoids the need for a multiplication in
+ * the transformation routines.
+ */
+typedef struct {
+ GLfloat (*data)[4]; /* may be malloc'd or point to client data */
+ GLfloat *start; /* points somewhere inside of */
+ GLuint count; /* size of the vector (in elements) */
+ GLuint stride; /* stride from one element to the next (in bytes) */
+ GLuint size; /* 2-4 for vertices and 1-4 for texcoords */
+ GLuint flags; /* which columns are dirty */
+ void *storage; /* self-allocated storage */
+} GLvector4f;
+
+
+extern void _mesa_vector4f_init( GLvector4f *v, GLuint flags,
+ GLfloat (*storage)[4] );
+extern void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags,
+ GLuint count, GLuint alignment );
+extern void _mesa_vector4f_free( GLvector4f *v );
+extern void _mesa_vector4f_print( GLvector4f *v, GLubyte *, GLboolean );
+extern void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint nr, GLuint elt );
+
+
+
+
+
+/*
+ * Given vector , return a pointer (cast to to the -th element.
+ *
+ * End up doing a lot of slow imuls if not careful.
+ */
+#define VEC_ELT( v, type, i ) \
+ ( (type *) ( ((GLbyte *) ((v)->data)) + (i) * (v)->stride) )
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/math/m_xform.c
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_xform.c:1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_xform.c Thu Apr 22 09:58:37 2004
@@ -0,0 +1,220 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/math/m_xform.c,v 1.2 2004/04/22 13:58:37 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Matrix/vertex/vector transformation stuff
+ *
+ *
+ * NOTES:
+ * 1. 4x4 transformation matrices are stored in memory in column major order.
+ * 2. Points/vertices are to be thought of as column vectors.
+ * 3. Transformation of a point p by a matrix M is: p' = M * p
+ */
+
+#include "glheader.h"
+#include "macros.h"
+
+#include "m_eval.h"
+#include "m_matrix.h"
+#include "m_translate.h"
+#include "m_xform.h"
+#include "mathmod.h"
+
+
+#ifdef DEBUG
+#include "m_debug.h"
+#endif
+
+#ifdef USE_X86_ASM
+#include "x86/common_x86_asm.h"
+#endif
+
+#ifdef USE_SPARC_ASM
+#include "sparc/sparc.h"
+#endif
+
+clip_func _mesa_clip_tab[5];
+clip_func _mesa_clip_np_tab[5];
+dotprod_func _mesa_dotprod_tab[5];
+vec_copy_func _mesa_copy_tab[0x10];
+normal_func _mesa_normal_tab[0xf];
+transform_func *_mesa_transform_tab[5];
+
+
+/* Raw data format used for:
+ * - Object-to-eye transform prior to culling, although this too
+ * could be culled under some circumstances.
+ * - Eye-to-clip transform (via the function above).
+ * - Cliptesting
+ * - And everything else too, if culling happens to be disabled.
+ *
+ * GH: It's used for everything now, as clipping/culling is done
+ * elsewhere (most often by the driver itself).
+ */
+#define TAG(x) x
+#define TAG2(x,y) x##y
+#define STRIDE_LOOP for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) )
+#define LOOP for ( i = 0 ; i < n ; i++ )
+#define ARGS
+#include "m_xform_tmp.h"
+#include "m_clip_tmp.h"
+#include "m_norm_tmp.h"
+#include "m_dotprod_tmp.h"
+#include "m_copy_tmp.h"
+#undef TAG
+#undef TAG2
+#undef LOOP
+#undef ARGS
+
+
+
+
+GLvector4f *_mesa_project_points( GLvector4f *proj_vec,
+ const GLvector4f *clip_vec )
+{
+ const GLuint stride = clip_vec->stride;
+ const GLfloat *from = (GLfloat *)clip_vec->start;
+ const GLuint count = clip_vec->count;
+ GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start;
+ GLuint i;
+
+ for (i = 0 ; i < count ; i++, STRIDE_F(from, stride))
+ {
+ GLfloat oow = 1.0F / from[3];
+ vProj[i][3] = oow;
+ vProj[i][0] = from[0] * oow;
+ vProj[i][1] = from[1] * oow;
+ vProj[i][2] = from[2] * oow;
+ }
+
+ proj_vec->flags |= VEC_SIZE_4;
+ proj_vec->size = 3;
+ proj_vec->count = clip_vec->count;
+ return proj_vec;
+}
+
+
+
+
+
+
+/*
+ * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This
+ * function is used for transforming clipping plane equations and spotlight
+ * directions.
+ * Mathematically, u = v * m.
+ * Input: v - input vector
+ * m - transformation matrix
+ * Output: u - transformed vector
+ */
+void _mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] )
+{
+ GLfloat v0=v[0], v1=v[1], v2=v[2], v3=v[3];
+#define M(row,col) m[row + col*4]
+ u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0);
+ u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1);
+ u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2);
+ u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3);
+#undef M
+}
+
+
+/* Useful for one-off point transformations, as in clipping.
+ * Note that because the matrix isn't analysed we do too many
+ * multiplies, and that the result is always 4-clean.
+ */
+void _mesa_transform_point_sz( GLfloat Q[4], const GLfloat M[16],
+ const GLfloat P[4], GLuint sz )
+{
+ if (Q == P)
+ return;
+
+ if (sz == 4)
+ {
+ Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3];
+ Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3];
+ Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3];
+ Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3];
+ }
+ else if (sz == 3)
+ {
+ Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12];
+ Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13];
+ Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14];
+ Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15];
+ }
+ else if (sz == 2)
+ {
+ Q[0] = M[0] * P[0] + M[4] * P[1] + M[12];
+ Q[1] = M[1] * P[0] + M[5] * P[1] + M[13];
+ Q[2] = M[2] * P[0] + M[6] * P[1] + M[14];
+ Q[3] = M[3] * P[0] + M[7] * P[1] + M[15];
+ }
+ else if (sz == 1)
+ {
+ Q[0] = M[0] * P[0] + M[12];
+ Q[1] = M[1] * P[0] + M[13];
+ Q[2] = M[2] * P[0] + M[14];
+ Q[3] = M[3] * P[0] + M[15];
+ }
+}
+
+
+/*
+ * This is called only once. It initializes several tables with pointers
+ * to optimized transformation functions. This is where we can test for
+ * AMD 3Dnow! capability, Intel SSE, etc. and hook in the right code.
+ */
+void
+_math_init_transformation( void )
+{
+ init_c_transformations();
+ init_c_norm_transform();
+ init_c_cliptest();
+ init_copy0();
+ init_dotprod();
+
+#ifdef DEBUG
+ _math_test_all_transform_functions( "default" );
+ _math_test_all_normal_transform_functions( "default" );
+ _math_test_all_cliptest_functions( "default" );
+#endif
+
+#ifdef USE_X86_ASM
+ _mesa_init_all_x86_transform_asm();
+#endif
+#ifdef USE_SPARC_ASM
+ _mesa_init_all_sparc_transform_asm();
+#endif
+}
+
+void
+_math_init( void )
+{
+ _math_init_transformation();
+ _math_init_translate();
+ _math_init_eval();
+}
Index: xc/extras/Mesa/src/mesa/math/m_xform.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_xform.h:1.1.1.3
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_xform.h Fri Dec 10 10:05:27 2004
@@ -0,0 +1,185 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _M_XFORM_H
+#define _M_XFORM_H
+
+
+#include "glheader.h"
+#include "config.h"
+#include "math/m_vector.h"
+#include "math/m_matrix.h"
+
+#ifdef USE_X86_ASM
+#define _XFORMAPI _ASMAPI
+#define _XFORMAPIP _ASMAPIP
+#else
+#define _XFORMAPI
+#define _XFORMAPIP *
+#endif
+
+
+extern void
+_mesa_transform_vector(GLfloat u[4], CONST GLfloat v[4], CONST GLfloat m[16]);
+
+
+extern void
+_math_init_transformation(void);
+
+
+/* KW: Clip functions now do projective divide as well. The projected
+ * coordinates are very useful to us because they let us cull
+ * backfaces and eliminate vertices from lighting, fogging, etc
+ * calculations. Despite the fact that this divide could be done one
+ * day in hardware, we would still have a reason to want to do it here
+ * as long as those other calculations remain in software.
+ *
+ * Clipping is a convenient place to do the divide on x86 as it should be
+ * possible to overlap with integer outcode calculations.
+ *
+ * There are two cases where we wouldn't want to do the divide in cliptest:
+ * - When we aren't clipping. We still might want to cull backfaces
+ * so the divide should be done elsewhere. This currently never
+ * happens.
+ *
+ * - When culling isn't likely to help us, such as when the GL culling
+ * is disabled and we not lighting or are only lighting
+ * one-sided. In this situation, backface determination provides
+ * us with no useful information. A tricky case to detect is when
+ * all input data is already culled, although hopefully the
+ * application wouldn't turn on culling in such cases.
+ *
+ * We supply a buffer to hold the [x/w,y/w,z/w,1/w] values which
+ * are the result of the projection. This is only used in the
+ * 4-vector case - in other cases, we just use the clip coordinates
+ * as the projected coordinates - they are identical.
+ *
+ * This is doubly convenient because it means the Win[] array is now
+ * of the same stride as all the others, so I can now turn map_vertices
+ * into a straight-forward matrix transformation, with asm acceleration
+ * automatically available.
+ */
+
+/* Vertex buffer clipping flags
+ */
+#define CLIP_RIGHT_SHIFT 0
+#define CLIP_LEFT_SHIFT 1
+#define CLIP_TOP_SHIFT 2
+#define CLIP_BOTTOM_SHIFT 3
+#define CLIP_NEAR_SHIFT 4
+#define CLIP_FAR_SHIFT 5
+
+#define CLIP_RIGHT_BIT 0x01
+#define CLIP_LEFT_BIT 0x02
+#define CLIP_TOP_BIT 0x04
+#define CLIP_BOTTOM_BIT 0x08
+#define CLIP_NEAR_BIT 0x10
+#define CLIP_FAR_BIT 0x20
+#define CLIP_USER_BIT 0x40
+#define CLIP_CULL_BIT 0x80
+#define CLIP_ALL_BITS 0x3f
+
+
+typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip,
+ GLvector4f *vProj,
+ GLubyte clipMask[],
+ GLubyte *orMask,
+ GLubyte *andMask );
+
+typedef void (*dotprod_func)( GLfloat *out,
+ GLuint out_stride,
+ CONST GLvector4f *coord_vec,
+ CONST GLfloat plane[4] );
+
+typedef void (*vec_copy_func)( GLvector4f *to,
+ CONST GLvector4f *from );
+
+
+
+/*
+ * Functions for transformation of normals in the VB.
+ */
+typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat,
+ GLfloat scale,
+ CONST GLvector4f *in,
+ CONST GLfloat lengths[],
+ GLvector4f *dest );
+
+
+/* Flags for selecting a normal transformation function.
+ */
+#define NORM_RESCALE 0x1 /* apply the scale factor */
+#define NORM_NORMALIZE 0x2 /* normalize */
+#define NORM_TRANSFORM 0x4 /* apply the transformation matrix */
+#define NORM_TRANSFORM_NO_ROT 0x8 /* apply the transformation matrix */
+
+
+
+
+/* KW: New versions of the transform function allow a mask array
+ * specifying that individual vector transform should be skipped
+ * when the mask byte is zero. This is always present as a
+ * parameter, to allow a unified interface.
+ */
+typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec,
+ CONST GLfloat m[16],
+ CONST GLvector4f *from_vec );
+
+
+extern GLvector4f *_mesa_project_points( GLvector4f *to,
+ CONST GLvector4f *from );
+
+extern void _mesa_transform_bounds3( GLubyte *orMask, GLubyte *andMask,
+ CONST GLfloat m[16],
+ CONST GLfloat src[][3] );
+
+extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask,
+ CONST GLfloat m[16],
+ CONST GLfloat src[][3] );
+
+
+extern dotprod_func _mesa_dotprod_tab[5];
+extern vec_copy_func _mesa_copy_tab[0x10];
+extern vec_copy_func _mesa_copy_clean_tab[5];
+extern clip_func _mesa_clip_tab[5];
+extern clip_func _mesa_clip_np_tab[5];
+extern normal_func _mesa_normal_tab[0xf];
+
+/* Use of 2 layers of linked 1-dimensional arrays to reduce
+ * cost of lookup.
+ */
+extern transform_func *_mesa_transform_tab[5];
+
+
+extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16],
+ CONST GLfloat P[4], GLuint sz );
+
+
+#define TransformRaw( to, mat, from ) \
+ ( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \
+ (to) )
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/math/m_xform_tmp.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/m_xform_tmp.h:1.1.1.2
--- /dev/null Wed Mar 16 21:01:29 2005
+++ xc/extras/Mesa/src/mesa/math/m_xform_tmp.h Fri Dec 10 10:05:27 2004
@@ -0,0 +1,810 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * New (3.1) transformation code written by Keith Whitwell.
+ */
+
+
+/*----------------------------------------------------------------------
+ * Begin Keith's new code
+ *
+ *----------------------------------------------------------------------
+ */
+
+/* KW: Fixed stride, now measured in bytes as is the OpenGL array stride.
+ */
+
+/* KW: These are now parameterized to produce two versions, one
+ * which transforms all incoming points, and a second which
+ * takes notice of a cullmask array, and only transforms
+ * unculled vertices.
+ */
+
+/* KW: 1-vectors can sneak into the texture pipeline via the array
+ * interface. These functions are here because I want consistant
+ * treatment of the vertex sizes and a lazy strategy for
+ * cleaning unused parts of the vector, and so as not to exclude
+ * them from the vertex array interface.
+ *
+ * Under our current analysis of matrices, there is no way that
+ * the product of a matrix and a 1-vector can remain a 1-vector,
+ * with the exception of the identity transform.
+ */
+
+/* KW: No longer zero-pad outgoing vectors. Now that external
+ * vectors can get into the pipeline we cannot ever assume
+ * that there is more to a vector than indicated by its
+ * size.
+ */
+
+/* KW: Now uses clipmask and a flag to allow us to skip both/either
+ * cliped and/or culled vertices.
+ */
+
+/* GH: Not any more -- it's easier (and faster) to just process the
+ * entire vector. Clipping and culling are handled further down
+ * the pipe, most often during or after the conversion to some
+ * driver-specific vertex format.
+ */
+
+static void _XFORMAPI
+TAG(transform_points1_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m12 = m[12];
+ const GLfloat m1 = m[1], m13 = m[13];
+ const GLfloat m2 = m[2], m14 = m[14];
+ const GLfloat m3 = m[3], m15 = m[15];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0];
+ to[i][0] = m0 * ox + m12;
+ to[i][1] = m1 * ox + m13;
+ to[i][2] = m2 * ox + m14;
+ to[i][3] = m3 * ox + m15;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points1_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLuint count = from_vec->count;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint i;
+ (void) m;
+ if (to_vec == from_vec) return;
+ STRIDE_LOOP {
+ to[i][0] = from[0];
+ }
+ to_vec->size = 1;
+ to_vec->flags |= VEC_SIZE_1;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points1_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1];
+ const GLfloat m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0];
+ to[i][0] = m0 * ox + m12;
+ to[i][1] = m1 * ox + m13;
+ }
+ to_vec->size = 2;
+ to_vec->flags |= VEC_SIZE_2;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0];
+ to[i][0] = m0 * ox + m12;
+ to[i][1] = m13;
+ }
+ to_vec->size = 2;
+ to_vec->flags |= VEC_SIZE_2;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points1_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1], m2 = m[2];
+ const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0];
+ to[i][0] = m0 * ox + m12;
+ to[i][1] = m1 * ox + m13;
+ to[i][2] = m2 * ox + m14;
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+
+static void _XFORMAPI
+TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0];
+ const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0];
+ to[i][0] = m0 * ox + m12;
+ to[i][1] = m13;
+ to[i][2] = m14;
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points1_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0];
+ to[i][0] = m0 * ox ;
+ to[i][1] = 0 ;
+ to[i][2] = m14;
+ to[i][3] = 0;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+
+
+
+/* 2-vectors, which are a lot more relevant than 1-vectors, are
+ * present early in the geometry pipeline and throughout the
+ * texture pipeline.
+ */
+static void _XFORMAPI
+TAG(transform_points2_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m4 = m[4], m12 = m[12];
+ const GLfloat m1 = m[1], m5 = m[5], m13 = m[13];
+ const GLfloat m2 = m[2], m6 = m[6], m14 = m[14];
+ const GLfloat m3 = m[3], m7 = m[7], m15 = m[15];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1];
+ to[i][0] = m0 * ox + m4 * oy + m12;
+ to[i][1] = m1 * ox + m5 * oy + m13;
+ to[i][2] = m2 * ox + m6 * oy + m14;
+ to[i][3] = m3 * ox + m7 * oy + m15;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points2_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ GLuint i;
+ (void) m;
+ if (to_vec == from_vec) return;
+ STRIDE_LOOP {
+ to[i][0] = from[0];
+ to[i][1] = from[1];
+ }
+ to_vec->size = 2;
+ to_vec->flags |= VEC_SIZE_2;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points2_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
+ const GLfloat m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1];
+ to[i][0] = m0 * ox + m4 * oy + m12;
+ to[i][1] = m1 * ox + m5 * oy + m13;
+ }
+ to_vec->size = 2;
+ to_vec->flags |= VEC_SIZE_2;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1];
+ to[i][0] = m0 * ox + m12;
+ to[i][1] = m5 * oy + m13;
+ }
+ to_vec->size = 2;
+ to_vec->flags |= VEC_SIZE_2;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points2_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
+ const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1];
+ to[i][0] = m0 * ox + m4 * oy + m12;
+ to[i][1] = m1 * ox + m5 * oy + m13;
+ to[i][2] = m2 * ox + m6 * oy + m14;
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+
+/* I would actually say this was a fairly important function, from
+ * a texture transformation point of view.
+ */
+static void _XFORMAPI
+TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5];
+ const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1];
+ to[i][0] = m0 * ox + m12;
+ to[i][1] = m5 * oy + m13;
+ to[i][2] = m14;
+ }
+ if (m14 == 0) {
+ to_vec->size = 2;
+ to_vec->flags |= VEC_SIZE_2;
+ } else {
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ }
+ to_vec->count = from_vec->count;
+}
+
+
+static void _XFORMAPI
+TAG(transform_points2_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1];
+ to[i][0] = m0 * ox ;
+ to[i][1] = m5 * oy ;
+ to[i][2] = m14;
+ to[i][3] = 0;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+
+
+static void _XFORMAPI
+TAG(transform_points3_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12];
+ const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13];
+ const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14];
+ const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2];
+ to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12;
+ to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13;
+ to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14;
+ to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points3_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ GLuint i;
+ (void) m;
+ if (to_vec == from_vec) return;
+ STRIDE_LOOP {
+ to[i][0] = from[0];
+ to[i][1] = from[1];
+ to[i][2] = from[2];
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points3_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
+ const GLfloat m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2];
+ to[i][0] = m0 * ox + m4 * oy + m12 ;
+ to[i][1] = m1 * ox + m5 * oy + m13 ;
+ to[i][2] = + oz ;
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2];
+ to[i][0] = m0 * ox + m12 ;
+ to[i][1] = m5 * oy + m13 ;
+ to[i][2] = + oz ;
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points3_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
+ const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
+ const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2];
+ to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 ;
+ to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 ;
+ to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 ;
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+/* previously known as ortho...
+ */
+static void _XFORMAPI
+TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5];
+ const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2];
+ to[i][0] = m0 * ox + m12 ;
+ to[i][1] = m5 * oy + m13 ;
+ to[i][2] = m10 * oz + m14 ;
+ }
+ to_vec->size = 3;
+ to_vec->flags |= VEC_SIZE_3;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points3_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
+ const GLfloat m10 = m[10], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2];
+ to[i][0] = m0 * ox + m8 * oz ;
+ to[i][1] = m5 * oy + m9 * oz ;
+ to[i][2] = m10 * oz + m14 ;
+ to[i][3] = -oz ;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+
+
+static void _XFORMAPI
+TAG(transform_points4_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12];
+ const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13];
+ const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14];
+ const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
+ to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow;
+ to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow;
+ to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
+ to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points4_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ GLuint i;
+ (void) m;
+ if (to_vec == from_vec) return;
+ STRIDE_LOOP {
+ to[i][0] = from[0];
+ to[i][1] = from[1];
+ to[i][2] = from[2];
+ to[i][3] = from[3];
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points4_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
+ const GLfloat m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
+ to[i][0] = m0 * ox + m4 * oy + m12 * ow;
+ to[i][1] = m1 * ox + m5 * oy + m13 * ow;
+ to[i][2] = + oz ;
+ to[i][3] = ow;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
+ to[i][0] = m0 * ox + m12 * ow;
+ to[i][1] = m5 * oy + m13 * ow;
+ to[i][2] = + oz ;
+ to[i][3] = ow;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points4_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
+ const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
+ const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
+ to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow;
+ to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow;
+ to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
+ to[i][3] = ow;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5];
+ const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
+ to[i][0] = m0 * ox + m12 * ow;
+ to[i][1] = m5 * oy + m13 * ow;
+ to[i][2] = m10 * oz + m14 * ow;
+ to[i][3] = ow;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static void _XFORMAPI
+TAG(transform_points4_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
+ const GLvector4f *from_vec )
+{
+ const GLuint stride = from_vec->stride;
+ GLfloat *from = from_vec->start;
+ GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
+ GLuint count = from_vec->count;
+ const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
+ const GLfloat m10 = m[10], m14 = m[14];
+ GLuint i;
+ STRIDE_LOOP {
+ const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
+ to[i][0] = m0 * ox + m8 * oz ;
+ to[i][1] = m5 * oy + m9 * oz ;
+ to[i][2] = m10 * oz + m14 * ow ;
+ to[i][3] = -oz ;
+ }
+ to_vec->size = 4;
+ to_vec->flags |= VEC_SIZE_4;
+ to_vec->count = from_vec->count;
+}
+
+static transform_func TAG(transform_tab_1)[7];
+static transform_func TAG(transform_tab_2)[7];
+static transform_func TAG(transform_tab_3)[7];
+static transform_func TAG(transform_tab_4)[7];
+
+/* Similar functions could be called several times, with more highly
+ * optimized routines overwriting the arrays. This only occurs during
+ * startup.
+ */
+static void _XFORMAPI TAG(init_c_transformations)( void )
+{
+#define TAG_TAB _mesa_transform_tab
+#define TAG_TAB_1 TAG(transform_tab_1)
+#define TAG_TAB_2 TAG(transform_tab_2)
+#define TAG_TAB_3 TAG(transform_tab_3)
+#define TAG_TAB_4 TAG(transform_tab_4)
+
+ TAG_TAB[1] = TAG_TAB_1;
+ TAG_TAB[2] = TAG_TAB_2;
+ TAG_TAB[3] = TAG_TAB_3;
+ TAG_TAB[4] = TAG_TAB_4;
+
+ /* 1-D points (ie texcoords) */
+ TAG_TAB_1[MATRIX_GENERAL] = TAG(transform_points1_general);
+ TAG_TAB_1[MATRIX_IDENTITY] = TAG(transform_points1_identity);
+ TAG_TAB_1[MATRIX_3D_NO_ROT] = TAG(transform_points1_3d_no_rot);
+ TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective);
+ TAG_TAB_1[MATRIX_2D] = TAG(transform_points1_2d);
+ TAG_TAB_1[MATRIX_2D_NO_ROT] = TAG(transform_points1_2d_no_rot);
+ TAG_TAB_1[MATRIX_3D] = TAG(transform_points1_3d);
+
+ /* 2-D points */
+ TAG_TAB_2[MATRIX_GENERAL] = TAG(transform_points2_general);
+ TAG_TAB_2[MATRIX_IDENTITY] = TAG(transform_points2_identity);
+ TAG_TAB_2[MATRIX_3D_NO_ROT] = TAG(transform_points2_3d_no_rot);
+ TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective);
+ TAG_TAB_2[MATRIX_2D] = TAG(transform_points2_2d);
+ TAG_TAB_2[MATRIX_2D_NO_ROT] = TAG(transform_points2_2d_no_rot);
+ TAG_TAB_2[MATRIX_3D] = TAG(transform_points2_3d);
+
+ /* 3-D points */
+ TAG_TAB_3[MATRIX_GENERAL] = TAG(transform_points3_general);
+ TAG_TAB_3[MATRIX_IDENTITY] = TAG(transform_points3_identity);
+ TAG_TAB_3[MATRIX_3D_NO_ROT] = TAG(transform_points3_3d_no_rot);
+ TAG_TAB_3[MATRIX_PERSPECTIVE] = TAG(transform_points3_perspective);
+ TAG_TAB_3[MATRIX_2D] = TAG(transform_points3_2d);
+ TAG_TAB_3[MATRIX_2D_NO_ROT] = TAG(transform_points3_2d_no_rot);
+ TAG_TAB_3[MATRIX_3D] = TAG(transform_points3_3d);
+
+ /* 4-D points */
+ TAG_TAB_4[MATRIX_GENERAL] = TAG(transform_points4_general);
+ TAG_TAB_4[MATRIX_IDENTITY] = TAG(transform_points4_identity);
+ TAG_TAB_4[MATRIX_3D_NO_ROT] = TAG(transform_points4_3d_no_rot);
+ TAG_TAB_4[MATRIX_PERSPECTIVE] = TAG(transform_points4_perspective);
+ TAG_TAB_4[MATRIX_2D] = TAG(transform_points4_2d);
+ TAG_TAB_4[MATRIX_2D_NO_ROT] = TAG(transform_points4_2d_no_rot);
+ TAG_TAB_4[MATRIX_3D] = TAG(transform_points4_3d);
+
+#undef TAG_TAB
+#undef TAG_TAB_1
+#undef TAG_TAB_2
+#undef TAG_TAB_3
+#undef TAG_TAB_4
+}
Index: xc/extras/Mesa/src/mesa/math/mathmod.h
diff -u /dev/null xc/extras/Mesa/src/mesa/math/mathmod.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/math/mathmod.h Thu Apr 8 05:17:54 2004
@@ -0,0 +1,41 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \mainpage Mesa Math Module
+ *
+ * This module contains math-related utility functions for transforming
+ * vertices, translating arrays of numbers from one data type to another,
+ * evaluating curved surfaces, etc.
+ */
+
+
+#ifndef _MESA_MATH_H_
+#define _MESA_MATH_H_
+
+extern void _math_init( void );
+
+#endif
Index: xc/extras/Mesa/src/mesa/shader/arbfragparse.c
diff -u /dev/null xc/extras/Mesa/src/mesa/shader/arbfragparse.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/shader/arbfragparse.c Fri Dec 10 10:06:45 2004
@@ -0,0 +1,244 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define DEBUG_FP 0
+
+/**
+ * \file arbfragparse.c
+ * ARB_fragment_program parser.
+ * \author Karl Rasche
+ */
+
+#include "glheader.h"
+#include "context.h"
+#include "imports.h"
+#include "macros.h"
+#include "mtypes.h"
+#include "arbprogparse.h"
+#include "arbfragparse.h"
+
+void
+_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp)
+{
+ GLint a;
+
+ fprintf(stderr, "PROGRAM_OUTPUT: 0x%x\n", PROGRAM_OUTPUT);
+ fprintf(stderr, "PROGRAM_INPUT: 0x%x\n", PROGRAM_INPUT);
+ fprintf(stderr, "PROGRAM_TEMPORARY: 0x%x\n", PROGRAM_TEMPORARY);
+
+ for (a=0; aInstructions = (struct fp_instruction *) _mesa_malloc (
+ sizeof(struct fp_instruction) );
+ program->Instructions[0].Opcode = FP_OPCODE_END;
+ return;
+ }
+
+ /* copy the relvant contents of the arb_program struct into the
+ * fragment_program struct
+ */
+ program->Base.String = ap.Base.String;
+ program->Base.NumInstructions = ap.Base.NumInstructions;
+ program->Base.NumTemporaries = ap.Base.NumTemporaries;
+ program->Base.NumParameters = ap.Base.NumParameters;
+ program->Base.NumAttributes = ap.Base.NumAttributes;
+ program->Base.NumAddressRegs = ap.Base.NumAddressRegs;
+
+ program->InputsRead = ap.InputsRead;
+ program->OutputsWritten = ap.OutputsWritten;
+ for (a=0; aTexturesUsed[a] = ap.TexturesUsed[a];
+ program->NumAluInstructions = ap.NumAluInstructions;
+ program->NumTexInstructions = ap.NumTexInstructions;
+ program->NumTexIndirections = ap.NumTexIndirections;
+ program->Parameters = ap.Parameters;
+ program->FogOption = ap.FogOption;
+
+ /* XXX: Eh.. we parsed something that wasn't a fragment program. doh! */
+ /* this wont happen any more */
+/*
+ if (ap.Base.Target != GL_FRAGMENT_PROGRAM_ARB)
+ {
+ program->Instructions = (struct fp_instruction *) _mesa_malloc (
+ sizeof(struct fp_instruction) );
+ program->Instructions[0].Opcode = FP_OPCODE_END;
+
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Parsed a non-fragment program as a fragment program");
+ return;
+ }
+*/
+
+#if DEBUG_FP
+ _mesa_debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions);
+#endif
+
+ program->Instructions = ap.FPInstructions;
+}
Index: xc/extras/Mesa/src/mesa/shader/arbfragparse.h
diff -u /dev/null xc/extras/Mesa/src/mesa/shader/arbfragparse.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/shader/arbfragparse.h Thu Jun 10 10:23:59 2004
@@ -0,0 +1,39 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef ARBFRAGPARSE_H
+#define ARBFRAGPARSE_H
+
+#include "mtypes.h"
+
+extern void
+_mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
+ const GLubyte * str, GLsizei len,
+ struct fragment_program *program);
+
+extern void
+_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp);
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/shader/arbprogparse.c
diff -u /dev/null xc/extras/Mesa/src/mesa/shader/arbprogparse.c:1.3
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/shader/arbprogparse.c Fri Dec 17 11:38:03 2004
@@ -0,0 +1,3967 @@
+/* $XFree86: xc/extras/Mesa/src/mesa/shader/arbprogparse.c,v 1.3 2004/12/17 16:38:03 tsi Exp $ */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define DEBUG_PARSING 0
+
+/**
+ * \file arbprogparse.c
+ * ARB_*_program parser core
+ * \author Karl Rasche
+ */
+
+#include "mtypes.h"
+#include "glheader.h"
+#include "context.h"
+#include "hash.h"
+#include "imports.h"
+#include "macros.h"
+#include "program.h"
+#include "nvvertprog.h"
+#include "nvfragprog.h"
+#include "arbprogparse.h"
+#include "grammar_mesa.h"
+
+#ifndef __extension__
+#if !defined(__GNUC__) || (__GNUC__ < 2) || \
+ ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7))
+# define __extension__
+#endif
+#endif
+
+/* TODO:
+ * Fragment Program Stuff:
+ * -----------------------------------------------------
+ *
+ * - things from Michal's email
+ * + overflow on atoi
+ * + not-overflowing floats (don't use parse_integer..)
+ * + can remove range checking in arbparse.c
+ *
+ * - check all limits of number of various variables
+ * + parameters
+ *
+ * - test! test! test!
+ *
+ * Vertex Program Stuff:
+ * -----------------------------------------------------
+ * - Optimize param array usage and count limits correctly, see spec,
+ * section 2.14.3.7
+ * + Record if an array is reference absolutly or relatively (or both)
+ * + For absolute arrays, store a bitmap of accesses
+ * + For single parameters, store an access flag
+ * + After parsing, make a parameter cleanup and merging pass, where
+ * relative arrays are layed out first, followed by abs arrays, and
+ * finally single state.
+ * + Remap offsets for param src and dst registers
+ * + Now we can properly count parameter usage
+ *
+ * - Multiple state binding errors in param arrays (see spec, just before
+ * section 2.14.3.3)
+ * - grep for XXX
+ *
+ * Mesa Stuff
+ * -----------------------------------------------------
+ * - User clipping planes vs. PositionInvariant
+ * - Is it sufficient to just multiply by the mvp to transform in the
+ * PositionInvariant case? Or do we need something more involved?
+ *
+ * - vp_src swizzle is GLubyte, fp_src swizzle is GLuint
+ * - fetch state listed in program_parameters list
+ * + WTF should this go???
+ * + currently in nvvertexec.c and s_nvfragprog.c
+ *
+ * - allow for multiple address registers (and fetch address regs properly)
+ *
+ * Cosmetic Stuff
+ * -----------------------------------------------------
+ * - remove any leftover unused grammer.c stuff (dict_ ?)
+ * - fix grammer.c error handling so its not static
+ * - #ifdef around stuff pertaining to extentions
+ *
+ * Outstanding Questions:
+ * -----------------------------------------------------
+ * - ARB_matrix_palette / ARB_vertex_blend -- not supported
+ * what gets hacked off because of this:
+ * + VERTEX_ATTRIB_MATRIXINDEX
+ * + VERTEX_ATTRIB_WEIGHT
+ * + MATRIX_MODELVIEW
+ * + MATRIX_PALETTE
+ *
+ * - When can we fetch env/local params from their own register files, and
+ * when to we have to fetch them into the main state register file?
+ * (think arrays)
+ *
+ * Grammar Changes:
+ * -----------------------------------------------------
+ */
+
+/* Changes since moving the file to shader directory
+
+2004-III-4 ------------------------------------------------------------
+- added #include "grammar_mesa.h"
+- removed grammar specific code part (it resides now in grammar.c)
+- added GL_ARB_fragment_program_shadow tokens
+- modified #include "arbparse_syn.h"
+- major changes inside _mesa_parse_arb_program()
+- check the program string for '\0' characters
+- copy the program string to a one-byte-longer location to have
+ it null-terminated
+- position invariance test (not writing to result.position) moved
+ to syntax part
+*/
+
+typedef GLubyte *production;
+
+/**
+ * This is the text describing the rules to parse the grammar
+ */
+__extension__ static char arb_grammar_text[] =
+#include "arbprogram_syn.h"
+;
+
+/**
+ * These should match up with the values defined in arbprogram.syn
+ */
+
+/*
+ Changes:
+ - changed and merged V_* and F_* opcode values to OP_*.
+ - added GL_ARB_fragment_program_shadow specific tokens (michal)
+*/
+#define REVISION 0x07
+
+/* program type */
+#define FRAGMENT_PROGRAM 0x01
+#define VERTEX_PROGRAM 0x02
+
+/* program section */
+#define OPTION 0x01
+#define INSTRUCTION 0x02
+#define DECLARATION 0x03
+#define END 0x04
+
+/* GL_ARB_fragment_program option flags */
+#define ARB_PRECISION_HINT_FASTEST 0x01
+#define ARB_PRECISION_HINT_NICEST 0x02
+#define ARB_FOG_EXP 0x04
+#define ARB_FOG_EXP2 0x08
+#define ARB_FOG_LINEAR 0x10
+
+/* GL_ARB_vertex_program option flags */
+#define ARB_POSITION_INVARIANT 0x20
+
+/* GL_ARB_fragment_program_shadow option flags */
+#define ARB_FRAGMENT_PROGRAM_SHADOW 0x40
+
+/* GL_ARB_fragment_program instruction class */
+#define OP_ALU_INST 0x00
+#define OP_TEX_INST 0x01
+
+/* GL_ARB_vertex_program instruction class */
+/* OP_ALU_INST */
+
+/* GL_ARB_fragment_program instruction type */
+#define OP_ALU_VECTOR 0x00
+#define OP_ALU_SCALAR 0x01
+#define OP_ALU_BINSC 0x02
+#define OP_ALU_BIN 0x03
+#define OP_ALU_TRI 0x04
+#define OP_ALU_SWZ 0x05
+#define OP_TEX_SAMPLE 0x06
+#define OP_TEX_KIL 0x07
+
+/* GL_ARB_vertex_program instruction type */
+#define OP_ALU_ARL 0x08
+/* OP_ALU_VECTOR */
+/* OP_ALU_SCALAR */
+/* OP_ALU_BINSC */
+/* OP_ALU_BIN */
+/* OP_ALU_TRI */
+/* OP_ALU_SWZ */
+
+/* GL_ARB_fragment_program instruction code */
+#define OP_ABS 0x00
+#define OP_ABS_SAT 0x1B
+#define OP_FLR 0x09
+#define OP_FLR_SAT 0x26
+#define OP_FRC 0x0A
+#define OP_FRC_SAT 0x27
+#define OP_LIT 0x0C
+#define OP_LIT_SAT 0x2A
+#define OP_MOV 0x11
+#define OP_MOV_SAT 0x30
+#define OP_COS 0x1F
+#define OP_COS_SAT 0x20
+#define OP_EX2 0x07
+#define OP_EX2_SAT 0x25
+#define OP_LG2 0x0B
+#define OP_LG2_SAT 0x29
+#define OP_RCP 0x14
+#define OP_RCP_SAT 0x33
+#define OP_RSQ 0x15
+#define OP_RSQ_SAT 0x34
+#define OP_SIN 0x38
+#define OP_SIN_SAT 0x39
+#define OP_SCS 0x35
+#define OP_SCS_SAT 0x36
+#define OP_POW 0x13
+#define OP_POW_SAT 0x32
+#define OP_ADD 0x01
+#define OP_ADD_SAT 0x1C
+#define OP_DP3 0x03
+#define OP_DP3_SAT 0x21
+#define OP_DP4 0x04
+#define OP_DP4_SAT 0x22
+#define OP_DPH 0x05
+#define OP_DPH_SAT 0x23
+#define OP_DST 0x06
+#define OP_DST_SAT 0x24
+#define OP_MAX 0x0F
+#define OP_MAX_SAT 0x2E
+#define OP_MIN 0x10
+#define OP_MIN_SAT 0x2F
+#define OP_MUL 0x12
+#define OP_MUL_SAT 0x31
+#define OP_SGE 0x16
+#define OP_SGE_SAT 0x37
+#define OP_SLT 0x17
+#define OP_SLT_SAT 0x3A
+#define OP_SUB 0x18
+#define OP_SUB_SAT 0x3B
+#define OP_XPD 0x1A
+#define OP_XPD_SAT 0x43
+#define OP_CMP 0x1D
+#define OP_CMP_SAT 0x1E
+#define OP_LRP 0x2B
+#define OP_LRP_SAT 0x2C
+#define OP_MAD 0x0E
+#define OP_MAD_SAT 0x2D
+#define OP_SWZ 0x19
+#define OP_SWZ_SAT 0x3C
+#define OP_TEX 0x3D
+#define OP_TEX_SAT 0x3E
+#define OP_TXB 0x3F
+#define OP_TXB_SAT 0x40
+#define OP_TXP 0x41
+#define OP_TXP_SAT 0x42
+#define OP_KIL 0x28
+
+/* GL_ARB_vertex_program instruction code */
+#define OP_ARL 0x02
+/* OP_ABS */
+/* OP_FLR */
+/* OP_FRC */
+/* OP_LIT */
+/* OP_MOV */
+/* OP_EX2 */
+#define OP_EXP 0x08
+/* OP_LG2 */
+#define OP_LOG 0x0D
+/* OP_RCP */
+/* OP_RSQ */
+/* OP_POW */
+/* OP_ADD */
+/* OP_DP3 */
+/* OP_DP4 */
+/* OP_DPH */
+/* OP_DST */
+/* OP_MAX */
+/* OP_MIN */
+/* OP_MUL */
+/* OP_SGE */
+/* OP_SLT */
+/* OP_SUB */
+/* OP_XPD */
+/* OP_MAD */
+/* OP_SWZ */
+
+/* fragment attribute binding */
+#define FRAGMENT_ATTRIB_COLOR 0x01
+#define FRAGMENT_ATTRIB_TEXCOORD 0x02
+#define FRAGMENT_ATTRIB_FOGCOORD 0x03
+#define FRAGMENT_ATTRIB_POSITION 0x04
+
+/* vertex attribute binding */
+#define VERTEX_ATTRIB_POSITION 0x01
+#define VERTEX_ATTRIB_WEIGHT 0x02
+#define VERTEX_ATTRIB_NORMAL 0x03
+#define VERTEX_ATTRIB_COLOR 0x04
+#define VERTEX_ATTRIB_FOGCOORD 0x05
+#define VERTEX_ATTRIB_TEXCOORD 0x06
+#define VERTEX_ATTRIB_MATRIXINDEX 0x07
+#define VERTEX_ATTRIB_GENERIC 0x08
+
+/* fragment result binding */
+#define FRAGMENT_RESULT_COLOR 0x01
+#define FRAGMENT_RESULT_DEPTH 0x02
+
+/* vertex result binding */
+#define VERTEX_RESULT_POSITION 0x01
+#define VERTEX_RESULT_COLOR 0x02
+#define VERTEX_RESULT_FOGCOORD 0x03
+#define VERTEX_RESULT_POINTSIZE 0x04
+#define VERTEX_RESULT_TEXCOORD 0x05
+
+/* texture target */
+#define TEXTARGET_1D 0x01
+#define TEXTARGET_2D 0x02
+#define TEXTARGET_3D 0x03
+#define TEXTARGET_RECT 0x04
+#define TEXTARGET_CUBE 0x05
+/* GL_ARB_fragment_program_shadow */
+#define TEXTARGET_SHADOW1D 0x06
+#define TEXTARGET_SHADOW2D 0x07
+#define TEXTARGET_SHADOWRECT 0x08
+
+/* face type */
+#define FACE_FRONT 0x00
+#define FACE_BACK 0x01
+
+/* color type */
+#define COLOR_PRIMARY 0x00
+#define COLOR_SECONDARY 0x01
+
+/* component */
+#define COMPONENT_X 0x00
+#define COMPONENT_Y 0x01
+#define COMPONENT_Z 0x02
+#define COMPONENT_W 0x03
+#define COMPONENT_0 0x04
+#define COMPONENT_1 0x05
+
+/* array index type */
+#define ARRAY_INDEX_ABSOLUTE 0x00
+#define ARRAY_INDEX_RELATIVE 0x01
+
+/* matrix name */
+#define MATRIX_MODELVIEW 0x01
+#define MATRIX_PROJECTION 0x02
+#define MATRIX_MVP 0x03
+#define MATRIX_TEXTURE 0x04
+#define MATRIX_PALETTE 0x05
+#define MATRIX_PROGRAM 0x06
+
+/* matrix modifier */
+#define MATRIX_MODIFIER_IDENTITY 0x00
+#define MATRIX_MODIFIER_INVERSE 0x01
+#define MATRIX_MODIFIER_TRANSPOSE 0x02
+#define MATRIX_MODIFIER_INVTRANS 0x03
+
+/* constant type */
+#define CONSTANT_SCALAR 0x01
+#define CONSTANT_VECTOR 0x02
+
+/* program param type */
+#define PROGRAM_PARAM_ENV 0x01
+#define PROGRAM_PARAM_LOCAL 0x02
+
+/* register type */
+#define REGISTER_ATTRIB 0x01
+#define REGISTER_PARAM 0x02
+#define REGISTER_RESULT 0x03
+#define REGISTER_ESTABLISHED_NAME 0x04
+
+/* param binding */
+#define PARAM_NULL 0x00
+#define PARAM_ARRAY_ELEMENT 0x01
+#define PARAM_STATE_ELEMENT 0x02
+#define PARAM_PROGRAM_ELEMENT 0x03
+#define PARAM_PROGRAM_ELEMENTS 0x04
+#define PARAM_CONSTANT 0x05
+
+/* param state property */
+#define STATE_MATERIAL_PARSER 0x01
+#define STATE_LIGHT_PARSER 0x02
+#define STATE_LIGHT_MODEL 0x03
+#define STATE_LIGHT_PROD 0x04
+#define STATE_FOG 0x05
+#define STATE_MATRIX_ROWS 0x06
+/* GL_ARB_fragment_program */
+#define STATE_TEX_ENV 0x07
+#define STATE_DEPTH 0x08
+/* GL_ARB_vertex_program */
+#define STATE_TEX_GEN 0x09
+#define STATE_CLIP_PLANE 0x0A
+#define STATE_POINT 0x0B
+
+/* state material property */
+#define MATERIAL_AMBIENT 0x01
+#define MATERIAL_DIFFUSE 0x02
+#define MATERIAL_SPECULAR 0x03
+#define MATERIAL_EMISSION 0x04
+#define MATERIAL_SHININESS 0x05
+
+/* state light property */
+#define LIGHT_AMBIENT 0x01
+#define LIGHT_DIFFUSE 0x02
+#define LIGHT_SPECULAR 0x03
+#define LIGHT_POSITION 0x04
+#define LIGHT_ATTENUATION 0x05
+#define LIGHT_HALF 0x06
+#define LIGHT_SPOT_DIRECTION 0x07
+
+/* state light model property */
+#define LIGHT_MODEL_AMBIENT 0x01
+#define LIGHT_MODEL_SCENECOLOR 0x02
+
+/* state light product property */
+#define LIGHT_PROD_AMBIENT 0x01
+#define LIGHT_PROD_DIFFUSE 0x02
+#define LIGHT_PROD_SPECULAR 0x03
+
+/* state texture environment property */
+#define TEX_ENV_COLOR 0x01
+
+/* state texture generation coord property */
+#define TEX_GEN_EYE 0x01
+#define TEX_GEN_OBJECT 0x02
+
+/* state fog property */
+#define FOG_COLOR 0x01
+#define FOG_PARAMS 0x02
+
+/* state depth property */
+#define DEPTH_RANGE 0x01
+
+/* state point parameters property */
+#define POINT_SIZE 0x01
+#define POINT_ATTENUATION 0x02
+
+/* declaration */
+#define ATTRIB 0x01
+#define PARAM 0x02
+#define TEMP 0x03
+#define OUTPUT 0x04
+#define ALIAS 0x05
+/* GL_ARB_vertex_program */
+#define ADDRESS 0x06
+
+/*-----------------------------------------------------------------------
+ * From here on down is the semantic checking portion
+ *
+ */
+
+/**
+ * Variable Table Handling functions
+ */
+typedef enum
+{
+ vt_none,
+ vt_address,
+ vt_attrib,
+ vt_param,
+ vt_temp,
+ vt_output,
+ vt_alias
+} var_type;
+
+
+/*
+ * Setting an explicit field for each of the binding properties is a bit wasteful
+ * of space, but it should be much more clear when reading later on..
+ */
+struct var_cache
+{
+ GLubyte *name;
+ var_type type;
+ GLuint address_binding; /* The index of the address register we should
+ * be using */
+ GLuint attrib_binding; /* For type vt_attrib, see nvfragprog.h for values */
+ GLuint attrib_binding_idx; /* The index into the attrib register file corresponding
+ * to the state in attrib_binding */
+ GLuint attrib_is_generic; /* If the attrib was specified through a generic
+ * vertex attrib */
+ GLuint temp_binding; /* The index of the temp register we are to use */
+ GLuint output_binding; /* For type vt_output, see nvfragprog.h for values */
+ GLuint output_binding_idx; /* This is the index into the result register file
+ * corresponding to the bound result state */
+ struct var_cache *alias_binding; /* For type vt_alias, points to the var_cache entry
+ * that this is aliased to */
+ GLuint param_binding_type; /* {PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM,
+ * PROGRAM_ENV_PARAM} */
+ GLuint param_binding_begin; /* This is the offset into the program_parameter_list where
+ * the tokens representing our bound state (or constants)
+ * start */
+ GLuint param_binding_length; /* This is how many entries in the the program_parameter_list
+ * we take up with our state tokens or constants. Note that
+ * this is _not_ the same as the number of param registers
+ * we eventually use */
+ struct var_cache *next;
+};
+
+static GLvoid
+var_cache_create (struct var_cache **va)
+{
+ *va = (struct var_cache *) _mesa_malloc (sizeof (struct var_cache));
+ if (*va) {
+ (**va).name = NULL;
+ (**va).type = vt_none;
+ (**va).attrib_binding = ~0;
+ (**va).attrib_is_generic = 0;
+ (**va).temp_binding = ~0;
+ (**va).output_binding = ~0;
+ (**va).output_binding_idx = ~0;
+ (**va).param_binding_type = ~0;
+ (**va).param_binding_begin = ~0;
+ (**va).param_binding_length = ~0;
+ (**va).alias_binding = NULL;
+ (**va).next = NULL;
+ }
+}
+
+static GLvoid
+var_cache_destroy (struct var_cache **va)
+{
+ if (*va) {
+ var_cache_destroy (&(**va).next);
+ _mesa_free (*va);
+ *va = NULL;
+ }
+}
+
+static GLvoid
+var_cache_append (struct var_cache **va, struct var_cache *nv)
+{
+ if (*va)
+ var_cache_append (&(**va).next, nv);
+ else
+ *va = nv;
+}
+
+static struct var_cache *
+var_cache_find (struct var_cache *va, GLubyte * name)
+{
+ struct var_cache *first = va;
+
+ while (va) {
+ if (!strcmp ( (const char*) name, (const char*) va->name)) {
+ if (va->type == vt_alias)
+ return var_cache_find (first, va->name);
+ return va;
+ }
+
+ va = va->next;
+ }
+
+ return NULL;
+}
+
+/**
+ * constructs an integer from 4 GLubytes in LE format
+ */
+static GLuint
+parse_position (GLubyte ** inst)
+{
+ GLuint value;
+
+ value = (GLuint) (*(*inst)++);
+ value += (GLuint) (*(*inst)++) * 0x100;
+ value += (GLuint) (*(*inst)++) * 0x10000;
+ value += (GLuint) (*(*inst)++) * 0x1000000;
+
+ return value;
+}
+
+/**
+ * This will, given a string, lookup the string as a variable name in the
+ * var cache. If the name is found, the var cache node corresponding to the
+ * var name is returned. If it is not found, a new entry is allocated
+ *
+ * \param I Points into the binary array where the string identifier begins
+ * \param found 1 if the string was found in the var_cache, 0 if it was allocated
+ * \return The location on the var_cache corresponding the the string starting at I
+ */
+static struct var_cache *
+parse_string (GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program, GLuint * found)
+{
+ GLubyte *i = *inst;
+ struct var_cache *va = NULL;
+ (void) Program;
+
+ *inst += _mesa_strlen ((char *) i) + 1;
+
+ va = var_cache_find (*vc_head, i);
+
+ if (va) {
+ *found = 1;
+ return va;
+ }
+
+ *found = 0;
+ var_cache_create (&va);
+ va->name = i;
+
+ var_cache_append (vc_head, va);
+
+ return va;
+}
+
+static char *
+parse_string_without_adding (GLubyte ** inst, struct arb_program *Program)
+{
+ GLubyte *i = *inst;
+ (void) Program;
+
+ *inst += _mesa_strlen ((char *) i) + 1;
+
+ return (char *) i;
+}
+
+/**
+ * \return -1 if we parse '-', return 1 otherwise
+ */
+static GLint
+parse_sign (GLubyte ** inst)
+{
+ /*return *(*inst)++ != '+'; */
+
+ if (**inst == '-') {
+ (*inst)++;
+ return -1;
+ }
+ else if (**inst == '+') {
+ (*inst)++;
+ return 1;
+ }
+
+ return 1;
+}
+
+/**
+ * parses and returns signed integer
+ */
+static GLint
+parse_integer (GLubyte ** inst, struct arb_program *Program)
+{
+ GLint sign;
+ GLint value;
+
+ /* check if *inst points to '+' or '-'
+ * if yes, grab the sign and increment *inst
+ */
+ sign = parse_sign (inst);
+
+ /* now check if *inst points to 0
+ * if yes, increment the *inst and return the default value
+ */
+ if (**inst == 0) {
+ (*inst)++;
+ return 0;
+ }
+
+ /* parse the integer as you normally would do it */
+ value = _mesa_atoi (parse_string_without_adding (inst, Program));
+
+ /* now, after terminating 0 there is a position
+ * to parse it - parse_position()
+ */
+ Program->Position = parse_position (inst);
+
+ return value * sign;
+}
+
+/**
+ */
+static GLfloat
+parse_float (GLubyte ** inst, struct arb_program *Program)
+{
+ GLint tmp[5], denom;
+ GLuint leading_zeros =0;
+ GLfloat value = 0;
+
+ tmp[1] = parse_integer (inst, Program); /* This is the integer portion of the number */
+
+ /* Now we grab the fractional portion of the number (the digits after
+ * the .). We can have leading 0's here, which parse_integer will ignore,
+ * so we'll check for those first
+ */
+ while ((**inst == '0') && ( *(*inst+1) != 0))
+ {
+ leading_zeros++;
+ (*inst)++;
+ }
+ tmp[2] = parse_integer (inst, Program); /* This is the fractional portion of the number */
+ tmp[3] = parse_sign (inst); /* This is the sign of the exponent */
+ tmp[4] = parse_integer (inst, Program); /* This is the exponent */
+
+ value = (GLfloat) tmp[1];
+ denom = 1;
+ while (denom < tmp[2])
+ denom *= 10;
+ denom *= (GLint) _mesa_pow( 10, leading_zeros );
+ value += (GLfloat) tmp[2] / (GLfloat) denom;
+
+ value *= (GLfloat) _mesa_pow (10, (GLfloat) tmp[3] * (GLfloat) tmp[4]);
+
+ return value;
+}
+
+
+/**
+ */
+static GLfloat
+parse_signed_float (GLubyte ** inst, struct arb_program *Program)
+{
+ GLint sign = parse_sign (inst);
+ GLfloat value = parse_float (inst, Program);
+ return value * sign;
+}
+
+/**
+ * This picks out a constant value from the parsed array. The constant vector is r
+ * returned in the *values array, which should be of length 4.
+ *
+ * \param values - The 4 component vector with the constant value in it
+ */
+static GLvoid
+parse_constant (GLubyte ** inst, GLfloat *values, struct arb_program *Program,
+ GLboolean use)
+{
+ GLuint components, i;
+
+
+ switch (*(*inst)++) {
+ case CONSTANT_SCALAR:
+ if (use == GL_TRUE) {
+ values[0] =
+ values[1] =
+ values[2] = values[3] = parse_float (inst, Program);
+ }
+ else {
+ values[0] =
+ values[1] =
+ values[2] = values[3] = parse_signed_float (inst, Program);
+ }
+
+ break;
+ case CONSTANT_VECTOR:
+ values[0] = values[1] = values[2] = 0;
+ values[3] = 1;
+ components = *(*inst)++;
+ for (i = 0; i < components; i++) {
+ values[i] = parse_signed_float (inst, Program);
+ }
+ break;
+ }
+}
+
+/**
+ * \param offset The offset from the address register that we should
+ * address
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_relative_offset (GLcontext *ctx, GLubyte **inst, struct arb_program *Program,
+ GLint *offset)
+{
+ *offset = parse_integer(inst, Program);
+ if ((*offset > 63) || (*offset < -64)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Relative offset out of range");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Relative offset %d out of range",
+ *offset);
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * \param color 0 if color type is primary, 1 if color type is secondary
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_color_type (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program,
+ GLint * color)
+{
+ (void) ctx; (void) Program;
+ *color = *(*inst)++ != COLOR_PRIMARY;
+ return 0;
+}
+
+/**
+ * Get an integer corresponding to a generic vertex attribute.
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_generic_attrib_num(GLcontext *ctx, GLubyte ** inst,
+ struct arb_program *Program, GLuint *attrib)
+{
+ GLint i = parse_integer(inst, Program);
+
+ if ((i < 0) || (i > MAX_VERTEX_PROGRAM_ATTRIBS))
+ {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid generic vertex attribute index");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid generic vertex attribute index");
+
+ return 1;
+ }
+
+ *attrib = (GLuint) i;
+
+ return 0;
+}
+
+
+/**
+ * \param coord The texture unit index
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_texcoord_num (GLcontext * ctx, GLubyte ** inst,
+ struct arb_program *Program, GLuint * coord)
+{
+ GLint i = parse_integer (inst, Program);
+
+ if ((i < 0) || (i >= (int)ctx->Const.MaxTextureUnits)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid texture unit index");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid texture unit index");
+ return 1;
+ }
+
+ *coord = (GLuint) i;
+ return 0;
+}
+
+/**
+ * \param coord The weight index
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_weight_num (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program,
+ GLint * coord)
+{
+ *coord = parse_integer (inst, Program);
+
+ if ((*coord < 0) || (*coord >= 1)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid weight index");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid weight index");
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * \param coord The clip plane index
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_clipplane_num (GLcontext * ctx, GLubyte ** inst,
+ struct arb_program *Program, GLint * coord)
+{
+ *coord = parse_integer (inst, Program);
+
+ if ((*coord < 0) || (*coord >= (GLint) ctx->Const.MaxClipPlanes)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid clip plane index");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid clip plane index");
+ return 1;
+ }
+
+ return 0;
+}
+
+
+/**
+ * \return 0 on front face, 1 on back face
+ */
+static GLuint
+parse_face_type (GLubyte ** inst)
+{
+ switch (*(*inst)++) {
+ case FACE_FRONT:
+ return 0;
+
+ case FACE_BACK:
+ return 1;
+ }
+ return 0;
+}
+
+
+/**
+ * Given a matrix and a modifier token on the binary array, return tokens
+ * that _mesa_fetch_state() [program.c] can understand.
+ *
+ * \param matrix - the matrix we are talking about
+ * \param matrix_idx - the index of the matrix we have (for texture & program matricies)
+ * \param matrix_modifier - the matrix modifier (trans, inv, etc)
+ * \return 0 on sucess, 1 on failure
+ */
+static GLuint
+parse_matrix (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program,
+ GLint * matrix, GLint * matrix_idx, GLint * matrix_modifier)
+{
+ GLubyte mat = *(*inst)++;
+
+ *matrix_idx = 0;
+
+ switch (mat) {
+ case MATRIX_MODELVIEW:
+ *matrix = STATE_MODELVIEW;
+ *matrix_idx = parse_integer (inst, Program);
+ if (*matrix_idx > 0) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "ARB_vertex_blend not supported\n");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "ARB_vertex_blend not supported\n");
+ return 1;
+ }
+ break;
+
+ case MATRIX_PROJECTION:
+ *matrix = STATE_PROJECTION;
+ break;
+
+ case MATRIX_MVP:
+ *matrix = STATE_MVP;
+ break;
+
+ case MATRIX_TEXTURE:
+ *matrix = STATE_TEXTURE;
+ *matrix_idx = parse_integer (inst, Program);
+ if (*matrix_idx >= (GLint) ctx->Const.MaxTextureUnits) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid Texture Unit");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Invalid Texture Unit: %d", *matrix_idx);
+ return 1;
+ }
+ break;
+
+ /* This is not currently supported (ARB_matrix_palette) */
+ case MATRIX_PALETTE:
+ *matrix_idx = parse_integer (inst, Program);
+ _mesa_set_program_error (ctx, Program->Position,
+ "ARB_matrix_palette not supported\n");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "ARB_matrix_palette not supported\n");
+ return 1;
+ break;
+
+ case MATRIX_PROGRAM:
+ *matrix = STATE_PROGRAM;
+ *matrix_idx = parse_integer (inst, Program);
+ if (*matrix_idx >= (GLint) ctx->Const.MaxProgramMatrices) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid Program Matrix");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Invalid Program Matrix: %d", *matrix_idx);
+ return 1;
+ }
+ break;
+ }
+
+ switch (*(*inst)++) {
+ case MATRIX_MODIFIER_IDENTITY:
+ *matrix_modifier = 0;
+ break;
+ case MATRIX_MODIFIER_INVERSE:
+ *matrix_modifier = STATE_MATRIX_INVERSE;
+ break;
+ case MATRIX_MODIFIER_TRANSPOSE:
+ *matrix_modifier = STATE_MATRIX_TRANSPOSE;
+ break;
+ case MATRIX_MODIFIER_INVTRANS:
+ *matrix_modifier = STATE_MATRIX_INVTRANS;
+ break;
+ }
+
+ return 0;
+}
+
+
+/**
+ * This parses a state string (rather, the binary version of it) into
+ * a 6-token sequence as described in _mesa_fetch_state() [program.c]
+ *
+ * \param inst - the start in the binary arry to start working from
+ * \param state_tokens - the storage for the 6-token state description
+ * \return - 0 on sucess, 1 on error
+ */
+static GLuint
+parse_state_single_item (GLcontext * ctx, GLubyte ** inst,
+ struct arb_program *Program, GLint * state_tokens)
+{
+ switch (*(*inst)++) {
+ case STATE_MATERIAL_PARSER:
+ state_tokens[0] = STATE_MATERIAL;
+ state_tokens[1] = parse_face_type (inst);
+ switch (*(*inst)++) {
+ case MATERIAL_AMBIENT:
+ state_tokens[2] = STATE_AMBIENT;
+ break;
+ case MATERIAL_DIFFUSE:
+ state_tokens[2] = STATE_DIFFUSE;
+ break;
+ case MATERIAL_SPECULAR:
+ state_tokens[2] = STATE_SPECULAR;
+ break;
+ case MATERIAL_EMISSION:
+ state_tokens[2] = STATE_EMISSION;
+ break;
+ case MATERIAL_SHININESS:
+ state_tokens[2] = STATE_SHININESS;
+ break;
+ }
+ break;
+
+ case STATE_LIGHT_PARSER:
+ state_tokens[0] = STATE_LIGHT;
+ state_tokens[1] = parse_integer (inst, Program);
+
+ /* Check the value of state_tokens[1] against the # of lights */
+ if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid Light Number");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Invalid Light Number: %d", state_tokens[1]);
+ return 1;
+ }
+
+ switch (*(*inst)++) {
+ case LIGHT_AMBIENT:
+ state_tokens[2] = STATE_AMBIENT;
+ break;
+ case LIGHT_DIFFUSE:
+ state_tokens[2] = STATE_DIFFUSE;
+ break;
+ case LIGHT_SPECULAR:
+ state_tokens[2] = STATE_SPECULAR;
+ break;
+ case LIGHT_POSITION:
+ state_tokens[2] = STATE_POSITION;
+ break;
+ case LIGHT_ATTENUATION:
+ state_tokens[2] = STATE_ATTENUATION;
+ break;
+ case LIGHT_HALF:
+ state_tokens[2] = STATE_HALF;
+ break;
+ case LIGHT_SPOT_DIRECTION:
+ state_tokens[2] = STATE_SPOT_DIRECTION;
+ break;
+ }
+ break;
+
+ case STATE_LIGHT_MODEL:
+ switch (*(*inst)++) {
+ case LIGHT_MODEL_AMBIENT:
+ state_tokens[0] = STATE_LIGHTMODEL_AMBIENT;
+ break;
+ case LIGHT_MODEL_SCENECOLOR:
+ state_tokens[0] = STATE_LIGHTMODEL_SCENECOLOR;
+ state_tokens[1] = parse_face_type (inst);
+ break;
+ }
+ break;
+
+ case STATE_LIGHT_PROD:
+ state_tokens[0] = STATE_LIGHTPROD;
+ state_tokens[1] = parse_integer (inst, Program);
+
+ /* Check the value of state_tokens[1] against the # of lights */
+ if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid Light Number");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Invalid Light Number: %d", state_tokens[1]);
+ return 1;
+ }
+
+ state_tokens[2] = parse_face_type (inst);
+ switch (*(*inst)++) {
+ case LIGHT_PROD_AMBIENT:
+ state_tokens[3] = STATE_AMBIENT;
+ break;
+ case LIGHT_PROD_DIFFUSE:
+ state_tokens[3] = STATE_DIFFUSE;
+ break;
+ case LIGHT_PROD_SPECULAR:
+ state_tokens[3] = STATE_SPECULAR;
+ break;
+ }
+ break;
+
+
+ case STATE_FOG:
+ switch (*(*inst)++) {
+ case FOG_COLOR:
+ state_tokens[0] = STATE_FOG_COLOR;
+ break;
+ case FOG_PARAMS:
+ state_tokens[0] = STATE_FOG_PARAMS;
+ break;
+ }
+ break;
+
+ case STATE_TEX_ENV:
+ state_tokens[1] = parse_integer (inst, Program);
+ switch (*(*inst)++) {
+ case TEX_ENV_COLOR:
+ state_tokens[0] = STATE_TEXENV_COLOR;
+ break;
+ }
+ break;
+
+ case STATE_TEX_GEN:
+ {
+ GLuint type, coord;
+
+ state_tokens[0] = STATE_TEXGEN;
+ /*state_tokens[1] = parse_integer (inst, Program);*/ /* Texture Unit */
+
+ if (parse_texcoord_num (ctx, inst, Program, &coord))
+ return 1;
+ state_tokens[1] = coord;
+
+ /* EYE or OBJECT */
+ type = *(*inst++);
+
+ /* 0 - s, 1 - t, 2 - r, 3 - q */
+ coord = *(*inst++);
+
+ if (type == TEX_GEN_EYE) {
+ switch (coord) {
+ case COMPONENT_X:
+ state_tokens[2] = STATE_TEXGEN_EYE_S;
+ break;
+ case COMPONENT_Y:
+ state_tokens[2] = STATE_TEXGEN_EYE_T;
+ break;
+ case COMPONENT_Z:
+ state_tokens[2] = STATE_TEXGEN_EYE_R;
+ break;
+ case COMPONENT_W:
+ state_tokens[2] = STATE_TEXGEN_EYE_Q;
+ break;
+ }
+ }
+ else {
+ switch (coord) {
+ case COMPONENT_X:
+ state_tokens[2] = STATE_TEXGEN_OBJECT_S;
+ break;
+ case COMPONENT_Y:
+ state_tokens[2] = STATE_TEXGEN_OBJECT_T;
+ break;
+ case COMPONENT_Z:
+ state_tokens[2] = STATE_TEXGEN_OBJECT_R;
+ break;
+ case COMPONENT_W:
+ state_tokens[2] = STATE_TEXGEN_OBJECT_Q;
+ break;
+ }
+ }
+ }
+ break;
+
+ case STATE_DEPTH:
+ switch (*(*inst)++) {
+ case DEPTH_RANGE:
+ state_tokens[0] = STATE_DEPTH_RANGE;
+ break;
+ }
+ break;
+
+ case STATE_CLIP_PLANE:
+ state_tokens[0] = STATE_CLIPPLANE;
+ state_tokens[1] = parse_integer (inst, Program);
+ if (parse_clipplane_num (ctx, inst, Program, &state_tokens[1]))
+ return 1;
+ break;
+
+ case STATE_POINT:
+ switch (*(*inst++)) {
+ case POINT_SIZE:
+ state_tokens[0] = STATE_POINT_SIZE;
+ break;
+
+ case POINT_ATTENUATION:
+ state_tokens[0] = STATE_POINT_ATTENUATION;
+ break;
+ }
+ break;
+
+ /* XXX: I think this is the correct format for a matrix row */
+ case STATE_MATRIX_ROWS:
+ state_tokens[0] = STATE_MATRIX;
+ if (parse_matrix
+ (ctx, inst, Program, &state_tokens[1], &state_tokens[2],
+ &state_tokens[5]))
+ return 1;
+
+ state_tokens[3] = parse_integer (inst, Program); /* The first row to grab */
+
+ if ((**inst) != 0) { /* Either the last row, 0 */
+ state_tokens[4] = parse_integer (inst, Program);
+ if (state_tokens[4] < state_tokens[3]) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Second matrix index less than the first");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Second matrix index (%d) less than the first (%d)",
+ state_tokens[4], state_tokens[3]);
+ return 1;
+ }
+ }
+ else {
+ state_tokens[4] = state_tokens[3];
+ (*inst)++;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+/**
+ * This parses a state string (rather, the binary version of it) into
+ * a 6-token similar for the state fetching code in program.c
+ *
+ * One might ask, why fetch these parameters into just like you fetch
+ * state when they are already stored in other places?
+ *
+ * Because of array offsets -> We can stick env/local parameters in the
+ * middle of a parameter array and then index someplace into the array
+ * when we execute.
+ *
+ * One optimization might be to only do this for the cases where the
+ * env/local parameters end up inside of an array, and leave the
+ * single parameters (or arrays of pure env/local pareameters) in their
+ * respective register files.
+ *
+ * For ENV parameters, the format is:
+ * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM
+ * state_tokens[1] = STATE_ENV
+ * state_tokens[2] = the parameter index
+ *
+ * for LOCAL parameters, the format is:
+ * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM
+ * state_tokens[1] = STATE_LOCAL
+ * state_tokens[2] = the parameter index
+ *
+ * \param inst - the start in the binary arry to start working from
+ * \param state_tokens - the storage for the 6-token state description
+ * \return - 0 on sucess, 1 on failure
+ */
+static GLuint
+parse_program_single_item (GLcontext * ctx, GLubyte ** inst,
+ struct arb_program *Program, GLint * state_tokens)
+{
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
+ state_tokens[0] = STATE_FRAGMENT_PROGRAM;
+ else
+ state_tokens[0] = STATE_VERTEX_PROGRAM;
+
+
+ switch (*(*inst)++) {
+ case PROGRAM_PARAM_ENV:
+ state_tokens[1] = STATE_ENV;
+ state_tokens[2] = parse_integer (inst, Program);
+
+ /* Check state_tokens[2] against the number of ENV parameters available */
+ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) &&
+ (state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramEnvParams))
+ ||
+ ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
+ (state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramEnvParams))) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid Program Env Parameter");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Invalid Program Env Parameter: %d",
+ state_tokens[2]);
+ return 1;
+ }
+
+ break;
+
+ case PROGRAM_PARAM_LOCAL:
+ state_tokens[1] = STATE_LOCAL;
+ state_tokens[2] = parse_integer (inst, Program);
+
+ /* Check state_tokens[2] against the number of LOCAL parameters available */
+ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) &&
+ (state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramLocalParams))
+ ||
+ ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
+ (state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramLocalParams))) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid Program Local Parameter");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Invalid Program Local Parameter: %d",
+ state_tokens[2]);
+ return 1;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+/**
+ * For ARB_vertex_program, programs are not allowed to use both an explicit
+ * vertex attribute and a generic vertex attribute corresponding to the same
+ * state. See section 2.14.3.1 of the GL_ARB_vertex_program spec.
+ *
+ * This will walk our var_cache and make sure that nobody does anything fishy.
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+generic_attrib_check(struct var_cache *vc_head)
+{
+ int a;
+ struct var_cache *curr;
+ GLboolean explicitAttrib[MAX_VERTEX_PROGRAM_ATTRIBS],
+ genericAttrib[MAX_VERTEX_PROGRAM_ATTRIBS];
+
+ for (a=0; atype == vt_attrib) {
+ if (curr->attrib_is_generic)
+ genericAttrib[ curr->attrib_binding_idx ] = GL_TRUE;
+ else
+ explicitAttrib[ curr->attrib_binding_idx ] = GL_TRUE;
+ }
+
+ curr = curr->next;
+ }
+
+ for (a=0; aBase.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ switch (*(*inst)++) {
+ case FRAGMENT_ATTRIB_COLOR:
+ err = parse_color_type (ctx, inst, Program, &coord);
+ *binding = FRAG_ATTRIB_COL0 + coord;
+ *binding_idx = 1 + coord;
+ break;
+
+ case FRAGMENT_ATTRIB_TEXCOORD:
+ err = parse_texcoord_num (ctx, inst, Program, &texcoord);
+ *binding = FRAG_ATTRIB_TEX0 + texcoord;
+ *binding_idx = 4 + texcoord;
+ break;
+
+ case FRAGMENT_ATTRIB_FOGCOORD:
+ *binding = FRAG_ATTRIB_FOGC;
+ *binding_idx = 3;
+ break;
+
+ case FRAGMENT_ATTRIB_POSITION:
+ *binding = FRAG_ATTRIB_WPOS;
+ *binding_idx = 0;
+ break;
+
+ default:
+ err = 1;
+ break;
+ }
+ }
+ else {
+ switch (*(*inst)++) {
+ case VERTEX_ATTRIB_POSITION:
+ *binding = VERT_ATTRIB_POS;
+ *binding_idx = 0;
+ break;
+
+ case VERTEX_ATTRIB_WEIGHT:
+ {
+ GLint weight;
+
+ err = parse_weight_num (ctx, inst, Program, &weight);
+ *binding = VERT_ATTRIB_WEIGHT;
+ *binding_idx = 1;
+ }
+ _mesa_set_program_error (ctx, Program->Position,
+ "ARB_vertex_blend not supported\n");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "ARB_vertex_blend not supported\n");
+ return 1;
+ break;
+
+ case VERTEX_ATTRIB_NORMAL:
+ *binding = VERT_ATTRIB_NORMAL;
+ *binding_idx = 2;
+ break;
+
+ case VERTEX_ATTRIB_COLOR:
+ {
+ GLint color;
+
+ err = parse_color_type (ctx, inst, Program, &color);
+ if (color) {
+ *binding = VERT_ATTRIB_COLOR1;
+ *binding_idx = 4;
+ }
+ else {
+ *binding = VERT_ATTRIB_COLOR0;
+ *binding_idx = 3;
+ }
+ }
+ break;
+
+ case VERTEX_ATTRIB_FOGCOORD:
+ *binding = VERT_ATTRIB_FOG;
+ *binding_idx = 5;
+ break;
+
+ case VERTEX_ATTRIB_TEXCOORD:
+ {
+ GLuint unit;
+
+ err = parse_texcoord_num (ctx, inst, Program, &unit);
+ *binding = VERT_ATTRIB_TEX0 + unit;
+ *binding_idx = 8 + unit;
+ }
+ break;
+
+ /* It looks like we don't support this at all, atm */
+ case VERTEX_ATTRIB_MATRIXINDEX:
+ parse_integer (inst, Program);
+ _mesa_set_program_error (ctx, Program->Position,
+ "ARB_palette_matrix not supported");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "ARB_palette_matrix not supported");
+ return 1;
+ break;
+
+ case VERTEX_ATTRIB_GENERIC:
+ {
+ GLuint attrib;
+
+ if (!parse_generic_attrib_num(ctx, inst, Program, &attrib)) {
+ *is_generic = 1;
+ switch (attrib) {
+ case 0:
+ *binding = VERT_ATTRIB_POS;
+ break;
+ case 1:
+ *binding = VERT_ATTRIB_WEIGHT;
+ break;
+ case 2:
+ *binding = VERT_ATTRIB_NORMAL;
+ break;
+ case 3:
+ *binding = VERT_ATTRIB_COLOR0;
+ break;
+ case 4:
+ *binding = VERT_ATTRIB_COLOR1;
+ break;
+ case 5:
+ *binding = VERT_ATTRIB_FOG;
+ break;
+ case 6:
+ break;
+ case 7:
+ break;
+ default:
+ *binding = VERT_ATTRIB_TEX0 + (attrib-8);
+ break;
+ }
+ *binding_idx = attrib;
+ }
+ }
+ break;
+
+ default:
+ err = 1;
+ break;
+ }
+ }
+
+ /* Can this even happen? */
+ if (err) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Bad attribute binding");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Bad attribute binding");
+ }
+
+ Program->InputsRead |= (1 << *binding_idx);
+
+ return err;
+}
+
+/**
+ * This translates between a binary token for an output variable type
+ * and the mesa token for the same thing.
+ *
+ *
+ * XXX: What is the 'name' for vertex program state? -> do we need it?
+ * I don't think we do;
+ *
+ * See nvfragprog.h for definitions
+ *
+ * \param inst - The parsed tokens
+ * \param binding - The name of the state we are binding too
+ * \param binding_idx - The index into the result register file that this is bound too
+ *
+ * See nvfragparse.c for the register file layout for fragment programs
+ * See nvvertparse.c for the register file layout for vertex programs
+ */
+static GLuint
+parse_result_binding (GLcontext * ctx, GLubyte ** inst, GLuint * binding,
+ GLuint * binding_idx, struct arb_program *Program)
+{
+ GLuint b;
+
+ switch (*(*inst)++) {
+ case FRAGMENT_RESULT_COLOR:
+ /* for frag programs, this is FRAGMENT_RESULT_COLOR */
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ *binding = FRAG_OUTPUT_COLR;
+ *binding_idx = 0;
+ }
+ /* for vtx programs, this is VERTEX_RESULT_POSITION */
+ else {
+ *binding_idx = 0;
+ }
+ break;
+
+ case FRAGMENT_RESULT_DEPTH:
+ /* for frag programs, this is FRAGMENT_RESULT_DEPTH */
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ *binding = FRAG_OUTPUT_DEPR;
+ *binding_idx = 2;
+ }
+ /* for vtx programs, this is VERTEX_RESULT_COLOR */
+ else {
+ GLint color_type;
+ GLuint face_type = parse_face_type(inst);
+ GLint color_type_ret = parse_color_type(ctx, inst, Program, &color_type);
+
+ /* back face */
+ if (face_type) {
+ if (color_type_ret) return 1;
+
+ /* secondary color */
+ if (color_type) {
+ *binding_idx = 4;
+ }
+ /* primary color */
+ else {
+ *binding_idx = 3;
+ }
+ }
+ /* front face */
+ else {
+ /* secondary color */
+ if (color_type) {
+ *binding_idx = 2;
+ }
+ /* primary color */
+ else {
+ *binding_idx = 1;
+ }
+ }
+ }
+ break;
+
+ case VERTEX_RESULT_FOGCOORD:
+ *binding_idx = 5;
+ break;
+
+ case VERTEX_RESULT_POINTSIZE:
+ *binding_idx = 6;
+ break;
+
+ case VERTEX_RESULT_TEXCOORD:
+ if (parse_texcoord_num (ctx, inst, Program, &b))
+ return 1;
+ *binding_idx = 7 + b;
+ break;
+ }
+
+ Program->OutputsWritten |= (1 << *binding_idx);
+
+ return 0;
+}
+
+/**
+ * This handles the declaration of ATTRIB variables
+ *
+ * XXX: Still needs
+ * parse_vert_attrib_binding(), or something like that
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLint
+parse_attrib (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLuint found;
+ char *error_msg;
+ struct var_cache *attrib_var;
+
+ attrib_var = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+ if (found) {
+ error_msg = (char *)
+ _mesa_malloc (_mesa_strlen ((char *) attrib_var->name) + 40);
+ _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s",
+ attrib_var->name);
+
+ _mesa_set_program_error (ctx, Program->Position, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, error_msg);
+
+ _mesa_free (error_msg);
+ return 1;
+ }
+
+ attrib_var->type = vt_attrib;
+
+ /* I think this is ok now - karl */
+ /* XXX: */
+ /*if (Program->type == GL_FRAGMENT_PROGRAM_ARB) */
+ {
+ if (parse_attrib_binding
+ (ctx, inst, Program, &attrib_var->attrib_binding,
+ &attrib_var->attrib_binding_idx, &attrib_var->attrib_is_generic))
+ return 1;
+ if (generic_attrib_check(*vc_head)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Cannot use both a generic vertex attribute and a specific attribute of the same type");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Cannot use both a generic vertex attribute and a specific attribute of the same type");
+ return 1;
+ }
+
+ }
+
+ Program->Base.NumAttributes++;
+ return 0;
+}
+
+/**
+ * \param use -- TRUE if we're called when declaring implicit parameters,
+ * FALSE if we're declaraing variables. This has to do with
+ * if we get a signed or unsigned float for scalar constants
+ */
+static GLuint
+parse_param_elements (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache *param_var,
+ struct arb_program *Program, GLboolean use)
+{
+ GLint idx;
+ GLuint err;
+ GLint state_tokens[6];
+ GLfloat const_values[4];
+
+ err = 0;
+
+ switch (*(*inst)++) {
+ case PARAM_STATE_ELEMENT:
+
+ if (parse_state_single_item (ctx, inst, Program, state_tokens))
+ return 1;
+
+ /* If we adding STATE_MATRIX that has multiple rows, we need to
+ * unroll it and call _mesa_add_state_reference() for each row
+ */
+ if ((state_tokens[0] == STATE_MATRIX)
+ && (state_tokens[3] != state_tokens[4])) {
+ GLint row;
+ GLint first_row = state_tokens[3];
+ GLint last_row = state_tokens[4];
+
+ for (row = first_row; row <= last_row; row++) {
+ state_tokens[3] = state_tokens[4] = row;
+
+ idx =
+ _mesa_add_state_reference (Program->Parameters,
+ state_tokens);
+ if (param_var->param_binding_begin == ~0U)
+ param_var->param_binding_begin = idx;
+ param_var->param_binding_length++;
+ Program->Base.NumParameters++;
+ }
+ }
+ else {
+ idx =
+ _mesa_add_state_reference (Program->Parameters, state_tokens);
+ if (param_var->param_binding_begin == ~0U)
+ param_var->param_binding_begin = idx;
+ param_var->param_binding_length++;
+ Program->Base.NumParameters++;
+ }
+ break;
+
+ case PARAM_PROGRAM_ELEMENT:
+
+ if (parse_program_single_item (ctx, inst, Program, state_tokens))
+ return 1;
+ idx = _mesa_add_state_reference (Program->Parameters, state_tokens);
+ if (param_var->param_binding_begin == ~0U)
+ param_var->param_binding_begin = idx;
+ param_var->param_binding_length++;
+ Program->Base.NumParameters++;
+
+ /* Check if there is more: 0 -> we're done, else its an integer */
+ if (**inst) {
+ GLuint out_of_range, new_idx;
+ GLuint start_idx = state_tokens[2] + 1;
+ GLuint end_idx = parse_integer (inst, Program);
+
+ out_of_range = 0;
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ if (((state_tokens[1] == STATE_ENV)
+ && (end_idx >= ctx->Const.MaxFragmentProgramEnvParams))
+ || ((state_tokens[1] == STATE_LOCAL)
+ && (end_idx >=
+ ctx->Const.MaxFragmentProgramLocalParams)))
+ out_of_range = 1;
+ }
+ else {
+ if (((state_tokens[1] == STATE_ENV)
+ && (end_idx >= ctx->Const.MaxVertexProgramEnvParams))
+ || ((state_tokens[1] == STATE_LOCAL)
+ && (end_idx >=
+ ctx->Const.MaxVertexProgramLocalParams)))
+ out_of_range = 1;
+ }
+ if (out_of_range) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid Program Parameter");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Invalid Program Parameter: %d", end_idx);
+ return 1;
+ }
+
+ for (new_idx = start_idx; new_idx <= end_idx; new_idx++) {
+ state_tokens[2] = new_idx;
+ idx =
+ _mesa_add_state_reference (Program->Parameters,
+ state_tokens);
+ param_var->param_binding_length++;
+ Program->Base.NumParameters++;
+ }
+ }
+ else
+ {
+ (*inst)++;
+ }
+ break;
+
+ case PARAM_CONSTANT:
+ parse_constant (inst, const_values, Program, use);
+ idx =
+ _mesa_add_named_constant (Program->Parameters,
+ (char *) param_var->name, const_values);
+ if (param_var->param_binding_begin == ~0U)
+ param_var->param_binding_begin = idx;
+ param_var->param_binding_length++;
+ Program->Base.NumParameters++;
+ break;
+
+ default:
+ _mesa_set_program_error (ctx, Program->Position,
+ "Unexpected token in parse_param_elements()");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Unexpected token in parse_param_elements()");
+ return 1;
+ }
+
+ /* Make sure we haven't blown past our parameter limits */
+ if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
+ (Program->Base.NumParameters >=
+ ctx->Const.MaxVertexProgramLocalParams))
+ || ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
+ && (Program->Base.NumParameters >=
+ ctx->Const.MaxFragmentProgramLocalParams))) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Too many parameter variables");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Too many parameter variables");
+ return 1;
+ }
+
+ return err;
+}
+
+/**
+ * This picks out PARAM program parameter bindings.
+ *
+ * XXX: This needs to be stressed & tested
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_param (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLuint found;
+ GLint specified_length;
+ char *error_msg;
+ struct var_cache *param_var;
+
+ param_var = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+
+ if (found) {
+ error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) param_var->name) + 40);
+ _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s",
+ param_var->name);
+
+ _mesa_set_program_error (ctx, Program->Position, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, error_msg);
+
+ _mesa_free (error_msg);
+ return 1;
+ }
+
+ specified_length = parse_integer (inst, Program);
+
+ if (specified_length < 0) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Negative parameter array length");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Negative parameter array length: %d", specified_length);
+ return 1;
+ }
+
+ param_var->type = vt_param;
+ param_var->param_binding_length = 0;
+
+ /* Right now, everything is shoved into the main state register file.
+ *
+ * In the future, it would be nice to leave things ENV/LOCAL params
+ * in their respective register files, if possible
+ */
+ param_var->param_binding_type = PROGRAM_STATE_VAR;
+
+ /* Remember to:
+ * * - add each guy to the parameter list
+ * * - increment the param_var->param_binding_len
+ * * - store the param_var->param_binding_begin for the first one
+ * * - compare the actual len to the specified len at the end
+ */
+ while (**inst != PARAM_NULL) {
+ if (parse_param_elements (ctx, inst, param_var, Program, GL_FALSE))
+ return 1;
+ }
+
+ /* Test array length here! */
+ if (specified_length) {
+ if (specified_length != (int)param_var->param_binding_length) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Declared parameter array lenght does not match parameter list");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Declared parameter array lenght does not match parameter list");
+ }
+ }
+
+ (*inst)++;
+
+ return 0;
+}
+
+/**
+ *
+ */
+static GLuint
+parse_param_use (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program, struct var_cache **new_var)
+{
+ struct var_cache *param_var;
+
+ /* First, insert a dummy entry into the var_cache */
+ var_cache_create (¶m_var);
+ param_var->name = (GLubyte *) _mesa_strdup (" ");
+ param_var->type = vt_param;
+
+ param_var->param_binding_length = 0;
+ /* Don't fill in binding_begin; We use the default value of -1
+ * to tell if its already initialized, elsewhere.
+ *
+ * param_var->param_binding_begin = 0;
+ */
+ param_var->param_binding_type = PROGRAM_STATE_VAR;
+
+ var_cache_append (vc_head, param_var);
+
+ /* Then fill it with juicy parameter goodness */
+ if (parse_param_elements (ctx, inst, param_var, Program, GL_TRUE))
+ return 1;
+
+ *new_var = param_var;
+
+ return 0;
+}
+
+
+/**
+ * This handles the declaration of TEMP variables
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_temp (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLuint found;
+ struct var_cache *temp_var;
+ char *error_msg;
+
+ while (**inst != 0) {
+ temp_var = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+ if (found) {
+ error_msg = (char *)
+ _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40);
+ _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s",
+ temp_var->name);
+
+ _mesa_set_program_error (ctx, Program->Position, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, error_msg);
+
+ _mesa_free (error_msg);
+ return 1;
+ }
+
+ temp_var->type = vt_temp;
+
+ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) &&
+ (Program->Base.NumTemporaries >=
+ ctx->Const.MaxFragmentProgramTemps))
+ || ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB)
+ && (Program->Base.NumTemporaries >=
+ ctx->Const.MaxVertexProgramTemps))) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Too many TEMP variables declared");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Too many TEMP variables declared");
+ return 1;
+ }
+
+ temp_var->temp_binding = Program->Base.NumTemporaries;
+ Program->Base.NumTemporaries++;
+ }
+ (*inst)++;
+
+ return 0;
+}
+
+/**
+ * This handles variables of the OUTPUT variety
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_output (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLuint found;
+ struct var_cache *output_var;
+
+ output_var = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+ if (found) {
+ char *error_msg;
+ error_msg = (char *)
+ _mesa_malloc (_mesa_strlen ((char *) output_var->name) + 40);
+ _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s",
+ output_var->name);
+
+ _mesa_set_program_error (ctx, Program->Position, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, error_msg);
+
+ _mesa_free (error_msg);
+ return 1;
+ }
+
+ output_var->type = vt_output;
+ return parse_result_binding (ctx, inst, &output_var->output_binding,
+ &output_var->output_binding_idx, Program);
+}
+
+/**
+ * This handles variables of the ALIAS kind
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_alias (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLuint found;
+ struct var_cache *temp_var;
+ char *error_msg;
+
+
+ temp_var = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+
+ if (found) {
+ error_msg = (char *)
+ _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40);
+ _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s",
+ temp_var->name);
+
+ _mesa_set_program_error (ctx, Program->Position, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, error_msg);
+
+ _mesa_free (error_msg);
+ return 1;
+ }
+
+ temp_var->type = vt_alias;
+ temp_var->alias_binding = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+
+ if (!found)
+ {
+ error_msg = (char *)
+ _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40);
+ _mesa_sprintf (error_msg, "Alias value %s is not defined",
+ temp_var->alias_binding->name);
+
+ _mesa_set_program_error (ctx, Program->Position, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, error_msg);
+
+ _mesa_free (error_msg);
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * This handles variables of the ADDRESS kind
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_address (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLuint found;
+ struct var_cache *temp_var;
+ char *error_msg;
+
+ while (**inst != 0) {
+ temp_var = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+ if (found) {
+ error_msg = (char *)
+ _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40);
+ _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s",
+ temp_var->name);
+
+ _mesa_set_program_error (ctx, Program->Position, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, error_msg);
+
+ _mesa_free (error_msg);
+ return 1;
+ }
+
+ temp_var->type = vt_address;
+
+ if (Program->Base.NumAddressRegs >=
+ ctx->Const.MaxVertexProgramAddressRegs) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Too many ADDRESS variables declared");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Too many ADDRESS variables declared");
+ return 1;
+ }
+
+ temp_var->address_binding = Program->Base.NumAddressRegs;
+ Program->Base.NumAddressRegs++;
+ }
+ (*inst)++;
+
+ return 0;
+}
+
+/**
+ * Parse a program declaration
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLint
+parse_declaration (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLint err = 0;
+
+ switch (*(*inst)++) {
+ case ADDRESS:
+ err = parse_address (ctx, inst, vc_head, Program);
+ break;
+
+ case ALIAS:
+ err = parse_alias (ctx, inst, vc_head, Program);
+ break;
+
+ case ATTRIB:
+ err = parse_attrib (ctx, inst, vc_head, Program);
+ break;
+
+ case OUTPUT:
+ err = parse_output (ctx, inst, vc_head, Program);
+ break;
+
+ case PARAM:
+ err = parse_param (ctx, inst, vc_head, Program);
+ break;
+
+ case TEMP:
+ err = parse_temp (ctx, inst, vc_head, Program);
+ break;
+ }
+
+ return err;
+}
+
+/**
+ * Handle the parsing out of a masked destination register
+ *
+ * If we are a vertex program, make sure we don't write to
+ * result.position of we have specified that the program is
+ * position invariant
+ *
+ * \param File - The register file we write to
+ * \param Index - The register index we write to
+ * \param WriteMask - The mask controlling which components we write (1->write)
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_masked_dst_reg (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache **vc_head, struct arb_program *Program,
+ GLint * File, GLint * Index, GLboolean * WriteMask)
+{
+ GLuint result;
+ GLubyte mask;
+ struct var_cache *dst;
+
+ /* We either have a result register specified, or a
+ * variable that may or may not be writable
+ */
+ switch (*(*inst)++) {
+ case REGISTER_RESULT:
+ if (parse_result_binding
+ (ctx, inst, &result, (GLuint *) Index, Program))
+ return 1;
+ *File = PROGRAM_OUTPUT;
+ break;
+
+ case REGISTER_ESTABLISHED_NAME:
+ dst = parse_string (inst, vc_head, Program, &result);
+ Program->Position = parse_position (inst);
+
+ /* If the name has never been added to our symbol table, we're hosed */
+ if (!result) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "0: Undefined variable");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "0: Undefined variable: %s",
+ dst->name);
+ return 1;
+ }
+
+ switch (dst->type) {
+ case vt_output:
+ *File = PROGRAM_OUTPUT;
+ *Index = dst->output_binding_idx;
+ break;
+
+ case vt_temp:
+ *File = PROGRAM_TEMPORARY;
+ *Index = dst->temp_binding;
+ break;
+
+ /* If the var type is not vt_output or vt_temp, no go */
+ default:
+ _mesa_set_program_error (ctx, Program->Position,
+ "Destination register is read only");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Destination register is read only: %s",
+ dst->name);
+ return 1;
+ }
+ break;
+
+ default:
+ _mesa_set_program_error (ctx, Program->Position,
+ "Unexpected opcode in parse_masked_dst_reg()");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Unexpected opcode in parse_masked_dst_reg()");
+ return 1;
+ }
+
+
+ /* Position invariance test */
+ /* This test is done now in syntax portion - when position invariance OPTION
+ is specified, "result.position" rule is disabled so there is no way
+ to write the position
+ */
+ /*if ((Program->HintPositionInvariant) && (*File == PROGRAM_OUTPUT) &&
+ (*Index == 0)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Vertex program specified position invariance and wrote vertex position");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Vertex program specified position invariance and wrote vertex position");
+ }*/
+
+ /* And then the mask.
+ * w,a -> bit 0
+ * z,b -> bit 1
+ * y,g -> bit 2
+ * x,r -> bit 3
+ */
+ mask = *(*inst)++;
+
+ WriteMask[0] = (GLboolean) (mask & (1 << 3)) >> 3;
+ WriteMask[1] = (GLboolean) (mask & (1 << 2)) >> 2;
+ WriteMask[2] = (GLboolean) (mask & (1 << 1)) >> 1;
+ WriteMask[3] = (GLboolean) (mask & (1));
+
+ return 0;
+}
+
+
+/**
+ * Handle the parsing of a address register
+ *
+ * \param Index - The register index we write to
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_address_reg (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache **vc_head,
+ struct arb_program *Program, GLint * Index)
+{
+ struct var_cache *dst;
+ GLuint result;
+ (void) Index;
+
+ dst = parse_string (inst, vc_head, Program, &result);
+ Program->Position = parse_position (inst);
+
+ /* If the name has never been added to our symbol table, we're hosed */
+ if (!result) {
+ _mesa_set_program_error (ctx, Program->Position, "Undefined variable");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Undefined variable: %s",
+ dst->name);
+ return 1;
+ }
+
+ if (dst->type != vt_address) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Variable is not of type ADDRESS");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Variable: %s is not of type ADDRESS", dst->name);
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * Handle the parsing out of a masked address register
+ *
+ * \param Index - The register index we write to
+ * \param WriteMask - The mask controlling which components we write (1->write)
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_masked_address_reg (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache **vc_head,
+ struct arb_program *Program, GLint * Index,
+ GLboolean * WriteMask)
+{
+ if (parse_address_reg (ctx, inst, vc_head, Program, Index))
+ return 1;
+
+ /* This should be 0x8 */
+ (*inst)++;
+
+ /* Writemask of .x is implied */
+ WriteMask[0] = 1;
+ WriteMask[1] = WriteMask[2] = WriteMask[3] = 0;
+
+ return 0;
+}
+
+
+/**
+ * Parse out a swizzle mask.
+ *
+ * The values in the input stream are:
+ * COMPONENT_X -> x/r
+ * COMPONENT_Y -> y/g
+ * COMPONENT_Z-> z/b
+ * COMPONENT_W-> w/a
+ *
+ * The values in the output mask are:
+ * 0 -> x/r
+ * 1 -> y/g
+ * 2 -> z/b
+ * 3 -> w/a
+ *
+ * The len parameter allows us to grab 4 components for a vector
+ * swizzle, or just 1 component for a scalar src register selection
+ */
+static GLuint
+parse_swizzle_mask (GLubyte ** inst, GLubyte * mask, GLint len)
+{
+ GLint a;
+
+ for (a = 0; a < 4; a++)
+ mask[a] = a;
+
+ for (a = 0; a < len; a++) {
+ switch (*(*inst)++) {
+ case COMPONENT_X:
+ mask[a] = 0;
+ break;
+
+ case COMPONENT_Y:
+ mask[a] = 1;
+ break;
+
+ case COMPONENT_Z:
+ mask[a] = 2;
+ break;
+
+ case COMPONENT_W:
+ mask[a] = 3;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+/**
+ */
+static GLuint
+parse_extended_swizzle_mask (GLubyte ** inst, GLubyte * mask, GLboolean * Negate)
+{
+ GLint a;
+ GLubyte swz;
+
+ *Negate = GL_FALSE;
+ for (a = 0; a < 4; a++) {
+ if (parse_sign (inst) == -1)
+ *Negate = GL_TRUE;
+
+ swz = *(*inst)++;
+
+ switch (swz) {
+ case COMPONENT_0:
+ mask[a] = SWIZZLE_ZERO;
+ break;
+ case COMPONENT_1:
+ mask[a] = SWIZZLE_ONE;
+ break;
+ case COMPONENT_X:
+ mask[a] = SWIZZLE_X;
+ break;
+ case COMPONENT_Y:
+ mask[a] = SWIZZLE_Y;
+ break;
+ case COMPONENT_Z:
+ mask[a] = SWIZZLE_Z;
+ break;
+ case COMPONENT_W:
+ mask[a] = SWIZZLE_W;
+ break;
+
+ }
+#if 0
+ if (swz == 0)
+ mask[a] = SWIZZLE_ZERO;
+ else if (swz == 1)
+ mask[a] = SWIZZLE_ONE;
+ else
+ mask[a] = swz - 2;
+#endif
+
+ }
+
+ return 0;
+}
+
+
+static GLuint
+parse_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
+ struct arb_program *Program, GLint * File, GLint * Index,
+ GLboolean *IsRelOffset )
+{
+ struct var_cache *src;
+ GLuint binding_state, binding_idx, is_generic, found;
+ GLint offset;
+
+ /* And the binding for the src */
+ switch (*(*inst)++) {
+ case REGISTER_ATTRIB:
+ if (parse_attrib_binding
+ (ctx, inst, Program, &binding_state, &binding_idx, &is_generic))
+ return 1;
+ *File = PROGRAM_INPUT;
+ *Index = binding_idx;
+
+ /* We need to insert a dummy variable into the var_cache so we can
+ * catch generic vertex attrib aliasing errors
+ */
+ var_cache_create(&src);
+ src->type = vt_attrib;
+ src->name = (GLubyte *)_mesa_strdup("Dummy Attrib Variable");
+ src->attrib_binding = binding_state;
+ src->attrib_binding_idx = binding_idx;
+ src->attrib_is_generic = is_generic;
+ var_cache_append(vc_head, src);
+ if (generic_attrib_check(*vc_head)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Cannot use both a generic vertex attribute and a specific attribute of the same type");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Cannot use both a generic vertex attribute and a specific attribute of the same type");
+ return 1;
+ }
+ break;
+
+ case REGISTER_PARAM:
+ switch (**inst) {
+ case PARAM_ARRAY_ELEMENT:
+ (*inst)++;
+ src = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+
+ if (!found) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "2: Undefined variable");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "2: Undefined variable: %s", src->name);
+ return 1;
+ }
+
+ *File = src->param_binding_type;
+
+ switch (*(*inst)++) {
+ case ARRAY_INDEX_ABSOLUTE:
+ offset = parse_integer (inst, Program);
+
+ if ((offset < 0)
+ || (offset >= (int)src->param_binding_length)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Index out of range");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Index %d out of range for %s", offset,
+ src->name);
+ return 1;
+ }
+
+ *Index = src->param_binding_begin + offset;
+ break;
+
+ case ARRAY_INDEX_RELATIVE:
+ {
+ GLint addr_reg_idx, rel_off;
+
+ /* First, grab the address regiseter */
+ if (parse_address_reg (ctx, inst, vc_head, Program, &addr_reg_idx))
+ return 1;
+
+ /* And the .x */
+ ((*inst)++);
+ ((*inst)++);
+ ((*inst)++);
+ ((*inst)++);
+
+ /* Then the relative offset */
+ if (parse_relative_offset(ctx, inst, Program, &rel_off)) return 1;
+
+ /* And store it properly */
+ *Index = src->param_binding_begin + rel_off;
+ *IsRelOffset = 1;
+ }
+ break;
+ }
+ break;
+
+ default:
+
+ if (parse_param_use (ctx, inst, vc_head, Program, &src))
+ return 1;
+
+ *File = src->param_binding_type;
+ *Index = src->param_binding_begin;
+ break;
+ }
+ break;
+
+ case REGISTER_ESTABLISHED_NAME:
+
+ src = parse_string (inst, vc_head, Program, &found);
+ Program->Position = parse_position (inst);
+
+ /* If the name has never been added to our symbol table, we're hosed */
+ if (!found) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "3: Undefined variable");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "3: Undefined variable: %s",
+ src->name);
+ return 1;
+ }
+
+ switch (src->type) {
+ case vt_attrib:
+ *File = PROGRAM_INPUT;
+ *Index = src->attrib_binding_idx;
+ break;
+
+ /* XXX: We have to handle offsets someplace in here! -- or are those above? */
+ case vt_param:
+ *File = src->param_binding_type;
+ *Index = src->param_binding_begin;
+ break;
+
+ case vt_temp:
+ *File = PROGRAM_TEMPORARY;
+ *Index = src->temp_binding;
+ break;
+
+ /* If the var type is vt_output no go */
+ default:
+ _mesa_set_program_error (ctx, Program->Position,
+ "destination register is read only");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "destination register is read only: %s",
+ src->name);
+ return 1;
+ }
+ break;
+
+ default:
+ _mesa_set_program_error (ctx, Program->Position,
+ "Unknown token in parse_src_reg");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Unknown token in parse_src_reg");
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ */
+static GLuint
+parse_vector_src_reg (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache **vc_head, struct arb_program *Program,
+ GLint * File, GLint * Index, GLboolean * Negate,
+ GLubyte * Swizzle, GLboolean *IsRelOffset)
+{
+ /* Grab the sign */
+ *Negate = (parse_sign (inst) == -1);
+
+ /* And the src reg */
+ if (parse_src_reg (ctx, inst, vc_head, Program, File, Index, IsRelOffset))
+ return 1;
+
+ /* finally, the swizzle */
+ parse_swizzle_mask (inst, Swizzle, 4);
+
+ return 0;
+}
+
+/**
+ */
+static GLuint
+parse_scalar_src_reg (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache **vc_head, struct arb_program *Program,
+ GLint * File, GLint * Index, GLboolean * Negate,
+ GLubyte * Swizzle, GLboolean *IsRelOffset)
+{
+ /* Grab the sign */
+ *Negate = (parse_sign (inst) == -1);
+
+ /* And the src reg */
+ if (parse_src_reg (ctx, inst, vc_head, Program, File, Index, IsRelOffset))
+ return 1;
+
+ /* Now, get the component and shove it into all the swizzle slots */
+ parse_swizzle_mask (inst, Swizzle, 1);
+
+ return 0;
+}
+
+/**
+ * This is a big mother that handles getting opcodes into the instruction
+ * and handling the src & dst registers for fragment program instructions
+ */
+static GLuint
+parse_fp_instruction (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache **vc_head, struct arb_program *Program,
+ struct fp_instruction *fp)
+{
+ GLint a, b;
+ GLubyte swz[4]; /* FP's swizzle mask is a GLubyte, while VP's is GLuint */
+ GLuint texcoord;
+ GLubyte instClass, type, code;
+ GLboolean rel;
+
+ /* No condition codes in ARB_fp */
+ fp->UpdateCondRegister = 0;
+
+ /* Record the position in the program string for debugging */
+ fp->StringPos = Program->Position;
+
+ /* OP_ALU_INST or OP_TEX_INST */
+ instClass = *(*inst)++;
+
+ /* OP_ALU_{VECTOR, SCALAR, BINSC, BIN, TRI, SWZ},
+ * OP_TEX_{SAMPLE, KIL}
+ */
+ type = *(*inst)++;
+
+ /* The actual opcode name */
+ code = *(*inst)++;
+
+ /* Increment the correct count */
+ switch (instClass) {
+ case OP_ALU_INST:
+ Program->NumAluInstructions++;
+ break;
+ case OP_TEX_INST:
+ Program->NumTexInstructions++;
+ break;
+ }
+
+ fp->Saturate = 0;
+ fp->Precision = FLOAT32;
+
+ fp->DstReg.CondMask = COND_TR;
+
+ switch (type) {
+ case OP_ALU_VECTOR:
+ switch (code) {
+ case OP_ABS_SAT:
+ fp->Saturate = 1;
+ case OP_ABS:
+ fp->Opcode = FP_OPCODE_ABS;
+ break;
+
+ case OP_FLR_SAT:
+ fp->Saturate = 1;
+ case OP_FLR:
+ fp->Opcode = FP_OPCODE_FLR;
+ break;
+
+ case OP_FRC_SAT:
+ fp->Saturate = 1;
+ case OP_FRC:
+ fp->Opcode = FP_OPCODE_FRC;
+ break;
+
+ case OP_LIT_SAT:
+ fp->Saturate = 1;
+ case OP_LIT:
+ fp->Opcode = FP_OPCODE_LIT;
+ break;
+
+ case OP_MOV_SAT:
+ fp->Saturate = 1;
+ case OP_MOV:
+ fp->Opcode = FP_OPCODE_MOV;
+ break;
+ }
+
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File,
+ &fp->DstReg.Index, fp->DstReg.WriteMask))
+ return 1;
+
+ fp->SrcReg[0].Abs = GL_FALSE;
+ fp->SrcReg[0].NegateAbs = GL_FALSE;
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File,
+ &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase,
+ swz, &rel))
+ return 1;
+ for (b=0; b<4; b++)
+ fp->SrcReg[0].Swizzle[b] = swz[b];
+ break;
+
+ case OP_ALU_SCALAR:
+ switch (code) {
+ case OP_COS_SAT:
+ fp->Saturate = 1;
+ case OP_COS:
+ fp->Opcode = FP_OPCODE_COS;
+ break;
+
+ case OP_EX2_SAT:
+ fp->Saturate = 1;
+ case OP_EX2:
+ fp->Opcode = FP_OPCODE_EX2;
+ break;
+
+ case OP_LG2_SAT:
+ fp->Saturate = 1;
+ case OP_LG2:
+ fp->Opcode = FP_OPCODE_LG2;
+ break;
+
+ case OP_RCP_SAT:
+ fp->Saturate = 1;
+ case OP_RCP:
+ fp->Opcode = FP_OPCODE_RCP;
+ break;
+
+ case OP_RSQ_SAT:
+ fp->Saturate = 1;
+ case OP_RSQ:
+ fp->Opcode = FP_OPCODE_RSQ;
+ break;
+
+ case OP_SIN_SAT:
+ fp->Saturate = 1;
+ case OP_SIN:
+ fp->Opcode = FP_OPCODE_SIN;
+ break;
+
+ case OP_SCS_SAT:
+ fp->Saturate = 1;
+ case OP_SCS:
+
+ fp->Opcode = FP_OPCODE_SCS;
+ break;
+ }
+
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File,
+ &fp->DstReg.Index, fp->DstReg.WriteMask))
+ return 1;
+ fp->SrcReg[0].Abs = GL_FALSE;
+ fp->SrcReg[0].NegateAbs = GL_FALSE;
+ if (parse_scalar_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File,
+ &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase,
+ swz, &rel))
+ return 1;
+ for (b=0; b<4; b++)
+ fp->SrcReg[0].Swizzle[b] = swz[b];
+ break;
+
+ case OP_ALU_BINSC:
+ switch (code) {
+ case OP_POW_SAT:
+ fp->Saturate = 1;
+ case OP_POW:
+ fp->Opcode = FP_OPCODE_POW;
+ break;
+ }
+
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File,
+ &fp->DstReg.Index, fp->DstReg.WriteMask))
+ return 1;
+ for (a = 0; a < 2; a++) {
+ fp->SrcReg[a].Abs = GL_FALSE;
+ fp->SrcReg[a].NegateAbs = GL_FALSE;
+ if (parse_scalar_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[a].File,
+ &fp->SrcReg[a].Index, &fp->SrcReg[a].NegateBase,
+ swz, &rel))
+ return 1;
+ for (b=0; b<4; b++)
+ fp->SrcReg[a].Swizzle[b] = swz[b];
+ }
+ break;
+
+
+ case OP_ALU_BIN:
+ switch (code) {
+ case OP_ADD_SAT:
+ fp->Saturate = 1;
+ case OP_ADD:
+ fp->Opcode = FP_OPCODE_ADD;
+ break;
+
+ case OP_DP3_SAT:
+ fp->Saturate = 1;
+ case OP_DP3:
+ fp->Opcode = FP_OPCODE_DP3;
+ break;
+
+ case OP_DP4_SAT:
+ fp->Saturate = 1;
+ case OP_DP4:
+ fp->Opcode = FP_OPCODE_DP4;
+ break;
+
+ case OP_DPH_SAT:
+ fp->Saturate = 1;
+ case OP_DPH:
+ fp->Opcode = FP_OPCODE_DPH;
+ break;
+
+ case OP_DST_SAT:
+ fp->Saturate = 1;
+ case OP_DST:
+ fp->Opcode = FP_OPCODE_DST;
+ break;
+
+ case OP_MAX_SAT:
+ fp->Saturate = 1;
+ case OP_MAX:
+ fp->Opcode = FP_OPCODE_MAX;
+ break;
+
+ case OP_MIN_SAT:
+ fp->Saturate = 1;
+ case OP_MIN:
+ fp->Opcode = FP_OPCODE_MIN;
+ break;
+
+ case OP_MUL_SAT:
+ fp->Saturate = 1;
+ case OP_MUL:
+ fp->Opcode = FP_OPCODE_MUL;
+ break;
+
+ case OP_SGE_SAT:
+ fp->Saturate = 1;
+ case OP_SGE:
+ fp->Opcode = FP_OPCODE_SGE;
+ break;
+
+ case OP_SLT_SAT:
+ fp->Saturate = 1;
+ case OP_SLT:
+ fp->Opcode = FP_OPCODE_SLT;
+ break;
+
+ case OP_SUB_SAT:
+ fp->Saturate = 1;
+ case OP_SUB:
+ fp->Opcode = FP_OPCODE_SUB;
+ break;
+
+ case OP_XPD_SAT:
+ fp->Saturate = 1;
+ case OP_XPD:
+ fp->Opcode = FP_OPCODE_XPD;
+ break;
+ }
+
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File,
+ &fp->DstReg.Index, fp->DstReg.WriteMask))
+ return 1;
+ for (a = 0; a < 2; a++) {
+ fp->SrcReg[a].Abs = GL_FALSE;
+ fp->SrcReg[a].NegateAbs = GL_FALSE;
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[a].File,
+ &fp->SrcReg[a].Index, &fp->SrcReg[a].NegateBase,
+ swz, &rel))
+ return 1;
+ for (b=0; b<4; b++)
+ fp->SrcReg[a].Swizzle[b] = swz[b];
+ }
+ break;
+
+ case OP_ALU_TRI:
+ switch (code) {
+ case OP_CMP_SAT:
+ fp->Saturate = 1;
+ case OP_CMP:
+ fp->Opcode = FP_OPCODE_CMP;
+ break;
+
+ case OP_LRP_SAT:
+ fp->Saturate = 1;
+ case OP_LRP:
+ fp->Opcode = FP_OPCODE_LRP;
+ break;
+
+ case OP_MAD_SAT:
+ fp->Saturate = 1;
+ case OP_MAD:
+ fp->Opcode = FP_OPCODE_MAD;
+ break;
+ }
+
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File,
+ &fp->DstReg.Index, fp->DstReg.WriteMask))
+ return 1;
+ for (a = 0; a < 3; a++) {
+ fp->SrcReg[a].Abs = GL_FALSE;
+ fp->SrcReg[a].NegateAbs = GL_FALSE;
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[a].File,
+ &fp->SrcReg[a].Index, &fp->SrcReg[a].NegateBase,
+ swz, &rel))
+ return 1;
+ for (b=0; b<4; b++)
+ fp->SrcReg[a].Swizzle[b] = swz[b];
+ }
+ break;
+
+ case OP_ALU_SWZ:
+ switch (code) {
+ case OP_SWZ_SAT:
+ fp->Saturate = 1;
+ case OP_SWZ:
+ fp->Opcode = FP_OPCODE_SWZ;
+ break;
+ }
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File,
+ &fp->DstReg.Index, fp->DstReg.WriteMask))
+ return 1;
+
+ if (parse_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File,
+ &fp->SrcReg[0].Index, &rel))
+ return 1;
+ parse_extended_swizzle_mask (inst, swz,
+ &fp->SrcReg[0].NegateBase);
+ for (b=0; b<4; b++)
+ fp->SrcReg[0].Swizzle[b] = swz[b];
+ break;
+
+ case OP_TEX_SAMPLE:
+ switch (code) {
+ case OP_TEX_SAT:
+ fp->Saturate = 1;
+ case OP_TEX:
+ fp->Opcode = FP_OPCODE_TEX;
+ break;
+
+ case OP_TXP_SAT:
+ fp->Saturate = 1;
+ case OP_TXP:
+ fp->Opcode = FP_OPCODE_TXP;
+ break;
+
+ case OP_TXB_SAT:
+
+ fp->Saturate = 1;
+ case OP_TXB:
+ fp->Opcode = FP_OPCODE_TXB;
+ break;
+ }
+
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File,
+ &fp->DstReg.Index, fp->DstReg.WriteMask))
+ return 1;
+ fp->SrcReg[0].Abs = GL_FALSE;
+ fp->SrcReg[0].NegateAbs = GL_FALSE;
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File,
+ &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase,
+ swz, &rel))
+ return 1;
+ for (b=0; b<4; b++)
+ fp->SrcReg[0].Swizzle[b] = swz[b];
+
+ /* texImageUnit */
+ if (parse_texcoord_num (ctx, inst, Program, &texcoord))
+ return 1;
+ fp->TexSrcUnit = texcoord;
+
+ /* texTarget */
+ switch (*(*inst)++) {
+ case TEXTARGET_1D:
+ fp->TexSrcBit = TEXTURE_1D_BIT;
+ break;
+ case TEXTARGET_2D:
+ fp->TexSrcBit = TEXTURE_2D_BIT;
+ break;
+ case TEXTARGET_3D:
+ fp->TexSrcBit = TEXTURE_3D_BIT;
+ break;
+ case TEXTARGET_RECT:
+ fp->TexSrcBit = TEXTURE_RECT_BIT;
+ break;
+ case TEXTARGET_CUBE:
+ fp->TexSrcBit = TEXTURE_CUBE_BIT;
+ break;
+ case TEXTARGET_SHADOW1D:
+ case TEXTARGET_SHADOW2D:
+ case TEXTARGET_SHADOWRECT:
+ /* TODO ARB_fragment_program_shadow code */
+ break;
+ }
+ Program->TexturesUsed[texcoord] |= fp->TexSrcBit;
+ break;
+
+ case OP_TEX_KIL:
+ fp->Opcode = FP_OPCODE_KIL;
+ fp->SrcReg[0].Abs = GL_FALSE;
+ fp->SrcReg[0].NegateAbs = GL_FALSE;
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File,
+ &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase,
+ swz, &rel))
+ return 1;
+ for (b=0; b<4; b++)
+ fp->SrcReg[0].Swizzle[b] = swz[b];
+ break;
+ }
+
+ return 0;
+}
+
+/**
+ * This is a big mother that handles getting opcodes into the instruction
+ * and handling the src & dst registers for vertex program instructions
+ */
+static GLuint
+parse_vp_instruction (GLcontext * ctx, GLubyte ** inst,
+ struct var_cache **vc_head, struct arb_program *Program,
+ struct vp_instruction *vp)
+{
+ GLint a;
+ GLubyte type, code;
+
+ /* OP_ALU_{ARL, VECTOR, SCALAR, BINSC, BIN, TRI, SWZ} */
+ type = *(*inst)++;
+
+ /* The actual opcode name */
+ code = *(*inst)++;
+
+ /* Record the position in the program string for debugging */
+ vp->StringPos = Program->Position;
+
+ vp->SrcReg[0].RelAddr = vp->SrcReg[1].RelAddr = vp->SrcReg[2].RelAddr = 0;
+
+ for (a = 0; a < 4; a++) {
+ vp->SrcReg[0].Swizzle[a] = a;
+ vp->SrcReg[1].Swizzle[a] = a;
+ vp->SrcReg[2].Swizzle[a] = a;
+ vp->DstReg.WriteMask[a] = 1;
+ }
+
+ switch (type) {
+ /* XXX: */
+ case OP_ALU_ARL:
+ vp->Opcode = VP_OPCODE_ARL;
+
+ /* Remember to set SrcReg.RelAddr; */
+
+ /* Get the masked address register [dst] */
+ if (parse_masked_address_reg
+ (ctx, inst, vc_head, Program, &vp->DstReg.Index,
+ vp->DstReg.WriteMask))
+ return 1;
+ vp->DstReg.File = PROGRAM_ADDRESS;
+
+ /* Get a scalar src register */
+ if (parse_scalar_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File,
+ &vp->SrcReg[0].Index, &vp->SrcReg[0].Negate,
+ vp->SrcReg[0].Swizzle, &vp->SrcReg[0].RelAddr))
+ return 1;
+
+ break;
+
+ case OP_ALU_VECTOR:
+ switch (code) {
+ case OP_ABS:
+ vp->Opcode = VP_OPCODE_ABS;
+ break;
+ case OP_FLR:
+ vp->Opcode = VP_OPCODE_FLR;
+ break;
+ case OP_FRC:
+ vp->Opcode = VP_OPCODE_FRC;
+ break;
+ case OP_LIT:
+ vp->Opcode = VP_OPCODE_LIT;
+ break;
+ case OP_MOV:
+ vp->Opcode = VP_OPCODE_MOV;
+ break;
+ }
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File,
+ &vp->DstReg.Index, vp->DstReg.WriteMask))
+ return 1;
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File,
+ &vp->SrcReg[0].Index, &vp->SrcReg[0].Negate,
+ vp->SrcReg[0].Swizzle, &vp->SrcReg[0].RelAddr))
+ return 1;
+ break;
+
+ case OP_ALU_SCALAR:
+ switch (code) {
+ case OP_EX2:
+ vp->Opcode = VP_OPCODE_EX2;
+ break;
+ case OP_EXP:
+ vp->Opcode = VP_OPCODE_EXP;
+ break;
+ case OP_LG2:
+ vp->Opcode = VP_OPCODE_LG2;
+ break;
+ case OP_LOG:
+ vp->Opcode = VP_OPCODE_LOG;
+ break;
+ case OP_RCP:
+ vp->Opcode = VP_OPCODE_RCP;
+ break;
+ case OP_RSQ:
+ vp->Opcode = VP_OPCODE_RSQ;
+ break;
+ }
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File,
+ &vp->DstReg.Index, vp->DstReg.WriteMask))
+ return 1;
+ if (parse_scalar_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File,
+ &vp->SrcReg[0].Index, &vp->SrcReg[0].Negate,
+ vp->SrcReg[0].Swizzle, &vp->SrcReg[0].RelAddr))
+ return 1;
+ break;
+
+ case OP_ALU_BINSC:
+ switch (code) {
+ case OP_POW:
+ vp->Opcode = VP_OPCODE_POW;
+ break;
+ }
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File,
+ &vp->DstReg.Index, vp->DstReg.WriteMask))
+ return 1;
+ for (a = 0; a < 2; a++) {
+ if (parse_scalar_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[a].File,
+ &vp->SrcReg[a].Index, &vp->SrcReg[a].Negate,
+ vp->SrcReg[a].Swizzle, &vp->SrcReg[a].RelAddr))
+ return 1;
+ }
+ break;
+
+ case OP_ALU_BIN:
+ switch (code) {
+ case OP_ADD:
+ vp->Opcode = VP_OPCODE_ADD;
+ break;
+ case OP_DP3:
+ vp->Opcode = VP_OPCODE_DP3;
+ break;
+ case OP_DP4:
+ vp->Opcode = VP_OPCODE_DP4;
+ break;
+ case OP_DPH:
+ vp->Opcode = VP_OPCODE_DPH;
+ break;
+ case OP_DST:
+ vp->Opcode = VP_OPCODE_DST;
+ break;
+ case OP_MAX:
+ vp->Opcode = VP_OPCODE_MAX;
+ break;
+ case OP_MIN:
+ vp->Opcode = VP_OPCODE_MIN;
+ break;
+ case OP_MUL:
+ vp->Opcode = VP_OPCODE_MUL;
+ break;
+ case OP_SGE:
+ vp->Opcode = VP_OPCODE_SGE;
+ break;
+ case OP_SLT:
+ vp->Opcode = VP_OPCODE_SLT;
+ break;
+ case OP_SUB:
+ vp->Opcode = VP_OPCODE_SUB;
+ break;
+ case OP_XPD:
+ vp->Opcode = VP_OPCODE_XPD;
+ break;
+ }
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File,
+ &vp->DstReg.Index, vp->DstReg.WriteMask))
+ return 1;
+ for (a = 0; a < 2; a++) {
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[a].File,
+ &vp->SrcReg[a].Index, &vp->SrcReg[a].Negate,
+ vp->SrcReg[a].Swizzle, &vp->SrcReg[a].RelAddr))
+ return 1;
+ }
+ break;
+
+ case OP_ALU_TRI:
+ switch (code) {
+ case OP_MAD:
+ vp->Opcode = VP_OPCODE_MAD;
+ break;
+ }
+
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File,
+ &vp->DstReg.Index, vp->DstReg.WriteMask))
+ return 1;
+ for (a = 0; a < 3; a++) {
+ if (parse_vector_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[a].File,
+ &vp->SrcReg[a].Index, &vp->SrcReg[a].Negate,
+ vp->SrcReg[a].Swizzle, &vp->SrcReg[a].RelAddr))
+ return 1;
+ }
+ break;
+
+ case OP_ALU_SWZ:
+ switch (code) {
+ case OP_SWZ:
+ vp->Opcode = VP_OPCODE_SWZ;
+ break;
+ }
+ if (parse_masked_dst_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File,
+ &vp->DstReg.Index, vp->DstReg.WriteMask))
+ return 1;
+
+ if (parse_src_reg
+ (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File,
+ &vp->SrcReg[0].Index, &vp->SrcReg[0].RelAddr))
+ return 1;
+ parse_extended_swizzle_mask (inst, vp->SrcReg[0].Swizzle,
+ &vp->SrcReg[0].Negate);
+ break;
+ }
+ return 0;
+}
+
+#if DEBUG_PARSING
+
+static GLvoid
+print_state_token (GLint token)
+{
+ switch (token) {
+ case STATE_MATERIAL:
+ fprintf (stderr, "STATE_MATERIAL ");
+ break;
+ case STATE_LIGHT:
+ fprintf (stderr, "STATE_LIGHT ");
+ break;
+
+ case STATE_LIGHTMODEL_AMBIENT:
+ fprintf (stderr, "STATE_AMBIENT ");
+ break;
+
+ case STATE_LIGHTMODEL_SCENECOLOR:
+ fprintf (stderr, "STATE_SCENECOLOR ");
+ break;
+
+ case STATE_LIGHTPROD:
+ fprintf (stderr, "STATE_LIGHTPROD ");
+ break;
+
+ case STATE_TEXGEN:
+ fprintf (stderr, "STATE_TEXGEN ");
+ break;
+
+ case STATE_FOG_COLOR:
+ fprintf (stderr, "STATE_FOG_COLOR ");
+ break;
+
+ case STATE_FOG_PARAMS:
+ fprintf (stderr, "STATE_FOG_PARAMS ");
+ break;
+
+ case STATE_CLIPPLANE:
+ fprintf (stderr, "STATE_CLIPPLANE ");
+ break;
+
+ case STATE_POINT_SIZE:
+ fprintf (stderr, "STATE_POINT_SIZE ");
+ break;
+
+ case STATE_POINT_ATTENUATION:
+ fprintf (stderr, "STATE_ATTENUATION ");
+ break;
+
+ case STATE_MATRIX:
+ fprintf (stderr, "STATE_MATRIX ");
+ break;
+
+ case STATE_MODELVIEW:
+ fprintf (stderr, "STATE_MODELVIEW ");
+ break;
+
+ case STATE_PROJECTION:
+ fprintf (stderr, "STATE_PROJECTION ");
+ break;
+
+ case STATE_MVP:
+ fprintf (stderr, "STATE_MVP ");
+ break;
+
+ case STATE_TEXTURE:
+ fprintf (stderr, "STATE_TEXTURE ");
+ break;
+
+ case STATE_PROGRAM:
+ fprintf (stderr, "STATE_PROGRAM ");
+ break;
+
+ case STATE_MATRIX_INVERSE:
+ fprintf (stderr, "STATE_INVERSE ");
+ break;
+
+ case STATE_MATRIX_TRANSPOSE:
+ fprintf (stderr, "STATE_TRANSPOSE ");
+ break;
+
+ case STATE_MATRIX_INVTRANS:
+ fprintf (stderr, "STATE_INVTRANS ");
+ break;
+
+ case STATE_AMBIENT:
+ fprintf (stderr, "STATE_AMBIENT ");
+ break;
+
+ case STATE_DIFFUSE:
+ fprintf (stderr, "STATE_DIFFUSE ");
+ break;
+
+ case STATE_SPECULAR:
+ fprintf (stderr, "STATE_SPECULAR ");
+ break;
+
+ case STATE_EMISSION:
+ fprintf (stderr, "STATE_EMISSION ");
+ break;
+
+ case STATE_SHININESS:
+ fprintf (stderr, "STATE_SHININESS ");
+ break;
+
+ case STATE_HALF:
+ fprintf (stderr, "STATE_HALF ");
+ break;
+
+ case STATE_POSITION:
+ fprintf (stderr, "STATE_POSITION ");
+ break;
+
+ case STATE_ATTENUATION:
+ fprintf (stderr, "STATE_ATTENUATION ");
+ break;
+
+ case STATE_SPOT_DIRECTION:
+ fprintf (stderr, "STATE_DIRECTION ");
+ break;
+
+ case STATE_TEXGEN_EYE_S:
+ fprintf (stderr, "STATE_TEXGEN_EYE_S ");
+ break;
+
+ case STATE_TEXGEN_EYE_T:
+ fprintf (stderr, "STATE_TEXGEN_EYE_T ");
+ break;
+
+ case STATE_TEXGEN_EYE_R:
+ fprintf (stderr, "STATE_TEXGEN_EYE_R ");
+ break;
+
+ case STATE_TEXGEN_EYE_Q:
+ fprintf (stderr, "STATE_TEXGEN_EYE_Q ");
+ break;
+
+ case STATE_TEXGEN_OBJECT_S:
+ fprintf (stderr, "STATE_TEXGEN_EYE_S ");
+ break;
+
+ case STATE_TEXGEN_OBJECT_T:
+ fprintf (stderr, "STATE_TEXGEN_OBJECT_T ");
+ break;
+
+ case STATE_TEXGEN_OBJECT_R:
+ fprintf (stderr, "STATE_TEXGEN_OBJECT_R ");
+ break;
+
+ case STATE_TEXGEN_OBJECT_Q:
+ fprintf (stderr, "STATE_TEXGEN_OBJECT_Q ");
+ break;
+
+ case STATE_TEXENV_COLOR:
+ fprintf (stderr, "STATE_TEXENV_COLOR ");
+ break;
+
+ case STATE_DEPTH_RANGE:
+ fprintf (stderr, "STATE_DEPTH_RANGE ");
+ break;
+
+ case STATE_VERTEX_PROGRAM:
+ fprintf (stderr, "STATE_VERTEX_PROGRAM ");
+ break;
+
+ case STATE_FRAGMENT_PROGRAM:
+ fprintf (stderr, "STATE_FRAGMENT_PROGRAM ");
+ break;
+
+ case STATE_ENV:
+ fprintf (stderr, "STATE_ENV ");
+ break;
+
+ case STATE_LOCAL:
+ fprintf (stderr, "STATE_LOCAL ");
+ break;
+
+ }
+ fprintf (stderr, "[%d] ", token);
+}
+
+
+static GLvoid
+debug_variables (GLcontext * ctx, struct var_cache *vc_head,
+ struct arb_program *Program)
+{
+ struct var_cache *vc;
+ GLint a, b;
+
+ fprintf (stderr, "debug_variables, vc_head: %x\n", vc_head);
+
+ /* First of all, print out the contents of the var_cache */
+ vc = vc_head;
+ while (vc) {
+ fprintf (stderr, "[%x]\n", vc);
+ switch (vc->type) {
+ case vt_none:
+ fprintf (stderr, "UNDEFINED %s\n", vc->name);
+ break;
+ case vt_attrib:
+ fprintf (stderr, "ATTRIB %s\n", vc->name);
+ fprintf (stderr, " binding: 0x%x\n", vc->attrib_binding);
+ break;
+ case vt_param:
+ fprintf (stderr, "PARAM %s begin: %d len: %d\n", vc->name,
+ vc->param_binding_begin, vc->param_binding_length);
+ b = vc->param_binding_begin;
+ for (a = 0; a < vc->param_binding_length; a++) {
+ fprintf (stderr, "%s\n",
+ Program->Parameters->Parameters[a + b].Name);
+ if (Program->Parameters->Parameters[a + b].Type == STATE) {
+ print_state_token (Program->Parameters->Parameters[a + b].
+ StateIndexes[0]);
+ print_state_token (Program->Parameters->Parameters[a + b].
+ StateIndexes[1]);
+ print_state_token (Program->Parameters->Parameters[a + b].
+ StateIndexes[2]);
+ print_state_token (Program->Parameters->Parameters[a + b].
+ StateIndexes[3]);
+ print_state_token (Program->Parameters->Parameters[a + b].
+ StateIndexes[4]);
+ print_state_token (Program->Parameters->Parameters[a + b].
+ StateIndexes[5]);
+ }
+ else
+ fprintf (stderr, "%f %f %f %f\n",
+ Program->Parameters->Parameters[a + b].Values[0],
+ Program->Parameters->Parameters[a + b].Values[1],
+ Program->Parameters->Parameters[a + b].Values[2],
+ Program->Parameters->Parameters[a + b].Values[3]);
+ }
+ break;
+ case vt_temp:
+ fprintf (stderr, "TEMP %s\n", vc->name);
+ fprintf (stderr, " binding: 0x%x\n", vc->temp_binding);
+ break;
+ case vt_output:
+ fprintf (stderr, "OUTPUT %s\n", vc->name);
+ fprintf (stderr, " binding: 0x%x\n", vc->output_binding);
+ break;
+ case vt_alias:
+ fprintf (stderr, "ALIAS %s\n", vc->name);
+ fprintf (stderr, " binding: 0x%x (%s)\n",
+ vc->alias_binding, vc->alias_binding->name);
+ break;
+ }
+ vc = vc->next;
+ }
+}
+
+#endif
+
+
+/**
+ * The main loop for parsing a fragment or vertex program
+ *
+ * \return 0 on sucess, 1 on error
+ */
+static GLint
+parse_arb_program (GLcontext * ctx, GLubyte * inst, struct var_cache **vc_head,
+ struct arb_program *Program)
+{
+ GLint err = 0;
+
+ Program->MajorVersion = (GLuint) * inst++;
+ Program->MinorVersion = (GLuint) * inst++;
+
+ while (*inst != END) {
+ switch (*inst++) {
+
+ case OPTION:
+ switch (*inst++) {
+ case ARB_PRECISION_HINT_FASTEST:
+ Program->PrecisionOption = GL_FASTEST;
+ break;
+
+ case ARB_PRECISION_HINT_NICEST:
+ Program->PrecisionOption = GL_NICEST;
+ break;
+
+ case ARB_FOG_EXP:
+ Program->FogOption = GL_EXP;
+ break;
+
+ case ARB_FOG_EXP2:
+ Program->FogOption = GL_EXP2;
+ break;
+
+ case ARB_FOG_LINEAR:
+ Program->FogOption = GL_LINEAR;
+ break;
+
+ case ARB_POSITION_INVARIANT:
+ if (Program->Base.Target == GL_VERTEX_PROGRAM_ARB)
+ Program->HintPositionInvariant = 1;
+ break;
+
+ case ARB_FRAGMENT_PROGRAM_SHADOW:
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ /* TODO ARB_fragment_program_shadow code */
+ }
+ break;
+ }
+ break;
+
+ case INSTRUCTION:
+ Program->Position = parse_position (&inst);
+
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+
+ /* Check the instruction count
+ * XXX: Does END count as an instruction?
+ */
+ if (Program->Base.NumInstructions+1 == MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Max instruction count exceeded!");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Max instruction count exceeded!");
+ }
+
+ /* Realloc Program->FPInstructions */
+ Program->FPInstructions =
+ (struct fp_instruction *) _mesa_realloc (Program->FPInstructions,
+ Program->Base.NumInstructions*sizeof(struct fp_instruction),
+ (Program->Base.NumInstructions+1)*sizeof (struct fp_instruction));
+
+ /* parse the current instruction */
+ err = parse_fp_instruction (ctx, &inst, vc_head, Program,
+ &Program->FPInstructions[Program->Base.NumInstructions]);
+
+ }
+ else {
+ /* Check the instruction count
+ * XXX: Does END count as an instruction?
+ */
+ if (Program->Base.NumInstructions+1 == MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Max instruction count exceeded!");
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Max instruction count exceeded!");
+ }
+
+ /* Realloc Program->VPInstructions */
+ Program->VPInstructions =
+ (struct vp_instruction *) _mesa_realloc (Program->VPInstructions,
+ Program->Base.NumInstructions*sizeof(struct vp_instruction),
+ (Program->Base.NumInstructions +1)*sizeof(struct vp_instruction));
+
+ /* parse the current instruction */
+ err = parse_vp_instruction (ctx, &inst, vc_head, Program,
+ &Program->VPInstructions[Program->Base.NumInstructions]);
+ }
+
+ /* increment Program->Base.NumInstructions */
+ Program->Base.NumInstructions++;
+ break;
+
+ case DECLARATION:
+ err = parse_declaration (ctx, &inst, vc_head, Program);
+ break;
+
+ default:
+ break;
+ }
+
+ if (err)
+ break;
+ }
+
+ /* Finally, tag on an OPCODE_END instruction */
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ Program->FPInstructions =
+ (struct fp_instruction *) _mesa_realloc (Program->FPInstructions,
+ Program->Base.NumInstructions*sizeof(struct fp_instruction),
+ (Program->Base.NumInstructions+1)*sizeof(struct fp_instruction));
+
+ Program->FPInstructions[Program->Base.NumInstructions].Opcode = FP_OPCODE_END;
+ /* YYY Wrong Position in program, whatever, at least not random -> crash
+ Program->Position = parse_position (&inst);
+ */
+ Program->FPInstructions[Program->Base.NumInstructions].StringPos = Program->Position;
+ }
+ else {
+ Program->VPInstructions =
+ (struct vp_instruction *) _mesa_realloc (Program->VPInstructions,
+ Program->Base.NumInstructions*sizeof(struct vp_instruction),
+ (Program->Base.NumInstructions+1)*sizeof(struct vp_instruction));
+
+ Program->VPInstructions[Program->Base.NumInstructions].Opcode = VP_OPCODE_END;
+ /* YYY Wrong Position in program, whatever, at least not random -> crash
+ Program->Position = parse_position (&inst);
+ */
+ Program->VPInstructions[Program->Base.NumInstructions].StringPos = Program->Position;
+ }
+
+ /* increment Program->Base.NumInstructions */
+ Program->Base.NumInstructions++;
+
+ return err;
+}
+
+/* XXX temporary */
+__extension__ static char core_grammar_text[] =
+#include "grammar_syn.h"
+;
+
+static int set_reg8 (GLcontext *ctx, grammar id, const byte *name, byte value)
+{
+ char error_msg[300];
+ GLint error_pos;
+
+ if (grammar_set_reg8 (id, name, value))
+ return 0;
+
+ grammar_get_last_error ((byte *) error_msg, 300, &error_pos);
+ _mesa_set_program_error (ctx, error_pos, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Grammar Register Error");
+ return 1;
+}
+
+static int extension_is_supported (const GLubyte *ext)
+{
+ const GLubyte *extensions = GL_CALL(GetString)(GL_EXTENSIONS);
+ const GLubyte *end = extensions + _mesa_strlen ((const char *) extensions);
+ const GLint ext_len = _mesa_strlen ((const char *) ext);
+
+ while (extensions < end)
+ {
+ const GLubyte *name_end = (const GLubyte *) strchr ((const char *) extensions, ' ');
+ if (name_end == NULL)
+ name_end = end;
+ if (name_end - extensions == ext_len && _mesa_strncmp ((const char *) ext,
+ (const char *) extensions, ext_len) == 0)
+ return 1;
+ extensions = name_end + 1;
+ }
+
+ return 0;
+}
+
+static int enable_ext (GLcontext *ctx, grammar id, const byte *name, const byte *extname)
+{
+ if (extension_is_supported (extname))
+ if (set_reg8 (ctx, id, name, 0x01))
+ return 1;
+ return 0;
+}
+
+/**
+ * This kicks everything off.
+ *
+ * \param ctx - The GL Context
+ * \param str - The program string
+ * \param len - The program string length
+ * \param Program - The arb_program struct to return all the parsed info in
+ * \return 0 on sucess, 1 on error
+ */
+GLuint
+_mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len,
+ struct arb_program * program)
+{
+ GLint a, err, error_pos;
+ char error_msg[300];
+ GLuint parsed_len;
+ struct var_cache *vc_head;
+ grammar arbprogram_syn_id;
+ GLubyte *parsed, *inst;
+ GLubyte *strz = NULL;
+ static int arbprogram_syn_is_ok = 0; /* XXX temporary */
+
+ /* Reset error state */
+ _mesa_set_program_error(ctx, -1, NULL);
+
+#if DEBUG_PARSING
+ fprintf (stderr, "Loading grammar text!\n");
+#endif
+
+ /* check if the arb_grammar_text (arbprogram.syn) is syntactically correct */
+ if (!arbprogram_syn_is_ok) {
+ grammar grammar_syn_id;
+ GLint err;
+ GLuint parsed_len;
+ byte *parsed;
+
+ grammar_syn_id = grammar_load_from_text ((byte *) core_grammar_text);
+ if (grammar_syn_id == 0) {
+ grammar_get_last_error ((byte *) error_msg, 300, &error_pos);
+ _mesa_set_program_error (ctx, error_pos, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Error loading grammar rule set");
+ return 1;
+ }
+
+ err = grammar_check (grammar_syn_id, (byte *) arb_grammar_text, &parsed, &parsed_len);
+
+ /* NOTE: we cant destroy grammar_syn_id right here because grammar_destroy() can
+ reset the last error
+ */
+
+ if (err == 0) {
+ grammar_get_last_error ((byte *) error_msg, 300, &error_pos);
+ _mesa_set_program_error (ctx, error_pos, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Error loading grammar rule set");
+
+ grammar_destroy (grammar_syn_id);
+ return 1;
+ }
+
+ grammar_destroy (grammar_syn_id);
+
+ arbprogram_syn_is_ok = 1;
+ }
+
+ /* create the grammar object */
+ arbprogram_syn_id = grammar_load_from_text ((byte *) arb_grammar_text);
+ if (arbprogram_syn_id == 0) {
+ grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos);
+ _mesa_set_program_error (ctx, error_pos, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION,
+ "Error loading grammer rule set");
+ return 1;
+ }
+
+ /* Set program_target register value */
+ if (set_reg8 (ctx, arbprogram_syn_id, (byte *) "program_target",
+ program->Base.Target == GL_FRAGMENT_PROGRAM_ARB ? 0x10 : 0x20)) {
+ grammar_destroy (arbprogram_syn_id);
+ return 1;
+ }
+
+ /* Enable all active extensions */
+ if (enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "vertex_blend", (byte *) "GL_ARB_vertex_blend") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "vertex_blend", (byte *) "GL_EXT_vertex_weighting") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "matrix_palette", (byte *) "GL_ARB_matrix_palette") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "point_parameters", (byte *) "GL_ARB_point_parameters") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "point_parameters", (byte *) "GL_EXT_point_parameters") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "secondary_color", (byte *) "GL_EXT_secondary_color") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "fog_coord", (byte *) "GL_EXT_fog_coord") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "texture_rectangle", (byte *) "GL_ARB_texture_rectangle") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "texture_rectangle", (byte *) "GL_EXT_texture_rectangle") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "texture_rectangle", (byte *) "GL_NV_texture_rectangle") ||
+ enable_ext (ctx, arbprogram_syn_id,
+ (byte *) "fragment_program_shadow", (byte *) "GL_ARB_fragment_program_shadow")) {
+ grammar_destroy (arbprogram_syn_id);
+ return 1;
+ }
+
+ /* check for NULL character occurences */
+ {
+ int i;
+ for (i = 0; i < len; i++)
+ if (str[i] == '\0') {
+ _mesa_set_program_error (ctx, i, "invalid character");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Lexical Error");
+
+ grammar_destroy (arbprogram_syn_id);
+ return 1;
+ }
+ }
+
+ /* copy the program string to a null-terminated string */
+ /* XXX should I check for NULL from malloc()? */
+ strz = (GLubyte *) _mesa_malloc (len + 1);
+ _mesa_memcpy (strz, str, len);
+ strz[len] = '\0';
+
+#if DEBUG_PARSING
+ printf ("Checking Grammar!\n");
+#endif
+ err = grammar_check (arbprogram_syn_id, strz, &parsed, &parsed_len);
+
+ /* Syntax parse error */
+ if (err == 0) {
+ _mesa_free (strz);
+ grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos);
+ _mesa_set_program_error (ctx, error_pos, error_msg);
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glProgramStringARB(syntax error)");
+
+ /* useful for debugging */
+ if (0) {
+ int line, col;
+ char *s;
+ printf("Program: %s\n", (char *) strz);
+ printf("Error Pos: %d\n", ctx->Program.ErrorPos);
+ s = (char *) _mesa_find_line_column(strz, strz+ctx->Program.ErrorPos, &line, &col);
+ printf("line %d col %d: %s\n", line, col, s);
+ }
+
+ grammar_destroy (arbprogram_syn_id);
+ return 1;
+ }
+
+#if DEBUG_PARSING
+ printf ("Destroying grammer dict [parse retval: %d]\n", err);
+#endif
+ grammar_destroy (arbprogram_syn_id);
+
+ /* Initialize the arb_program struct */
+ program->Base.String = strz;
+ program->Base.NumInstructions =
+ program->Base.NumTemporaries =
+ program->Base.NumParameters =
+ program->Base.NumAttributes = program->Base.NumAddressRegs = 0;
+ program->Parameters = _mesa_new_parameter_list ();
+ program->InputsRead = 0;
+ program->OutputsWritten = 0;
+ program->Position = 0;
+ program->MajorVersion = program->MinorVersion = 0;
+ program->PrecisionOption = GL_DONT_CARE;
+ program->FogOption = GL_NONE;
+ program->HintPositionInvariant = GL_FALSE;
+ for (a = 0; a < MAX_TEXTURE_IMAGE_UNITS; a++)
+ program->TexturesUsed[a] = 0;
+ program->NumAluInstructions =
+ program->NumTexInstructions =
+ program->NumTexIndirections = 0;
+
+ program->FPInstructions = NULL;
+ program->VPInstructions = NULL;
+
+ vc_head = NULL;
+ err = 0;
+
+ /* Start examining the tokens in the array */
+ inst = parsed;
+
+ /* Check the grammer rev */
+ if (*inst++ != REVISION) {
+ _mesa_set_program_error (ctx, 0, "Grammar version mismatch");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glProgramStringARB(Grammar verison mismatch)");
+ err = 1;
+ }
+ else {
+ switch (*inst++) {
+ case FRAGMENT_PROGRAM:
+ program->Base.Target = GL_FRAGMENT_PROGRAM_ARB;
+ break;
+
+ case VERTEX_PROGRAM:
+ program->Base.Target = GL_VERTEX_PROGRAM_ARB;
+ break;
+ }
+
+ err = parse_arb_program (ctx, inst, &vc_head, program);
+#if DEBUG_PARSING
+ fprintf (stderr, "Symantic analysis returns %d [1 is bad!]\n", err);
+#endif
+ }
+
+ /*debug_variables(ctx, vc_head, program); */
+
+ /* We're done with the parsed binary array */
+ var_cache_destroy (&vc_head);
+
+ _mesa_free (parsed);
+#if DEBUG_PARSING
+ printf ("_mesa_parse_arb_program() done\n");
+#endif
+ return err;
+}
Index: xc/extras/Mesa/src/mesa/shader/arbprogparse.h
diff -u /dev/null xc/extras/Mesa/src/mesa/shader/arbprogparse.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/shader/arbprogparse.h Thu Jun 10 10:24:00 2004
@@ -0,0 +1,74 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef ARBPROGPARSE_H
+#define ARBPROGPARSE_H
+
+#include "context.h"
+#include "mtypes.h"
+#include "nvvertprog.h"
+#include "nvfragprog.h"
+
+/**
+ * This is basically a union of the vertex_program and fragment_program
+ * structs that we can use to parse the program into
+ *
+ * XXX: this should go into mtypes.h?
+ */
+struct arb_program
+{
+ struct program Base;
+ struct program_parameter_list *Parameters;
+ GLuint InputsRead;
+ GLuint OutputsWritten;
+
+ GLuint Position; /* Just used for error reporting while parsing */
+ GLuint MajorVersion;
+ GLuint MinorVersion;
+
+ /* ARB_vertex_program specifics */
+ struct vp_instruction *VPInstructions;
+
+ /* Options currently recognized by the parser */
+ /* ARB_fp */
+ GLenum PrecisionOption; /* GL_DONT_CARE, GL_NICEST or GL_FASTEST */
+ GLenum FogOption; /* GL_NONE, GL_LINEAR, GL_EXP or GL_EXP2 */
+
+ /* ARB_fp & _vp */
+ GLboolean HintPositionInvariant;
+
+ /* ARB_fragment_program sepecifics */
+ struct fp_instruction *FPInstructions;
+ GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS];
+ GLuint NumAluInstructions;
+ GLuint NumTexInstructions;
+ GLuint NumTexIndirections;
+};
+
+extern GLuint
+_mesa_parse_arb_program( GLcontext *ctx, const GLubyte *str, GLsizei len,
+ struct arb_program *Program );
+
+#endif
Index: xc/extras/Mesa/src/mesa/shader/arbprogram.c
diff -u /dev/null xc/extras/Mesa/src/mesa/shader/arbprogram.c:1.1.1.2
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/shader/arbprogram.c Fri Dec 10 10:33:51 2004
@@ -0,0 +1,721 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file arbprogram.c
+ * ARB_vertex/fragment_program state management functions.
+ * \author Brian Paul
+ */
+
+
+#include "glheader.h"
+#include "arbprogram.h"
+#include "arbfragparse.h"
+#include "arbvertparse.h"
+#include "context.h"
+#include "imports.h"
+#include "macros.h"
+#include "mtypes.h"
+#include "nvprogram.h"
+#include "nvfragparse.h"
+#include "nvfragprog.h"
+#include "nvvertparse.h"
+#include "nvvertprog.h"
+
+
+void GLAPIENTRY
+_mesa_EnableVertexAttribArrayARB(GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.MaxVertexProgramAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glEnableVertexAttribArrayARB(index)");
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.VertexAttrib[index].Enabled = GL_TRUE;
+ ctx->Array._Enabled |= _NEW_ARRAY_ATTRIB(index);
+ ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
+}
+
+
+void GLAPIENTRY
+_mesa_DisableVertexAttribArrayARB(GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.MaxVertexProgramAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glEnableVertexAttribArrayARB(index)");
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.VertexAttrib[index].Enabled = GL_FALSE;
+ ctx->Array._Enabled &= ~_NEW_ARRAY_ATTRIB(index);
+ ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
+}
+
+
+void GLAPIENTRY
+_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params)
+{
+ GLfloat fparams[4];
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ _mesa_GetVertexAttribfvARB(index, pname, fparams);
+ if (ctx->ErrorValue == GL_NO_ERROR) {
+ if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
+ COPY_4V(params, fparams);
+ }
+ else {
+ params[0] = fparams[0];
+ }
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index == 0 || index >= VERT_ATTRIB_MAX) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Enabled;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
+ params[0] = ctx->Array.VertexAttrib[index].Normalized;
+ break;
+ case GL_CURRENT_VERTEX_ATTRIB_ARB:
+ FLUSH_CURRENT(ctx, 0);
+ COPY_4V(params, ctx->Current.Attrib[index]);
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
+ if (!ctx->Extensions.ARB_vertex_buffer_object) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)");
+ return;
+ }
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].BufferObj->Name;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params)
+{
+ GLfloat fparams[4];
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ _mesa_GetVertexAttribfvARB(index, pname, fparams);
+ if (ctx->ErrorValue == GL_NO_ERROR) {
+ if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
+ COPY_4V_CAST(params, fparams, GLint); /* float to int */
+ }
+ else {
+ params[0] = (GLint) fparams[0];
+ }
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.MaxVertexProgramAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)");
+ return;
+ }
+
+ if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerARB(pname)");
+ return;
+ }
+
+ *pointer = (GLvoid *) ctx->Array.VertexAttrib[index].Ptr;;
+}
+
+
+void GLAPIENTRY
+_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
+ const GLvoid *string)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+
+ if (target == GL_VERTEX_PROGRAM_ARB
+ && ctx->Extensions.ARB_vertex_program) {
+ struct vertex_program *prog = ctx->VertexProgram.Current;
+ if (format != GL_PROGRAM_FORMAT_ASCII_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)");
+ return;
+ }
+ _mesa_parse_arb_vertex_program(ctx, target, (const GLubyte *) string,
+ len, prog);
+
+ if (ctx->Driver.ProgramStringNotify)
+ ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base );
+ }
+ else if (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program) {
+ struct fragment_program *prog = ctx->FragmentProgram.Current;
+ if (format != GL_PROGRAM_FORMAT_ASCII_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)");
+ return;
+ }
+ _mesa_parse_arb_fragment_program(ctx, target, (const GLubyte *) string,
+ len, prog);
+
+ if (ctx->Driver.ProgramStringNotify)
+ ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base );
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) x, (GLfloat) y,
+ (GLfloat) z, (GLfloat) w);
+}
+
+
+void GLAPIENTRY
+_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params)
+{
+ _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) params[0],
+ (GLfloat) params[1], (GLfloat) params[2],
+ (GLfloat) params[3]);
+}
+
+
+void GLAPIENTRY
+_mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+
+ if (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program) {
+ if (index >= ctx->Const.MaxFragmentProgramEnvParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)");
+ return;
+ }
+ ASSIGN_4V(ctx->FragmentProgram.Parameters[index], x, y, z, w);
+ }
+ else if (target == GL_VERTEX_PROGRAM_ARB
+ && ctx->Extensions.ARB_vertex_program) {
+ if (index >= ctx->Const.MaxVertexProgramEnvParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)");
+ return;
+ }
+ ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameter(target)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params)
+{
+ _mesa_ProgramEnvParameter4fARB(target, index, params[0], params[1],
+ params[2], params[3]);
+}
+
+
+void GLAPIENTRY
+_mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index,
+ GLdouble *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat fparams[4];
+
+ _mesa_GetProgramEnvParameterfvARB(target, index, fparams);
+ if (ctx->ErrorValue == GL_NO_ERROR) {
+ params[0] = fparams[0];
+ params[1] = fparams[1];
+ params[2] = fparams[2];
+ params[3] = fparams[3];
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
+ GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+
+ if (!ctx->_CurrentProgram)
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program) {
+ if (index >= ctx->Const.MaxFragmentProgramEnvParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)");
+ return;
+ }
+ COPY_4V(params, ctx->FragmentProgram.Parameters[index]);
+ }
+ else if (target == GL_VERTEX_PROGRAM_ARB
+ && ctx->Extensions.ARB_vertex_program) {
+ if (index >= ctx->Const.MaxVertexProgramEnvParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)");
+ return;
+ }
+ COPY_4V(params, ctx->VertexProgram.Parameters[index]);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramEnvParameter(target)");
+ return;
+ }
+}
+
+
+/**
+ * Note, this function is also used by the GL_NV_fragment_program extension.
+ */
+void GLAPIENTRY
+_mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct program *prog;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+
+ if ((target == GL_FRAGMENT_PROGRAM_NV
+ && ctx->Extensions.NV_fragment_program) ||
+ (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program)) {
+ if (index >= ctx->Const.MaxFragmentProgramLocalParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB");
+ return;
+ }
+ prog = &(ctx->FragmentProgram.Current->Base);
+ }
+ else if (target == GL_VERTEX_PROGRAM_ARB
+ && ctx->Extensions.ARB_vertex_program) {
+ if (index >= ctx->Const.MaxVertexProgramLocalParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB");
+ return;
+ }
+ prog = &(ctx->VertexProgram.Current->Base);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameterARB");
+ return;
+ }
+
+ ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS);
+ prog->LocalParams[index][0] = x;
+ prog->LocalParams[index][1] = y;
+ prog->LocalParams[index][2] = z;
+ prog->LocalParams[index][3] = w;
+}
+
+
+/**
+ * Note, this function is also used by the GL_NV_fragment_program extension.
+ */
+void GLAPIENTRY
+_mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params)
+{
+ _mesa_ProgramLocalParameter4fARB(target, index, params[0], params[1],
+ params[2], params[3]);
+}
+
+
+/**
+ * Note, this function is also used by the GL_NV_fragment_program extension.
+ */
+void GLAPIENTRY
+_mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y,
+ GLdouble z, GLdouble w)
+{
+ _mesa_ProgramLocalParameter4fARB(target, index, (GLfloat) x, (GLfloat) y,
+ (GLfloat) z, (GLfloat) w);
+}
+
+
+/**
+ * Note, this function is also used by the GL_NV_fragment_program extension.
+ */
+void GLAPIENTRY
+_mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params)
+{
+ _mesa_ProgramLocalParameter4fARB(target, index,
+ (GLfloat) params[0], (GLfloat) params[1],
+ (GLfloat) params[2], (GLfloat) params[3]);
+}
+
+
+/**
+ * Note, this function is also used by the GL_NV_fragment_program extension.
+ */
+void GLAPIENTRY
+_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
+ GLfloat *params)
+{
+ const struct program *prog;
+ GLuint maxParams;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_VERTEX_PROGRAM_ARB
+ && ctx->Extensions.ARB_vertex_program) {
+ prog = &(ctx->VertexProgram.Current->Base);
+ maxParams = ctx->Const.MaxVertexProgramLocalParams;
+ }
+ else if (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program) {
+ prog = &(ctx->FragmentProgram.Current->Base);
+ maxParams = ctx->Const.MaxFragmentProgramLocalParams;
+ }
+ else if (target == GL_FRAGMENT_PROGRAM_NV
+ && ctx->Extensions.NV_fragment_program) {
+ prog = &(ctx->FragmentProgram.Current->Base);
+ maxParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetProgramLocalParameterARB(target)");
+ return;
+ }
+
+ if (index >= maxParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glGetProgramLocalParameterARB(index)");
+ return;
+ }
+
+ ASSERT(prog);
+ ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS);
+ COPY_4V(params, prog->LocalParams[index]);
+}
+
+
+/**
+ * Note, this function is also used by the GL_NV_fragment_program extension.
+ */
+void GLAPIENTRY
+_mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
+ GLdouble *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat floatParams[4];
+ _mesa_GetProgramLocalParameterfvARB(target, index, floatParams);
+ if (ctx->ErrorValue == GL_NO_ERROR) {
+ COPY_4V(params, floatParams);
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
+{
+ struct program *prog;
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->_CurrentProgram)
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_VERTEX_PROGRAM_ARB
+ && ctx->Extensions.ARB_vertex_program) {
+ prog = &(ctx->VertexProgram.Current->Base);
+ }
+ else if (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program) {
+ prog = &(ctx->FragmentProgram.Current->Base);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
+ return;
+ }
+
+ ASSERT(prog);
+
+ switch (pname) {
+ case GL_PROGRAM_LENGTH_ARB:
+ *params = prog->String ? _mesa_strlen((char *) prog->String) : 0;
+ break;
+ case GL_PROGRAM_FORMAT_ARB:
+ *params = prog->Format;
+ break;
+ case GL_PROGRAM_BINDING_ARB:
+ *params = prog->Id;
+ break;
+ case GL_PROGRAM_INSTRUCTIONS_ARB:
+ *params = prog->NumInstructions;
+ break;
+ case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramInstructions;
+ else
+ *params = ctx->Const.MaxFragmentProgramInstructions;
+ break;
+ case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
+ *params = prog->NumInstructions;
+ break;
+ case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramInstructions;
+ else
+ *params = ctx->Const.MaxFragmentProgramInstructions;
+ break;
+ case GL_PROGRAM_TEMPORARIES_ARB:
+ *params = prog->NumTemporaries;
+ break;
+ case GL_MAX_PROGRAM_TEMPORARIES_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramTemps;
+ else
+ *params = ctx->Const.MaxFragmentProgramTemps;
+ break;
+ case GL_PROGRAM_NATIVE_TEMPORARIES_ARB:
+ /* XXX same as GL_PROGRAM_TEMPORARIES_ARB? */
+ *params = prog->NumTemporaries;
+ break;
+ case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB:
+ /* XXX same as GL_MAX_PROGRAM_TEMPORARIES_ARB? */
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramTemps;
+ else
+ *params = ctx->Const.MaxFragmentProgramTemps;
+ break;
+ case GL_PROGRAM_PARAMETERS_ARB:
+ *params = prog->NumParameters;
+ break;
+ case GL_MAX_PROGRAM_PARAMETERS_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramLocalParams;
+ else
+ *params = ctx->Const.MaxFragmentProgramLocalParams;
+ break;
+ case GL_PROGRAM_NATIVE_PARAMETERS_ARB:
+ /* XXX same as GL_MAX_PROGRAM_PARAMETERS_ARB? */
+ *params = prog->NumParameters;
+ break;
+ case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB:
+ /* XXX same as GL_MAX_PROGRAM_PARAMETERS_ARB? */
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramLocalParams;
+ else
+ *params = ctx->Const.MaxFragmentProgramLocalParams;
+ break;
+ case GL_PROGRAM_ATTRIBS_ARB:
+ *params = prog->NumAttributes;
+ break;
+ case GL_MAX_PROGRAM_ATTRIBS_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramAttribs;
+ else
+ *params = ctx->Const.MaxFragmentProgramAttribs;
+ break;
+ case GL_PROGRAM_NATIVE_ATTRIBS_ARB:
+ /* XXX same as GL_PROGRAM_ATTRIBS_ARB? */
+ *params = prog->NumAttributes;
+ break;
+ case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB:
+ /* XXX same as GL_MAX_PROGRAM_ATTRIBS_ARB? */
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramAttribs;
+ else
+ *params = ctx->Const.MaxFragmentProgramAttribs;
+ break;
+ case GL_PROGRAM_ADDRESS_REGISTERS_ARB:
+ *params = prog->NumAddressRegs;
+ break;
+ case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramAddressRegs;
+ else
+ *params = ctx->Const.MaxFragmentProgramAddressRegs;
+ break;
+ case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
+ /* XXX same as GL_PROGRAM_ADDRESS_REGISTERS_ARB? */
+ *params = prog->NumAddressRegs;
+ break;
+ case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
+ /* XXX same as GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB? */
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramAddressRegs;
+ else
+ *params = ctx->Const.MaxFragmentProgramAddressRegs;
+ break;
+ case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramLocalParams;
+ else
+ *params = ctx->Const.MaxFragmentProgramLocalParams;
+ break;
+ case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB:
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ *params = ctx->Const.MaxVertexProgramEnvParams;
+ else
+ *params = ctx->Const.MaxFragmentProgramEnvParams;
+ break;
+ case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB:
+ if (ctx->Driver.IsProgramNative)
+ *params = ctx->Driver.IsProgramNative( ctx, target, prog );
+ else
+ *params = GL_TRUE;
+ break;
+
+ /*
+ * The following apply to fragment programs only.
+ */
+ case GL_PROGRAM_ALU_INSTRUCTIONS_ARB:
+ case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
+ if (target != GL_FRAGMENT_PROGRAM_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
+ return;
+ }
+ *params = ctx->FragmentProgram.Current->NumAluInstructions;
+ break;
+ case GL_PROGRAM_TEX_INSTRUCTIONS_ARB:
+ case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
+ if (target != GL_FRAGMENT_PROGRAM_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
+ return;
+ }
+ *params = ctx->FragmentProgram.Current->NumTexInstructions;
+ break;
+ case GL_PROGRAM_TEX_INDIRECTIONS_ARB:
+ case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
+ if (target != GL_FRAGMENT_PROGRAM_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
+ return;
+ }
+ *params = ctx->FragmentProgram.Current->NumTexIndirections;
+ break;
+ case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB:
+ case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
+ if (target != GL_FRAGMENT_PROGRAM_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
+ return;
+ }
+ *params = ctx->Const.MaxFragmentProgramAluInstructions;
+ break;
+ case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB:
+ case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
+ if (target != GL_FRAGMENT_PROGRAM_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
+ return;
+ }
+ *params = ctx->Const.MaxFragmentProgramTexInstructions;
+ break;
+ case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB:
+ case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
+ if (target != GL_FRAGMENT_PROGRAM_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
+ return;
+ }
+ *params = ctx->Const.MaxFragmentProgramTexIndirections;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(pname)");
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
+{
+ struct program *prog;
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->_CurrentProgram)
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_VERTEX_PROGRAM_ARB) {
+ prog = &(ctx->VertexProgram.Current->Base);
+ }
+ else if (target == GL_FRAGMENT_PROGRAM_ARB) {
+ prog = &(ctx->FragmentProgram.Current->Base);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(target)");
+ return;
+ }
+
+ ASSERT(prog);
+
+ if (pname != GL_PROGRAM_STRING_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(pname)");
+ return;
+ }
+
+ MEMCPY(string, prog->String, _mesa_strlen((char *) prog->String));
+}
+
Index: xc/extras/Mesa/src/mesa/shader/arbprogram.h
diff -u /dev/null xc/extras/Mesa/src/mesa/shader/arbprogram.h:1.1.1.1
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/shader/arbprogram.h Fri Dec 10 10:06:47 2004
@@ -0,0 +1,128 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef ARBPROGRAM_H
+#define ARBPROGRAM_H
+
+
+extern void GLAPIENTRY
+_mesa_EnableVertexAttribArrayARB(GLuint index);
+
+
+extern void GLAPIENTRY
+_mesa_DisableVertexAttribArrayARB(GLuint index);
+
+
+extern void GLAPIENTRY
+_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
+ const GLvoid *string);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y,
+ GLdouble z, GLdouble w);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+
+extern void GLAPIENTRY
+_mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index,
+ GLdouble *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
+ GLfloat *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
+ GLdouble *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
+ GLfloat *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params);
+
+
+extern void GLAPIENTRY
+_mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string);
+
+
+#endif
Index: xc/extras/Mesa/src/mesa/shader/arbprogram.syn
diff -u /dev/null xc/extras/Mesa/src/mesa/shader/arbprogram.syn:1.1.1.1
--- /dev/null Wed Mar 16 21:01:30 2005
+++ xc/extras/Mesa/src/mesa/shader/arbprogram.syn Thu Jun 10 10:24:00 2004
@@ -0,0 +1,2725 @@
+.syntax program;
+
+/*
+ This value must be incremented every time emit code values or structure of the production
+ array changes. This value is placed at the beginning of the production array. The loader
+ compares the value with its REVISION value. If they do not match, the loader is not up
+ to date.
+*/
+.emtcode REVISION 0x07
+
+/* program type */
+.emtcode FRAGMENT_PROGRAM 0x01
+.emtcode VERTEX_PROGRAM 0x02
+
+/* program section */
+.emtcode OPTION 0x01
+.emtcode INSTRUCTION 0x02
+.emtcode DECLARATION 0x03
+.emtcode END 0x04
+
+/* GL_ARB_fragment_program option flags */
+.emtcode ARB_PRECISION_HINT_FASTEST 0x01
+.emtcode ARB_PRECISION_HINT_NICEST 0x02
+.emtcode ARB_FOG_EXP 0x04
+.emtcode ARB_FOG_EXP2 0x08
+.emtcode ARB_FOG_LINEAR 0x10
+
+/* GL_ARB_vertex_program option flags */
+.emtcode ARB_POSITION_INVARIANT 0x20
+
+/* GL_ARB_fragment_program_shadow option flags */
+.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x40
+
+/* GL_ARB_fragment_program instruction class */
+.emtcode OP_ALU_INST 0x00
+.emtcode OP_TEX_INST 0x01
+
+/* GL_ARB_vertex_program instruction class */
+/* OP_ALU_INST */
+
+/* GL_ARB_fragment_program instruction type */
+.emtcode OP_ALU_VECTOR 0x00
+.emtcode OP_ALU_SCALAR 0x01
+.emtcode OP_ALU_BINSC 0x02
+.emtcode OP_ALU_BIN 0x03
+.emtcode OP_ALU_TRI 0x04
+.emtcode OP_ALU_SWZ 0x05
+.emtcode OP_TEX_SAMPLE 0x06
+.emtcode OP_TEX_KIL 0x07
+
+/* GL_ARB_vertex_program instruction type */
+.emtcode OP_ALU_ARL 0x08
+/* OP_ALU_VECTOR */
+/* OP_ALU_SCALAR */
+/* OP_ALU_BINSC */
+/* OP_ALU_BIN */
+/* OP_ALU_TRI */
+/* OP_ALU_SWZ */
+
+/* GL_ARB_fragment_program instruction code */
+.emtcode OP_ABS 0x00
+.emtcode OP_ABS_SAT 0x1B
+.emtcode OP_FLR 0x09
+.emtcode OP_FLR_SAT 0x26
+.emtcode OP_FRC 0x0A
+.emtcode OP_FRC_SAT 0x27
+.emtcode OP_LIT 0x0C
+.emtcode OP_LIT_SAT 0x2A
+.emtcode OP_MOV 0x11
+.emtcode OP_MOV_SAT 0x30
+.emtcode OP_COS 0x1F
+.emtcode OP_COS_SAT 0x20
+.emtcode OP_EX2 0x07
+.emtcode OP_EX2_SAT 0x25
+.emtcode OP_LG2 0x0B
+.emtcode OP_LG2_SAT 0x29
+.emtcode OP_RCP 0x14
+.emtcode OP_RCP_SAT 0x33
+.emtcode OP_RSQ 0x15
+.emtcode OP_RSQ_SAT 0x34
+.emtcode OP_SIN 0x38
+.emtcode OP_SIN_SAT 0x39
+.emtcode OP_SCS 0x35
+.emtcode OP_SCS_SAT 0x36
+.emtcode OP_POW 0x13
+.emtcode OP_POW_SAT 0x32
+.emtcode OP_ADD 0x01
+.emtcode OP_ADD_SAT 0x1C
+.emtcode OP_DP3 0x03
+.emtcode OP_DP3_SAT 0x21
+.emtcode OP_DP4 0x04
+.emtcode OP_DP4_SAT 0x22
+.emtcode OP_DPH 0x05
+.emtcode OP_DPH_SAT 0x23
+.emtcode OP_DST 0x06
+.emtcode OP_DST_SAT 0x24
+.emtcode OP_MAX 0x0F
+.emtcode OP_MAX_SAT 0x2E
+.emtcode OP_MIN 0x10
+.emtcode OP_MIN_SAT 0x2F
+.emtcode OP_MUL 0x12
+.emtcode OP_MUL_SAT 0x31
+.emtcode OP_SGE 0x16
+.emtcode OP_SGE_SAT 0x37
+.emtcode OP_SLT 0x17
+.emtcode OP_SLT_SAT 0x3A
+.emtcode OP_SUB 0x18
+.emtcode OP_SUB_SAT 0x3B
+.emtcode OP_XPD 0x1A
+.emtcode OP_XPD_SAT 0x43
+.emtcode OP_CMP 0x1D
+.emtcode OP_CMP_SAT 0x1E
+.emtcode OP_LRP 0x2B
+.emtcode OP_LRP_SAT 0x2C
+.emtcode OP_MAD 0x0E
+.emtcode OP_MAD_SAT 0x2D
+.emtcode OP_SWZ 0x19
+.emtcode OP_SWZ_SAT 0x3C
+.emtcode OP_TEX 0x3D
+.emtcode OP_TEX_SAT 0x3E
+.emtcode OP_TXB 0x3F
+.emtcode OP_TXB_SAT 0x40
+.emtcode OP_TXP 0x41
+.emtcode OP_TXP_SAT 0x42
+.emtcode OP_KIL 0x28
+
+/* GL_ARB_vertex_program instruction code */
+.emtcode OP_ARL 0x02
+/* OP_ABS */
+/* OP_FLR */
+/* OP_FRC */
+/* OP_LIT */
+/* OP_MOV */
+/* OP_EX2 */
+.emtcode OP_EXP 0x08
+/* OP_LG2 */
+.emtcode OP_LOG 0x0D
+/* OP_RCP */
+/* OP_RSQ */
+/* OP_POW */
+/* OP_ADD */
+/* OP_DP3 */
+/* OP_DP4 */
+/* OP_DPH */
+/* OP_DST */
+/* OP_MAX */
+/* OP_MIN */
+/* OP_MUL */
+/* OP_SGE */
+/* OP_SLT */
+/* OP_SUB */
+/* OP_XPD */
+/* OP_MAD */
+/* OP_SWZ */
+
+/* fragment attribute binding */
+.emtcode FRAGMENT_ATTRIB_COLOR 0x01
+.emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
+.emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
+.emtcode FRAGMENT_ATTRIB_POSITION 0x04
+
+/* vertex attribute binding */
+.emtcode VERTEX_ATTRIB_POSITION 0x01
+.emtcode VERTEX_ATTRIB_WEIGHT 0x02
+.emtcode VERTEX_ATTRIB_NORMAL 0x03
+.emtcode VERTEX_ATTRIB_COLOR 0x04
+.emtcode VERTEX_ATTRIB_FOGCOORD 0x05
+.emtcode VERTEX_ATTRIB_TEXCOORD 0x06
+.emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
+.emtcode VERTEX_ATTRIB_GENERIC 0x08
+
+/* fragment result binding */
+.emtcode FRAGMENT_RESULT_COLOR 0x01
+.emtcode FRAGMENT_RESULT_DEPTH 0x02
+
+/* vertex result binding */
+.emtcode VERTEX_RESULT_POSITION 0x01
+.emtcode VERTEX_RESULT_COLOR 0x02
+.emtcode VERTEX_RESULT_FOGCOORD 0x03
+.emtcode VERTEX_RESULT_POINTSIZE 0x04
+.emtcode VERTEX_RESULT_TEXCOORD 0x05
+
+/* texture target */
+.emtcode TEXTARGET_1D 0x01
+.emtcode TEXTARGET_2D 0x02
+.emtcode TEXTARGET_3D 0x03
+.emtcode TEXTARGET_RECT 0x04
+.emtcode TEXTARGET_CUBE 0x05
+/* GL_ARB_fragment_program_shadow */
+.emtcode TEXTARGET_SHADOW1D 0x06
+.emtcode TEXTARGET_SHADOW2D 0x07
+.emtcode TEXTARGET_SHADOWRECT 0x08
+
+/* face type */
+.emtcode FACE_FRONT 0x00
+.emtcode FACE_BACK 0x01
+
+/* color type */
+.emtcode COLOR_PRIMARY 0x00
+.emtcode COLOR_SECONDARY 0x01
+
+/* component */
+.emtcode COMPONENT_X 0x00
+.emtcode COMPONENT_Y 0x01
+.emtcode COMPONENT_Z 0x02
+.emtcode COMPONENT_W 0x03
+.emtcode COMPONENT_0 0x04
+.emtcode COMPONENT_1 0x05
+
+/* array index type */
+.emtcode ARRAY_INDEX_ABSOLUTE 0x00
+.emtcode ARRAY_INDEX_RELATIVE 0x01
+
+/* matrix name */
+.emtcode MATRIX_MODELVIEW 0x01
+.emtcode MATRIX_PROJECTION 0x02
+.emtcode MATRIX_MVP 0x03
+.emtcode MATRIX_TEXTURE 0x04
+.emtcode MATRIX_PALETTE 0x05
+.emtcode MATRIX_PROGRAM 0x06
+
+/* matrix modifier */
+.emtcode MATRIX_MODIFIER_IDENTITY 0x00
+.emtcode MATRIX_MODIFIER_INVERSE 0x01
+.emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
+.emtcode MATRIX_MODIFIER_INVTRANS 0x03
+
+/* constant type */
+.emtcode CONSTANT_SCALAR 0x01
+.emtcode CONSTANT_VECTOR 0x02
+
+/* program param type */
+.emtcode PROGRAM_PARAM_ENV 0x01
+.emtcode PROGRAM_PARAM_LOCAL 0x02
+
+/* register type */
+.emtcode REGISTER_ATTRIB 0x01
+.emtcode REGISTER_PARAM 0x02
+.emtcode REGISTER_RESULT 0x03
+.emtcode REGISTER_ESTABLISHED_NAME 0x04
+
+/* param binding */
+.emtcode PARAM_NULL 0x00
+.emtcode PARAM_ARRAY_ELEMENT 0x01
+.emtcode PARAM_STATE_ELEMENT 0x02
+.emtcode PARAM_PROGRAM_ELEMENT 0x03
+.emtcode PARAM_PROGRAM_ELEMENTS 0x04
+.emtcode PARAM_CONSTANT 0x05
+
+/* param state property */
+.emtcode STATE_MATERIAL 0x01
+.emtcode STATE_LIGHT 0x02
+.emtcode STATE_LIGHT_MODEL 0x03
+.emtcode STATE_LIGHT_PROD 0x04
+.emtcode STATE_FOG 0x05
+.emtcode STATE_MATRIX_ROWS 0x06
+/* GL_ARB_fragment_program */
+.emtcode STATE_TEX_ENV 0x07
+.emtcode STATE_DEPTH 0x08
+/* GL_ARB_vertex_program */
+.emtcode STATE_TEX_GEN 0x09
+.emtcode STATE_CLIP_PLANE 0x0A
+.emtcode STATE_POINT 0x0B
+
+/* state material property */
+.emtcode MATERIAL_AMBIENT 0x01
+.emtcode MATERIAL_DIFFUSE 0x02
+.emtcode MATERIAL_SPECULAR 0x03
+.emtcode MATERIAL_EMISSION 0x04
+.emtcode MATERIAL_SHININESS 0x05
+
+/* state light property */
+.emtcode LIGHT_AMBIENT 0x01
+.emtcode LIGHT_DIFFUSE 0x02
+.emtcode LIGHT_SPECULAR 0x03
+.emtcode LIGHT_POSITION 0x04
+.emtcode LIGHT_ATTENUATION 0x05
+.emtcode LIGHT_HALF 0x06
+.emtcode LIGHT_SPOT_DIRECTION 0x07
+
+/* state light model property */
+.emtcode LIGHT_MODEL_AMBIENT 0x01
+.emtcode LIGHT_MODEL_SCENECOLOR 0x02
+
+/* state light product property */
+.emtcode LIGHT_PROD_AMBIENT 0x01
+.emtcode LIGHT_PROD_DIFFUSE 0x02
+.emtcode LIGHT_PROD_SPECULAR 0x03
+
+/* state texture environment property */
+.emtcode TEX_ENV_COLOR 0x01
+
+/* state texture generation coord property */
+.emtcode TEX_GEN_EYE 0x01
+.emtcode TEX_GEN_OBJECT 0x02
+
+/* state fog property */
+.emtcode FOG_COLOR 0x01
+.emtcode FOG_PARAMS 0x02
+
+/* state depth property */
+.emtcode DEPTH_RANGE 0x01
+
+/* state point parameters property */
+.emtcode POINT_SIZE 0x01
+.emtcode POINT_ATTENUATION 0x02
+
+/* declaration */
+.emtcode ATTRIB 0x01
+.emtcode PARAM 0x02
+.emtcode TEMP 0x03
+.emtcode OUTPUT 0x04
+.emtcode ALIAS 0x05
+/* GL_ARB_vertex_program */
+.emtcode ADDRESS 0x06
+
+/* error messages */
+.errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
+.errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
+.errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
+.errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
+.errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
+.errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
+.errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
+.errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
+.errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
+.errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
+.errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
+.errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
+.errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
+.errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
+.errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
+.errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
+.errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
+.errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
+.errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
+.errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
+.errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
+.errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
+.errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
+.errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
+.errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
+.errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
+.errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
+.errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
+.errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
+.errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
+.errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
+.errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
+.errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
+.errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
+.errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
+.errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
+.errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
+.errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
+.errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
+.errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
+.errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
+.errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
+.errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
+.errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
+.errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
+.errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
+.errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
+.errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
+.errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
+.errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
+.errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
+.errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
+.errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
+.errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
+.errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
+.errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
+.errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
+.errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
+
+/* extension presence condition registers */
+
+/* GL_ARB_vertex_blend */
+/* GL_EXT_vertex_weighting */
+.regbyte vertex_blend 0x00
+
+/* GL_ARB_matrix_palette */
+.regbyte matrix_palette 0x00
+
+/* GL_ARB_point_parameters */
+/* GL_EXT_point_parameters */
+.regbyte point_parameters 0x00
+
+/* GL_EXT_secondary_color */
+.regbyte secondary_color 0x00
+
+/* GL_EXT_fog_coord */
+.regbyte fog_coord 0x00
+
+/* GL_EXT_texture_rectangle */
+/* GL_NV_texture_rectangle */
+.regbyte texture_rectangle 0x00
+
+/* GL_ARB_fragment_program_shadow */
+.regbyte fragment_program_shadow 0x00
+
+/* option presence condition registers */
+/* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
+/* register is set to 1 to indicate that the OPTION was specified. */
+
+/* GL_ARB_fragment_program */
+.regbyte ARB_precision_hint_fastest 0x00
+.regbyte ARB_precision_hint_nicest 0x00
+.regbyte ARB_fog_exp 0x00
+.regbyte ARB_fog_exp2 0x00
+.regbyte ARB_fog_linear 0x00
+
+/* GL_ARB_vertex_program */
+.regbyte ARB_position_invariant 0x00
+
+/* GL_ARB_fragment_program_shadow */
+.regbyte ARB_fragment_program_shadow 0x00
+
+/* program target condition register */
+/* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
+/* to distinguish between them we need a register that will store for us the current target. */
+/* the client will typically set the register to apropriate value before parsing a particular */
+/* program. the mapping between program targets and their values is listed below. */
+/* */
+/* program target register value */
+/* ---------------------------------------------- */
+/* FRAGMENT_PROGRAM 0x10 */
+/* VERTEX_PROGRAM 0x20 */
+/* */
+/* the initial value of the register is 0 to catch potential errors with not setting the register */
+/* with the proper value. */
+.regbyte program_target 0x00
+
+/*
+ ::= "END"
+*/
+program
+ programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
+programs
+ .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
+ .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
+frag_program_1_0
+ '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
+ optional_space .and fp_optionSequence .and fp_statementSequence .and
+ "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
+ '\0' .error CODE_AFTER_END;
+vert_program_1_0
+ '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
+ optional_space .and vp_optionSequence .and vp_statementSequence .and
+ "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
+ '\0' .error CODE_AFTER_END;
+
+/*
+ ::=