From ade150d66724259119012420068fa930807311c2 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 22 Apr 2010 11:41:41 -0400 Subject: mesa: Compute extension string according to API We can now stop special casing glGetString() and drop specials_es*.c. --- src/mesa/es/main/APIspec.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/es/main/APIspec.xml') diff --git a/src/mesa/es/main/APIspec.xml b/src/mesa/es/main/APIspec.xml index 17665d8df5..7e77eb74d5 100644 --- a/src/mesa/es/main/APIspec.xml +++ b/src/mesa/es/main/APIspec.xml @@ -3955,7 +3955,7 @@ - + @@ -4178,7 +4178,7 @@ - + -- cgit v1.2.3 From ea0c7e71638a4a72a4eae962e6cc471bd33a5605 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 22 Apr 2010 20:26:51 -0400 Subject: mesa: Move api_exec_es*.c into mesa/main This requires renaming a few functions to have unique names so that they can all live within the same driver. --- src/mesa/Makefile | 6 + src/mesa/es/Makefile | 8 - src/mesa/es/main/APIspec.dtd | 52 - src/mesa/es/main/APIspec.py | 617 ------ src/mesa/es/main/APIspec.xml | 4336 -------------------------------------- src/mesa/es/main/APIspecutil.py | 265 --- src/mesa/es/main/es_generator.py | 719 ------- src/mesa/es/sources.mak | 2 - src/mesa/main/APIspec.dtd | 52 + src/mesa/main/APIspec.py | 617 ++++++ src/mesa/main/APIspec.xml | 4336 ++++++++++++++++++++++++++++++++++++++ src/mesa/main/APIspecutil.py | 265 +++ src/mesa/main/api_exec.h | 6 + src/mesa/main/context.c | 48 +- src/mesa/main/es_generator.py | 726 +++++++ src/mesa/main/remap.h | 33 + src/mesa/sources.mak | 2 + 17 files changed, 6086 insertions(+), 6004 deletions(-) delete mode 100644 src/mesa/es/main/APIspec.dtd delete mode 100644 src/mesa/es/main/APIspec.py delete mode 100644 src/mesa/es/main/APIspec.xml delete mode 100644 src/mesa/es/main/APIspecutil.py delete mode 100644 src/mesa/es/main/es_generator.py create mode 100644 src/mesa/main/APIspec.dtd create mode 100644 src/mesa/main/APIspec.py create mode 100644 src/mesa/main/APIspec.xml create mode 100644 src/mesa/main/APIspecutil.py create mode 100644 src/mesa/main/es_generator.py (limited to 'src/mesa/es/main/APIspec.xml') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 8c0ebf84c4..7dcde5275e 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -24,6 +24,12 @@ default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \ libglapi.a driver_subdirs +main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py + $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@ + +main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py + $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@ + ###################################################################### # Helper libraries used by many drivers: diff --git a/src/mesa/es/Makefile b/src/mesa/es/Makefile index 8b484853af..b095620c9d 100644 --- a/src/mesa/es/Makefile +++ b/src/mesa/es/Makefile @@ -83,17 +83,9 @@ libes2api.a: $(ES2_API_OBJECTS) @$(MKLIB) -o es2api -static $(ES2_API_OBJECTS) GENERATED_SOURCES := \ - main/api_exec_es1.c \ - main/api_exec_es2.c \ main/get_es1.c \ main/get_es2.c -main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py - $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@ - -main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py - $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@ - main/get_es1.c: main/get_gen.py $(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@ diff --git a/src/mesa/es/main/APIspec.dtd b/src/mesa/es/main/APIspec.dtd deleted file mode 100644 index efcfa31f10..0000000000 --- a/src/mesa/es/main/APIspec.dtd +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mesa/es/main/APIspec.py b/src/mesa/es/main/APIspec.py deleted file mode 100644 index 6947f7301c..0000000000 --- a/src/mesa/es/main/APIspec.py +++ /dev/null @@ -1,617 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2009 Chia-I Wu -# -# 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. -""" -A parser for APIspec. -""" - -class SpecError(Exception): - """Error in the spec file.""" - - -class Spec(object): - """A Spec is an abstraction of the API spec.""" - - def __init__(self, doc): - self.doc = doc - - self.spec_node = doc.getRootElement() - self.tmpl_nodes = {} - self.api_nodes = {} - self.impl_node = None - - # parse - node = self.spec_node.children - while node: - if node.type == "element": - if node.name == "template": - self.tmpl_nodes[node.prop("name")] = node - elif node.name == "api": - self.api_nodes[node.prop("name")] = node - else: - raise SpecError("unexpected node %s in apispec" % - node.name) - node = node.next - - # find an implementation - for name, node in self.api_nodes.iteritems(): - if node.prop("implementation") == "true": - self.impl_node = node - break - if not self.impl_node: - raise SpecError("unable to find an implementation") - - def get_impl(self): - """Return the implementation.""" - return API(self, self.impl_node) - - def get_api(self, name): - """Return an API.""" - return API(self, self.api_nodes[name]) - - -class API(object): - """An API consists of categories and functions.""" - - def __init__(self, spec, api_node): - self.name = api_node.prop("name") - self.is_impl = (api_node.prop("implementation") == "true") - - self.categories = [] - self.functions = [] - - # parse - func_nodes = [] - node = api_node.children - while node: - if node.type == "element": - if node.name == "category": - cat = node.prop("name") - self.categories.append(cat) - elif node.name == "function": - func_nodes.append(node) - else: - raise SpecError("unexpected node %s in api" % node.name) - node = node.next - - # realize functions - for func_node in func_nodes: - tmpl_node = spec.tmpl_nodes[func_node.prop("template")] - try: - func = Function(tmpl_node, func_node, self.is_impl, - self.categories) - except SpecError, e: - func_name = func_node.prop("name") - raise SpecError("failed to parse %s: %s" % (func_name, e)) - self.functions.append(func) - - def match(self, func, conversions={}): - """Find a matching function in the API.""" - match = None - need_conv = False - for f in self.functions: - matched, conv = f.match(func, conversions) - if matched: - match = f - need_conv = conv - # exact match - if not need_conv: - break - return (match, need_conv) - - -class Function(object): - """Parse and realize a