| 1 |
#cxx . . $ `<file>/libglfork.cpp`/include <dlfcn.h> |
| 2 |
#include <pthread.h> |
| 3 |
#include <semaphore.h> |
| 4 |
#include <time.h> |
| 5 |
#include <unistd.h> |
| 6 |
#include <sys/socket.h> |
| 7 |
#include <sys/un.h> |
| 8 |
#include <errno.h> |
| 9 |
#include <cstdlib> |
| 10 |
#include <cstring> |
| 11 |
#include <cstdio> |
| 12 |
#include <cassert> |
| 13 |
#include <map> |
| 14 |
#include <string> |
| 15 |
#include <X11/Xatom.h> |
| 16 |
#pragma GCC visibility push(default) |
| 17 |
#define GLX_GLXEXT_PROTOTYPEScxx . . $ `libglfork.cpp:17:9`! |
| 18 |
#define GL_GLEXT_PROTOTYPEScxx . . $ `libglfork.cpp:18:9`! |
| 19 |
#include <GL/glx.h> |
| 20 |
#pragma GCC visibility pop |
| 21 |
|
| 22 |
#define primus_printcxx . . $ `libglfork.cpp:22:9`!(c, ...) do { if (c) fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "primus: " __VA_ARGS__); } while (0) |
| 23 |
|
| 24 |
#define die_ifcxx . . $ `libglfork.cpp:24:9`!(cond, ...) do {if (cond) {primus_printcxx . . $ `libglfork.cpp:22:9`!(true, "fatal: " __VA_ARGS__); exit(1);} } while (0) |
| 25 |
#define primus_warncxx . . $ `libglfork.cpp:25:9`!(...) primus_printcxx . . $ `libglfork.cpp:22:9`!(primus.loglevel >= 1, "warning: " __VA_ARGS__) |
| 26 |
#define primus_perfcxx . . $ `libglfork.cpp:26:9`!(...) primus_printcxx . . $ `libglfork.cpp:22:9`!(primus.loglevel >= 2, "profiling: " __VA_ARGS__) |
| 27 |
|
| 28 |
// Try to load any of the colon-separated libraries |
| 29 |
static void *mdlopencxx . . $ mdlopen(fb9ec0bb113f3da8).(const char *paths, int flag) |
| 30 |
{ |
| 31 |
char *p = strdupacxx . . $ `<external>/13506128340496143423/string.h:201:10`!(paths); |
| 32 |
char errors[1024], *errors_ptr = errors, *errors_end = errors + 1024; |
| 33 |
for (char *c = p; c; p = c + 1) |
| 34 |
{ |
| 35 |
if ((c = strchr(p, ':'))) |
| 36 |
*c = 0; |
| 37 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(p[0] != '/', "need absolute library path: %s\n", p); |
| 38 |
void *handle = dlopen(p, flag); |
| 39 |
if (handle) |
| 40 |
return handle; |
| 41 |
errors_ptr += snprintf(errors_ptr, errors_end - errors_ptr, "%s\n", dlerror()); |
| 42 |
} |
| 43 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(true, "failed to load any of the libraries: %s\n%s", paths, errors); |
| 44 |
} |
| 45 |
|
| 46 |
static void *real_dlsymcxx . . $ real_dlsym(5c3a2d84d269ab4b).(void *handle, const char *symbol) |
| 47 |
{ |
| 48 |
typedef void* (*dlsym_fncxx . . $ real_dlsym(5c3a2d84d269ab4b).dlsym_fn#)(void *, const char*); |
| 49 |
static dlsym_fncxx . . $ real_dlsym(5c3a2d84d269ab4b).dlsym_fn# pdlsym = (dlsym_fncxx . . $ real_dlsym(5c3a2d84d269ab4b).dlsym_fn#) dlsym(dlopen("libdl.so.2", RTLD_LAZYcxx . . $ `<external>/10632388298615623587/dlfcn.h:24:9`!), "dlsym"); |
| 50 |
return pdlsym(handle, symbol); |
| 51 |
} |
| 52 |
|
| 53 |
// Pointers to implemented/forwarded GLX and OpenGL functions |
| 54 |
struct CapturedFnscxx . . $ CapturedFns# { |
| 55 |
void *handlecxx . . $ CapturedFns#handle.; |
| 56 |
// Declare functions as fields of the struct |
| 57 |
#define DEF_GLX_PROTOcxx . . $ `libglfork.cpp:57:9`!(ret, name, args, ...) ret (*name) args; |
| 58 |
#include "glx-reimpl.def"cxx . . $ `<file>/glx-reimpl.def`/ |
| 59 |
#include "glx-dpyredir.def"cxx . . $ `<file>/glx-dpyredir.def`/ |
| 60 |
#include "glxext-reimpl.def"cxx . . $ `<file>/glxext-reimpl.def`/ |
| 61 |
#include "gl-passthru.def"cxx . . $ `<file>/gl-passthru.def`/ |
| 62 |
#include "gl-needed.def"cxx . . $ `<file>/gl-needed.def`/ |
| 63 |
#undef DEF_GLX_PROTOcxx . . $ `libglfork.cpp:57:9`! |
| 64 |
CapturedFnscxx . . $ CapturedFns#CapturedFns(85c52e162fed56f9).(const char *lib) |
| 65 |
{ |
| 66 |
handlecxx . . $ CapturedFns#handle. = mdlopencxx . . $ mdlopen(fb9ec0bb113f3da8).(lib, RTLD_LAZYcxx . . $ `<external>/10632388298615623587/dlfcn.h:24:9`!); |
| 67 |
#define DEF_GLX_PROTOcxx . . $ `libglfork.cpp:67:9`!(ret, name, args, ...) name = (ret (*) args)real_dlsym(handle, #name); |
| 68 |
#include "glx-reimpl.def"cxx . . $ `<file>/glx-reimpl.def`/ |
| 69 |
#include "glx-dpyredir.def"cxx . . $ `<file>/glx-dpyredir.def`/ |
| 70 |
#undef DEF_GLX_PROTOcxx . . $ `libglfork.cpp:67:9`! |
| 71 |
#define DEF_GLX_PROTOcxx . . $ `libglfork.cpp:71:9`!(ret, name, args, ...) name = (ret (*) args)this->glXGetProcAddress((GLubyte*)#name); |
| 72 |
#include "glxext-reimpl.def"cxx . . $ `<file>/glxext-reimpl.def`/ |
| 73 |
#include "gl-passthru.def"cxx . . $ `<file>/gl-passthru.def`/ |
| 74 |
#include "gl-needed.def"cxx . . $ `<file>/gl-needed.def`/ |
| 75 |
#undef DEF_GLX_PROTOcxx . . $ `libglfork.cpp:71:9`! |
| 76 |
} |
| 77 |
~cxx . . $ CapturedFns#`~CapturedFns`(ced63f7c635d850d).CapturedFnscxx . . $ CapturedFns#() |
| 78 |
{ |
| 79 |
dlclose(handlecxx . . $ CapturedFns#handle.); |
| 80 |
} |
| 81 |
}; |
| 82 |
|
| 83 |
// Drawable tracking info |
| 84 |
struct DrawableInfocxx . . $ DrawableInfo# { |
| 85 |
// Only XWindow is not explicitely created via GLX |
| 86 |
enumcxx . . $ DrawableInfo#$anonymous_type_0# {XWindowcxx . . $ DrawableInfo#XWindow., Windowcxx . . $ DrawableInfo#Window., Pixmapcxx . . $ DrawableInfo#Pixmap., Pbuffercxx . . $ DrawableInfo#Pbuffer.} kindcxx . . $ DrawableInfo#kind.; |
| 87 |
GLXFBConfig fbconfigcxx . . $ DrawableInfo#fbconfig.; |
| 88 |
GLXPbuffer pbuffercxx . . $ DrawableInfo#pbuffer.; |
| 89 |
Drawablecxx . . $ Drawable# windowcxx . . $ DrawableInfo#window.; |
| 90 |
int widthcxx . . $ DrawableInfo#width., heightcxx . . $ DrawableInfo#height.; |
| 91 |
enum ReinitTodocxx . . $ DrawableInfo#ReinitTodo# {NONEcxx . . $ DrawableInfo#NONE., RESIZEcxx . . $ DrawableInfo#RESIZE., SHUTDOWNcxx . . $ DrawableInfo#SHUTDOWN.} reinitcxx . . $ DrawableInfo#reinit.; |
| 92 |
GLvoid *pixeldatacxx . . $ DrawableInfo#pixeldata.; |
| 93 |
GLsync synccxx . . $ DrawableInfo#sync.; |
| 94 |
GLXContext actxcxx . . $ DrawableInfo#actx.; |
| 95 |
|
| 96 |
structcxx . . $ DrawableInfo#$anonymous_type_1# { |
| 97 |
pthread_tcxx . . $ pthread_t# workercxx . . $ DrawableInfo#$anonymous_type_1#worker.; |
| 98 |
sem_tcxx . . $ sem_t# acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem., relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.; |
| 99 |
ReinitTodocxx . . $ DrawableInfo#ReinitTodo# reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit.; |
| 100 |
|
| 101 |
void spawn_workercxx . . $ DrawableInfo#$anonymous_type_1#spawn_worker(5804c443e1435b1b).(GLXDrawable draw, void* (*work)(void*)) |
| 102 |
{ |
| 103 |
reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. = RESIZEcxx . . $ DrawableInfo#RESIZE.; |
| 104 |
sem_init(&acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem., 0, 0); |
| 105 |
sem_init(&relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem., 0, 0); |
| 106 |
pthread_create(&workercxx . . $ DrawableInfo#$anonymous_type_1#worker., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, work, (void*)draw); |
| 107 |
} |
| 108 |
void reap_workercxx . . $ DrawableInfo#$anonymous_type_1#reap_worker(49f6e7a06ebc5aa8).() |
| 109 |
{ |
| 110 |
//pthread_cancel(worker); |
| 111 |
pthread_join(workercxx . . $ DrawableInfo#$anonymous_type_1#worker., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 112 |
sem_destroy(&relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); |
| 113 |
sem_destroy(&acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem.); |
| 114 |
workercxx . . $ DrawableInfo#$anonymous_type_1#worker. = 0; |
| 115 |
} |
| 116 |
} rcxx . . $ DrawableInfo#r., dcxx . . $ DrawableInfo#d.; |
| 117 |
void reap_workerscxx . . $ DrawableInfo#reap_workers(49f6e7a06ebc5aa8).() |
| 118 |
{ |
| 119 |
if (rcxx . . $ DrawableInfo#r..workercxx . . $ DrawableInfo#$anonymous_type_1#worker.) |
| 120 |
{ |
| 121 |
rcxx . . $ DrawableInfo#r..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. = SHUTDOWNcxx . . $ DrawableInfo#SHUTDOWN.; |
| 122 |
sem_post(&rcxx . . $ DrawableInfo#r..acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem.); |
| 123 |
sem_wait(&rcxx . . $ DrawableInfo#r..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); |
| 124 |
rcxx . . $ DrawableInfo#r..reap_workercxx . . $ DrawableInfo#$anonymous_type_1#reap_worker(49f6e7a06ebc5aa8).(); |
| 125 |
dcxx . . $ DrawableInfo#d..reap_workercxx . . $ DrawableInfo#$anonymous_type_1#reap_worker(49f6e7a06ebc5aa8).(); |
| 126 |
} |
| 127 |
} |
| 128 |
void update_geometrycxx . . $ DrawableInfo#update_geometry(3e454b8ccf442868).(int width, int height) |
| 129 |
{ |
| 130 |
if (this->widthcxx . . $ DrawableInfo#width. == width && this->heightcxx . . $ DrawableInfo#height. == height) |
| 131 |
return; |
| 132 |
this->widthcxx . . $ DrawableInfo#width. = width; this->heightcxx . . $ DrawableInfo#height. = height; |
| 133 |
__sync_synchronize(); |
| 134 |
reinitcxx . . $ DrawableInfo#reinit. = RESIZEcxx . . $ DrawableInfo#RESIZE.; |
| 135 |
} |
| 136 |
~cxx . . $ DrawableInfo#`~DrawableInfo`(ced63f7c635d850d).DrawableInfocxx . . $ DrawableInfo#(); |
| 137 |
}; |
| 138 |
|
| 139 |
struct DrawablesInfocxx . . $ DrawablesInfo#: public stdcxx . . $ std/::mapcxx . . $ std/map#<GLXDrawable, DrawableInfocxx . . $ DrawableInfo#> { |
| 140 |
bool knowncxx . . $ DrawablesInfo#known(31596a199e1d8a50).(GLXDrawable draw) |
| 141 |
{ |
| 142 |
return this->findcxx . . $ std/map#find(36f8d56706583706).(draw) !=cxx . . $ std/`operator!=`(be6a71a859368080). this->endcxx . . $ std/map#end(7e4de33083b6e738).(); |
| 143 |
} |
| 144 |
}; |
| 145 |
|
| 146 |
struct ContextInfocxx . . $ ContextInfo# { |
| 147 |
GLXFBConfig fbconfigcxx . . $ ContextInfo#fbconfig.; |
| 148 |
int sharegroupcxx . . $ ContextInfo#sharegroup.; |
| 149 |
}; |
| 150 |
|
| 151 |
struct ContextsInfocxx . . $ ContextsInfo#: public stdcxx . . $ std/::mapcxx . . $ std/map#<GLXContext, ContextInfocxx . . $ ContextInfo#> { |
| 152 |
void recordcxx . . $ ContextsInfo#record(e2087cb129f34be0).(GLXContext ctx, GLXFBConfig config, GLXContext share) |
| 153 |
{ |
| 154 |
static int nsharegroups; |
| 155 |
int sharegroup = share ? (*this)[cxx . . $ std/map#`operator[]`(bbd415b616967878).share].sharegroupcxx . . $ ContextInfo#sharegroup. : nsharegroups++; |
| 156 |
(*this)[cxx . . $ std/map#`operator[]`(bbd415b616967878).ctx] =cxx . . $ ContextInfo#`operator=`(81f4b08ba02bf73). (ContextInfocxx . . $ ContextInfo#){config, sharegroup}; |
| 157 |
} |
| 158 |
}; |
| 159 |
|
| 160 |
// Shorthand for obtaining compile-time configurable value that can be |
| 161 |
// overridden by environment |
| 162 |
#define getconfcxx . . $ `libglfork.cpp:162:9`!(V) (getenv(#V) ? getenv(#V) : V) |
| 163 |
|
| 164 |
// Runs before all other initialization takes place |
| 165 |
struct EarlyInitializercxx . . $ EarlyInitializer# { |
| 166 |
EarlyInitializercxx . . $ EarlyInitializer#EarlyInitializer(2fec76cd82af5a15).(const char **adpy_strp, const char **libgla_strp) |
| 167 |
{ |
| •168 |
// Setting environment variables in a bash process from an LD_PRELOAD |
| 169 |
// library during initialization may be harmful. It can temporarily wipe |
| 170 |
// the environment making subsequent getenv() return NULL (see #962566). |
| 171 |
// Not setting this variable will allow primus to continue its |
| 172 |
// initialization while possibly breaking OpenGL usage in bash processes |
| 173 |
// (but not in subsequent processes started from bash scripts). |
| 174 |
if (!dlsym(RTLD_DEFAULTcxx . . $ `<external>/16223394379662886929/dlfcn.h:50:9`!, "bash_copyright")) { |
| 175 |
// Allow multiple glvnd libGL.so.1 instances to be loaded into a process |
| 176 |
// and OpenGL calls dispatched to them depending on context. |
| 177 |
setenv("__GLVND_DISALLOW_PATCHING", "1", 0); |
| •178 |
} |
| 179 |
#ifdef BUMBLEBEE_SOCKETcxx . . $ `<built-in>:479:9`! |
| 180 |
// Signal the Bumblebee daemon to bring up secondary X |
| 181 |
int sock = socket(PF_UNIXcxx . . $ `<external>/8962547315054503424/socket.h:43:9`!, SOCK_STREAMcxx . . $ `<external>/5956532346368192945/socket_type.h:28:9`! | SOCK_CLOEXECcxx . . $ `<external>/5956532346368192945/socket_type.h:51:9`!, 0); |
| 182 |
struct sockaddr_un addr; |
| 183 |
addr.sun_family = AF_UNIXcxx . . $ `<external>/8962547315054503424/socket.h:95:9`!; |
| 184 |
strncpy(addr.sun_path, getconfcxx . . $ `libglfork.cpp:162:9`!(BUMBLEBEE_SOCKETcxx . . $ `<built-in>:479:9`!), sizeof(addr.sun_path)); |
| 185 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0, |
| 186 |
"failed to connect to Bumblebee daemon: %s\n", strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 187 |
static char c[256]; |
| 188 |
if (!getenv("PRIMUS_DISPLAY")) |
| 189 |
{ |
| 190 |
send(sock, "Q VirtualDisplay", strlen("Q VirtualDisplay") + 1, 0); |
| 191 |
recv(sock, &c, 255, 0); |
| 192 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(memcmp(c, "Value: ", strlen("Value: ")), "unexpected query response\n"); |
| 193 |
*strchrnul(c, '\n') = 0; |
| 194 |
*adpy_strp = strdup(c + 7); |
| 195 |
} |
| 196 |
if (!getenv("PRIMUS_libGLa")) |
| 197 |
{ |
| 198 |
send(sock, "Q LibraryPath", strlen("Q LibraryPath") + 1, 0); |
| 199 |
recv(sock, &c, 255, 0); |
| 200 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(memcmp(c, "Value: ", strlen("Value: ")), "unexpected query response\n"); |
| 201 |
*strchrnul(c, '\n') = 0; |
| 202 |
int npaths = 0; |
| 203 |
for (char *p = c + 7; *p; npaths++, p = strchrnul(p + 1, ':')); |
| 204 |
if (npaths) |
| 205 |
{ |
| 206 |
char *bblibs = new char[strlen(c + 7) + npaths * strlen("/libGL.so.1") + 1], *b = bblibs, *n, *p; |
| 207 |
for (p = c + 7; *p; p = n) |
| 208 |
{ |
| 209 |
n = strchrnul(p + 1, ':'); |
| 210 |
b += sprintf(b, "%.*s/libGL.so.1", (int)(n - p), p); |
| 211 |
} |
| 212 |
*libgla_strp = bblibs; |
| 213 |
} |
| 214 |
} |
| 215 |
send(sock, "C", 1, 0); |
| 216 |
recv(sock, &c, 255, 0); |
| 217 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(c[0] == 'N', "Bumblebee daemon reported: %s\n", c + 5); |
| 218 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(c[0] != 'Y', "failure contacting Bumblebee daemon\n"); |
| 219 |
// the socket will be closed when the application quits, then bumblebee will shut down the secondary X |
| 220 |
#else |
| 221 |
#warning Building without Bumblebee daemon support |
| 222 |
#endif |
| 223 |
} |
| 224 |
}; |
| 225 |
|
| 226 |
// Process-wide data |
| 227 |
static struct PrimusInfocxx . . $ PrimusInfo# { |
| 228 |
const char *adpy_strcxx . . $ PrimusInfo#adpy_str., *libgla_strcxx . . $ PrimusInfo#libgla_str.; |
| 229 |
EarlyInitializercxx . . $ EarlyInitializer# eicxx . . $ PrimusInfo#ei.; |
| 230 |
// Readback-display synchronization method |
| 231 |
// 0: no sync, 1: D lags behind one frame, 2: fully synced |
| 232 |
int synccxx . . $ PrimusInfo#sync.; |
| 233 |
// 0: only errors, 1: warnings, 2: profiling |
| 234 |
int loglevelcxx . . $ PrimusInfo#loglevel.; |
| 235 |
// 0: autodetect, 1: texture, 2: PBO glDrawPixels |
| 236 |
int dispmethodcxx . . $ PrimusInfo#dispmethod.; |
| 237 |
// sleep ratio in readback thread, percent |
| 238 |
int autosleepcxx . . $ PrimusInfo#autosleep.; |
| 239 |
// The "accelerating" X display |
| 240 |
Displaycxx . . $ Display# *adpycxx . . $ PrimusInfo#adpy.; |
| 241 |
// The "displaying" X display. The same as the application is using, but |
| 242 |
// primus opens its own connection. |
| 243 |
Displaycxx . . $ Display# *ddpycxx . . $ PrimusInfo#ddpy.; |
| 244 |
CapturedFnscxx . . $ CapturedFns# afnscxx . . $ PrimusInfo#afns.; |
| 245 |
CapturedFnscxx . . $ CapturedFns# dfnscxx . . $ PrimusInfo#dfns.; |
| 246 |
// FIXME: there are race conditions in accesses to these |
| 247 |
DrawablesInfocxx . . $ DrawablesInfo# drawablescxx . . $ PrimusInfo#drawables.; |
| 248 |
ContextsInfocxx . . $ ContextsInfo# contextscxx . . $ PrimusInfo#contexts.; |
| 249 |
|
| 250 |
PrimusInfocxx . . $ PrimusInfo#PrimusInfo(49f6e7a06ebc5aa8).(): |
| 251 |
adpy_strcxx . . $ PrimusInfo#adpy_str.(getconfcxx . . $ `libglfork.cpp:162:9`!(PRIMUS_DISPLAYcxx . . $ `<built-in>:484:9`!)), |
| 252 |
libgla_strcxx . . $ PrimusInfo#libgla_str.(getconfcxx . . $ `libglfork.cpp:162:9`!(PRIMUS_libGLacxx . . $ `<built-in>:485:9`!)), |
| 253 |
eicxx . . $ PrimusInfo#ei.(&adpy_strcxx . . $ PrimusInfo#adpy_str., &libgla_strcxx . . $ PrimusInfo#libgla_str.), |
| 254 |
synccxx . . $ PrimusInfo#sync.(atoi(getconfcxx . . $ `libglfork.cpp:162:9`!(PRIMUS_SYNCcxx . . $ `<built-in>:480:9`!))), |
| 255 |
loglevelcxx . . $ PrimusInfo#loglevel.(atoi(getconfcxx . . $ `libglfork.cpp:162:9`!(PRIMUS_VERBOSEcxx . . $ `<built-in>:481:9`!))), |
| 256 |
dispmethodcxx . . $ PrimusInfo#dispmethod.(atoi(getconfcxx . . $ `libglfork.cpp:162:9`!(PRIMUS_UPLOADcxx . . $ `<built-in>:482:9`!))), |
| 257 |
autosleepcxx . . $ PrimusInfo#autosleep.(atoi(getconfcxx . . $ `libglfork.cpp:162:9`!(PRIMUS_SLEEPcxx . . $ `<built-in>:483:9`!))), |
| 258 |
adpycxx . . $ PrimusInfo#adpy.(XOpenDisplay(adpy_strcxx . . $ PrimusInfo#adpy_str.)), |
| 259 |
ddpycxx . . $ PrimusInfo#ddpy.(XOpenDisplay(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!)), |
| 260 |
afnscxx . . $ PrimusInfo#afns.(libgla_strcxx . . $ PrimusInfo#libgla_str.), |
| 261 |
dfnscxx . . $ PrimusInfo#dfns.(getconfcxx . . $ `libglfork.cpp:162:9`!(PRIMUS_libGLdcxx . . $ `<built-in>:486:9`!)) |
| 262 |
{ |
| 263 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(!adpy, "failed to open secondary X display\n"); |
| 264 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(!ddpy, "failed to open main X display\n"); |
| 265 |
} |
| 266 |
} primuscxx . . $ primus.; |
| 267 |
|
| 268 |
// Thread-specific data |
| 269 |
static __thread structcxx . . $ $anonymous_type_f2d3b7192aabd040_2# { |
| 270 |
Displaycxx . . $ Display# *dpycxx . . $ $anonymous_type_f2d3b7192aabd040_2#dpy.; |
| 271 |
GLXDrawable drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#drawable., read_drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#read_drawable.; |
| 272 |
void make_currentcxx . . $ $anonymous_type_f2d3b7192aabd040_2#make_current(652187420032b021).(Displaycxx . . $ Display# *dpy, GLXDrawable draw, GLXDrawable read) |
| 273 |
{ |
| 274 |
this->dpycxx . . $ $anonymous_type_f2d3b7192aabd040_2#dpy. = dpy; |
| 275 |
this->drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#drawable. = draw; |
| 276 |
this->read_drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#read_drawable. = read; |
| 277 |
} |
| 278 |
} tsdatacxx . . $ tsdata.; |
| 279 |
|
| 280 |
// Profiler |
| 281 |
struct Profilercxx . . $ Profiler# { |
| 282 |
const char *namecxx . . $ Profiler#name.; |
| 283 |
const char * const *state_namescxx . . $ Profiler#state_names.; |
| 284 |
|
| 285 |
double state_timecxx . . $ Profiler#state_time.[6], prev_timestampcxx . . $ Profiler#prev_timestamp., print_timestampcxx . . $ Profiler#print_timestamp.; |
| 286 |
int statecxx . . $ Profiler#state., nframescxx . . $ Profiler#nframes., widthcxx . . $ Profiler#width., heightcxx . . $ Profiler#height.; |
| 287 |
|
| 288 |
static double get_timestampcxx . . $ Profiler#get_timestamp(31fa7155c10fdd13).() |
| 289 |
{ |
| 290 |
struct timespeccxx . . $ timespec# tp; |
| 291 |
clock_gettime(CLOCK_MONOTONICcxx . . $ `<external>/89459239771508533/time.h:48:10`!, &tp); |
| 292 |
return tp.tv_seccxx . . $ timespec#tv_sec. + 1e-9 * tp.tv_nseccxx . . $ timespec#tv_nsec.; |
| 293 |
} |
| 294 |
|
| 295 |
Profilercxx . . $ Profiler#Profiler(7bdc0c6e2c70929f).(const char *name, const char * const *state_names): |
| 296 |
namecxx . . $ Profiler#name.(name), |
| 297 |
state_namescxx . . $ Profiler#state_names.(state_names), |
| 298 |
statecxx . . $ Profiler#state.(0), nframescxx . . $ Profiler#nframes.(0), widthcxx . . $ Profiler#width.(0), heightcxx . . $ Profiler#height.(0) |
| 299 |
{ |
| 300 |
memset(state_timecxx . . $ Profiler#state_time., 0, sizeof(state_timecxx . . $ Profiler#state_time.)); |
| 301 |
prev_timestampcxx . . $ Profiler#prev_timestamp. = print_timestampcxx . . $ Profiler#print_timestamp. = get_timestampcxx . . $ Profiler#get_timestamp(31fa7155c10fdd13).(); |
| 302 |
} |
| 303 |
|
| 304 |
void tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(bool state_reset = false) |
| 305 |
{ |
| 306 |
if (primuscxx . . $ primus..loglevelcxx . . $ PrimusInfo#loglevel. < 2) |
| 307 |
return; |
| 308 |
double timestamp = get_timestampcxx . . $ Profiler#get_timestamp(31fa7155c10fdd13).(); |
| 309 |
assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(state_reset || state_names[state]); |
| 310 |
if (state_reset) |
| 311 |
statecxx . . $ Profiler#state. = 0; |
| 312 |
assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(state * sizeof(state_time[0]) < sizeof(state_time)); |
| 313 |
state_timecxx . . $ Profiler#state_time.[statecxx . . $ Profiler#state.++] += timestamp - prev_timestampcxx . . $ Profiler#prev_timestamp.; |
| 314 |
prev_timestampcxx . . $ Profiler#prev_timestamp. = timestamp; |
| 315 |
if (state_namescxx . . $ Profiler#state_names.[statecxx . . $ Profiler#state.]) |
| 316 |
return; |
| 317 |
nframescxx . . $ Profiler#nframes.++; |
| 318 |
// check if it's time to print again |
| 319 |
double period = timestamp - print_timestampcxx . . $ Profiler#print_timestamp.; // time since we printed |
| 320 |
if (period < 5) |
| 321 |
return; |
| 322 |
// construct output |
| 323 |
char buf[128], *cbuf = buf, *end = buf+128; |
| 324 |
for (int i = 0; i < statecxx . . $ Profiler#state.; i++) |
| 325 |
cbuf += snprintf(cbuf, end - cbuf, ", %.1f%% %s", 100 * state_timecxx . . $ Profiler#state_time.[i] / period, state_namescxx . . $ Profiler#state_names.[i]); |
| 326 |
primus_perfcxx . . $ `libglfork.cpp:26:9`!("%s: %dx%d, %.1f fps%s\n", name, width, height, nframes / period, buf); |
| 327 |
// start counting again |
| 328 |
print_timestampcxx . . $ Profiler#print_timestamp. = timestamp; |
| 329 |
nframescxx . . $ Profiler#nframes. = 0; |
| 330 |
memset(state_timecxx . . $ Profiler#state_time., 0, sizeof(state_timecxx . . $ Profiler#state_time.)); |
| 331 |
} |
| 332 |
}; |
| 333 |
|
| 334 |
// Find out the dimensions of the window |
| 335 |
static void note_geometrycxx . . $ note_geometry(7a3854b0833f0299).(Displaycxx . . $ Display# *dpy, Drawablecxx . . $ Drawable# draw, int *width, int *height) |
| 336 |
{ |
| 337 |
Windowcxx . . $ Window# root; |
| 338 |
int x, y; |
| 339 |
unsigned bw, d; |
| 340 |
XGetGeometry(dpy, draw, &root, &x, &y, (unsigned *)width, (unsigned *)height, &bw, &d); |
| 341 |
} |
| 342 |
|
| 343 |
static GLXFBConfig* get_dconfigscxx . . $ get_dconfigs(5ee131bcb2eafdd).(Displaycxx . . $ Display# *dpy) |
| 344 |
{ |
| 345 |
static const int attrs[] = {GLX_DOUBLEBUFFERcxx . . $ `<external>/4496914429062116541/glx.h:61:9`!, GL_TRUEcxx . . $ `<external>/11565930711847777359/gl.h:140:9`!, Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`!}; |
| 346 |
int ncfg; |
| 347 |
GLXFBConfig *dconfigs = primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXChooseFBConfigcxx . . $ CapturedFns#glXChooseFBConfig.(dpy, 0, attrs, &ncfg); |
| 348 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(!dconfigs, "broken GLX on main X display\n"); |
| 349 |
return dconfigs; |
| 350 |
} |
| 351 |
|
| 352 |
static bool test_drawpixels_fastcxx . . $ test_drawpixels_fast(50135e35ccfb5585).(Displaycxx . . $ Display# *dpy, GLXContext ctx, GLXFBConfig dconfig) |
| 353 |
{ |
| 354 |
int width = 1920, height = 1080; |
| 355 |
int pbattrs[] = {GLX_PBUFFER_WIDTHcxx . . $ `<external>/4496914429062116541/glx.h:151:9`!, width, GLX_PBUFFER_HEIGHTcxx . . $ `<external>/4496914429062116541/glx.h:150:9`!, height, GLX_PRESERVED_CONTENTScxx . . $ `<external>/4496914429062116541/glx.h:141:9`!, Truecxx . . $ `<external>/7073035915403465041/Xlib.h:80:9`!, Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`!}; |
| 356 |
GLXPbuffer pbuffer = primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXCreatePbuffercxx . . $ CapturedFns#glXCreatePbuffer.(dpy, dconfig, pbattrs); |
| 357 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXMakeCurrentcxx . . $ CapturedFns#glXMakeCurrent.(dpy, pbuffer, ctx); |
| 358 |
GLuint pbo; |
| 359 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glGenBufferscxx . . $ CapturedFns#glGenBuffers.(1, &pbo); |
| 360 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, pbo); |
| 361 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBufferDatacxx . . $ CapturedFns#glBufferData.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, width*height*4, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, GL_STREAM_DRAWcxx . . $ `<external>/13868558256673015710/glext.h:469:9`!); |
| 362 |
void *pixeldata = malloc(width*height*4); |
| 363 |
|
| 364 |
double end = 0.2 + Profilercxx . . $ Profiler#::get_timestampcxx . . $ Profiler#get_timestamp(31fa7155c10fdd13).(); |
| 365 |
int iters = 0; |
| 366 |
do { |
| 367 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBufferSubDatacxx . . $ CapturedFns#glBufferSubData.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, 0, width*height*4, pixeldata); |
| 368 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glDrawPixelscxx . . $ CapturedFns#glDrawPixels.(width, height, GL_BGRAcxx . . $ `<external>/11565930711847777359/gl.h:1451:9`!, GL_UNSIGNED_BYTEcxx . . $ `<external>/11565930711847777359/gl.h:144:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 369 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXSwapBufferscxx . . $ CapturedFns#glXSwapBuffers.(dpy, pbuffer); |
| 370 |
iters++; |
| 371 |
} while (end > Profilercxx . . $ Profiler#::get_timestampcxx . . $ Profiler#get_timestamp(31fa7155c10fdd13).()); |
| 372 |
|
| 373 |
free(pixeldata); |
| 374 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glDeleteBufferscxx . . $ CapturedFns#glDeleteBuffers.(1, &pbo); |
| 375 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXDestroyPbuffercxx . . $ CapturedFns#glXDestroyPbuffer.(dpy, pbuffer); |
| 376 |
|
| 377 |
bool is_fast = iters >= 12; |
| 378 |
primus_perfcxx . . $ `libglfork.cpp:26:9`!("upload autodetection: will use %s path (%d iters)\n", is_fast ? "PBO" : "texture", iters); |
| 379 |
return is_fast; |
| 380 |
} |
| 381 |
|
| 382 |
static void* display_workcxx . . $ display_work(9f162e79bfc6c74).(void *vd) |
| 383 |
{ |
| 384 |
GLXDrawable drawable = (GLXDrawable)vd; |
| 385 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).drawable]; |
| 386 |
int width, height; |
| 387 |
static const float quad_vertex_coords[] = {-1, -1, -1, 1, 1, 1, 1, -1}; |
| 388 |
static const float quad_texture_coords[] = { 0, 0, 0, 1, 1, 1, 1, 0}; |
| 389 |
GLuint textures[2] = {0}, pbos[2] = {0}; |
| 390 |
int ctex = 0; |
| 391 |
static const char *state_names[] = {"wait", "upload", "draw+swap", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!}; |
| 392 |
Profilercxx . . $ Profiler# profilercxx . . $ Profiler#Profiler(7bdc0c6e2c70929f).("display", state_names); |
| 393 |
Displaycxx . . $ Display# *ddpy = XOpenDisplay(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 394 |
if (!ddpy) // Chromium sandbox prevents opening new connections |
| 395 |
{ |
| 396 |
ddpy = primuscxx . . $ primus..ddpycxx . . $ PrimusInfo#ddpy.; |
| 397 |
primus_warncxx . . $ `libglfork.cpp:25:9`!("reusing initial X connection for display thread\n"); |
| 398 |
} |
| 399 |
assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(di.kind == di.XWindow || di.kind == di.Window); |
| 400 |
XSelectInput(ddpy, di.windowcxx . . $ DrawableInfo#window., StructureNotifyMaskcxx . . $ `<external>/1208737181511191802/X.h:168:9`!); |
| 401 |
note_geometrycxx . . $ note_geometry(7a3854b0833f0299).(ddpy, di.windowcxx . . $ DrawableInfo#window., &width, &height); |
| 402 |
di.update_geometrycxx . . $ DrawableInfo#update_geometry(3e454b8ccf442868).(width, height); |
| 403 |
GLXFBConfig *dconfigs = get_dconfigscxx . . $ get_dconfigs(5ee131bcb2eafdd).(ddpy); |
| 404 |
GLXContext context = primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXCreateNewContextcxx . . $ CapturedFns#glXCreateNewContext.(ddpy, *dconfigs, GLX_RGBA_TYPEcxx . . $ `<external>/4496914429062116541/glx.h:136:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, Truecxx . . $ `<external>/7073035915403465041/Xlib.h:80:9`!); |
| 405 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(!primus.dfns.glXIsDirect(ddpy, context), |
| 406 |
"failed to acquire direct rendering context for display thread\n"); |
| 407 |
if (!primuscxx . . $ primus..dispmethodcxx . . $ PrimusInfo#dispmethod.) |
| 408 |
primuscxx . . $ primus..dispmethodcxx . . $ PrimusInfo#dispmethod. = test_drawpixels_fastcxx . . $ test_drawpixels_fast(50135e35ccfb5585).(ddpy, context, *dconfigs) ? 2 : 1; |
| 409 |
XFree(dconfigs); |
| 410 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXMakeCurrentcxx . . $ CapturedFns#glXMakeCurrent.(ddpy, di.windowcxx . . $ DrawableInfo#window., context); |
| 411 |
bool use_textures = (primuscxx . . $ primus..dispmethodcxx . . $ PrimusInfo#dispmethod. == 1); |
| 412 |
if (use_textures) |
| 413 |
{ |
| 414 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glVertexPointercxx . . $ CapturedFns#glVertexPointer. (2, GL_FLOATcxx . . $ `<external>/11565930711847777359/gl.h:149:9`!, 0, quad_vertex_coords); |
| 415 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glTexCoordPointercxx . . $ CapturedFns#glTexCoordPointer.(2, GL_FLOATcxx . . $ `<external>/11565930711847777359/gl.h:149:9`!, 0, quad_texture_coords); |
| 416 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glEnableClientStatecxx . . $ CapturedFns#glEnableClientState.(GL_VERTEX_ARRAYcxx . . $ `<external>/11565930711847777359/gl.h:168:9`!); |
| 417 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glEnableClientStatecxx . . $ CapturedFns#glEnableClientState.(GL_TEXTURE_COORD_ARRAYcxx . . $ `<external>/11565930711847777359/gl.h:172:9`!); |
| 418 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glGenTexturescxx . . $ CapturedFns#glGenTextures.(2, textures); |
| 419 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glEnablecxx . . $ CapturedFns#glEnable.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!); |
| 420 |
} |
| 421 |
else |
| 422 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glGenBufferscxx . . $ CapturedFns#glGenBuffers.(2, pbos); |
| 423 |
for (;;) |
| 424 |
{ |
| 425 |
sem_wait(&di.dcxx . . $ DrawableInfo#d..acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem.); |
| 426 |
profiler.tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(true); |
| 427 |
if (di.dcxx . . $ DrawableInfo#d..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit.) |
| 428 |
{ |
| 429 |
if (di.dcxx . . $ DrawableInfo#d..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. == di.SHUTDOWNcxx . . $ DrawableInfo#SHUTDOWN.) |
| 430 |
{ |
| 431 |
if (use_textures) |
| 432 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glDeleteTexturescxx . . $ CapturedFns#glDeleteTextures.(2, textures); |
| 433 |
else |
| 434 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glDeleteBufferscxx . . $ CapturedFns#glDeleteBuffers.(2, pbos); |
| 435 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXMakeCurrentcxx . . $ CapturedFns#glXMakeCurrent.(ddpy, 0, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 436 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXDestroyContextcxx . . $ CapturedFns#glXDestroyContext.(ddpy, context); |
| 437 |
if (ddpy != primuscxx . . $ primus..ddpycxx . . $ PrimusInfo#ddpy.) |
| 438 |
XCloseDisplay(ddpy); |
| 439 |
sem_post(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); |
| 440 |
return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 441 |
} |
| 442 |
di.dcxx . . $ DrawableInfo#d..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. = di.NONEcxx . . $ DrawableInfo#NONE.; |
| 443 |
profiler.widthcxx . . $ Profiler#width. = width = di.widthcxx . . $ DrawableInfo#width.; |
| 444 |
profiler.heightcxx . . $ Profiler#height. = height = di.heightcxx . . $ DrawableInfo#height.; |
| 445 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glViewportcxx . . $ CapturedFns#glViewport.(0, 0, width, height); |
| 446 |
if (use_textures) |
| 447 |
{ |
| 448 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBindTexturecxx . . $ CapturedFns#glBindTexture.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, textures[ctex ^ 1]); |
| 449 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glTexParametericxx . . $ CapturedFns#glTexParameteri.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, GL_TEXTURE_MIN_FILTERcxx . . $ `<external>/11565930711847777359/gl.h:615:9`!, GL_NEARESTcxx . . $ `<external>/11565930711847777359/gl.h:644:9`!); |
| 450 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glTexImage2Dcxx . . $ CapturedFns#glTexImage2D.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, 0, GL_RGBAcxx . . $ `<external>/11565930711847777359/gl.h:469:9`!, width, height, 0, GL_BGRAcxx . . $ `<external>/11565930711847777359/gl.h:1451:9`!, GL_UNSIGNED_BYTEcxx . . $ `<external>/11565930711847777359/gl.h:144:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 451 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBindTexturecxx . . $ CapturedFns#glBindTexture.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, textures[ctex]); |
| 452 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glTexParametericxx . . $ CapturedFns#glTexParameteri.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, GL_TEXTURE_MIN_FILTERcxx . . $ `<external>/11565930711847777359/gl.h:615:9`!, GL_NEARESTcxx . . $ `<external>/11565930711847777359/gl.h:644:9`!); |
| 453 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glTexImage2Dcxx . . $ CapturedFns#glTexImage2D.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, 0, GL_RGBAcxx . . $ `<external>/11565930711847777359/gl.h:469:9`!, width, height, 0, GL_BGRAcxx . . $ `<external>/11565930711847777359/gl.h:1451:9`!, GL_UNSIGNED_BYTEcxx . . $ `<external>/11565930711847777359/gl.h:144:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 454 |
} |
| 455 |
else |
| 456 |
{ |
| 457 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, pbos[ctex ^ 1]); |
| 458 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBufferDatacxx . . $ CapturedFns#glBufferData.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, width*height*4, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, GL_STREAM_DRAWcxx . . $ `<external>/13868558256673015710/glext.h:469:9`!); |
| 459 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, pbos[ctex]); |
| 460 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBufferDatacxx . . $ CapturedFns#glBufferData.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, width*height*4, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, GL_STREAM_DRAWcxx . . $ `<external>/13868558256673015710/glext.h:469:9`!); |
| 461 |
} |
| 462 |
sem_post(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); |
| 463 |
continue; |
| 464 |
} |
| 465 |
if (use_textures) |
| 466 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glTexSubImage2Dcxx . . $ CapturedFns#glTexSubImage2D.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, 0, 0, 0, width, height, GL_BGRAcxx . . $ `<external>/11565930711847777359/gl.h:1451:9`!, GL_UNSIGNED_BYTEcxx . . $ `<external>/11565930711847777359/gl.h:144:9`!, di.pixeldatacxx . . $ DrawableInfo#pixeldata.); |
| 467 |
else |
| 468 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBufferSubDatacxx . . $ CapturedFns#glBufferSubData.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, 0, width*height*4, di.pixeldatacxx . . $ DrawableInfo#pixeldata.); |
| 469 |
if (!primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync.) |
| 470 |
sem_post(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Unlock as soon as possible |
| 471 |
profiler.tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(); |
| 472 |
if (use_textures) |
| 473 |
{ |
| 474 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glDrawArrayscxx . . $ CapturedFns#glDrawArrays.(GL_QUADScxx . . $ `<external>/11565930711847777359/gl.h:163:9`!, 0, 4); |
| 475 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBindTexturecxx . . $ CapturedFns#glBindTexture.(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, textures[ctex ^= 1]); |
| 476 |
} |
| 477 |
else |
| 478 |
{ |
| 479 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glDrawPixelscxx . . $ CapturedFns#glDrawPixels.(width, height, GL_BGRAcxx . . $ `<external>/11565930711847777359/gl.h:1451:9`!, GL_UNSIGNED_BYTEcxx . . $ `<external>/11565930711847777359/gl.h:144:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 480 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_UNPACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7910:9`!, pbos[ctex ^= 1]); |
| 481 |
} |
| 482 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXSwapBufferscxx . . $ CapturedFns#glXSwapBuffers.(ddpy, di.windowcxx . . $ DrawableInfo#window.); |
| 483 |
for (int pending = XPending(ddpy); pending > 0; pending--) |
| 484 |
{ |
| 485 |
XEventcxx . . $ XEvent# event; |
| 486 |
XNextEvent(ddpy, &event); |
| 487 |
if (event.typecxx . . $ _XEvent#type. == ConfigureNotifycxx . . $ `<external>/1208737181511191802/X.h:201:9`!) |
| 488 |
di.update_geometrycxx . . $ DrawableInfo#update_geometry(3e454b8ccf442868).(event.xconfigurecxx . . $ _XEvent#xconfigure..widthcxx . . $ $anonymous_type_17d7f07cf933eea7_38#width., event.xconfigurecxx . . $ _XEvent#xconfigure..heightcxx . . $ $anonymous_type_17d7f07cf933eea7_38#height.); |
| 489 |
} |
| 490 |
if (primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync.) |
| 491 |
sem_post(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Unlock only after drawing |
| 492 |
profiler.tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(); |
| 493 |
} |
| 494 |
return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 495 |
} |
| 496 |
|
| 497 |
static void* readback_workcxx . . $ readback_work(9f162e79bfc6c74).(void *vd) |
| 498 |
{ |
| 499 |
GLXDrawable drawable = (GLXDrawable)vd; |
| 500 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).drawable]; |
| 501 |
int width, height; |
| 502 |
GLuint pbos[2] = {0}; |
| 503 |
int cbuf = 0; |
| 504 |
unsigned sleep_usec = 0; |
| 505 |
static const char *state_names[] = {"app", "sleep", "map", "wait", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!}; |
| 506 |
Profilercxx . . $ Profiler# profilercxx . . $ Profiler#Profiler(7bdc0c6e2c70929f).("readback", state_names); |
| 507 |
struct timespeccxx . . $ timespec# tp; |
| 508 |
if (!primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync.) |
| 509 |
sem_post(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // No PBO is mapped initially |
| 510 |
GLXContext context = primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXCreateNewContextcxx . . $ CapturedFns#glXCreateNewContext.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., di.fbconfigcxx . . $ DrawableInfo#fbconfig., GLX_RGBA_TYPEcxx . . $ `<external>/4496914429062116541/glx.h:136:9`!, di.actxcxx . . $ DrawableInfo#actx., Truecxx . . $ `<external>/7073035915403465041/Xlib.h:80:9`!); |
| 511 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(!primus.afns.glXIsDirect(primus.adpy, context), |
| 512 |
"failed to acquire direct rendering context for readback thread\n"); |
| 513 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXMakeCurrentcxx . . $ CapturedFns#glXMakeCurrent.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., di.pbuffercxx . . $ DrawableInfo#pbuffer., context); |
| 514 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glGenBufferscxx . . $ CapturedFns#glGenBuffers.(2, &pbos[0]); |
| 515 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glReadBuffercxx . . $ CapturedFns#glReadBuffer.(GL_FRONTcxx . . $ `<external>/11565930711847777359/gl.h:236:9`!); |
| 516 |
for (;;) |
| 517 |
{ |
| 518 |
sem_wait(&di.rcxx . . $ DrawableInfo#r..acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem.); |
| 519 |
profiler.tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(true); |
| 520 |
if (di.rcxx . . $ DrawableInfo#r..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit.) |
| 521 |
{ |
| 522 |
clock_gettime(CLOCK_REALTIMEcxx . . $ `<external>/89459239771508533/time.h:46:10`!, &tp); |
| 523 |
tp.tv_seccxx . . $ timespec#tv_sec. += 1; |
| 524 |
// Wait for D worker, if active |
| 525 |
if (!primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync. && sem_timedwait(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem., &tp)) |
| 526 |
{ |
| 527 |
pthread_cancel(di.dcxx . . $ DrawableInfo#d..workercxx . . $ DrawableInfo#$anonymous_type_1#worker.); |
| 528 |
sem_post(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Pretend that D worker completed reinit |
| 529 |
primus_warncxx . . $ `libglfork.cpp:25:9`!("timeout waiting for display worker\n"); |
| 530 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(di.r.reinit != di.SHUTDOWN, "killed worker on resize\n"); |
| 531 |
} |
| 532 |
di.dcxx . . $ DrawableInfo#d..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. = di.rcxx . . $ DrawableInfo#r..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit.; |
| 533 |
sem_post(&di.dcxx . . $ DrawableInfo#d..acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem.); // Signal D worker to reinit |
| 534 |
sem_wait(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Wait until reinit was completed |
| 535 |
if (!primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync.) |
| 536 |
sem_post(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Unlock as no PBO is currently mapped |
| 537 |
if (di.rcxx . . $ DrawableInfo#r..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. == di.SHUTDOWNcxx . . $ DrawableInfo#SHUTDOWN.) |
| 538 |
{ |
| 539 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, pbos[cbuf ^ 1]); |
| 540 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glUnmapBuffercxx . . $ CapturedFns#glUnmapBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!); |
| 541 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glDeleteBufferscxx . . $ CapturedFns#glDeleteBuffers.(2, &pbos[0]); |
| 542 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXMakeCurrentcxx . . $ CapturedFns#glXMakeCurrent.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., 0, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 543 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXDestroyContextcxx . . $ CapturedFns#glXDestroyContext.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., context); |
| 544 |
sem_post(&di.rcxx . . $ DrawableInfo#r..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); |
| 545 |
return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 546 |
} |
| 547 |
di.rcxx . . $ DrawableInfo#r..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. = di.NONEcxx . . $ DrawableInfo#NONE.; |
| 548 |
profiler.widthcxx . . $ Profiler#width. = width = di.widthcxx . . $ DrawableInfo#width.; |
| 549 |
profiler.heightcxx . . $ Profiler#height. = height = di.heightcxx . . $ DrawableInfo#height.; |
| 550 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXMakeCurrentcxx . . $ CapturedFns#glXMakeCurrent.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., di.pbuffercxx . . $ DrawableInfo#pbuffer., context); |
| 551 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, pbos[cbuf ^ 1]); |
| 552 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glBufferDatacxx . . $ CapturedFns#glBufferData.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, width*height*4, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, GL_STREAM_READcxx . . $ `<external>/13868558256673015710/glext.h:470:9`!); |
| 553 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, pbos[cbuf]); |
| 554 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glBufferDatacxx . . $ CapturedFns#glBufferData.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, width*height*4, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, GL_STREAM_READcxx . . $ `<external>/13868558256673015710/glext.h:470:9`!); |
| 555 |
} |
| 556 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glWaitSynccxx . . $ CapturedFns#glWaitSync.(di.synccxx . . $ DrawableInfo#sync., 0, GL_TIMEOUT_IGNOREDcxx . . $ `<external>/13868558256673015710/glext.h:1411:9`!); |
| 557 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glReadPixelscxx . . $ CapturedFns#glReadPixels.(0, 0, width, height, GL_BGRAcxx . . $ `<external>/11565930711847777359/gl.h:1451:9`!, GL_UNSIGNED_BYTEcxx . . $ `<external>/11565930711847777359/gl.h:144:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 558 |
if (!primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync.) |
| 559 |
sem_post(&di.rcxx . . $ DrawableInfo#r..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Unblock main thread as soon as possible |
| 560 |
usleep(sleep_usec); |
| 561 |
profiler.tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(); |
| 562 |
if (primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync. == 1) // Get the previous framebuffer |
| 563 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, pbos[cbuf ^ 1]); |
| 564 |
double map_time = Profilercxx . . $ Profiler#::get_timestampcxx . . $ Profiler#get_timestamp(31fa7155c10fdd13).(); |
| 565 |
GLvoid *pixeldata = primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glMapBuffercxx . . $ CapturedFns#glMapBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, GL_READ_ONLYcxx . . $ `<external>/13868558256673015710/glext.h:463:9`!); |
| 566 |
map_time = Profilercxx . . $ Profiler#::get_timestampcxx . . $ Profiler#get_timestamp(31fa7155c10fdd13).() - map_time; |
| 567 |
sleep_usec = (map_time * 1e6 + sleep_usec) * primuscxx . . $ primus..autosleepcxx . . $ PrimusInfo#autosleep. / 100; |
| 568 |
profiler.tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(); |
| 569 |
clock_gettime(CLOCK_REALTIMEcxx . . $ `<external>/89459239771508533/time.h:46:10`!, &tp); |
| 570 |
tp.tv_seccxx . . $ timespec#tv_sec. += 1; |
| 571 |
if (!primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync. && sem_timedwait(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem., &tp)) |
| 572 |
primus_warncxx . . $ `libglfork.cpp:25:9`!("dropping a frame to avoid deadlock\n"); |
| 573 |
else |
| 574 |
{ |
| 575 |
di.pixeldatacxx . . $ DrawableInfo#pixeldata. = pixeldata; |
| 576 |
sem_post(&di.dcxx . . $ DrawableInfo#d..acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem.); |
| 577 |
if (primuscxx . . $ primus..synccxx . . $ PrimusInfo#sync.) |
| 578 |
{ |
| 579 |
sem_wait(&di.dcxx . . $ DrawableInfo#d..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); |
| 580 |
sem_post(&di.rcxx . . $ DrawableInfo#r..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Unblock main thread only after D::work has completed |
| 581 |
} |
| 582 |
cbuf ^= 1; |
| 583 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glBindBuffercxx . . $ CapturedFns#glBindBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!, pbos[cbuf]); |
| 584 |
} |
| 585 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glUnmapBuffercxx . . $ CapturedFns#glUnmapBuffer.(GL_PIXEL_PACK_BUFFER_EXTcxx . . $ `<external>/13868558256673015710/glext.h:7909:9`!); |
| 586 |
profiler.tickcxx . . $ Profiler#tick(b45ddcbc8423892c).(); |
| 587 |
} |
| 588 |
return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 589 |
} |
| 590 |
|
| 591 |
// Find appropriate FBConfigs on adpy for a given Visual on ddpy |
| 592 |
static GLXFBConfig* match_fbconfigcxx . . $ match_fbconfig(b0da394d5a05baba).(Displaycxx . . $ Display# *dpy, XVisualInfocxx . . $ XVisualInfo# *vis) |
| 593 |
{ |
| 594 |
int ncfg, attrs[] = { |
| 595 |
GLX_DOUBLEBUFFERcxx . . $ `<external>/4496914429062116541/glx.h:61:9`!, 0, GLX_STEREOcxx . . $ `<external>/4496914429062116541/glx.h:62:9`!, 0, GLX_AUX_BUFFERScxx . . $ `<external>/4496914429062116541/glx.h:63:9`!, 0, |
| 596 |
GLX_RED_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:64:9`!, 0, GLX_GREEN_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:65:9`!, 0, GLX_BLUE_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:66:9`!, 0, |
| 597 |
GLX_ALPHA_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:67:9`!, 0, GLX_DEPTH_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:68:9`!, 0, GLX_STENCIL_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:69:9`!, 0, |
| 598 |
GLX_ACCUM_RED_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:70:9`!, 0, GLX_ACCUM_GREEN_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:71:9`!, 0, GLX_ACCUM_BLUE_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:72:9`!, 0, GLX_ACCUM_ALPHA_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:73:9`!, 0, |
| 599 |
GLX_SAMPLE_BUFFERScxx . . $ `<external>/4496914429062116541/glx.h:160:9`!, 0, GLX_SAMPLEScxx . . $ `<external>/4496914429062116541/glx.h:161:9`!, 0, Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`! |
| 600 |
}; |
| 601 |
for (int i = 0; attrs[i] != Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`!; i += 2) |
| 602 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXGetConfigcxx . . $ CapturedFns#glXGetConfig.(dpy, vis, attrs[i], &attrs[i+1]); |
| 603 |
return primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXChooseFBConfigcxx . . $ CapturedFns#glXChooseFBConfig.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., 0, attrs, &ncfg); |
| 604 |
} |
| 605 |
|
| 606 |
GLXContext glXCreateContextcxx . . $ glXCreateContext(96f7cd79e3c1637e).(Displaycxx . . $ Display# *dpy, XVisualInfocxx . . $ XVisualInfo# *vis, GLXContext shareList, Boolcxx . . $ `<external>/7073035915403465041/Xlib.h:78:9`! direct) |
| 607 |
{ |
| 608 |
GLXFBConfig *acfgs = match_fbconfigcxx . . $ match_fbconfig(b0da394d5a05baba).(dpy, vis); |
| 609 |
GLXContext actx = primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXCreateNewContextcxx . . $ CapturedFns#glXCreateNewContext.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., *acfgs, GLX_RGBA_TYPEcxx . . $ `<external>/4496914429062116541/glx.h:136:9`!, shareList, direct); |
| 610 |
primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts..recordcxx . . $ ContextsInfo#record(e2087cb129f34be0).(actx, *acfgs, shareList); |
| 611 |
return actx; |
| 612 |
} |
| 613 |
|
| 614 |
GLXContext glXCreateNewContextcxx . . $ glXCreateNewContext(8f01e94044cb1435).(Displaycxx . . $ Display# *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Boolcxx . . $ `<external>/7073035915403465041/Xlib.h:78:9`! direct) |
| 615 |
{ |
| 616 |
GLXContext actx = primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXCreateNewContextcxx . . $ CapturedFns#glXCreateNewContext.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., config, renderType, shareList, direct); |
| 617 |
primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts..recordcxx . . $ ContextsInfo#record(e2087cb129f34be0).(actx, config, shareList); |
| 618 |
return actx; |
| 619 |
} |
| 620 |
|
| 621 |
GLXContext glXCreateContextAttribsARBcxx . . $ glXCreateContextAttribsARB(da7763501054e028).(Displaycxx . . $ Display# *dpy, GLXFBConfig config, GLXContext shareList, Boolcxx . . $ `<external>/7073035915403465041/Xlib.h:78:9`! direct, const int *attrib_list) |
| 622 |
{ |
| 623 |
GLXContext actx = primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXCreateContextAttribsARBcxx . . $ CapturedFns#glXCreateContextAttribsARB.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., config, shareList, direct, attrib_list); |
| 624 |
primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts..recordcxx . . $ ContextsInfo#record(e2087cb129f34be0).(actx, config, shareList); |
| 625 |
return actx; |
| 626 |
} |
| 627 |
|
| 628 |
void glXDestroyContextcxx . . $ glXDestroyContext(7a30a6fff7a118be).(Displaycxx . . $ Display# *dpy, GLXContext ctx) |
| 629 |
{ |
| 630 |
primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts..erasecxx . . $ std/map#erase(a7de169f3ef4bfb3).(ctx); |
| 631 |
// kludge: reap background tasks when deleting the last context |
| 632 |
// otherwise something will deadlock during unloading the library |
| 633 |
if (primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts..emptycxx . . $ std/map#empty(3482b152b9333168).()) |
| 634 |
for (DrawablesInfocxx . . $ DrawablesInfo#::iteratorcxx . . $ std/map#iterator# i = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables..begincxx . . $ std/map#begin(7e4de33083b6e738).(); i !=cxx . . $ std/`operator!=`(be6a71a859368080). primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables..endcxx . . $ std/map#end(7e4de33083b6e738).(); i++cxx . . $ std/_Rb_tree_iterator#operator++(2987e7ff93f61dc1).) |
| 635 |
i->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).secondcxx . . $ std/pair#second..reap_workerscxx . . $ DrawableInfo#reap_workers(49f6e7a06ebc5aa8).(); |
| 636 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXDestroyContextcxx . . $ CapturedFns#glXDestroyContext.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., ctx); |
| 637 |
} |
| 638 |
|
| 639 |
static GLXPbuffer create_pbuffercxx . . $ create_pbuffer(b63f495908585f9c).(DrawableInfocxx . . $ DrawableInfo# &di) |
| 640 |
{ |
| 641 |
int pbattrs[] = {GLX_PBUFFER_WIDTHcxx . . $ `<external>/4496914429062116541/glx.h:151:9`!, di.widthcxx . . $ DrawableInfo#width., GLX_PBUFFER_HEIGHTcxx . . $ `<external>/4496914429062116541/glx.h:150:9`!, di.heightcxx . . $ DrawableInfo#height., GLX_PRESERVED_CONTENTScxx . . $ `<external>/4496914429062116541/glx.h:141:9`!, Truecxx . . $ `<external>/7073035915403465041/Xlib.h:80:9`!, Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`!}; |
| 642 |
return primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXCreatePbuffercxx . . $ CapturedFns#glXCreatePbuffer.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., di.fbconfigcxx . . $ DrawableInfo#fbconfig., pbattrs); |
| 643 |
} |
| 644 |
|
| 645 |
// Create or recall backing Pbuffer for the drawable |
| 646 |
static GLXPbuffer lookup_pbuffercxx . . $ lookup_pbuffer(896432af97fa376).(Displaycxx . . $ Display# *dpy, GLXDrawable draw, GLXContext ctx) |
| 647 |
{ |
| 648 |
if (!draw) |
| 649 |
return 0; |
| 650 |
bool known = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables..knowncxx . . $ DrawablesInfo#known(31596a199e1d8a50).(draw); |
| 651 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).draw]; |
| 652 |
if (!known) |
| 653 |
{ |
| 654 |
// Drawable is a plain X Window. Get the FBConfig from the context |
| 655 |
if (ctx) |
| 656 |
di.fbconfigcxx . . $ DrawableInfo#fbconfig. = primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts.[cxx . . $ std/map#`operator[]`(bbd415b616967878).ctx].fbconfigcxx . . $ ContextInfo#fbconfig.; |
| 657 |
else |
| 658 |
{ |
| 659 |
XWindowAttributescxx . . $ XWindowAttributes# attrs; |
| 660 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(!XGetWindowAttributes(dpy, draw, &attrs), "failed to query attributes"); |
| 661 |
int nvis; |
| 662 |
XVisualInfocxx . . $ XVisualInfo# tmpl = {0}, *vis; |
| 663 |
tmpl.visualidcxx . . $ $anonymous_type_c787e362e16f063b_7#visualid. = XVisualIDFromVisual(attrs.visualcxx . . $ $anonymous_type_17d7f07cf933eea7_8#visual.); |
| 664 |
die_ifcxx . . $ `libglfork.cpp:24:9`!(!(vis = XGetVisualInfo(dpy, VisualIDMaskcxx . . $ `<external>/9110752858362169270/Xutil.h:305:9`!, &tmpl, &nvis)), "no visuals"); |
| 665 |
di.fbconfigcxx . . $ DrawableInfo#fbconfig. = *match_fbconfigcxx . . $ match_fbconfig(b0da394d5a05baba).(dpy, vis); |
| 666 |
XFree(vis); |
| 667 |
} |
| 668 |
di.kindcxx . . $ DrawableInfo#kind. = di.XWindowcxx . . $ DrawableInfo#XWindow.; |
| 669 |
di.windowcxx . . $ DrawableInfo#window. = draw; |
| 670 |
note_geometrycxx . . $ note_geometry(7a3854b0833f0299).(dpy, draw, &di.widthcxx . . $ DrawableInfo#width., &di.heightcxx . . $ DrawableInfo#height.); |
| 671 |
} |
| 672 |
else if (ctx && di.fbconfigcxx . . $ DrawableInfo#fbconfig. != primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts.[cxx . . $ std/map#`operator[]`(bbd415b616967878).ctx].fbconfigcxx . . $ ContextInfo#fbconfig.) |
| 673 |
{ |
| 674 |
if (di.pbuffercxx . . $ DrawableInfo#pbuffer.) |
| 675 |
{ |
| 676 |
primus_warncxx . . $ `libglfork.cpp:25:9`!("recreating incompatible pbuffer\n"); |
| 677 |
di.reap_workerscxx . . $ DrawableInfo#reap_workers(49f6e7a06ebc5aa8).(); |
| 678 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXDestroyPbuffercxx . . $ CapturedFns#glXDestroyPbuffer.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., di.pbuffercxx . . $ DrawableInfo#pbuffer.); |
| 679 |
di.pbuffercxx . . $ DrawableInfo#pbuffer. = 0; |
| 680 |
} |
| 681 |
di.fbconfigcxx . . $ DrawableInfo#fbconfig. = primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts.[cxx . . $ std/map#`operator[]`(bbd415b616967878).ctx].fbconfigcxx . . $ ContextInfo#fbconfig.; |
| 682 |
} |
| 683 |
if (!di.pbuffercxx . . $ DrawableInfo#pbuffer.) |
| 684 |
di.pbuffercxx . . $ DrawableInfo#pbuffer. = create_pbuffercxx . . $ create_pbuffer(b63f495908585f9c).(di); |
| 685 |
return di.pbuffercxx . . $ DrawableInfo#pbuffer.; |
| 686 |
} |
| 687 |
|
| 688 |
Boolcxx . . $ `<external>/7073035915403465041/Xlib.h:78:9`! glXMakeCurrentcxx . . $ glXMakeCurrent(28ec388ff54b4462).(Displaycxx . . $ Display# *dpy, GLXDrawable drawable, GLXContext ctx) |
| 689 |
{ |
| 690 |
GLXPbuffer pbuffer = lookup_pbuffercxx . . $ lookup_pbuffer(896432af97fa376).(dpy, drawable, ctx); |
| 691 |
tsdatacxx . . $ tsdata..make_currentcxx . . $ $anonymous_type_f2d3b7192aabd040_2#make_current(652187420032b021).(dpy, drawable, drawable); |
| 692 |
return primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXMakeCurrentcxx . . $ CapturedFns#glXMakeCurrent.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., pbuffer, ctx); |
| 693 |
} |
| 694 |
|
| 695 |
Boolcxx . . $ `<external>/7073035915403465041/Xlib.h:78:9`! glXMakeContextCurrentcxx . . $ glXMakeContextCurrent(f77684254f398a6).(Displaycxx . . $ Display# *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) |
| 696 |
{ |
| 697 |
if (draw == read) |
| 698 |
return glXMakeCurrentcxx . . $ glXMakeCurrent(28ec388ff54b4462).(dpy, draw, ctx); |
| 699 |
GLXPbuffer pbuffer = lookup_pbuffercxx . . $ lookup_pbuffer(896432af97fa376).(dpy, draw, ctx); |
| 700 |
GLXPbuffer pb_read = lookup_pbuffercxx . . $ lookup_pbuffer(896432af97fa376).(dpy, read, ctx); |
| 701 |
tsdatacxx . . $ tsdata..make_currentcxx . . $ $anonymous_type_f2d3b7192aabd040_2#make_current(652187420032b021).(dpy, draw, read); |
| 702 |
return primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXMakeContextCurrentcxx . . $ CapturedFns#glXMakeContextCurrent.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., pbuffer, pb_read, ctx); |
| 703 |
} |
| 704 |
|
| 705 |
void glXSwapBufferscxx . . $ glXSwapBuffers(110b5f28c5b598db).(Displaycxx . . $ Display# *dpy, GLXDrawable drawable) |
| 706 |
{ |
| 707 |
XFlush(dpy); |
| 708 |
assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(primus.drawables.known(drawable)); |
| 709 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).drawable]; |
| 710 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXSwapBufferscxx . . $ CapturedFns#glXSwapBuffers.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., di.pbuffercxx . . $ DrawableInfo#pbuffer.); |
| 711 |
if (di.kindcxx . . $ DrawableInfo#kind. == di.Pbuffercxx . . $ DrawableInfo#Pbuffer. || di.kindcxx . . $ DrawableInfo#kind. == di.Pixmapcxx . . $ DrawableInfo#Pixmap.) |
| 712 |
return; |
| 713 |
GLXContext ctx = glXGetCurrentContext(); |
| 714 |
if (!ctx) |
| 715 |
primus_warncxx . . $ `libglfork.cpp:25:9`!("glXSwapBuffers: no current context\n"); |
| 716 |
else if (drawable != tsdatacxx . . $ tsdata..drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#drawable.) |
| 717 |
primus_warncxx . . $ `libglfork.cpp:25:9`!("glXSwapBuffers: drawable not current\n"); |
| 718 |
if (di.rcxx . . $ DrawableInfo#r..workercxx . . $ DrawableInfo#$anonymous_type_1#worker. && ctx && (!di.actxcxx . . $ DrawableInfo#actx. || primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts.[cxx . . $ std/map#`operator[]`(bbd415b616967878).di.actxcxx . . $ DrawableInfo#actx.].sharegroupcxx . . $ ContextInfo#sharegroup. != primuscxx . . $ primus..contextscxx . . $ PrimusInfo#contexts.[cxx . . $ std/map#`operator[]`(bbd415b616967878).ctx].sharegroupcxx . . $ ContextInfo#sharegroup.)) |
| 719 |
{ |
| 720 |
primus_warncxx . . $ `libglfork.cpp:25:9`!("glXSwapBuffers: respawning threads after context change\n"); |
| 721 |
di.reap_workerscxx . . $ DrawableInfo#reap_workers(49f6e7a06ebc5aa8).(); |
| 722 |
} |
| 723 |
if (!di.rcxx . . $ DrawableInfo#r..workercxx . . $ DrawableInfo#$anonymous_type_1#worker.) |
| 724 |
{ |
| 725 |
// Need to create a sharing context to use GL sync objects |
| 726 |
di.actxcxx . . $ DrawableInfo#actx. = ctx; |
| 727 |
di.dcxx . . $ DrawableInfo#d..spawn_workercxx . . $ DrawableInfo#$anonymous_type_1#spawn_worker(5804c443e1435b1b).(drawable, display_workcxx . . $ display_work(9f162e79bfc6c74).); |
| 728 |
di.rcxx . . $ DrawableInfo#r..spawn_workercxx . . $ DrawableInfo#$anonymous_type_1#spawn_worker(5804c443e1435b1b).(drawable, readback_workcxx . . $ readback_work(9f162e79bfc6c74).); |
| 729 |
} |
| 730 |
// Readback thread needs a sync object to avoid reading an incomplete frame |
| 731 |
di.synccxx . . $ DrawableInfo#sync. = primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glFenceSynccxx . . $ CapturedFns#glFenceSync.(GL_SYNC_GPU_COMMANDS_COMPLETEcxx . . $ `<external>/13868558256673015710/glext.h:1404:9`!, 0); |
| 732 |
sem_post(&di.rcxx . . $ DrawableInfo#r..acqsemcxx . . $ DrawableInfo#$anonymous_type_1#acqsem.); // Signal the readback worker thread |
| 733 |
sem_wait(&di.rcxx . . $ DrawableInfo#r..relsemcxx . . $ DrawableInfo#$anonymous_type_1#relsem.); // Wait until it has issued glReadBuffer |
| 734 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glDeleteSynccxx . . $ CapturedFns#glDeleteSync.(di.synccxx . . $ DrawableInfo#sync.); |
| 735 |
if (di.reinitcxx . . $ DrawableInfo#reinit. == di.RESIZEcxx . . $ DrawableInfo#RESIZE.) |
| 736 |
{ |
| 737 |
__sync_synchronize(); |
| 738 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXDestroyPbuffercxx . . $ CapturedFns#glXDestroyPbuffer.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., di.pbuffercxx . . $ DrawableInfo#pbuffer.); |
| 739 |
di.pbuffercxx . . $ DrawableInfo#pbuffer. = create_pbuffercxx . . $ create_pbuffer(b63f495908585f9c).(di); |
| 740 |
if (ctx) // FIXME: drawable can be current in other threads |
| 741 |
glXMakeContextCurrentcxx . . $ glXMakeContextCurrent(f77684254f398a6).(dpy, tsdatacxx . . $ tsdata..drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#drawable., tsdatacxx . . $ tsdata..read_drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#read_drawable., ctx); |
| 742 |
di.rcxx . . $ DrawableInfo#r..reinitcxx . . $ DrawableInfo#$anonymous_type_1#reinit. = di.reinitcxx . . $ DrawableInfo#reinit.; |
| 743 |
di.reinitcxx . . $ DrawableInfo#reinit. = di.NONEcxx . . $ DrawableInfo#NONE.; |
| 744 |
} |
| 745 |
} |
| 746 |
|
| 747 |
GLXWindow glXCreateWindowcxx . . $ glXCreateWindow(4b0f3c43590795a3).(Displaycxx . . $ Display# *dpy, GLXFBConfig config, Windowcxx . . $ Window# win, const int *attribList) |
| 748 |
{ |
| 749 |
GLXFBConfig *dconfigs = get_dconfigscxx . . $ get_dconfigs(5ee131bcb2eafdd).(dpy); |
| 750 |
GLXWindow glxwin = primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXCreateWindowcxx . . $ CapturedFns#glXCreateWindow.(dpy, *dconfigs, win, attribList); |
| 751 |
XFree(dconfigs); |
| 752 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).glxwin]; |
| 753 |
di.kindcxx . . $ DrawableInfo#kind. = di.Windowcxx . . $ DrawableInfo#Window.; |
| 754 |
di.fbconfigcxx . . $ DrawableInfo#fbconfig. = config; |
| 755 |
di.windowcxx . . $ DrawableInfo#window. = win; |
| 756 |
note_geometrycxx . . $ note_geometry(7a3854b0833f0299).(dpy, win, &di.widthcxx . . $ DrawableInfo#width., &di.heightcxx . . $ DrawableInfo#height.); |
| 757 |
return glxwin; |
| 758 |
} |
| 759 |
|
| 760 |
DrawableInfocxx . . $ DrawableInfo#::~cxx . . $ DrawableInfo#`~DrawableInfo`(ced63f7c635d850d).DrawableInfocxx . . $ DrawableInfo#() |
| 761 |
{ |
| 762 |
reap_workerscxx . . $ DrawableInfo#reap_workers(49f6e7a06ebc5aa8).(); |
| 763 |
if (pbuffercxx . . $ DrawableInfo#pbuffer.) |
| 764 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXDestroyPbuffercxx . . $ CapturedFns#glXDestroyPbuffer.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., pbuffercxx . . $ DrawableInfo#pbuffer.); |
| 765 |
} |
| 766 |
|
| 767 |
void glXDestroyWindowcxx . . $ glXDestroyWindow(110b5f28c5b598db).(Displaycxx . . $ Display# *dpy, GLXWindow window) |
| 768 |
{ |
| 769 |
assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(primus.drawables.known(window)); |
| 770 |
primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables..erasecxx . . $ std/map#erase(a7de169f3ef4bfb3).(window); |
| 771 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXDestroyWindowcxx . . $ CapturedFns#glXDestroyWindow.(dpy, window); |
| 772 |
} |
| 773 |
|
| 774 |
GLXPbuffer glXCreatePbuffercxx . . $ glXCreatePbuffer(ad53aa79af250841).(Displaycxx . . $ Display# *dpy, GLXFBConfig config, const int *attribList) |
| 775 |
{ |
| 776 |
GLXFBConfig *dconfigs = get_dconfigscxx . . $ get_dconfigs(5ee131bcb2eafdd).(dpy); |
| 777 |
GLXPbuffer pbuffer = primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXCreatePbuffercxx . . $ CapturedFns#glXCreatePbuffer.(dpy, *dconfigs, attribList); |
| 778 |
XFree(dconfigs); |
| 779 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).pbuffer]; |
| 780 |
di.kindcxx . . $ DrawableInfo#kind. = di.Pbuffercxx . . $ DrawableInfo#Pbuffer.; |
| 781 |
di.fbconfigcxx . . $ DrawableInfo#fbconfig. = config; |
| 782 |
for (int i = 0; attribList[i] != Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`!; i++) |
| 783 |
if (attribList[i] == GLX_PBUFFER_WIDTHcxx . . $ `<external>/4496914429062116541/glx.h:151:9`!) |
| 784 |
di.widthcxx . . $ DrawableInfo#width. = attribList[i+1]; |
| 785 |
else if (attribList[i] == GLX_PBUFFER_HEIGHTcxx . . $ `<external>/4496914429062116541/glx.h:150:9`!) |
| 786 |
di.heightcxx . . $ DrawableInfo#height. = attribList[i+1]; |
| 787 |
return pbuffer; |
| 788 |
} |
| 789 |
|
| 790 |
void glXDestroyPbuffercxx . . $ glXDestroyPbuffer(110b5f28c5b598db).(Displaycxx . . $ Display# *dpy, GLXPbuffer pbuf) |
| 791 |
{ |
| 792 |
assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(primus.drawables.known(pbuf)); |
| 793 |
primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables..erasecxx . . $ std/map#erase(a7de169f3ef4bfb3).(pbuf); |
| 794 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXDestroyPbuffercxx . . $ CapturedFns#glXDestroyPbuffer.(dpy, pbuf); |
| 795 |
} |
| 796 |
|
| 797 |
GLXPixmap glXCreatePixmapcxx . . $ glXCreatePixmap(4b0f3c43590795a3).(Displaycxx . . $ Display# *dpy, GLXFBConfig config, Pixmapcxx . . $ Pixmap# pixmap, const int *attribList) |
| 798 |
{ |
| 799 |
GLXFBConfig *dconfigs = get_dconfigscxx . . $ get_dconfigs(5ee131bcb2eafdd).(dpy); |
| 800 |
GLXPixmap glxpix = primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXCreatePixmapcxx . . $ CapturedFns#glXCreatePixmap.(dpy, *dconfigs, pixmap, attribList); |
| 801 |
XFree(dconfigs); |
| 802 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).glxpix]; |
| 803 |
di.kindcxx . . $ DrawableInfo#kind. = di.Pixmapcxx . . $ DrawableInfo#Pixmap.; |
| 804 |
di.fbconfigcxx . . $ DrawableInfo#fbconfig. = config; |
| 805 |
note_geometrycxx . . $ note_geometry(7a3854b0833f0299).(dpy, pixmap, &di.widthcxx . . $ DrawableInfo#width., &di.heightcxx . . $ DrawableInfo#height.); |
| 806 |
return glxpix; |
| 807 |
} |
| 808 |
|
| 809 |
void glXDestroyPixmapcxx . . $ glXDestroyPixmap(110b5f28c5b598db).(Displaycxx . . $ Display# *dpy, GLXPixmap pixmap) |
| 810 |
{ |
| 811 |
assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(primus.drawables.known(pixmap)); |
| 812 |
primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables..erasecxx . . $ std/map#erase(a7de169f3ef4bfb3).(pixmap); |
| 813 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXDestroyPixmapcxx . . $ CapturedFns#glXDestroyPixmap.(dpy, pixmap); |
| 814 |
} |
| 815 |
|
| 816 |
GLXPixmap glXCreateGLXPixmapcxx . . $ glXCreateGLXPixmap(99640b0ce78aa492).(Displaycxx . . $ Display# *dpy, XVisualInfocxx . . $ XVisualInfo# *visual, Pixmapcxx . . $ Pixmap# pixmap) |
| 817 |
{ |
| 818 |
GLXPixmap glxpix = primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXCreateGLXPixmapcxx . . $ CapturedFns#glXCreateGLXPixmap.(dpy, visual, pixmap); |
| 819 |
DrawableInfocxx . . $ DrawableInfo# &di = primuscxx . . $ primus..drawablescxx . . $ PrimusInfo#drawables.[cxx . . $ std/map#`operator[]`(bbd415b616967878).glxpix]; |
| 820 |
di.kindcxx . . $ DrawableInfo#kind. = di.Pixmapcxx . . $ DrawableInfo#Pixmap.; |
| 821 |
note_geometrycxx . . $ note_geometry(7a3854b0833f0299).(dpy, pixmap, &di.widthcxx . . $ DrawableInfo#width., &di.heightcxx . . $ DrawableInfo#height.); |
| 822 |
GLXFBConfig *acfgs = match_fbconfigcxx . . $ match_fbconfig(b0da394d5a05baba).(dpy, visual); |
| 823 |
di.fbconfigcxx . . $ DrawableInfo#fbconfig. = *acfgs; |
| 824 |
return glxpix; |
| 825 |
} |
| 826 |
|
| 827 |
void glXDestroyGLXPixmapcxx . . $ glXDestroyGLXPixmap(110b5f28c5b598db).(Displaycxx . . $ Display# *dpy, GLXPixmap pixmap) |
| 828 |
{ |
| 829 |
glXDestroyPixmapcxx . . $ glXDestroyPixmap(110b5f28c5b598db).(dpy, pixmap); |
| 830 |
} |
| 831 |
|
| 832 |
static XVisualInfocxx . . $ XVisualInfo# *match_visualcxx . . $ match_visual(39bc11640891ef9b).(Displaycxx . . $ Display# *dpy, int attrs[]) |
| 833 |
{ |
| 834 |
XVisualInfocxx . . $ XVisualInfo# *vis = glXChooseVisual(dpy, 0, attrs); |
| 835 |
for (int i = 2; attrs[i] != Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`! && vis; i += 2) |
| 836 |
{ |
| 837 |
int tmp = attrs[i+1]; |
| 838 |
primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXGetConfigcxx . . $ CapturedFns#glXGetConfig.(dpy, vis, attrs[i], &attrs[i+1]); |
| 839 |
if (tmp != attrs[i+1]) |
| 840 |
vis = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 841 |
} |
| 842 |
return vis; |
| 843 |
} |
| 844 |
|
| 845 |
XVisualInfocxx . . $ XVisualInfo# *glXGetVisualFromFBConfigcxx . . $ glXGetVisualFromFBConfig(c50f7e95d894f88).(Displaycxx . . $ Display# *dpy, GLXFBConfig config) |
| 846 |
{ |
| 847 |
if (!primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXGetVisualFromFBConfigcxx . . $ CapturedFns#glXGetVisualFromFBConfig.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., config)) |
| 848 |
return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 849 |
int i, attrs[] = { |
| 850 |
GLX_RGBAcxx . . $ `<external>/4496914429062116541/glx.h:60:9`!, GLX_DOUBLEBUFFERcxx . . $ `<external>/4496914429062116541/glx.h:61:9`!, |
| 851 |
GLX_RED_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:64:9`!, 0, GLX_GREEN_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:65:9`!, 0, GLX_BLUE_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:66:9`!, 0, |
| 852 |
GLX_ALPHA_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:67:9`!, 0, GLX_DEPTH_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:68:9`!, 0, GLX_STENCIL_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:69:9`!, 0, |
| 853 |
GLX_SAMPLE_BUFFERScxx . . $ `<external>/4496914429062116541/glx.h:160:9`!, 0, GLX_SAMPLEScxx . . $ `<external>/4496914429062116541/glx.h:161:9`!, 0, Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`! |
| 854 |
}; |
| 855 |
for (i = 2; attrs[i] != Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`!; i += 2) |
| 856 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXGetFBConfigAttribcxx . . $ CapturedFns#glXGetFBConfigAttrib.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., config, attrs[i], &attrs[i+1]); |
| 857 |
XVisualInfocxx . . $ XVisualInfo# *vis = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 858 |
for (i -= 2; i >= 0 && !vis; i -= 2) |
| 859 |
{ |
| 860 |
vis = match_visualcxx . . $ match_visual(39bc11640891ef9b).(dpy, attrs); |
| 861 |
attrs[i] = Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`!; |
| 862 |
} |
| 863 |
return vis; |
| 864 |
} |
| 865 |
|
| 866 |
int glXGetFBConfigAttribcxx . . $ glXGetFBConfigAttrib(924721a0fd7a0d84).(Displaycxx . . $ Display# *dpy, GLXFBConfig config, int attribute, int *value) |
| 867 |
{ |
| 868 |
int r = primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXGetFBConfigAttribcxx . . $ CapturedFns#glXGetFBConfigAttrib.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., config, attribute, value); |
| 869 |
if (attribute == GLX_VISUAL_IDcxx . . $ `<external>/4496914429062116541/glx.h:129:9`! && *value) |
| 870 |
return primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXGetConfigcxx . . $ CapturedFns#glXGetConfig.(dpy, glXGetVisualFromFBConfigcxx . . $ glXGetVisualFromFBConfig(c50f7e95d894f88).(dpy, config), attribute, value); |
| 871 |
return r; |
| 872 |
} |
| 873 |
|
| 874 |
void glXQueryDrawablecxx . . $ glXQueryDrawable(f7b96e1cce7f2779).(Displaycxx . . $ Display# *dpy, GLXDrawable draw, int attribute, unsigned int *value) |
| 875 |
{ |
| 876 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXQueryDrawablecxx . . $ CapturedFns#glXQueryDrawable.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., lookup_pbuffercxx . . $ lookup_pbuffer(896432af97fa376).(dpy, draw, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!), attribute, value); |
| 877 |
} |
| 878 |
|
| 879 |
void glXUseXFontcxx . . $ glXUseXFont(b120620453ea1297).(Fontcxx . . $ Font# font, int first, int count, int list) |
| 880 |
{ |
| 881 |
unsigned long prop; |
| 882 |
Displaycxx . . $ Display# *dpy = glXGetCurrentDisplay(); |
| 883 |
XFontStructcxx . . $ XFontStruct# *fs = XQueryFont(dpy, font); |
| 884 |
XGetFontProperty(fs, XA_FONTcxx . . $ `<external>/12705893824843406196/Xatom.h:26:9`!, &prop); |
| 885 |
char *xlfd = XGetAtomName(dpy, prop); |
| 886 |
Fontcxx . . $ Font# afont = XLoadFont(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., xlfd); |
| 887 |
primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXUseXFontcxx . . $ CapturedFns#glXUseXFont.(afont, first, count, list); |
| 888 |
XUnloadFont(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., afont); |
| 889 |
XFree(xlfd); |
| 890 |
XFreeFontInfo(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, fs, 1); |
| 891 |
} |
| 892 |
|
| 893 |
GLXContext glXGetCurrentContextcxx . . $ glXGetCurrentContext(de005d43f0a9bab4).(void) |
| 894 |
{ |
| 895 |
return primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXGetCurrentContextcxx . . $ CapturedFns#glXGetCurrentContext.(); |
| 896 |
} |
| 897 |
|
| 898 |
GLXDrawable glXGetCurrentDrawablecxx . . $ glXGetCurrentDrawable(f708dce9a8856c70).(void) |
| 899 |
{ |
| 900 |
return tsdatacxx . . $ tsdata..drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#drawable.; |
| 901 |
} |
| 902 |
|
| 903 |
void glXWaitGLcxx . . $ glXWaitGL(49f6e7a06ebc5aa8).(void) |
| 904 |
{ |
| 905 |
} |
| 906 |
|
| 907 |
void glXWaitXcxx . . $ glXWaitX(49f6e7a06ebc5aa8).(void) |
| 908 |
{ |
| 909 |
} |
| 910 |
|
| 911 |
Displaycxx . . $ Display# *glXGetCurrentDisplaycxx . . $ glXGetCurrentDisplay(17eb9fe335efbb88).(void) |
| 912 |
{ |
| 913 |
return tsdatacxx . . $ tsdata..dpycxx . . $ $anonymous_type_f2d3b7192aabd040_2#dpy.; |
| 914 |
} |
| 915 |
|
| 916 |
GLXDrawable glXGetCurrentReadDrawablecxx . . $ glXGetCurrentReadDrawable(f708dce9a8856c70).(void) |
| 917 |
{ |
| 918 |
return tsdatacxx . . $ tsdata..read_drawablecxx . . $ $anonymous_type_f2d3b7192aabd040_2#read_drawable.; |
| 919 |
} |
| 920 |
|
| 921 |
// Application sees ddpy-side Visuals, but adpy-side FBConfigs and Contexts |
| 922 |
XVisualInfocxx . . $ XVisualInfo#* glXChooseVisualcxx . . $ glXChooseVisual(3a8cee6a56e8bac4).(Displaycxx . . $ Display# *dpy, int screen, int *attribList) |
| 923 |
{ |
| 924 |
return primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXChooseVisualcxx . . $ CapturedFns#glXChooseVisual.(dpy, screen, attribList); |
| 925 |
} |
| 926 |
|
| 927 |
int glXGetConfigcxx . . $ glXGetConfig(2bf5cc32dbbe2269).(Displaycxx . . $ Display# *dpy, XVisualInfocxx . . $ XVisualInfo# *visual, int attrib, int *value) |
| 928 |
{ |
| 929 |
return primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXGetConfigcxx . . $ CapturedFns#glXGetConfig.(dpy, visual, attrib, value); |
| 930 |
} |
| 931 |
|
| 932 |
// GLX forwarders that reroute to adpy |
| 933 |
#define DEF_GLX_PROTOcxx . . $ `libglfork.cpp:933:9`!(ret, name, par, ...) \ |
| 934 |
ret name par \ |
| 935 |
{ return primus.afns.name(primus.adpy, __VA_ARGS__); } |
| 936 |
#include "glx-dpyredir.def"cxx . . $ `<file>/glx-dpyredir.def`/ |
| 937 |
#undef DEF_GLX_PROTOcxx . . $ `libglfork.cpp:933:9`! |
| 938 |
|
| 939 |
// OpenGL forwarders |
| 940 |
#define DEF_GLX_PROTOcxx . . $ `libglfork.cpp:940:9`!(ret, name, par, ...) \ |
| 941 |
void ifunc_##name(void) asm(#name) __attribute__((visibility("default"),ifunc("i" #name))); \ |
| 942 |
extern "C" { \ |
| 943 |
static ret l##name par \ |
| 944 |
{ return primus.afns.name(__VA_ARGS__); } \ |
| 945 |
static void *i##name(void) \ |
| 946 |
{ return primus.afns.handle ? real_dlsym(primus.afns.handle, #name) : (void*)l##name; } } |
| 947 |
#include "gl-passthru.def"cxx . . $ `<file>/gl-passthru.def`/ |
| 948 |
#undef DEF_GLX_PROTOcxx . . $ `libglfork.cpp:940:9`! |
| 949 |
|
| 950 |
// GLX extensions |
| 951 |
|
| 952 |
int glXSwapIntervalSGIcxx . . $ glXSwapIntervalSGI(7864480464b09eea).(int interval) |
| 953 |
{ |
| 954 |
return 1; // Indicate failure to set swapinterval |
| 955 |
} |
| 956 |
|
| 957 |
__GLXextFuncPtr glXGetProcAddresscxx . . $ glXGetProcAddress(d9550b36c1428718).(const GLubyte *procName) |
| 958 |
{ |
| 959 |
static const char * const redefined_names[] = { |
| 960 |
#define DEF_GLX_PROTOcxx . . $ `libglfork.cpp:960:9`!(ret, name, args, ...) #name, |
| 961 |
#include "glx-reimpl.def"cxx . . $ `<file>/glx-reimpl.def`/ |
| 962 |
#include "glxext-reimpl.def"cxx . . $ `<file>/glxext-reimpl.def`/ |
| 963 |
#include "glx-dpyredir.def"cxx . . $ `<file>/glx-dpyredir.def`/ |
| 964 |
#undef DEF_GLX_PROTOcxx . . $ `libglfork.cpp:960:9`! |
| 965 |
}; |
| 966 |
static const __GLXextFuncPtr redefined_fns[] = { |
| 967 |
#define DEF_GLX_PROTOcxx . . $ `libglfork.cpp:967:9`!(ret, name, args, ...) (__GLXextFuncPtr)name, |
| 968 |
#include "glx-reimpl.def"cxx . . $ `<file>/glx-reimpl.def`/ |
| 969 |
#include "glxext-reimpl.def"cxx . . $ `<file>/glxext-reimpl.def`/ |
| 970 |
#include "glx-dpyredir.def"cxx . . $ `<file>/glx-dpyredir.def`/ |
| 971 |
#undef DEF_GLX_PROTOcxx . . $ `libglfork.cpp:967:9`! |
| 972 |
}; |
| 973 |
enumcxx . . $ glXGetProcAddress(d9550b36c1428718).$anonymous_type_3# {n_redefinedcxx . . $ glXGetProcAddress(d9550b36c1428718).n_redefined. = sizeof(redefined_fns) / sizeof(redefined_fns[0])}; |
| 974 |
// Non-GLX functions are forwarded to the accelerating libGL |
| 975 |
if (memcmp(procName, "glX", 3)) |
| 976 |
return primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXGetProcAddresscxx . . $ CapturedFns#glXGetProcAddress.(procName); |
| 977 |
// All GLX functions are either implemented in primus or not available |
| 978 |
for (int i = 0; i < n_redefinedcxx . . $ glXGetProcAddress(d9550b36c1428718).n_redefined.; i++) |
| 979 |
if (!strcmp((const char *)procName, redefined_names[i])) |
| 980 |
return redefined_fns[i]; |
| 981 |
return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 982 |
} |
| 983 |
|
| 984 |
__GLXextFuncPtr glXGetProcAddressARBcxx . . $ glXGetProcAddressARB(d9550b36c1428718).(const GLubyte *procName) |
| 985 |
{ |
| 986 |
return glXGetProcAddresscxx . . $ glXGetProcAddress(d9550b36c1428718).(procName); |
| 987 |
} |
| 988 |
|
| 989 |
static const char glxext_clientsidecxx . . $ glxext_clientside.[] = "GLX_ARB_get_proc_address "; |
| 990 |
static const char glxext_adpycxx . . $ glxext_adpy.[] = "GLX_ARB_create_context GLX_ARB_create_context_profile "; |
| 991 |
static const char glxext_ddpycxx . . $ glxext_ddpy.[] = ""; |
| 992 |
|
| 993 |
const char *glXGetClientStringcxx . . $ glXGetClientString(209508c1a12eab39).(Displaycxx . . $ Display# *dpy, int name) |
| 994 |
{ |
| 995 |
static stdcxx . . $ std/::stringcxx . . $ std/string# exts(stdcxx . . $ std/::stringcxx . . $ std/string#(glxext_clientsidecxx . . $ glxext_clientside.) +cxx . . $ std/operator+(900ec9581c410ad9). glxext_adpycxx . . $ glxext_adpy. +cxx . . $ std/operator+(900ec9581c410ad9). glxext_ddpycxx . . $ glxext_ddpy.); |
| 996 |
switch (name) |
| 997 |
{ |
| 998 |
case GLX_VENDORcxx . . $ `<external>/4496914429062116541/glx.h:91:9`!: return "primus"; |
| 999 |
case GLX_VERSIONcxx . . $ `<external>/4496914429062116541/glx.h:92:9`!: return "1.4"; |
| 1000 |
case GLX_EXTENSIONScxx . . $ `<external>/4496914429062116541/glx.h:93:9`!: return exts.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); |
| 1001 |
default: return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 1002 |
} |
| 1003 |
} |
| 1004 |
|
| 1005 |
static stdcxx . . $ std/::stringcxx . . $ std/string# intersect_extscxx . . $ intersect_exts(2b6594e022f5a2e8).(const char *set1, const char *set2) |
| 1006 |
{ |
| 1007 |
stdcxx . . $ std/::stringcxx . . $ std/string# rcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 1008 |
for (const char *p; *set1; set1 = p + 1) |
| 1009 |
{ |
| 1010 |
p = strchr(set1, ' '); |
| 1011 |
if (memmem(set2, strlen(set2), set1, p - set1)) |
| 1012 |
r.appendcxx . . $ std/__cxx11/basic_string#append(4f422887dc0eafa2).(set1, p - set1 + 1); |
| 1013 |
} |
| 1014 |
return rcxx . . $ std/__cxx11/basic_string#basic_string(8f3aaafa33d05d0b).; |
| 1015 |
} |
| 1016 |
|
| 1017 |
const char *glXQueryExtensionsStringcxx . . $ glXQueryExtensionsString(209508c1a12eab39).(Displaycxx . . $ Display# *dpy, int screen) |
| 1018 |
{ |
| 1019 |
static stdcxx . . $ std/::stringcxx . . $ std/string# exts |
| 1020 |
(stdcxx . . $ std/::stringcxx . . $ std/string#(glxext_clientsidecxx . . $ glxext_clientside.) |
| 1021 |
+cxx . . $ std/operator+(aa1c00e85b87da6b). intersect_extscxx . . $ intersect_exts(2b6594e022f5a2e8).(glxext_adpycxx . . $ glxext_adpy., primuscxx . . $ primus..afnscxx . . $ PrimusInfo#afns..glXQueryExtensionsStringcxx . . $ CapturedFns#glXQueryExtensionsString.(primuscxx . . $ primus..adpycxx . . $ PrimusInfo#adpy., 0)) |
| 1022 |
+cxx . . $ std/operator+(aa1c00e85b87da6b). intersect_extscxx . . $ intersect_exts(2b6594e022f5a2e8).(glxext_ddpycxx . . $ glxext_ddpy., primuscxx . . $ primus..dfnscxx . . $ PrimusInfo#dfns..glXQueryExtensionsStringcxx . . $ CapturedFns#glXQueryExtensionsString.(dpy, 0))); |
| 1023 |
return exts.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); |
| 1024 |
} |
| 1025 |
|
| 1026 |
// OpenGL ABI specifies that anything above OpenGL 1.2 + ARB_multitexture must |
| 1027 |
// be obtained via glXGetProcAddress, but some applications link against |
| 1028 |
// extension functions, and Mesa and vendor libraries let them |
| 1029 |
#ifndef PRIMUS_STRICT |
| 1030 |
#warning Enabled workarounds for applications demanding more than promised by the OpenGL ABI |
| 1031 |
|
| 1032 |
// OpenGL extension forwarders |
| 1033 |
#define Pcxx . . $ `libglfork.cpp:1033:9`!(name) \ |
| 1034 |
void ifunc_##name(void) asm(#name) __attribute__((visibility("default"),ifunc("i" #name))); \ |
| 1035 |
extern "C" { static void *i##name(void) \ |
| 1036 |
{ return primus.afns.handle ? real_dlsym(primus.afns.handle, #name) : NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; } } |
| 1037 |
#include "glext-passthru.def"cxx . . $ `<file>/glext-passthru.def`/ |
| 1038 |
#undef Pcxx . . $ `libglfork.cpp:1033:9`! |
| 1039 |
#endif |