mesa: Drop the function parameter spec from the remap table.

Since we don't generate dynamic dispatch stubs any more, we don't need
this data.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23451>
This commit is contained in:
Emma Anholt 2023-06-05 15:08:43 -07:00 committed by Marge Bot
parent 398a8d43dc
commit 29397f2e00
5 changed files with 8 additions and 73 deletions

View file

@ -30,23 +30,8 @@ import gl_XML
def get_function_spec(func):
sig = ""
# derive parameter signature
for p in func.parameterIterator():
if p.is_padding:
continue
# FIXME: This is a *really* ugly hack. :(
tn = p.type_expr.get_base_type_node()
if p.is_pointer():
sig += 'p'
elif tn.integer:
sig += 'i'
elif tn.size == 4:
sig += 'f'
else:
sig += 'd'
spec = []
spec = [sig]
for ent in func.entry_points:
spec.append("gl" + ent)

View file

@ -125,8 +125,7 @@ _glapi_get_dispatch_table_size(void);
_GLAPI_EXPORT int
_glapi_add_dispatch( const char * const * function_names,
const char * parameter_signature );
_glapi_add_dispatch( const char * const * function_names );
_GLAPI_EXPORT int
_glapi_get_proc_offset(const char *funcName);

View file

@ -140,18 +140,6 @@ struct _glapi_function {
* Name of the function.
*/
const char * name;
/**
* Text string that describes the types of the parameters passed to the
* named function. Parameter types are converted to characters using the
* following rules:
* - 'i' for \c GLint, \c GLuint, and \c GLenum
* - 'p' for any pointer type
* - 'f' for \c GLfloat and \c GLclampf
* - 'd' for \c GLdouble and \c GLclampd
*/
const char * parameter_signature;
};
@ -161,14 +149,6 @@ struct _glapi_function {
*
* \param function_names Array of pointers to function names that should
* share a common dispatch offset.
* \param parameter_signature String representing the types of the parameters
* passed to the named function. Parameter types
* are converted to characters using the following
* rules:
* - 'i' for \c GLint, \c GLuint, and \c GLenum
* - 'p' for any pointer type
* - 'f' for \c GLfloat and \c GLclampf
* - 'd' for \c GLdouble and \c GLclampd
*
* \returns
* The offset in the dispatch table of the named function. A pointer to the
@ -185,22 +165,12 @@ struct _glapi_function {
* too painful of a limitation.
*
* \todo
* Determine whether or not \c parameter_signature should be allowed to be
* \c NULL. It doesn't seem like much of a hardship for drivers to have to
* pass in an empty string.
*
* \todo
* Determine if code should be added to reject function names that start with
* 'glX'.
*
* \bug
* Add code to compare \c parameter_signature with the parameter signature of
* a static function. In order to do that, we need to find a way to \b get
* the parameter signature of a static function.
*/
int
_glapi_add_dispatch(const char *const *function_names, const char *parameter_signature)
_glapi_add_dispatch(const char *const *function_names)
{
unsigned i;
int offset = ~0;

View file

@ -60,14 +60,6 @@ _glapi_get_dispatch_table_size(void)
*
* \param function_names Array of pointers to function names that should
* share a common dispatch offset.
* \param parameter_signature String representing the types of the parameters
* passed to the named function. Parameter types
* are converted to characters using the following
* rules:
* - 'i' for \c GLint, \c GLuint, and \c GLenum
* - 'p' for any pointer type
* - 'f' for \c GLfloat and \c GLclampf
* - 'd' for \c GLdouble and \c GLclampd
*
* \returns
* The offset in the dispatch table of the named function. A pointer to the
@ -82,13 +74,9 @@ _glapi_get_dispatch_table_size(void)
* 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT,
* \c glPointParameterfARB, and \c glPointParameterf), so this should not be
* too painful of a limitation.
*
* \todo
* Check parameter_signature.
*/
int
_glapi_add_dispatch( const char * const * function_names,
const char * parameter_signature )
_glapi_add_dispatch( const char * const * function_names )
{
const struct mapi_stub *alias = NULL;
unsigned i;

View file

@ -57,8 +57,7 @@ int driDispatchRemapTable[driDispatchRemapTable_size];
* and the dispatch offset will be returned.
*
* \param spec a '\0'-separated string array specifying a function.
* It begins with the parameter signature of the function,
* followed by the names of the entry points. An empty entry
* It consists of a list of gl* names followed by \0. An empty name
* point name terminates the array.
*
* \return the offset of the (re-)mapped function in the dispatch
@ -67,16 +66,12 @@ int driDispatchRemapTable[driDispatchRemapTable_size];
static int
map_function_spec(const char *spec)
{
const char *signature;
const char *names[MAX_ENTRY_POINTS + 1];
int num_names = 0;
if (!spec)
return -1;
signature = spec;
spec += strlen(spec) + 1;
/* spec is terminated by an empty string */
while (*spec) {
names[num_names] = spec;
@ -91,7 +86,7 @@ map_function_spec(const char *spec)
names[num_names] = NULL;
/* add the entry points to the dispatch table */
return _glapi_add_dispatch(names, signature);
return _glapi_add_dispatch(names);
}
@ -113,18 +108,16 @@ _mesa_init_remap_table(void)
/* initialize the MESA_remap_table_functions table */
for (i = 0; i < driDispatchRemapTable_size; i++) {
int offset;
const char *spec;
/* sanity check */
assert(i == MESA_remap_table_functions[i].remap_index);
spec = _mesa_function_pool + MESA_remap_table_functions[i].pool_index;
const char *spec = _mesa_function_pool + MESA_remap_table_functions[i].pool_index;
offset = map_function_spec(spec);
/* store the dispatch offset in the MESA_remap_table_functions table */
driDispatchRemapTable[i] = offset;
if (offset < 0) {
const char *name = spec + strlen(spec) + 1;
_mesa_warning(NULL, "failed to remap %s", name);
_mesa_warning(NULL, "failed to remap %s", spec);
}
}
}