diff --git a/src/mapi/glapi/gen/glX_proto_recv.py b/src/mapi/glapi/gen/glX_proto_recv.py index 946f011818b..e33dd6d268e 100644 --- a/src/mapi/glapi/gen/glX_proto_recv.py +++ b/src/mapi/glapi/gen/glX_proto_recv.py @@ -134,9 +134,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto): print '{' - if not f.is_abi(): - print ' %s %s = __glGetProcAddress("gl%s");' % (self.fptrType(name), name, name) - if f.glx_rop or f.vectorequiv: self.printRenderFunction(f) elif f.glx_sop or f.glx_vendorpriv: @@ -221,7 +218,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto): def emit_function_call(self, f, retval_assign, indent): list = [] - prefix = "gl" if f.is_abi() else "" for param in f.parameterIterator(): if param.is_padding: @@ -234,7 +230,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto): list.append( '%s %s' % (indent, location) ) - print '%s %s%s%s(%s);' % (indent, retval_assign, prefix, f.name, string.join(list, ',\n')) + print '%s %sgl%s(%s);' % (indent, retval_assign, f.name, string.join(list, ',\n')) def common_func_print_just_start(self, f, indent): diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py index f1cabdfabf0..c84af469a59 100644 --- a/src/mapi/glapi/gen/glX_proto_send.py +++ b/src/mapi/glapi/gen/glX_proto_send.py @@ -948,7 +948,6 @@ struct _glapi_table * __glXNewIndirectAPI( void ) _glapi_proc *table; unsigned entries; unsigned i; - int o; entries = _glapi_get_dispatch_table_size(); table = malloc(entries * sizeof(_glapi_proc)); @@ -985,13 +984,7 @@ struct _glapi_table * __glXNewIndirectAPI( void ) print(preamble) preamble = None - if func.is_abi(): - print(' table[{offset}] = (_glapi_proc) __indirect_gl{name};'.format(name = func.name, offset = func.offset)) - else: - print(' o = _glapi_get_proc_offset("gl{0}");'.format(func.name)) - print(' assert(o > 0);') - print(' table[o] = (_glapi_proc) __indirect_gl{0};'.format(func.name)) - + print(' table[{offset}] = (_glapi_proc) __indirect_gl{name};'.format(name = func.name, offset = func.offset)) return diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py index 4dcaaeb463e..81422da502f 100644 --- a/src/mapi/glapi/gen/gl_XML.py +++ b/src/mapi/glapi/gen/gl_XML.py @@ -40,17 +40,6 @@ def parse_GL_API(file_name, factory=None, pointer_size=0): api = factory.create_api(pointer_size) api.parse_file(file_name) - - # After the XML has been processed, we need to go back and assign - # dispatch offsets to the functions that request that their offsets - # be assigned by the scripts. Typically this means all functions - # that are not part of the ABI. - - for func in api.functionIterateByCategory(): - if func.assign_offset and func.offset < 0: - func.offset = api.next_offset; - api.next_offset += 1 - return api @@ -638,8 +627,6 @@ class gl_function( gl_item ): # Decimal('1.1') }. self.api_map = {} - self.assign_offset = False - self.static_entry_points = [] # Track the parameter string (for the function prototype) @@ -711,15 +698,11 @@ class gl_function( gl_item ): # Only try to set the offset when a non-alias entry-point # is being processed. - if name in static_data.offsets and static_data.offsets[name] <= static_data.MAX_OFFSETS: + if name in static_data.offsets: self.offset = static_data.offsets[name] - elif name in static_data.offsets and static_data.offsets[name] > static_data.MAX_OFFSETS: - self.offset = static_data.offsets[name] - self.assign_offset = True else: if self.exec_flavor != "skip": raise RuntimeError("Entry-point %s is missing offset in static_data.py. Add one at the bottom of the list." % (name)) - self.assign_offset = False if not self.name: self.name = true_name @@ -829,10 +812,6 @@ class gl_function( gl_item ): return p_string - - def is_abi(self): - return (self.offset >= 0 and not self.assign_offset) - def is_static_entry_point(self, name): return name in self.static_entry_points diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py index ae1300cdb89..38cae5794ce 100644 --- a/src/mapi/glapi/gen/gl_table.py +++ b/src/mapi/glapi/gen/gl_table.py @@ -119,40 +119,18 @@ class PrintRemapTable(gl_XML.gl_print_base): print(' } while(0)') print('') - functions = [] - abi_functions = [] - count = 0 - for f in api.functionIterateByOffset(): - if not f.is_abi(): - functions.append([f, count]) - count += 1 - else: - abi_functions.append([f, -1]) + abi_functions = [f for f in api.functionIterateByOffset()] print('/* total number of offsets below */') - print('#define _gloffset_COUNT %d' % (len(abi_functions + functions))) + print('#define _gloffset_COUNT %d' % (len(abi_functions))) print('') - for f, index in abi_functions: + for f in abi_functions: print('#define _gloffset_%s %d' % (f.name, f.offset)) - remap_table = "driDispatchRemapTable" - - print('#define %s_size %u' % (remap_table, count)) - print('extern int %s[ %s_size ];' % (remap_table, remap_table)) print('') - for f, index in functions: - print('#define %s_remap_index %u' % (f.name, index)) - - print('') - - for f, index in functions: - print('#define _gloffset_%s %s[%s_remap_index]' % (f.name, remap_table, f.name)) - - print('') - - for f, index in abi_functions + functions: + for f in abi_functions: arg_string = gl_XML.create_parameter_string(f.parameters, 0) print('typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % (f.return_type, f.name, arg_string)) @@ -176,10 +154,10 @@ def _parser(): dest='file_name', help="Path to an XML description of OpenGL API.") parser.add_argument('-m', '--mode', - choices=['table', 'remap_table'], + choices=['table', 'dispatch'], default='table', metavar="mode", - help="Generate either a table or a remap_table") + help="Generate either a table or a dispatch") return parser.parse_args() @@ -191,7 +169,7 @@ def main(): if args.mode == "table": printer = PrintGlTable() - elif args.mode == "remap_table": + elif args.mode == "dispatch": printer = PrintRemapTable() printer.Print(api) diff --git a/src/mapi/glapi/gen/remap_helper.py b/src/mapi/glapi/gen/remap_helper.py deleted file mode 100644 index f5d58675dcd..00000000000 --- a/src/mapi/glapi/gen/remap_helper.py +++ /dev/null @@ -1,118 +0,0 @@ - -# Copyright (C) 2009 Chia-I Wu -# All Rights Reserved. -# -# This is based on extension_helper.py by Ian Romanick. -# -# 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. - -import argparse - -import license -import gl_XML - - -class PrintGlRemap(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - - self.name = "remap_helper.py (from Mesa)" - self.license = license.bsd_license_template % ("Copyright (C) 2009 Chia-I Wu ", "Chia-I Wu") - return - - - def printRealHeader(self): - print('#include "main/dispatch.h"') - print('#include "main/remap.h"') - print('') - return - - - def printBody(self, api): - pool_indices = {} - - print('/* this is internal to remap.c */') - print('#ifndef need_MESA_remap_table') - print('#error Only remap.c should include this file!') - print('#endif /* need_MESA_remap_table */') - print('') - - print('') - print('static const char _mesa_function_pool[] =') - - # output string pool - index = 0; - for f in api.functionIterateAll(): - pool_indices[f] = index - - # a function has either assigned offset, fixed offset, - # or no offset - if f.assign_offset: - comments = "will be remapped" - elif f.offset > 0: - comments = "offset %d" % f.offset - else: - comments = "dynamic" - - print(' /* _mesa_function_pool[%d]: %s (%s) */' \ - % (index, f.name, comments)) - print(' "gl%s\\0"' % f.entry_points[0]) - index += len(f.entry_points[0]) + 3 - print(' ;') - print('') - - print('/* these functions need to be remapped */') - print('static const struct gl_function_pool_remap MESA_remap_table_functions[] = {') - # output all functions that need to be remapped - # iterate by offsets so that they are sorted by remap indices - for f in api.functionIterateByOffset(): - if not f.assign_offset: - continue - print(' { %5d, %s_remap_index },' \ - % (pool_indices[f], f.name)) - print(' { -1, -1 }') - print('};') - print('') - return - - -def _parser(): - """Parse input options and return a namsepace.""" - parser = argparse.ArgumentParser() - parser.add_argument('-f', '--filename', - default="gl_API.xml", - metavar="input_file_name", - dest='file_name', - help="An xml description file.") - return parser.parse_args() - - -def main(): - """Main function.""" - args = _parser() - - api = gl_XML.parse_GL_API(args.file_name) - - printer = PrintGlRemap() - printer.Print(api) - - -if __name__ == '__main__': - main() diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index e533ed667e4..60a8a648fb8 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -20,8 +20,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -MAX_OFFSETS = 2 ** 31 # TODO: remove this - """Table of functions that have ABI-mandated offsets in the dispatch table. The first 407 entries are required by indirect GLX. The rest can use any diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 31e1a6e5ae2..4eb2171ed8e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -117,7 +117,6 @@ #include "queryobj.h" #include "syncobj.h" #include "rastpos.h" -#include "remap.h" #include "scissor.h" #include "shared.h" #include "shaderobj.h" @@ -230,8 +229,6 @@ one_time_init(const char *extensions_override) * unecessary creation/destruction of glsl types. */ glsl_type_singleton_init_or_ref(); - - _mesa_init_remap_table(); } /** diff --git a/src/mesa/main/meson.build b/src/mesa/main/meson.build index 71d97a02b5b..9070bc9bedc 100644 --- a/src/mesa/main/meson.build +++ b/src/mesa/main/meson.build @@ -5,7 +5,7 @@ main_dispatch_h = custom_target( 'dispatch.h', input : [files('../../mapi/glapi/gen/gl_table.py'), gl_and_es_api_files], output : 'dispatch.h', - command : [prog_python, '@INPUT0@', '-f', '@INPUT1@', '-m', 'remap_table'], + command : [prog_python, '@INPUT0@', '-f', '@INPUT1@', '-m', 'dispatch'], depend_files : glapi_gen_depends, capture : true, ) @@ -19,15 +19,6 @@ main_marshal_generated_h = custom_target( capture : true, ) -main_remap_helper_h = custom_target( - 'remap_helper.h', - input : [files('../../mapi/glapi/gen/remap_helper.py'), gl_and_es_api_files], - output : 'remap_helper.h', - command : [prog_python, '@INPUT0@', '-f', '@INPUT1@'], - depend_files : glapi_gen_depends, - capture : true, -) - if _shader_replacement != '' # shader replacement shader_replacement_h = custom_target( diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c deleted file mode 100644 index 415f18e5295..00000000000 --- a/src/mesa/main/remap.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * 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 - * 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. - */ - - -/** - * \file remap.c - * Remap table management. - * - * Entries in the dispatch table are either static or dynamic. The - * dispatch table is shared by mesa core and glapi. When they are - * built separately, it is possible that a static entry in mesa core - * is dynamic, or assigned a different static offset, in glapi. The - * remap table is in charge of mapping a static entry in mesa core to - * a dynamic entry, or the corresponding static entry, in glapi. - */ - -#include -#include -#include "remap.h" - -#include "glapi/glapi.h" - -#define MAX_ENTRY_POINTS 16 - -#define need_MESA_remap_table -#include "main/remap_helper.h" -#include "errors.h" - - -/* this is global for quick access */ -int driDispatchRemapTable[driDispatchRemapTable_size]; - - - -/** - * Initialize the remap table. This is called in one_time_init(). - * The remap table needs to be initialized before calling the - * CALL/GET/SET macros defined in main/dispatch.h. - */ -void -_mesa_init_remap_table(void) -{ - static bool initialized = false; - GLint i; - - if (initialized) - return; - initialized = true; - - for (i = 0; i < driDispatchRemapTable_size; i++) { - /* sanity check */ - assert(i == MESA_remap_table_functions[i].remap_index); - const char *name = _mesa_function_pool + MESA_remap_table_functions[i].pool_index; - - /* store the dispatch offset in driDispatchRemapTable, for use by - * _gloffset_* macros. - */ - driDispatchRemapTable[i] = _glapi_add_dispatch(name); - if (driDispatchRemapTable[i] < 0) { - _mesa_warning(NULL, "failed to remap %s", name); - } - } -} diff --git a/src/mesa/main/remap.h b/src/mesa/main/remap.h deleted file mode 100644 index 19d2f0daa5a..00000000000 --- a/src/mesa/main/remap.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * 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 - * 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. - */ - - -#ifndef REMAP_H -#define REMAP_H - - -struct gl_function_pool_remap { - int pool_index; - int remap_index; -}; - -extern int -driDispatchRemapTable[]; - -extern void -_mesa_init_remap_table(void); - - -#endif /* REMAP_H */ diff --git a/src/mesa/main/tests/disable_windows_include.c b/src/mesa/main/tests/disable_windows_include.c index 5ff65d7dc68..3e67bd77b11 100644 --- a/src/mesa/main/tests/disable_windows_include.c +++ b/src/mesa/main/tests/disable_windows_include.c @@ -98,7 +98,6 @@ #include #include #include -#include #include #include #include diff --git a/src/mesa/meson.build b/src/mesa/meson.build index fed6557c810..46e4ac9fabf 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -160,8 +160,6 @@ files_libmesa = files( 'main/rastpos.h', 'main/readpix.c', 'main/readpix.h', - 'main/remap.c', - 'main/remap.h', 'main/renderbuffer.c', 'main/renderbuffer.h', 'main/robustness.c', @@ -426,7 +424,6 @@ files_libmesa += [ main_marshal_generated_h, main_dispatch_h, ir_expression_operation_h, - main_remap_helper_h, sha1_h, main_unmarshal_table_c, ] + main_marshal_generated_c