mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 11:40:10 +01:00
glx/xlib: switch glapi from static to shared (which is also static)
Shared glapi doesn't make GL functions globally available, so we have to use the dispatch API. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33794>
This commit is contained in:
parent
e5c76088e9
commit
fde53ac020
5 changed files with 32 additions and 26 deletions
|
|
@ -41,6 +41,8 @@
|
|||
#include "xm_api.h"
|
||||
#include "main/errors.h"
|
||||
#include "main/config.h"
|
||||
#include "main/dispatch.h"
|
||||
#include "mapi/glapi/glapi.h"
|
||||
#include "util/compiler.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
|
|
@ -1368,7 +1370,7 @@ glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
|
|||
XMesaContext xm_dst = dst->xmesaContext;
|
||||
(void) dpy;
|
||||
if (GetCurrentContext() == src) {
|
||||
glFlush();
|
||||
CALL_Flush(GET_DISPATCH(), ());
|
||||
}
|
||||
XMesaCopyContext(xm_src, xm_dst, mask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
#include <stdio.h>
|
||||
#include <GL/glx.h>
|
||||
#include "main/errors.h"
|
||||
#include "main/dispatch.h"
|
||||
#include "mapi/glapi/glapi.h"
|
||||
|
||||
|
||||
/* Some debugging info. */
|
||||
|
|
@ -261,22 +263,22 @@ glXUseXFont(Font font, int first, int count, int listbase)
|
|||
#endif
|
||||
|
||||
/* Save the current packing mode for bitmaps. */
|
||||
glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
|
||||
glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
|
||||
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, &swapbytes));
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, &lsbfirst));
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, &rowlength));
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, &skiprows));
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, &skippixels));
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, &alignment));
|
||||
|
||||
/* Enforce a standard packing mode which is compatible with
|
||||
fill_bitmap() from above. This is actually the default mode,
|
||||
except for the (non)alignment. */
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, GL_FALSE));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, GL_FALSE));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, 0));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, 1));
|
||||
|
||||
pixmap = XCreatePixmap(dpy, win, 10, 10, 1);
|
||||
values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
|
||||
|
|
@ -338,13 +340,13 @@ glXUseXFont(Font font, int first, int count, int listbase)
|
|||
bm_width = (width + 7) / 8;
|
||||
bm_height = height;
|
||||
|
||||
glNewList(list, GL_COMPILE);
|
||||
CALL_NewList(GET_DISPATCH(), (list, GL_COMPILE));
|
||||
if (valid && (bm_width > 0) && (bm_height > 0)) {
|
||||
|
||||
memset(bm, '\0', bm_width * bm_height);
|
||||
fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm);
|
||||
|
||||
glBitmap(width, height, x0, y0, dx, dy, bm);
|
||||
CALL_Bitmap(GET_DISPATCH(), (width, height, x0, y0, dx, dy, bm));
|
||||
#if MESA_DEBUG
|
||||
if (debug_xfonts) {
|
||||
printf("width/height = %u/%u\n", width, height);
|
||||
|
|
@ -354,9 +356,9 @@ glXUseXFont(Font font, int first, int count, int listbase)
|
|||
#endif
|
||||
}
|
||||
else {
|
||||
glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL);
|
||||
CALL_Bitmap(GET_DISPATCH(), (0, 0, 0.0, 0.0, dx, dy, NULL));
|
||||
}
|
||||
glEndList();
|
||||
CALL_EndList(GET_DISPATCH(), ());
|
||||
}
|
||||
|
||||
free(bm);
|
||||
|
|
@ -364,10 +366,10 @@ glXUseXFont(Font font, int first, int count, int listbase)
|
|||
XFreeGC(dpy, gc);
|
||||
|
||||
/* Restore saved packing modes. */
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
|
||||
glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, swapbytes));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, lsbfirst));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, rowlength));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, skiprows));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, skippixels));
|
||||
CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, alignment));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ libxlib = static_library(
|
|||
files('glx_api.c', 'glx_getproc.c', 'glx_usefont.c', 'xm_api.c', 'xm_st.c'),
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_mapi, inc_mesa],
|
||||
dependencies : [dep_x11, dep_xext, dep_xcb, dep_glproto, idep_mesautil],
|
||||
dependencies : [dep_x11, dep_xext, dep_xcb, dep_glproto, idep_mesautil, idep_dispatch_h],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ libgl = shared_library(
|
|||
gnu_symbol_visibility : 'hidden',
|
||||
link_args : [ld_args_bsymbolic, ld_args_gc_sections, gallium_xlib_ld_args],
|
||||
link_depends : gallium_xlib_link_depends,
|
||||
link_whole : [libxlib, (with_shared_glapi ? libglapi_bridge : libglapi_static)],
|
||||
link_whole : [libxlib, libglapi_bridge],
|
||||
link_with : [
|
||||
libgalliumvl_stub, libws_xlib,
|
||||
libgalliumvl_stub, libws_xlib, libglapi,
|
||||
libgallium, libmesa, gallium_xlib_link_with,
|
||||
],
|
||||
dependencies : [dep_x11, idep_mesautil, dep_thread, dep_clock, dep_unwind, driver_swrast, driver_virgl, driver_asahi],
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ main_dispatch_h = custom_target(
|
|||
capture : true,
|
||||
)
|
||||
|
||||
idep_dispatch_h = declare_dependency(sources : [main_dispatch_h])
|
||||
|
||||
main_marshal_generated_h = custom_target(
|
||||
'marshal_generated.h',
|
||||
input : ['../../mapi/glapi/gen/marshal_generated_h.py', '../../mapi/glapi/gen/gl_and_es_API.xml'],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue