Update rust-gpu to 0.10.0-alpha.1 (#4033)

* rust-gpu alpha.1: update nix flake

* rust-gpu alpha.1: disable non-working mold shell hook

* rust-gpu alpha.1: update rust-gpu to `0.10.0-alpha.1` on crates

* Review

* Fix gpu nodes

* Reduce wasm size

---------

Co-authored-by: Timon <me@timon.zip>
This commit is contained in:
Firestar99
2026-04-28 01:53:49 +02:00
committed by GitHub
parent 3d84e63ef9
commit 824d1162eb
17 changed files with 61 additions and 261 deletions

View File

@@ -40,7 +40,6 @@ glam_array!(glam::Vec2, [f32; 2]);
glam_array!(glam::Vec3, [f32; 3]);
// glam_array!(Vec3A, [f32; 4]);
glam_array!(glam::Vec4, [f32; 4]);
glam_array!(glam::Quat, [f32; 4]);
glam_cols_array!(glam::Mat2, [f32; 4]);
glam_cols_array!(glam::Mat3, [f32; 9]);
// glam_cols_array!(Mat3A, [f32; 4]);
@@ -51,7 +50,6 @@ glam_cols_array!(glam::Affine3A, [f32; 12]);
glam_array!(glam::DVec2, [f64; 2]);
glam_array!(glam::DVec3, [f64; 3]);
glam_array!(glam::DVec4, [f64; 4]);
glam_array!(glam::DQuat, [f64; 4]);
glam_cols_array!(glam::DMat2, [f64; 4]);
glam_cols_array!(glam::DMat3, [f64; 9]);
glam_cols_array!(glam::DMat4, [f64; 16]);

View File

@@ -26,7 +26,6 @@ identity!(isize);
identity!(f32);
identity!(f64);
identity!(spirv_std::arch::SubgroupMask);
identity!(spirv_std::memory::Semantics);
identity!(spirv_std::ray_tracing::RayFlags);
identity!(spirv_std::indirect_command::DrawIndirectCommand);

View File

@@ -3,7 +3,7 @@ use crate::shader_runtime::per_pixel_adjust_runtime::PerPixelAdjustShaderRuntime
pub mod per_pixel_adjust_runtime;
pub const FULLSCREEN_VERTEX_SHADER_NAME: &str = "fullscreen_vertexfullscreen_vertex";
pub const FULLSCREEN_VERTEX_SHADER_NAME: &str = "fullscreen_vertex_fullscreen_vertex";
pub struct ShaderRuntime {
context: WgpuContext,

View File

@@ -70,8 +70,7 @@ impl PerPixelAdjustGraphicsPipeline {
let fragment_name = &name;
let fragment_name = &fragment_name[(fragment_name.find("::").unwrap() + 2)..];
// TODO workaround to naga removing `:`
let fragment_name = fragment_name.replace(":", "");
let fragment_name = fragment_name.replace("::", "_");
let shader_module = device.create_shader_module(ShaderModuleDescriptor {
label: Some(&format!("PerPixelAdjust {name} wgsl shader")),
source: ShaderSource::Wgsl(Cow::Borrowed(info.wgsl_shader)),

View File

@@ -66,7 +66,7 @@ impl ShaderCodegen for PerPixelAdjust {
}
}
let entry_point_mod = format_ident!("{}_gpu_entry_point", fn_name);
let entry_point_mod = format_ident!("{}_gpu", fn_name);
let entry_point_name_ident = format_ident!("ENTRY_POINT_NAME");
let entry_point_name = quote!(#entry_point_mod::#entry_point_name_ident);
let uniform_struct_ident = format_ident!("Uniform");

View File

@@ -6,12 +6,9 @@ description = "graphene raster data format"
authors = ["Graphite Authors <contact@graphite.art>"]
license = "MIT OR Apache-2.0"
[lib]
crate-type = ["rlib", "dylib"]
[dependencies]
[build-dependencies]
cargo-gpu = { workspace = true }
cargo-gpu-install = { workspace = true }
env_logger = { workspace = true }
log = { workspace = true }

View File

@@ -1,5 +1,5 @@
use cargo_gpu::InstalledBackend;
use cargo_gpu::spirv_builder::{MetadataPrintout, SpirvMetadata};
use cargo_gpu_install::install::{Install, InstalledBackend};
use cargo_gpu_install::spirv_builder::SpirvMetadata;
use std::path::PathBuf;
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -29,19 +29,18 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let rustc_codegen_spirv_path = std::env::var("RUSTC_CODEGEN_SPIRV_PATH").unwrap_or_default();
let backend = if rustc_codegen_spirv_path.is_empty() {
// install the toolchain and build the `rustc_codegen_spirv` codegen backend with it
cargo_gpu::Install::from_shader_crate(shader_crate.clone()).run()?
Install::from_shader_crate(shader_crate.clone()).run()?
} else {
// use the `RUSTC_CODEGEN_SPIRV` environment variable to find the codegen backend
let mut backend = InstalledBackend::default();
backend.rustc_codegen_spirv_location = PathBuf::from(rustc_codegen_spirv_path);
backend.toolchain_channel = "nightly".to_string();
backend.target_spec_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
backend
};
// build the shader crate
let mut builder = backend.to_spirv_builder(shader_crate, "spirv-unknown-naga-wgsl");
builder.print_metadata = MetadataPrintout::DependencyOnly;
builder.build_script.defaults = true;
builder.spirv_metadata = SpirvMetadata::Full;
let wgsl_result = builder.build()?;
let path_to_spv = wgsl_result.module.unwrap_single();

View File

@@ -6,8 +6,5 @@ description = "graphene raster nodes shaders entrypoint"
authors = ["Graphite Authors <contact@graphite.art>"]
license = "MIT OR Apache-2.0"
[lib]
crate-type = ["rlib", "dylib"]
[dependencies]
raster-nodes = { path = "../..", default-features = false }

View File

@@ -1,26 +0,0 @@
{
"allows-weak-linkage": false,
"arch": "spirv",
"crt-objects-fallback": "false",
"crt-static-allows-dylibs": true,
"crt-static-respected": true,
"data-layout": "e-m:e-p:32:32:32-i64:64-n8:16:32:64",
"dll-prefix": "",
"dll-suffix": ".spv.json",
"dynamic-linking": true,
"emit-debug-gdb-scripts": false,
"env": "naga-wgsl",
"linker-flavor": "unix",
"linker-is-gnu": false,
"llvm-target": "spirv-unknown-naga-wgsl",
"main-needs-argc-argv": false,
"metadata": {
"description": null,
"host_tools": null,
"std": null,
"tier": null
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
}