Skip to content

Use libloading to load d3dcompiler_47.dll #7531

@RedMindZ

Description

@RedMindZ

Is your feature request related to a problem? Please describe.
Some windows machines may lack d3dcompiler_47.dll. Specifically in my case, I have a windows 7 machine where this dll is missing, preventing my program from running, even though the program doesn't use FXC, and is otherwise compatible with windows 7.

Describe the solution you'd like
Place FXC behind a feature flag. Specifically, I believe the call to Fxc::D3DCompile is the only usage of d3dcompiler_47.dll, so putting this call behind a feature flag should remove the dependency on the dll.

Describe alternatives you've considered
Given that FXC is a legacy compiler, and now that we have the static-dxc feature, it might be reasonable to outright remove FXC. This is a more drastic solution that could reduce future maintenance work, but is probably unnecessary for now. Putting FXC behind a feature flag will also make migration easier for users.

Additional context
While windows 7 is a tier 3 target for rust, I still believe this feature would be valuable to produce smaller executables with less dependencies, leading to compatibility with more systems. There is no reason to depend on a dll that doesn't actually get used. Especially with the advent of static-dxc, now there should be very few reasons to ever use FXC, and maybe it should even be disabled by default.

If this feature sounds reasonable to you, I would be happy to implement a PR. This seems like a rather simple feature to me, but I am not too familiar with the codebase, so if there are any roadblocks or complications that I should be aware of, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions