First attempt at a GPU runner
CI / cargo fmt (push) Failing after 1m5s
CI / cargo test (push) Failing after 2m15s
CI / cargo test (GPU) (push) Successful in 16m58s

Currently failing with an error I don't understand:

```
wgpu error: Validation Error

Caused by:
  In Device::create_shader_module, label = '...\image_binary.spv'

Shader '...\image_binary.spv' parsing error: InvalidTypeWidth(1)
```
This commit is contained in:
2026-07-29 11:12:52 -04:00
parent 7ff19631ba
commit 53d5ad1422
15 changed files with 1482 additions and 276 deletions
+28
View File
@@ -0,0 +1,28 @@
use cargo_gpu_install::install::Install;
use cargo_gpu_install::spirv_builder::{Capability, ShaderPanicStrategy, SpirvMetadata};
use std::path::PathBuf;
pub fn main() -> anyhow::Result<()> {
let manifest_dir = env!("CARGO_MANIFEST_DIR");
let crate_path = [manifest_dir, "..", "image-binary"]
.iter()
.copied()
.collect::<PathBuf>();
let install = Install::from_shader_crate(crate_path.clone())
.within_build_script()
.run()?;
let mut builder = install.to_spirv_builder(crate_path, "spirv-unknown-vulkan1.3");
builder.build_script.defaults = true;
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;
builder.capabilities = vec![Capability::Int8, Capability::Int16, Capability::Int64];
let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
println!(
"cargo::rustc-env=SHADER_SPV_PATH_IMAGE_BINARY={}",
spv_path.display()
);
Ok(())
}