[DONOTMERGE] [native] Load SDL/glfw via dlopen instead of linking at build time #3736
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This modifies DXVK's SDL2 linkage to be dlopened rather than referenced at build time. This is an important part of #3451 which needs all WSI implementations to coexist while also not requiring hard dependencies on every possible WSI library in existence.
Notably absent from this draft is any sort of boilerplate to simplify loading SDL symbols: this does every declaration, every load, and every cast manually. Nobody in their right mind would want to maintain this, but I didn't want to start getting clever until there was a clear path forward for what DXVK's preferred style is here. Personally I like doing inline files that macro everything out (example: part 1, part 2), but that usually assumes all the API access comes from one place, which is not the case here.Major TODO items aside from the horrendous style:
libSDL2-2.0.so.0
but it'd be great to replace that with something likeSDL2_LIBRARY_NAME
.I'm not familiar with the dependency tree for DXVK internals, so if there's a way to just have one WsiLibrary instead of the weird one-off case I have in dxvk_sdl2_exts.cpp that would probably clean things up a lot!