mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 00:50:36 +02:00
glx/apple: locate dispatch table functions to wrap by name
Avoid reaching into the dispatch table internals (and thus having to deal with the complexities of remap etc.) by identifying functions to wrap by name. See: https://lists.freedesktop.org/archives/mesa-dev/2015-June/086721.html et seq. https://bugs.freedesktop.org/show_bug.cgi?id=90311 Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
parent
b37b7b42dc
commit
d3540b405b
3 changed files with 22 additions and 7 deletions
|
|
@ -41,7 +41,6 @@
|
|||
#include "main/glheader.h"
|
||||
#include "glapi.h"
|
||||
#include "glapitable.h"
|
||||
#include "main/dispatch.h"
|
||||
|
||||
#include "apple_glx.h"
|
||||
#include "apple_xgl_api.h"
|
||||
|
|
@ -61,12 +60,11 @@ static void _apple_glapi_create_table(void) {
|
|||
assert(__applegl_api);
|
||||
memcpy(__applegl_api, __ogl_framework_api, sizeof(struct _glapi_table));
|
||||
|
||||
SET_ReadPixels(__applegl_api, __applegl_glReadPixels);
|
||||
SET_CopyPixels(__applegl_api, __applegl_glCopyPixels);
|
||||
SET_CopyColorTable(__applegl_api, __applegl_glCopyColorTable);
|
||||
SET_DrawBuffer(__applegl_api, __applegl_glDrawBuffer);
|
||||
SET_DrawBuffers(__applegl_api, __applegl_glDrawBuffers);
|
||||
SET_Viewport(__applegl_api, __applegl_glViewport);
|
||||
_glapi_table_patch(__applegl_api, "ReadPixels", __applegl_glReadPixels);
|
||||
_glapi_table_patch(__applegl_api, "CopyPixels", __applegl_glCopyPixels);
|
||||
_glapi_table_patch(__applegl_api, "CopyColorTable", __applegl_glCopyColorTable);
|
||||
_glapi_table_patch(__applegl_api, "DrawBuffers", __applegl_glDrawBuffer);
|
||||
_glapi_table_patch(__applegl_api, "Viewport", __applegl_glViewport);
|
||||
}
|
||||
|
||||
void apple_glapi_set_dispatch(void) {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ header = """/* GLXEXT is the define used in the xserver when the GLX extension i
|
|||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "main/glheader.h"
|
||||
|
||||
|
|
@ -144,6 +145,19 @@ _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
|
|||
|
||||
return disp;
|
||||
}
|
||||
|
||||
void
|
||||
_glapi_table_patch(struct _glapi_table *table, const char *name, void *wrapper)
|
||||
{
|
||||
for (int func_index = 0; func_index < GLAPI_TABLE_COUNT; ++func_index) {
|
||||
if (!strcmp(_glapi_table_func_names[func_index], name)) {
|
||||
((void **)table)[func_index] = wrapper;
|
||||
return;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "could not patch %s in dispatch table\\n", name);
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -161,6 +161,9 @@ _glapi_get_proc_name(unsigned int offset);
|
|||
#if defined(GLX_USE_APPLEGL) || defined(GLX_USE_WINDOWSGL)
|
||||
_GLAPI_EXPORT struct _glapi_table *
|
||||
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
|
||||
|
||||
_GLAPI_EXPORT void
|
||||
_glapi_table_patch(struct _glapi_table *, const char *name, void *wrapper);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue