* Most functions - including pthreads, malloc, free, etc are not safe to use in
signal handlers. So we use a simple spin-lock and manual linked-list to manage
our list of PIDs to wait on.
* This doesn't translate well to metalsl and is in general not very useful - we
were only doing it to avoid packing issues which in some cases are moot
anyway. E.g. the histogram buffer doesn't have to be std140 and packed like an
array of vectors, it can be std430 and packed like an array of uints.
* We implement this with dyld interposing. This means we must decide at compile
time which functions to be hooked - in particular we require a manually
curated list of functions that are actually exposed in the latest macOS GL
version. Fortunately this is not a moving target anymore so this list should
now be complete.
* The hooking is not complete:
- It doesn't do full context tracking, just context create and make current
- There's no drawable/window querying or tracking, so windows aren't properly processed and their size is wrong
* Also note that this does not support the replay side yet (CGLPlatform is still
mostly stubs) and capturing actually still crashes.
* The only formats the spec requires are for optimalTiledFeatures and already
requires all the usage bits we are going to enable ourselves. The only cases
where we can get in trouble is for formats that support a subset of those
features e.g. on linear tiled images.
* So we can safely remove the reported support for those formats and still be
compliant. The application must then work with that lack of support the same
way as it would do if the ICD itself didn't have that support.
* For some reason the actual paint event never makes it through after converting
to metal-compatible widgets, but painting in response to UpdateRequest (which
should become a paint really) works about as well.
* This assumes it will be used in concert with dyld interposing so it doesn't
actually do any hooking apart from intercepting dlopen/dlsym to substitute any
dynamic access to hooked functions. Otherwise it just fulfills the contract by
calling callbacks and populating original function pointers
* We never should have serialised size_t in the first place so this shouldn't
have happened, but since we want to keep some semblence of best-effort
backwards compatibility, we'll keep the code and just disable it on macOS.