On 18 June 2015 at 06:53, Julien Isorce <julien.iso...@gmail.com> wrote: > From: Jon TURNEY <jon.tur...@dronecode.org.uk> > > _SET_DrawBuffers requires driDispatchRemapTable, > so we need to link with libmesa for remap.c. > libmesa requires the C++ linker. > > Also need to arrange to call _mesa_init_remap_table() > to initialize the remap table. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90311 > Signed-off-by: Jon TURNEY <jon.tur...@dronecode.org.uk> > --- > src/glx/Makefile.am | 5 ++++- > src/glx/apple/apple_glapi.c | 3 +++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am > index 6e50e09..de24496 100644 > --- a/src/glx/Makefile.am > +++ b/src/glx/Makefile.am > @@ -139,7 +139,10 @@ libglx_la_SOURCES += \ > applegl_glx.c > > SUBDIRS += apple > -libglx_la_LIBADD += $(builddir)/apple/libappleglx.la > +libglx_la_LIBADD += \ > + $(builddir)/apple/libappleglx.la \ > + $(top_builddir)/src/mesa/libmesa.la > +nodist_EXTRA_lib@GL_LIB@_la_SOURCES = dummy.cpp > endif > > GL_LIBS = \ > diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c > index 4d19f7f..849044b 100644 > --- a/src/glx/apple/apple_glapi.c > +++ b/src/glx/apple/apple_glapi.c > @@ -39,6 +39,7 @@ > #include <GL/gl.h> > > #include "main/glheader.h" > +#include "main/remap.h" > #include "glapi.h" > #include "glapitable.h" > #include "main/dispatch.h" > @@ -54,6 +55,8 @@ static void _apple_glapi_create_table(void) { > if (__applegl_api) > return; > > + _mesa_init_remap_table(); > + > __ogl_framework_api = > _glapi_create_table_from_handle(apple_cgl_get_dl_handle(), "gl"); > assert(__ogl_framework_api); > So as mentioned previously glx (libGL) should interact with the dispatch directly, rather than have any knowledge in the implementation detail (which lies in mesa).
src/glx/indirect_glx.c is a nice example, where __glXNewIndirectAPI (autogenerated from mapi/glapi/gen/glX_proto_send.py) is used to create the dispatch table and then set it with _glapi_set_dispatch(). AppleDRI uses similar approach _glapi_create_table_from_handle(generated from mapi/glapi/gen/gl_gentable.py), but there are things that could be improved/fixed. - __ogl_framework_api does not need to be over a thousand entries long. There are six overrides + __ogl_framework_api->Scissor used. So tweaking the generator to directly produce __applegl_api and(?) a slimmed down __ogl_framework_api sounds like a good idea to me. Further on one could also: - Drop the multiple forward declarations of __ogl_framework_api. - Wrap/implement appledri around __GLXDRI(display|screen) shoving storing things like dl_handle, thus allowing things to be torn down on exit. Namely I'm suggesting to cleanup and test Jon's earlier work. - apple_glapi_set_dispatch is called "too late" - at applegl_bind_context. According to the docs/spec one should be able to fetch the function pointers without any context let alone a currently bound one. - As a follow up from the above struct glx_context_vtable::get_proc_address could be nuked, making the struct fit nicely into 32/64 byte cache :-) Obviously if you can find an alternative way (but not as hacky as this one) that'll be great. Cheers, Emil P.S. Why is there no appledriproto package, similar to xf86driproto and friends ? Having appledri{,str}.h duplicated seems fragile and ill-advised. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev