-
-
Notifications
You must be signed in to change notification settings - Fork 441
Add the ability to supply multiple library paths in SearchPathContainer #1351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0abd791 to
1671ba4
Compare
|
re: openal id like the ability to choose to prioritize soft but its not a huge deal |
perhaps it should be changed to "prioritize" instead of "only soft" or "only native", true means prefer soft, then try native, false means prefer native, then try soft |
|
I agree with this, prioritise makes sense. |
4cadbd0 to
2e35013
Compare
HurricanKai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think overrides should be activated whenever the list contains something.
I don't have all the info on this, but in my mind in there the candidate to search for should've already been decided and simply loaded, with some logic higher up iterating through the array and finding the first functional candidate.
I think it's reasonable to account for a situation where one possible candidate is __Internal which needs the override, but another candidate can simply use the normal logic and should not also trigger the override.
I'm also not sure what happens it a candidate not ment to hit an override ends up in the override branch. They do all sorts of casting insanity to be efficient and trick the JIT into accepting invariants that are not immediately obvious otherwise. Breaking those might cause all sorts of bugs that I can't foresee anymore.
ah yeah i completely blanked on the override problem, thats an interesting one to solve hmm |
|
@Perksey do we just not allow multiple libnames on platforms with P/Invoke overrides? i cant think of a way this can really be done cleanly, unless we want to try all libnames as dynamically loaded using our dynamic loader first, and if that fails, then use the P/Invoke override, unless it is possible that the P/Invoke override may be detected as being able to be dynamically loaded, but shouldnt be for x or y reason |
|
I recommend:
This way the priority is still respected. |
|
I agree with perksey. Attempting different candidates and deciding which ones to use should be done at a higher level then overrides. |
3f75474 to
ad1099e
Compare
This means that now if loading OpenAL soft fails, ittl try to fall back to native, and if loading OpenAL native fails, ittl fall back to OpenAL soft
ad1099e to
c9bd443
Compare
This has now been implemented, with the codegen of [System.ObsoleteAttribute("This function is obsolete! Please use the string[] overload!")]
public static INativeContext CreateDefaultContext(string n)
{
if (n == "libSDL2.so")
return new OVERRIDE_1();
else if (n == "__Internal")
return new OVERRIDE_0();
else
return new Silk.NET.Core.Contexts.DefaultNativeContext(n);
}
public static INativeContext CreateDefaultContext(string[] n)
{
foreach (string name in n)
{
if (name == "libSDL2.so")
return new OVERRIDE_1();
else if (name == "__Internal")
return new OVERRIDE_0();
else if (Silk.NET.Core.Contexts.DefaultNativeContext.TryCreate(name, out DefaultNativeContext context))
return context;
}
throw new System.IO.FileNotFoundException("Could not load from any of the possible library names! Please make sure that the library is installed and in the right place!");
} |
|
Perfect, thank you! |
…er (#1351) * Add the ability to supply multiple library paths in SearchPathContainer * OpenAL: Change `soft` parameter from exclusive to preference This means that now if loading OpenAL soft fails, ittl try to fall back to native, and if loading OpenAL native fails, ittl fall back to OpenAL soft * SingletonSeparatedList -> SeparatedList * Loader: Allow fallible loading of native contexts and libraries * SilkTouch: Use fallible codepath for multiple libname fallback
…er (#1351) * Add the ability to supply multiple library paths in SearchPathContainer * OpenAL: Change `soft` parameter from exclusive to preference This means that now if loading OpenAL soft fails, ittl try to fall back to native, and if loading OpenAL native fails, ittl fall back to OpenAL soft * SingletonSeparatedList -> SeparatedList * Loader: Allow fallible loading of native contexts and libraries * SilkTouch: Use fallible codepath for multiple libname fallback
* Add the ability to supply multiple library paths in SearchPathContainer (#1351) * Add the ability to supply multiple library paths in SearchPathContainer * OpenAL: Change `soft` parameter from exclusive to preference This means that now if loading OpenAL soft fails, ittl try to fall back to native, and if loading OpenAL native fails, ittl fall back to OpenAL soft * SingletonSeparatedList -> SeparatedList * Loader: Allow fallible loading of native contexts and libraries * SilkTouch: Use fallible codepath for multiple libname fallback * Update patch notes for 2.17 release (#1360) * Make examples dispose windows (#1355) * Load Assimp from source, rather than nuget in GL tut 4.1 * Make all OpenGL examples dispose their IWindow objects properly * Make all Direct3D11 examples dispose their IWindow objects properly * Apply overload exclusions to Vtbl functions * Add DirectWrite bindings * Add no-obsolete-enum control descriptor to Direct2D bindings Any bindings after 2.16 should be using this control descriptor, as they arent released yet, and dont need to keep backwards compat * Direct2D: Dont Generate IDXGISurface * Add DirectWrite to solution * Make d3d9 use the D3DColorValue from DXGI While this is a breaking change, it effects approximately 0 people --------- Co-authored-by: Dylan Perks <[email protected]>
Summary of the PR
Closes #1333
Allows passing multiple library paths to CreateDefaultContext, and add multiple library path support into SearchPathContainer
Related issues, Discord discussions, or proposals
Links go here.
Further Comments
This also brings into consideration the possibility cleaning up of places such as OpenAL, so that it tries the native OpenAL, then later tries OpenAL-soft, instead of the "choose one or the other" that we have now,
@Perksey should the
AL.GetApi(bool)be deprecated withObsoleteAttributeand the new non-deprecated behaviour beNative Platform -> Soft?