Skip to content

Conversation

Firestar99
Copy link
Collaborator

@Firestar99 Firestar99 commented Aug 26, 2025

Requires #3027

This PR adds the rust-gpu integration to compile shader nodes into a giant wgsl shader file (with multiple entry points). The runtime componentry to run these shaders can be found in #2985

From weekly updates

End of week update (week 11):

$ git checkout shaders
$ cargo b -p graphene-raster-nodes
    Finished `dev` profile [optimized + debuginfo] target(s) in 0.26s
$ ll ./target/spirv-builder/spirv-unknown-naga-wgsl/release/deps/graphene_raster_nodes.wgsl -h
-rw-r--r-- 1 firestar99 users 149K Aug  3 23:37 ./target/spirv-builder/spirv-unknown-naga-wgsl/release/deps/graphene_raster_nodes.wgsl

@timon-schelling
Copy link
Collaborator

timon-schelling commented Aug 26, 2025

I think it should be rust-gpu cargo b -r ... otherwise rustup will be used right? rust-gpu toolchain should not be available without wrapper script.

@Keavon Keavon changed the title shaders: rust gpu integration Shaders: rust-gpu integration Aug 26, 2025
@Firestar99 Firestar99 changed the title Shaders: rust-gpu integration Shaders: rust-gpu integration to compile shader nodes to wgsl Aug 27, 2025
@Firestar99
Copy link
Collaborator Author

Firestar99 commented Aug 27, 2025

@timon-schelling I don't quite understand what you mean... could you attach that to some piece of code? Commit nix: use rustc_codegen_spirv.so from nix you made should contain the necessary switches to use the nix rust-gpu toolchain.

Resolved in voice call

@Firestar99 Firestar99 force-pushed the provide-cargo-rust-gpu-to-nix-devs branch from 17e8fd1 to c2f4f47 Compare August 27, 2025 12:08
@Firestar99 Firestar99 force-pushed the provide-cargo-rust-gpu-to-nix-devs branch from c2f4f47 to 0fd1e87 Compare August 28, 2025 13:43
@Firestar99 Firestar99 force-pushed the provide-cargo-rust-gpu-to-nix-devs branch from 0fd1e87 to 63d832e Compare August 29, 2025 11:07
@Firestar99 Firestar99 force-pushed the provide-cargo-rust-gpu-to-nix-devs branch from 63d832e to 0bdc23d Compare August 30, 2025 12:34
@Firestar99 Firestar99 force-pushed the shaders-rust-gpu branch 2 times, most recently from 28268aa to c93fb8f Compare August 30, 2025 12:49
Base automatically changed from provide-cargo-rust-gpu-to-nix-devs to master August 30, 2025 16:42
@timon-schelling
Copy link
Collaborator

timon-schelling commented Aug 30, 2025

I'm getting

warning: dropping unsupported crate type `dylib` for target `wasm32-unknown-unknown`
warning: `graphene-raster-nodes` (lib) generated 1 warning

@TrueDoctor take a close look at the macro changes
otherwise LGTM

@timon-schelling timon-schelling removed the request for review from Keavon August 30, 2025 18:23
@timon-schelling timon-schelling marked this pull request as ready for review August 30, 2025 18:23
@Firestar99
Copy link
Collaborator Author

I can't fix that warning, that's the crate-type = [...] in grasternodes. rust-gpu needs dylib and you also want the default lib for CPU stuff and wasm. Technically, this makes you compile a dylib on CPU targets as well, so you'll get an *.so in your target. And wasm doesn't support that and emits this warning. But you can't config that per-target nor pass it as a cargo arg, so we're stuck with this for now.

@Keavon Keavon changed the title Shaders: rust-gpu integration to compile shader nodes to wgsl Shaders: rust-gpu integration to compile shader nodes to WGSL Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants