aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi/glapi/gen
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-08-29 14:48:31 +0200
committermarha <marha@users.sourceforge.net>2011-08-29 14:48:31 +0200
commit924a6ffc82a7af0ca311af711ea2cf973dc6ff15 (patch)
treef5ee6d0aaf321029a4abb12c3c051c0434dde308 /mesalib/src/mapi/glapi/gen
parent8e57a7fcbf736b8e437baf0bbccb93095d97617f (diff)
parent01df5d59e56a1b060568f8cad2e89f7eea22fc70 (diff)
downloadvcxsrv-924a6ffc82a7af0ca311af711ea2cf973dc6ff15.tar.gz
vcxsrv-924a6ffc82a7af0ca311af711ea2cf973dc6ff15.tar.bz2
vcxsrv-924a6ffc82a7af0ca311af711ea2cf973dc6ff15.zip
Merge remote-tracking branch 'origin/released'
Conflicts: apps/xwininfo/configure.ac apps/xwininfo/xwininfo.c libX11/configure.ac libX11/specs/libX11/AppC.xml libX11/specs/libX11/AppD.xml libX11/specs/libX11/CH03.xml libX11/specs/libX11/CH04.xml libX11/specs/libX11/CH05.xml libX11/specs/libX11/CH06.xml libX11/specs/libX11/CH07.xml libX11/specs/libX11/CH08.xml libX11/specs/libX11/CH09.xml libX11/specs/libX11/CH11.xml libX11/specs/libX11/CH12.xml libX11/specs/libX11/CH13.xml libX11/specs/libX11/CH14.xml libX11/specs/libX11/CH15.xml libX11/specs/libX11/CH16.xml libxcb/configure.ac libxcb/src/c_client.py libxcb/src/xcb_auth.c libxcb/src/xcb_util.c mesalib/common.py mesalib/configs/linux-dri mesalib/docs/GL3.txt mesalib/docs/download.html mesalib/docs/install.html mesalib/include/GL/internal/dri_interface.h mesalib/scons/custom.py mesalib/scons/gallium.py mesalib/src/gallium/auxiliary/util/u_math.h mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c mesalib/src/glsl/ast_function.cpp mesalib/src/glsl/ast_to_hir.cpp mesalib/src/glsl/glcpp/glcpp-parse.y mesalib/src/glsl/glsl_parser_extras.cpp mesalib/src/glsl/glsl_parser_extras.h mesalib/src/glsl/ir.cpp mesalib/src/glsl/ir.h mesalib/src/glsl/ir_clone.cpp mesalib/src/glsl/ir_print_visitor.cpp mesalib/src/glsl/ir_validate.cpp mesalib/src/glsl/linker.cpp mesalib/src/glsl/main.cpp mesalib/src/glsl/opt_tree_grafting.cpp mesalib/src/mapi/glapi/gen/Makefile mesalib/src/mapi/glapi/gen/gl_XML.py mesalib/src/mapi/glapi/gen/gl_table.py mesalib/src/mapi/glapi/glapi_mapi_tmp.h mesalib/src/mapi/glapi/glapi_sparc.S mesalib/src/mapi/glapi/glapi_x86-64.S mesalib/src/mapi/glapi/glapi_x86.S mesalib/src/mapi/glapi/glapitemp.h mesalib/src/mapi/glapi/glprocs.h mesalib/src/mapi/mapi/u_thread.c mesalib/src/mapi/mapi/u_thread.h mesalib/src/mesa/SConscript mesalib/src/mesa/drivers/common/driverfuncs.c mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c mesalib/src/mesa/main/api_arrayelt.c mesalib/src/mesa/main/bufferobj.c mesalib/src/mesa/main/compiler.h mesalib/src/mesa/main/dd.h mesalib/src/mesa/main/dlist.c mesalib/src/mesa/main/enums.c mesalib/src/mesa/main/es_generator.py mesalib/src/mesa/main/fbobject.c mesalib/src/mesa/main/imports.h mesalib/src/mesa/main/mtypes.h mesalib/src/mesa/main/pbo.c mesalib/src/mesa/main/remap_helper.h mesalib/src/mesa/main/shared.c mesalib/src/mesa/main/texgetimage.c mesalib/src/mesa/main/teximage.c mesalib/src/mesa/main/uniforms.c mesalib/src/mesa/program/ir_to_mesa.cpp mesalib/src/mesa/program/prog_optimize.c mesalib/src/mesa/program/register_allocate.c mesalib/src/mesa/program/register_allocate.h mesalib/src/mesa/sources.mak mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c mesalib/src/mesa/state_tracker/st_cb_texture.c mesalib/src/mesa/state_tracker/st_texture.h mesalib/src/mesa/swrast/s_context.c mesalib/src/mesa/tnl/t_draw.c mesalib/src/mesa/vbo/vbo_exec_array.c mesalib/src/mesa/vbo/vbo_save_api.c pixman/pixman/pixman-arm-common.h pixman/pixman/pixman-fast-path.c pixman/pixman/pixman-inlines.h pixman/test/Makefile.am pixman/test/utils.c pixman/test/utils.h xorg-server/configure.ac xorg-server/fb/fbblt.c xorg-server/hw/xquartz/darwin.c xorg-server/xkeyboard-config/symbols/de
Diffstat (limited to 'mesalib/src/mapi/glapi/gen')
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile6
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_XML.py46
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_and_es_API.xml5
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_apitemp.py7
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_table.py20
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py2
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_x86_asm.py538
-rw-r--r--mesalib/src/mapi/glapi/gen/glapi_gen.mk44
-rw-r--r--mesalib/src/mapi/glapi/gen/gles_api.py452
-rw-r--r--mesalib/src/mapi/glapi/gen/remap_helper.py18
10 files changed, 850 insertions, 288 deletions
diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile
index d0e97f3b2..14733f162 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile
+++ b/mesalib/src/mapi/glapi/gen/Makefile
@@ -180,10 +180,8 @@ $(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON)
######################################################################
-$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API)
- $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_API.xml \
- -f $(MESA_GLAPI_DIR)/gen-es/es1_API.xml \
- -f $(MESA_GLAPI_DIR)/gen-es/es2_API.xml > $@
+$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON_ES)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_es_API.xml > $@
$(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON)
$(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@
diff --git a/mesalib/src/mapi/glapi/gen/gl_XML.py b/mesalib/src/mapi/glapi/gen/gl_XML.py
index 4bf2d02ba..96bb039b7 100644
--- a/mesalib/src/mapi/glapi/gen/gl_XML.py
+++ b/mesalib/src/mapi/glapi/gen/gl_XML.py
@@ -618,7 +618,7 @@ class gl_function( gl_item ):
# for each entry-point. Otherwise, they may generate code
# that won't compile.
- self.parameter_strings = {}
+ self.entry_point_parameters = {}
self.process_element( element )
@@ -703,12 +703,34 @@ class gl_function( gl_item ):
if element.children:
self.initialized = 1
- self.parameter_strings[name] = create_parameter_string(parameters, 1)
+ self.entry_point_parameters[name] = parameters
else:
- self.parameter_strings[name] = None
+ self.entry_point_parameters[name] = []
return
+ def filter_entry_points(self, entry_point_list):
+ """Filter out entry points not in entry_point_list."""
+ if not self.initialized:
+ raise RuntimeError('%s is not initialized yet' % self.name)
+
+ entry_points = []
+ for ent in self.entry_points:
+ if ent not in entry_point_list:
+ if ent in self.static_entry_points:
+ self.static_entry_points.remove(ent)
+ self.entry_point_parameters.pop(ent)
+ else:
+ entry_points.append(ent)
+
+ if not entry_points:
+ raise RuntimeError('%s has no entry point after filtering' % self.name)
+
+ self.entry_points = entry_points
+ if self.name not in entry_points:
+ # use the first remaining entry point
+ self.name = entry_points[0]
+ self.parameters = self.entry_point_parameters[entry_points[0]]
def get_images(self):
"""Return potentially empty list of input images."""
@@ -721,11 +743,11 @@ class gl_function( gl_item ):
def get_parameter_string(self, entrypoint = None):
if entrypoint:
- s = self.parameter_strings[ entrypoint ]
- if s:
- return s
+ params = self.entry_point_parameters[ entrypoint ]
+ else:
+ params = self.parameters
- return create_parameter_string( self.parameters, 1 )
+ return create_parameter_string( params, 1 )
def get_called_parameter_string(self):
p_string = ""
@@ -791,6 +813,16 @@ class gl_api:
typeexpr.create_initial_types()
return
+ def filter_functions(self, entry_point_list):
+ """Filter out entry points not in entry_point_list."""
+ functions_by_name = {}
+ for func in self.functions_by_name.itervalues():
+ entry_points = [ent for ent in func.entry_points if ent in entry_point_list]
+ if entry_points:
+ func.filter_entry_points(entry_points)
+ functions_by_name[func.name] = func
+
+ self.functions_by_name = functions_by_name
def process_element(self, doc):
element = doc.children
diff --git a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
index ac7d43ced..1313da0f5 100644
--- a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
@@ -3,6 +3,11 @@
<!-- OpenGL + OpenGL ES -->
+<!-- IMPORTANT
+ Remember to update gles_api.py when new OpenGL ES specific entry points
+ are added. Otherwise, they will be filtered out.
+-->
+
<OpenGLAPI>
<xi:include href="gl_API.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
diff --git a/mesalib/src/mapi/glapi/gen/gl_apitemp.py b/mesalib/src/mapi/glapi/gen/gl_apitemp.py
index 41a40fbeb..72c2e46c3 100644
--- a/mesalib/src/mapi/glapi/gen/gl_apitemp.py
+++ b/mesalib/src/mapi/glapi/gen/gl_apitemp.py
@@ -64,6 +64,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
n = f.static_name(name)
+ silence = ''
+ space = ''
for p in f.parameterIterator():
if p.is_padding:
continue
@@ -78,6 +80,9 @@ class PrintGlOffsets(gl_XML.gl_print_base):
o_string = o_string + comma + cast + p.name
comma = ", "
+ silence += "%s(void) %s;" % (space, p.name);
+ space = ' '
+
if f.return_type != 'void':
dispatch = "RETURN_DISPATCH"
@@ -97,6 +102,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n, f.get_parameter_string(name))
print '{'
+ if silence:
+ print ' %s' % (silence)
if p_string == "":
print ' %s(%s, (), (F, "gl%s();\\n"));' \
% (dispatch, f.name, name)
diff --git a/mesalib/src/mapi/glapi/gen/gl_table.py b/mesalib/src/mapi/glapi/gen/gl_table.py
index 210e75925..0361d6590 100644
--- a/mesalib/src/mapi/glapi/gen/gl_table.py
+++ b/mesalib/src/mapi/glapi/gen/gl_table.py
@@ -214,28 +214,28 @@ class PrintRemapTable(gl_XML.gl_print_base):
def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-m mode] [-c ver]" % sys.argv[0]
print " -m mode Mode can be 'table' or 'remap_table'."
- print " -c Enable compatibility with OpenGL ES."
+ print " -c ver Version can be 'es1' or 'es2'."
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c:")
except Exception,e:
show_usage()
mode = "table"
- es = False
+ es = None
for (arg,val) in args:
if arg == "-f":
file_name = val
elif arg == "-m":
mode = val
elif arg == "-c":
- es = True
+ es = val
if mode == "table":
printer = PrintGlTable(es)
@@ -246,4 +246,14 @@ if __name__ == '__main__':
api = gl_XML.parse_GL_API( file_name )
+ if es is not None:
+ import gles_api
+
+ api_map = {
+ 'es1': gles_api.es1_api,
+ 'es2': gles_api.es2_api,
+ }
+
+ api.filter_functions(api_map[es])
+
printer.Print( api )
diff --git a/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py b/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py
index 11cd9af40..ef759bf7b 100644
--- a/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -138,7 +138,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
print '# endif'
print ''
- print '#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)'
+ print '#if defined(PTHREADS) || defined(WIN32)'
print '# define THREADS'
print '#endif'
print ''
diff --git a/mesalib/src/mapi/glapi/gen/gl_x86_asm.py b/mesalib/src/mapi/glapi/gen/gl_x86_asm.py
index ede034e58..b43b65dd8 100644
--- a/mesalib/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/mesalib/src/mapi/glapi/gen/gl_x86_asm.py
@@ -1,269 +1,269 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# 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 <idr@us.ibm.com>
-
-import license
-import gl_XML, glX_XML
-import sys, getopt
-
-class PrintGenericStubs(gl_XML.gl_print_base):
-
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "gl_x86_asm.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004, 2005""", "BRIAN PAUL, IBM")
- return
-
-
- def get_stack_size(self, f):
- size = 0
- for p in f.parameterIterator():
- if p.is_padding:
- continue
-
- size += p.get_stack_size()
-
- return size
-
-
- def printRealHeader(self):
- print '#include "x86/assyntax.h"'
- 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 '# define _glapi_Dispatch _mglapi_Dispatch'
- 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__) && !defined(__APPLE__)'
- 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(WIN32) || defined(BEOS_THREADS)'
- print '# define THREADS'
- print '#endif'
- print ''
- print '#ifdef GLX_USE_TLS'
- print ''
- print '#ifdef GLX_X86_READONLY_TEXT'
- print '# define CTX_INSNS MOV_L(GS:(EAX), EAX)'
- print '#else'
- print '# define CTX_INSNS NOP /* Pad for init_glapi_relocs() */'
- print '#endif'
- print ''
- 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 '\tCALL(_x86_get_dispatch) ;\t\t\t\\'
- print '\tCTX_INSNS ; \\'
- print '\tJMP(GL_OFFSET(off))'
- print ''
- print '#elif 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_Dispatch)), 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_Dispatch)), 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 '#ifdef HAVE_ALIAS'
- print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
- print '\t.globl\tGL_PREFIX(fn, fn_alt) ;\t\t\t\\'
- print '\t.set\tGL_PREFIX(fn, fn_alt), GL_PREFIX(alias, alias_alt)'
- print '#else'
- print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
- print ' GL_STUB(fn, off, fn_alt)'
- print '#endif'
- print ''
- print 'SEG_TEXT'
- print ''
- print '#ifdef GLX_USE_TLS'
- print ''
- print '\tGLOBL\tGLNAME(_x86_get_dispatch)'
- print '\tHIDDEN(GLNAME(_x86_get_dispatch))'
- print 'ALIGNTEXT16'
- print 'GLNAME(_x86_get_dispatch):'
- print '\tcall 1f'
- print '1:\tpopl %eax'
- print '\taddl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax'
- print '\tmovl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax'
- print '\tret'
- print ''
- print '#elif defined(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 '#if defined( GLX_USE_TLS ) && !defined( GLX_X86_READONLY_TEXT )'
- print '\t\t.section\twtext, "awx", @progbits'
- print '#endif /* defined( GLX_USE_TLS ) */'
-
- print ''
- print '\t\tALIGNTEXT16'
- print '\t\tGLOBL GLNAME(gl_dispatch_functions_start)'
- print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_start))'
- print 'GLNAME(gl_dispatch_functions_start):'
- print ''
- return
-
-
- def printRealFooter(self):
- print ''
- print '\t\tGLOBL\tGLNAME(gl_dispatch_functions_end)'
- print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_end))'
- print '\t\tALIGNTEXT16'
- print 'GLNAME(gl_dispatch_functions_end):'
- print ''
- print '#if defined(GLX_USE_TLS) && defined(__linux__)'
- print ' .section ".note.ABI-tag", "a"'
- print ' .p2align 2'
- print ' .long 1f - 0f /* name length */'
- print ' .long 3f - 2f /* data length */'
- print ' .long 1 /* note length */'
- print '0: .asciz "GNU" /* vendor name */'
- print '1: .p2align 2'
- print '2: .long 0 /* note data: the ABI tag */'
- print ' .long 2,4,20 /* Minimum kernel version w/TLS */'
- print '3: .p2align 2 /* pad out section */'
- print '#endif /* GLX_USE_TLS */'
- print ''
- print '#if defined (__ELF__) && defined (__linux__)'
- print ' .section .note.GNU-stack,"",%progbits'
- print '#endif'
- return
-
-
- def printBody(self, api):
- for f in api.functionIterateByOffset():
- name = f.dispatch_name()
- stack = self.get_stack_size(f)
- alt = "%s@%u" % (name, stack)
-
- print '\tGL_STUB(%s, %d, %s)' % (name, f.offset, alt)
-
- if not f.is_static_entry_point(f.name):
- print '\tHIDDEN(GL_PREFIX(%s, %s))' % (name, alt)
-
-
- for f in api.functionIterateByOffset():
- name = f.dispatch_name()
- stack = self.get_stack_size(f)
- alt = "%s@%u" % (name, stack)
-
- for n in f.entry_points:
- if f.is_static_entry_point(n):
- if n != f.name:
- alt2 = "%s@%u" % (n, stack)
- text = '\tGL_STUB_ALIAS(%s, %d, %s, %s, %s)' % (n, f.offset, alt2, name, alt)
-
- if f.has_different_protocol(n):
- print '#ifndef GLX_INDIRECT_RENDERING'
- print text
- print '#endif'
- else:
- print text
-
- 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":
- printer = PrintGenericStubs()
- else:
- print "ERROR: Invalid mode \"%s\" specified." % mode
- show_usage()
-
- api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
- printer.Print(api)
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# 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 <idr@us.ibm.com>
+
+import license
+import gl_XML, glX_XML
+import sys, getopt
+
+class PrintGenericStubs(gl_XML.gl_print_base):
+
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "gl_x86_asm.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004, 2005""", "BRIAN PAUL, IBM")
+ return
+
+
+ def get_stack_size(self, f):
+ size = 0
+ for p in f.parameterIterator():
+ if p.is_padding:
+ continue
+
+ size += p.get_stack_size()
+
+ return size
+
+
+ def printRealHeader(self):
+ print '#include "x86/assyntax.h"'
+ 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 '# define _glapi_Dispatch _mglapi_Dispatch'
+ 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__) && !defined(__APPLE__)'
+ 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(WIN32)'
+ print '# define THREADS'
+ print '#endif'
+ print ''
+ print '#ifdef GLX_USE_TLS'
+ print ''
+ print '#ifdef GLX_X86_READONLY_TEXT'
+ print '# define CTX_INSNS MOV_L(GS:(EAX), EAX)'
+ print '#else'
+ print '# define CTX_INSNS NOP /* Pad for init_glapi_relocs() */'
+ print '#endif'
+ print ''
+ 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 '\tCALL(_x86_get_dispatch) ;\t\t\t\\'
+ print '\tCTX_INSNS ; \\'
+ print '\tJMP(GL_OFFSET(off))'
+ print ''
+ print '#elif 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_Dispatch)), 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_Dispatch)), 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 '#ifdef HAVE_ALIAS'
+ print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
+ print '\t.globl\tGL_PREFIX(fn, fn_alt) ;\t\t\t\\'
+ print '\t.set\tGL_PREFIX(fn, fn_alt), GL_PREFIX(alias, alias_alt)'
+ print '#else'
+ print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
+ print ' GL_STUB(fn, off, fn_alt)'
+ print '#endif'
+ print ''
+ print 'SEG_TEXT'
+ print ''
+ print '#ifdef GLX_USE_TLS'
+ print ''
+ print '\tGLOBL\tGLNAME(_x86_get_dispatch)'
+ print '\tHIDDEN(GLNAME(_x86_get_dispatch))'
+ print 'ALIGNTEXT16'
+ print 'GLNAME(_x86_get_dispatch):'
+ print '\tcall 1f'
+ print '1:\tpopl %eax'
+ print '\taddl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax'
+ print '\tmovl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax'
+ print '\tret'
+ print ''
+ print '#elif defined(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 '#if defined( GLX_USE_TLS ) && !defined( GLX_X86_READONLY_TEXT )'
+ print '\t\t.section\twtext, "awx", @progbits'
+ print '#endif /* defined( GLX_USE_TLS ) */'
+
+ print ''
+ print '\t\tALIGNTEXT16'
+ print '\t\tGLOBL GLNAME(gl_dispatch_functions_start)'
+ print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_start))'
+ print 'GLNAME(gl_dispatch_functions_start):'
+ print ''
+ return
+
+
+ def printRealFooter(self):
+ print ''
+ print '\t\tGLOBL\tGLNAME(gl_dispatch_functions_end)'
+ print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_end))'
+ print '\t\tALIGNTEXT16'
+ print 'GLNAME(gl_dispatch_functions_end):'
+ print ''
+ print '#if defined(GLX_USE_TLS) && defined(__linux__)'
+ print ' .section ".note.ABI-tag", "a"'
+ print ' .p2align 2'
+ print ' .long 1f - 0f /* name length */'
+ print ' .long 3f - 2f /* data length */'
+ print ' .long 1 /* note length */'
+ print '0: .asciz "GNU" /* vendor name */'
+ print '1: .p2align 2'
+ print '2: .long 0 /* note data: the ABI tag */'
+ print ' .long 2,4,20 /* Minimum kernel version w/TLS */'
+ print '3: .p2align 2 /* pad out section */'
+ print '#endif /* GLX_USE_TLS */'
+ print ''
+ print '#if defined (__ELF__) && defined (__linux__)'
+ print ' .section .note.GNU-stack,"",%progbits'
+ print '#endif'
+ return
+
+
+ def printBody(self, api):
+ for f in api.functionIterateByOffset():
+ name = f.dispatch_name()
+ stack = self.get_stack_size(f)
+ alt = "%s@%u" % (name, stack)
+
+ print '\tGL_STUB(%s, %d, %s)' % (name, f.offset, alt)
+
+ if not f.is_static_entry_point(f.name):
+ print '\tHIDDEN(GL_PREFIX(%s, %s))' % (name, alt)
+
+
+ for f in api.functionIterateByOffset():
+ name = f.dispatch_name()
+ stack = self.get_stack_size(f)
+ alt = "%s@%u" % (name, stack)
+
+ for n in f.entry_points:
+ if f.is_static_entry_point(n):
+ if n != f.name:
+ alt2 = "%s@%u" % (n, stack)
+ text = '\tGL_STUB_ALIAS(%s, %d, %s, %s, %s)' % (n, f.offset, alt2, name, alt)
+
+ if f.has_different_protocol(n):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+ print text
+ print '#endif'
+ else:
+ print text
+
+ 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":
+ printer = PrintGenericStubs()
+ else:
+ print "ERROR: Invalid mode \"%s\" specified." % mode
+ show_usage()
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer.Print(api)
diff --git a/mesalib/src/mapi/glapi/gen/glapi_gen.mk b/mesalib/src/mapi/glapi/gen/glapi_gen.mk
new file mode 100644
index 000000000..c7fa7c015
--- /dev/null
+++ b/mesalib/src/mapi/glapi/gen/glapi_gen.mk
@@ -0,0 +1,44 @@
+# Helpers for glapi header generation
+
+ifndef TOP
+$(error TOP must be defined.)
+endif
+
+glapi_gen_common_deps := \
+ $(wildcard $(TOP)/src/mapi/glapi/gen/*.xml) \
+ $(wildcard $(TOP)/src/mapi/glapi/gen/*.py)
+
+glapi_gen_mapi_script := $(TOP)/src/mapi/mapi/mapi_abi.py
+glapi_gen_mapi_deps := \
+ $(glapi_gen_mapi_script) \
+ $(glapi_gen_common_deps)
+
+# $(1): path to an XML file
+# $(2): name of the printer
+define glapi_gen_mapi
+@mkdir -p $(dir $@)
+$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) \
+ --mode lib --printer $(2) $(1) > $@
+endef
+
+glapi_gen_dispatch_script := $(TOP)/src/mapi/glapi/gen/gl_table.py
+glapi_gen_dispatch_deps := $(glapi_gen_common_deps)
+
+# $(1): path to an XML file
+# $(2): empty, es1, or es2 for entry point filtering
+define glapi_gen_dispatch
+@mkdir -p $(dir $@)
+$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_dispatch_script) \
+ -f $(1) -m remap_table $(if $(2),-c $(2),) > $@
+endef
+
+glapi_gen_remap_script := $(TOP)/src/mapi/glapi/gen/remap_helper.py
+glapi_gen_remap_deps := $(glapi_gen_common_deps)
+
+# $(1): path to an XML file
+# $(2): empty, es1, or es2 for entry point filtering
+define glapi_gen_remap
+@mkdir -p $(dir $@)
+$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_remap_script) \
+ -f $(1) $(if $(2),-c $(2),) > $@
+endef
diff --git a/mesalib/src/mapi/glapi/gen/gles_api.py b/mesalib/src/mapi/glapi/gen/gles_api.py
new file mode 100644
index 000000000..4cde9e544
--- /dev/null
+++ b/mesalib/src/mapi/glapi/gen/gles_api.py
@@ -0,0 +1,452 @@
+#!/usr/bin/env python
+
+# Mesa 3-D graphics library
+# Version: 7.12
+#
+# Copyright (C) 2011 LunarG Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# 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
+# THE AUTHORS OR COPYRIGHT HOLDERS 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:
+# Chia-I Wu <olv@lunarg.com>
+
+# These info should be part of GLAPI XML. Until that is possible, scripts have
+# to use tables here to filter gl_api.
+
+es1_core = (
+ # OpenGL ES 1.1
+ 'ActiveTexture',
+ 'AlphaFunc',
+ 'AlphaFuncx',
+ 'BindBuffer',
+ 'BindTexture',
+ 'BlendFunc',
+ 'BufferData',
+ 'BufferSubData',
+ 'Clear',
+ 'ClearColor',
+ 'ClearColorx',
+ 'ClearDepthf',
+ 'ClearDepthx',
+ 'ClearStencil',
+ 'ClientActiveTexture',
+ 'ClipPlanef',
+ 'ClipPlanex',
+ 'Color4f',
+ 'Color4ub',
+ 'Color4x',
+ 'ColorMask',
+ 'ColorPointer',
+ 'CompressedTexImage2D',
+ 'CompressedTexSubImage2D',
+ 'CopyTexImage2D',
+ 'CopyTexSubImage2D',
+ 'CullFace',
+ 'DeleteBuffers',
+ 'DeleteTextures',
+ 'DepthFunc',
+ 'DepthMask',
+ 'DepthRangef',
+ 'DepthRangex',
+ 'Disable',
+ 'DisableClientState',
+ 'DrawArrays',
+ 'DrawElements',
+ 'Enable',
+ 'EnableClientState',
+ 'Finish',
+ 'Flush',
+ 'Fogf',
+ 'Fogfv',
+ 'Fogx',
+ 'Fogxv',
+ 'FrontFace',
+ 'Frustumf',
+ 'Frustumx',
+ 'GenBuffers',
+ 'GenTextures',
+ 'GetBooleanv',
+ 'GetBufferParameteriv',
+ 'GetClipPlanef',
+ 'GetClipPlanex',
+ 'GetError',
+ 'GetFixedv',
+ 'GetFloatv',
+ 'GetIntegerv',
+ 'GetLightfv',
+ 'GetLightxv',
+ 'GetMaterialfv',
+ 'GetMaterialxv',
+ 'GetPointerv',
+ 'GetString',
+ 'GetTexEnvfv',
+ 'GetTexEnviv',
+ 'GetTexEnvxv',
+ 'GetTexParameterfv',
+ 'GetTexParameteriv',
+ 'GetTexParameterxv',
+ 'Hint',
+ 'IsBuffer',
+ 'IsEnabled',
+ 'IsTexture',
+ 'Lightf',
+ 'Lightfv',
+ 'LightModelf',
+ 'LightModelfv',
+ 'LightModelx',
+ 'LightModelxv',
+ 'Lightx',
+ 'Lightxv',
+ 'LineWidth',
+ 'LineWidthx',
+ 'LoadIdentity',
+ 'LoadMatrixf',
+ 'LoadMatrixx',
+ 'LogicOp',
+ 'Materialf',
+ 'Materialfv',
+ 'Materialx',
+ 'Materialxv',
+ 'MatrixMode',
+ 'MultiTexCoord4f',
+ 'MultiTexCoord4x',
+ 'MultMatrixf',
+ 'MultMatrixx',
+ 'Normal3f',
+ 'Normal3x',
+ 'NormalPointer',
+ 'Orthof',
+ 'Orthox',
+ 'PixelStorei',
+ 'PointParameterf',
+ 'PointParameterfv',
+ 'PointParameterx',
+ 'PointParameterxv',
+ 'PointSize',
+ 'PointSizex',
+ 'PolygonOffset',
+ 'PolygonOffsetx',
+ 'PopMatrix',
+ 'PushMatrix',
+ 'ReadPixels',
+ 'Rotatef',
+ 'Rotatex',
+ 'SampleCoverage',
+ 'SampleCoveragex',
+ 'Scalef',
+ 'Scalex',
+ 'Scissor',
+ 'ShadeModel',
+ 'StencilFunc',
+ 'StencilMask',
+ 'StencilOp',
+ 'TexCoordPointer',
+ 'TexEnvf',
+ 'TexEnvfv',
+ 'TexEnvi',
+ 'TexEnviv',
+ 'TexEnvx',
+ 'TexEnvxv',
+ 'TexImage2D',
+ 'TexParameterf',
+ 'TexParameterfv',
+ 'TexParameteri',
+ 'TexParameteriv',
+ 'TexParameterx',
+ 'TexParameterxv',
+ 'TexSubImage2D',
+ 'Translatef',
+ 'Translatex',
+ 'VertexPointer',
+ 'Viewport',
+)
+
+es1_api = es1_core + (
+ # GL_OES_EGL_image
+ 'EGLImageTargetTexture2DOES',
+ 'EGLImageTargetRenderbufferStorageOES',
+ # GL_OES_mapbuffer
+ 'GetBufferPointervOES',
+ 'MapBufferOES',
+ 'UnmapBufferOES',
+ # GL_EXT_multi_draw_arrays
+ 'MultiDrawArraysEXT',
+ 'MultiDrawElementsEXT',
+ # GL_OES_blend_equation_separate
+ 'BlendEquationSeparateOES',
+ # GL_OES_blend_func_separate
+ 'BlendFuncSeparateOES',
+ # GL_OES_blend_subtract
+ 'BlendEquationOES',
+ # GL_OES_draw_texture
+ 'DrawTexiOES',
+ 'DrawTexivOES',
+ 'DrawTexfOES',
+ 'DrawTexfvOES',
+ 'DrawTexsOES',
+ 'DrawTexsvOES',
+ 'DrawTexxOES',
+ 'DrawTexxvOES',
+ # GL_OES_fixed_point
+ 'AlphaFuncxOES',
+ 'ClearColorxOES',
+ 'ClearDepthxOES',
+ 'Color4xOES',
+ 'DepthRangexOES',
+ 'FogxOES',
+ 'FogxvOES',
+ 'FrustumxOES',
+ 'LightModelxOES',
+ 'LightModelxvOES',
+ 'LightxOES',
+ 'LightxvOES',
+ 'LineWidthxOES',
+ 'LoadMatrixxOES',
+ 'MaterialxOES',
+ 'MaterialxvOES',
+ 'MultiTexCoord4xOES',
+ 'MultMatrixxOES',
+ 'Normal3xOES',
+ 'OrthoxOES',
+ 'PointSizexOES',
+ 'PolygonOffsetxOES',
+ 'RotatexOES',
+ 'SampleCoveragexOES',
+ 'ScalexOES',
+ 'TexEnvxOES',
+ 'TexEnvxvOES',
+ 'TexParameterxOES',
+ 'TranslatexOES',
+ 'ClipPlanexOES',
+ 'GetClipPlanexOES',
+ 'GetFixedvOES',
+ 'GetLightxvOES',
+ 'GetMaterialxvOES',
+ 'GetTexEnvxvOES',
+ 'GetTexParameterxvOES',
+ 'PointParameterxOES',
+ 'PointParameterxvOES',
+ 'TexParameterxvOES',
+ # GL_OES_framebuffer_object
+ 'BindFramebufferOES',
+ 'BindRenderbufferOES',
+ 'CheckFramebufferStatusOES',
+ 'DeleteFramebuffersOES',
+ 'DeleteRenderbuffersOES',
+ 'FramebufferRenderbufferOES',
+ 'FramebufferTexture2DOES',
+ 'GenerateMipmapOES',
+ 'GenFramebuffersOES',
+ 'GenRenderbuffersOES',
+ 'GetFramebufferAttachmentParameterivOES',
+ 'GetRenderbufferParameterivOES',
+ 'IsFramebufferOES',
+ 'IsRenderbufferOES',
+ 'RenderbufferStorageOES',
+ # GL_OES_point_size_array
+ 'PointSizePointerOES',
+ # GL_OES_query_matrix
+ 'QueryMatrixxOES',
+ # GL_OES_single_precision
+ 'ClearDepthfOES',
+ 'DepthRangefOES',
+ 'FrustumfOES',
+ 'OrthofOES',
+ 'ClipPlanefOES',
+ 'GetClipPlanefOES',
+ # GL_OES_texture_cube_map
+ 'GetTexGenfvOES',
+ 'GetTexGenivOES',
+ 'GetTexGenxvOES',
+ 'TexGenfOES',
+ 'TexGenfvOES',
+ 'TexGeniOES',
+ 'TexGenivOES',
+ 'TexGenxOES',
+ 'TexGenxvOES',
+)
+
+es2_core = (
+ # OpenGL ES 2.0
+ "ActiveTexture",
+ "AttachShader",
+ "BindAttribLocation",
+ "BindBuffer",
+ "BindFramebuffer",
+ "BindRenderbuffer",
+ "BindTexture",
+ "BlendColor",
+ "BlendEquation",
+ "BlendEquationSeparate",
+ "BlendFunc",
+ "BlendFuncSeparate",
+ "BufferData",
+ "BufferSubData",
+ "CheckFramebufferStatus",
+ "Clear",
+ "ClearColor",
+ "ClearDepthf",
+ "ClearStencil",
+ "ColorMask",
+ "CompileShader",
+ "CompressedTexImage2D",
+ "CompressedTexSubImage2D",
+ "CopyTexImage2D",
+ "CopyTexSubImage2D",
+ "CreateProgram",
+ "CreateShader",
+ "CullFace",
+ "DeleteBuffers",
+ "DeleteFramebuffers",
+ "DeleteProgram",
+ "DeleteRenderbuffers",
+ "DeleteShader",
+ "DeleteTextures",
+ "DepthFunc",
+ "DepthMask",
+ "DepthRangef",
+ "DetachShader",
+ "Disable",
+ "DisableVertexAttribArray",
+ "DrawArrays",
+ "DrawElements",
+ "Enable",
+ "EnableVertexAttribArray",
+ "Finish",
+ "Flush",
+ "FramebufferRenderbuffer",
+ "FramebufferTexture2D",
+ "FrontFace",
+ "GenBuffers",
+ "GenerateMipmap",
+ "GenFramebuffers",
+ "GenRenderbuffers",
+ "GenTextures",
+ "GetActiveAttrib",
+ "GetActiveUniform",
+ "GetAttachedShaders",
+ "GetAttribLocation",
+ "GetBooleanv",
+ "GetBufferParameteriv",
+ "GetError",
+ "GetFloatv",
+ "GetFramebufferAttachmentParameteriv",
+ "GetIntegerv",
+ "GetProgramInfoLog",
+ "GetProgramiv",
+ "GetRenderbufferParameteriv",
+ "GetShaderInfoLog",
+ "GetShaderiv",
+ "GetShaderPrecisionFormat",
+ "GetShaderSource",
+ "GetString",
+ "GetTexParameterfv",
+ "GetTexParameteriv",
+ "GetUniformfv",
+ "GetUniformiv",
+ "GetUniformLocation",
+ "GetVertexAttribfv",
+ "GetVertexAttribiv",
+ "GetVertexAttribPointerv",
+ "Hint",
+ "IsBuffer",
+ "IsEnabled",
+ "IsFramebuffer",
+ "IsProgram",
+ "IsRenderbuffer",
+ "IsShader",
+ "IsTexture",
+ "LineWidth",
+ "LinkProgram",
+ "PixelStorei",
+ "PolygonOffset",
+ "ReadPixels",
+ "ReleaseShaderCompiler",
+ "RenderbufferStorage",
+ "SampleCoverage",
+ "Scissor",
+ "ShaderBinary",
+ "ShaderSource",
+ "StencilFunc",
+ "StencilFuncSeparate",
+ "StencilMask",
+ "StencilMaskSeparate",
+ "StencilOp",
+ "StencilOpSeparate",
+ "TexImage2D",
+ "TexParameterf",
+ "TexParameterfv",
+ "TexParameteri",
+ "TexParameteriv",
+ "TexSubImage2D",
+ "Uniform1f",
+ "Uniform1fv",
+ "Uniform1i",
+ "Uniform1iv",
+ "Uniform2f",
+ "Uniform2fv",
+ "Uniform2i",
+ "Uniform2iv",
+ "Uniform3f",
+ "Uniform3fv",
+ "Uniform3i",
+ "Uniform3iv",
+ "Uniform4f",
+ "Uniform4fv",
+ "Uniform4i",
+ "Uniform4iv",
+ "UniformMatrix2fv",
+ "UniformMatrix3fv",
+ "UniformMatrix4fv",
+ "UseProgram",
+ "ValidateProgram",
+ "VertexAttrib1f",
+ "VertexAttrib1fv",
+ "VertexAttrib2f",
+ "VertexAttrib2fv",
+ "VertexAttrib3f",
+ "VertexAttrib3fv",
+ "VertexAttrib4f",
+ "VertexAttrib4fv",
+ "VertexAttribPointer",
+ "Viewport",
+)
+
+es2_api = es2_core + (
+ # GL_OES_EGL_image
+ 'EGLImageTargetTexture2DOES',
+ 'EGLImageTargetRenderbufferStorageOES',
+ # GL_OES_mapbuffer
+ 'GetBufferPointervOES',
+ 'MapBufferOES',
+ 'UnmapBufferOES',
+ # GL_EXT_multi_draw_arrays
+ 'MultiDrawArraysEXT',
+ 'MultiDrawElementsEXT',
+ # GL_OES_texture_3D
+ 'CompressedTexImage3DOES',
+ 'CompressedTexSubImage3DOES',
+ 'CopyTexSubImage3DOES',
+ 'FramebufferTexture3DOES',
+ 'TexImage3DOES',
+ 'TexSubImage3DOES',
+ # GL_OES_get_program_binary
+ 'GetProgramBinaryOES',
+ 'ProgramBinaryOES',
+)
diff --git a/mesalib/src/mapi/glapi/gen/remap_helper.py b/mesalib/src/mapi/glapi/gen/remap_helper.py
index 69b8e5e9d..367ae24c7 100644
--- a/mesalib/src/mapi/glapi/gen/remap_helper.py
+++ b/mesalib/src/mapi/glapi/gen/remap_helper.py
@@ -197,22 +197,36 @@ class PrintGlRemap(gl_XML.gl_print_base):
def show_usage():
- print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-c ver]" % sys.argv[0]
+ print " -c ver Version can be 'es1' or 'es2'."
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:c:")
except Exception,e:
show_usage()
+ es = None
for (arg,val) in args:
if arg == "-f":
file_name = val
+ elif arg == "-c":
+ es = val
api = gl_XML.parse_GL_API( file_name )
+ if es is not None:
+ import gles_api
+
+ api_map = {
+ 'es1': gles_api.es1_api,
+ 'es2': gles_api.es2_api,
+ }
+
+ api.filter_functions(api_map[es])
+
printer = PrintGlRemap()
printer.Print( api )