-
Notifications
You must be signed in to change notification settings - Fork 17
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
Static Linking #57
Comments
See the |
Ah I see, that explains the issue. |
Thanks for the explanation! |
Not sure I follow: runtime linking (and dynamic linking) is rather straightforward if the final application provides the library, not in the least because that's the only thing distributed by Microsoft.
Distribution (and perhaps even support) to build
I have no intent to make dynamic linking (as opposed to runtime linking) the default but can definitely submit my efforts on the
As long as we're clear on runtime vs dynamic vs static linking :)
We've got our own implementation for hassle-rs/src/fake_sign/mod.rs Line 41 in f8c26ae
|
Yeah, sry about the confusion about all of this.
This is very interesting. So potentially a use-case for static linking is still on the table, but a lot of work still, obviously. I wonder what naga plans to do here when it implements DXBC, but if this method is reliable then maybe they can avoid having to sign shaders with |
Just checked MESA, they also just rely on |
Ack, yes, that's a valid "does not work out of the box otherwise" justification.
Not a lot if DXC itself supports being compiled statically, as this implementation already exists and lives purely in hassle-rs' Rust code.
Yup, keep us posted; we use this method internally at Traverse for quite some time already.
That's just Microsoft's tool to run on top of DirectX though, they have no reason to expose the internals of this implementation themselves if the systems they run on have access to dxil.dll 😉 - this shouldn't be used in any other way by mesa. |
@daxpedda I just started looking into this for #62 again, and it was actually quite trivial to modify DXC to build a static library, just drop Then unfortunately CMake emits a link "config" if we were to "install" this project, telling you all the many libraries to link rather than providing a single re This isn't going to fit in my time-plan at all, but to approach this I would have to:
|
That's awesome, thank you for the update! I guess the work necessary will need some time (microsoft/DirectXShaderCompiler#4766), but it seems to me that at the end there won't be a way around a new crate feature that will compile the DirectXShaderCompiler with the newly introduced option, which would be a significant burden on compile time. Or is there? In any case, that's good news, and I'm looking forward to what happens in microsoft/DirectXShaderCompiler#4766.
I have to say that as eager as I am to look more into this and spend some time to contribute, but I would rather die then touch CMake again, so not gonna touch this. Happy to contribute to |
As I explained to @Makogan in #62 we have many ways of going at this:
Effectively my plan is to not rule out any of these cases but support them all via some simple feature flags (some will have to be mutually exclusive I think) and/or guidelines (e.g. set the right library search path via TL;DR: No, I have no plans/time at all to compile DXC on the spot within the Rust crate. Will static-link against a precompiled / pre-provided And again, the main downside of prebuilts provided by
Thanks!
Don't worry, I already have the proof-of-concept oneliner change made, and hiding it behind an
Thanks again, but here also the branches and changes have already been made and just need to be cleaned after the features are switchable via feature flags. |
Thank you for all the detailed responses, it really clears up a lot of misconceptions I still have.
I briefly looked into this for Windows, but as far as I understand that would require users to install the Windows SDK, which I didn't actually confirm contains these libraries, but I confirmed that a clean Windows 10 install with all drivers doesn't include them.
That sounds totally reasonable to me.
I agree that this is probably not a good idea because of the size.
Considering option one is preferable (to us) anyway, not doing this is very reasonable.
I was more concerned about distribution. My hope is, that after getting generating the AR blob upstream, Microsoft will actually distribute it alongside their releases ... otherwise we will have to build it ourselves, on some Windows machine, or get cross-compiling going ... which I'm not looking forward to. Compiling on CI might also turn out to be frustrating, but I didn't try so I should stop rambling now. |
This is more a case of the user providing it themselves, either in PWD, or via an env var (that may have been installed by another tool, the Vulkan SDK for example includes this library and I think also sets up the env vars such that it can be found). But on Linux, yes there are distros that provide a package OOTB!
Fair enough, might be a thing to take up with Microsoft, who after all provides the rest of DirectX pre-installed on Windows 😬 - but then again all games come with precompiled shaders for obvious reasons, so it is really a development tool whereas GPU drivers are ... obviously ... for the runtime 😬 |
Just to make sure, there are no typical consumer tools that one can expect a regular gamer to have installed that includes those libraries?
I'm all for pre-compiled shaders, but unfortunately EDIT:
After reading your response again I realized there might be a misunderstanding: I meant released as part of their DirectXShaderCompiler releases. |
Strongly doubt it, but I'm not a Windows user nor a game developer to tell :)
(Without reading context in that issue) this effort could still allow you to more easily embed a
The static library specifically? Yes, that's the desired outcome (and |
Good point! I guess I didn't think it through yet 😅
Our goals are aligned then! So this now just needs time and work, looking forward 🚀! |
https://github.com/hexops/mach-dxcompiler figured out how to do statically linked DXC builds, without cmake. |
Is there something preventing statically linking the DirectXShaderCompiler?
My understanding is that hassle doesn't actually build the compiler, but only provides an FFI interface, so statically linking would require building it as a library.
I've also read that shader validation is performed by the GPU/Driver, so is that why getting around the official dll's is not possible?
The text was updated successfully, but these errors were encountered: