glapi: remove the remap table
it's unused now Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Eric Engestrom <None> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32789>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
|
||||
# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
|
||||
# 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 <olv@0xlab.org>", "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()
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
*
|
||||
* Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
#include <string.h>
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
*
|
||||
* Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
|
||||
*
|
||||
* 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 */
|
||||
@@ -98,7 +98,6 @@
|
||||
#include <mesa/main/queryobj.h>
|
||||
#include <mesa/main/rastpos.h>
|
||||
#include <mesa/main/readpix.h>
|
||||
#include <mesa/main/remap.h>
|
||||
#include <mesa/main/renderbuffer.h>
|
||||
#include <mesa/main/samplerobj.h>
|
||||
#include <mesa/main/scissor.h>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user