-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
For the last couple of Rust GPU projects I've been building my shaders using a standalone compiler, https://github.com/tombh/rust-gpu-cli, which is based on Bevy's https://github.com/Bevy-Rust-GPU/rust-gpu-builder.
My own reason for this is that I found it hard maintaining both my own application code and the shader code in the same repo. I think mostly because of rust-gpu
's requirement for a specific rust-toolchain.toml
.
I suspect cargo gpu
will also solve this problem? In which case I'd like to contribute and focus my efforts here instead 🤓
So some reflections as both a rust-gpu
and rust-gpu
CLI frontend user:
- Should
rust-gpu
always support both ways of compiling shaders? Therefore auto-magically in a monorepo and with a standalone CLI frontend? Personally I'm currently leaning towards only supporting the latter. There are so many unconventional moving parts in compiling Rust shaders that I think hiding too much of the magic can lead to more harm than good. - I see that
cargo gpu
will be published to crates.io. I wonder if it can be taken one step further and pre-compiled to static, cross-platform binaries? Possibly that's what you were discussing in Investigaterustup component
forcargo-gpu
#2? I've actually already had success with this on Github Actions: see https://github.com/tombh/rust-gpu-cli/pull/1/files It compileslibrustc_codegen_spirv.{so,dylib,dll}
. And then the actual finalrust-gpu-cli
app dynamically sets theLD_LIBRARY_PATH
(orDYLD_FALLBACK_LIBRARY_PATH
etc depending on the OS). The only problem I faced was thatrustup
can't cross-compilerustc-dev
so I haven't been able to getaarch64
binaries for Linux compiling yet. - Related to the previous point: is
rust-toolchain.toml
needed for compilinglibrustc_codegen_spirv.so
or for compiling shaders or for both? Because if it's just for compilinglibrustc_codegen_spirv.so
then does that mean that pre-compiled versions oflibrustc_codegen_spirv.so
would avoid the need forcargo gpu
to install its ownrustup
toolchains? - Also related to the above, am I understanding correctly that this project installs (or plans to install) Rust toolchains under the hood? I think it'd be good to mention that in the README. Especially if it installs to
~/.rustup/toolchains
. Also I think it'd be good to have the CLI be verbose by default about what it's doing. Even the simple fact thatcargo gpu build
is itself callingcargo build
/rustc
shouldn't be assumed knowledge. It took me a long time to arrive at even the basic understanding I currently have about howrust-gpu
works. So as much as a turnkey solution is a great idea, in my experience hiding all the inner workings wasn't so useful. - It's great to have bagged the
cargo gpu
namespace, but my first thought was that thegpu
namespace could refer to a lot more than just compiling shaders. I wonder if something likecargo rust-gpu
(whilst redundantly mentioning "rust") might be more appropriate?
Metadata
Metadata
Assignees
Labels
No labels