Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ wgpu = { version = "30.0.1", default-features = false, features = ["std", "parki
pollster = "1.0.1"

# rust-gpu
cargo-gpu-install = { version = "0.10.0" }
spirv-std = { version = "0.10.0" }
cargo-gpu-install = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }
spirv-std = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }

# math libraries
glam = { version = "0.33.11", default-features = false, features = ["bytemuck"] }
Expand Down
4 changes: 2 additions & 2 deletions generated/graphics/ash/cargo-gpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ gpu-allocator = { version = "0.28.0", default-features = false, features = ["std

# rust-gpu
# While `cargo-gpu` is backwards compatible with older rust-gpu versions, easiest is to just match the versions exactly.
cargo-gpu-install = { version = "0.10.0" }
spirv-std = { version = "0.10.0" }
cargo-gpu-install = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }
spirv-std = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }

# math libraries
glam = { version = "0.33.11", default-features = false, features = ["bytemuck"] }
Expand Down
8 changes: 5 additions & 3 deletions generated/graphics/ash/cargo-gpu/mygraphics/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ pub fn main() -> anyhow::Result<()> {
.copied()
.collect::<PathBuf>();

let target = "spirv-unknown-vulkan1.3";
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");
let mut builder = install.to_spirv_builder(crate_path, target);
builder.build_script.defaults = true;
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
println!("cargo::rustc-env=SHADER_SPV_PATH={}", spv_path.display());
let shader_path = compile_result.module.unwrap_single();

println!("cargo::rustc-env=SHADER_SPV_PATH={}", shader_path.display());
Ok(())
}
4 changes: 2 additions & 2 deletions generated/graphics/ash/spirv-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ gpu-allocator = { version = "0.28.0", default-features = false, features = ["std

# rust-gpu
# The version of the dependencies `spirv-builder` and `spirv-std` must match exactly!
spirv-builder = { version = "0.10.0" }
spirv-std = { version = "0.10.0" }
spirv-builder = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }
spirv-std = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }

# math libraries
glam = { version = "0.33.11", default-features = false, features = ["bytemuck"] }
Expand Down
8 changes: 5 additions & 3 deletions generated/graphics/ash/spirv-builder/mygraphics/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ pub fn main() -> anyhow::Result<()> {
.copied()
.collect::<PathBuf>();

let mut builder = SpirvBuilder::new(crate_path, "spirv-unknown-vulkan1.3");
let target = "spirv-unknown-vulkan1.3";
let mut builder = SpirvBuilder::new(crate_path, target);
builder.build_script.defaults = true;
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
println!("cargo::rustc-env=SHADER_SPV_PATH={}", spv_path.display());
let shader_path = compile_result.module.unwrap_single();

println!("cargo::rustc-env=SHADER_SPV_PATH={}", shader_path.display());
Ok(())
}
4 changes: 2 additions & 2 deletions generated/graphics/wgpu/cargo-gpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pollster = "1.0.1"

# rust-gpu
# While `cargo-gpu` is backwards compatible with older rust-gpu versions, easiest is to just match the versions exactly.
cargo-gpu-install = { version = "0.10.0" }
spirv-std = { version = "0.10.0" }
cargo-gpu-install = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }
spirv-std = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }

# math libraries
glam = { version = "0.33.11", default-features = false, features = ["bytemuck"] }
Expand Down
8 changes: 5 additions & 3 deletions generated/graphics/wgpu/cargo-gpu/mygraphics/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ pub fn main() -> anyhow::Result<()> {
.copied()
.collect::<PathBuf>();

let target = "spirv-unknown-naga-wgsl";
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");
let mut builder = install.to_spirv_builder(crate_path, target);
builder.build_script.defaults = true;
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
println!("cargo::rustc-env=SHADER_SPV_PATH={}", spv_path.display());
let shader_path = compile_result.module.unwrap_single();

println!("cargo::rustc-env=SHADER_WGSL_PATH={}", shader_path.display());
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use mygraphics_shaders::ShaderConstants;
use wgpu::{
ColorTargetState, ColorWrites, Device, FragmentState, FrontFace, MultisampleState,
PipelineLayoutDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology, RenderPass,
RenderPipeline, RenderPipelineDescriptor, TextureFormat, VertexState, include_spirv,
RenderPipeline, RenderPipelineDescriptor, TextureFormat, VertexState, include_wgsl,
};

#[derive(Debug, Clone)]
Expand All @@ -17,7 +17,7 @@ impl MyRenderPipeline {
global_bind_group_layout: &GlobalBindGroupLayout,
out_format: TextureFormat,
) -> anyhow::Result<Self> {
let module = device.create_shader_module(include_spirv!(env!("SHADER_SPV_PATH")));
let module = device.create_shader_module(include_wgsl!(env!("SHADER_WGSL_PATH")));

let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: Some("MyRenderPipeline layout"),
Expand Down
4 changes: 2 additions & 2 deletions generated/graphics/wgpu/spirv-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pollster = "1.0.1"

# rust-gpu
# The version of the dependencies `spirv-builder` and `spirv-std` must match exactly!
spirv-builder = { version = "0.10.0" }
spirv-std = { version = "0.10.0" }
spirv-builder = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }
spirv-std = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }

# math libraries
glam = { version = "0.33.11", default-features = false, features = ["bytemuck"] }
Expand Down
8 changes: 5 additions & 3 deletions generated/graphics/wgpu/spirv-builder/mygraphics/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ pub fn main() -> anyhow::Result<()> {
.copied()
.collect::<PathBuf>();

let mut builder = SpirvBuilder::new(crate_path, "spirv-unknown-vulkan1.3");
let target = "spirv-unknown-naga-wgsl";
let mut builder = SpirvBuilder::new(crate_path, target);
builder.build_script.defaults = true;
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
println!("cargo::rustc-env=SHADER_SPV_PATH={}", spv_path.display());
let shader_path = compile_result.module.unwrap_single();

println!("cargo::rustc-env=SHADER_WGSL_PATH={}", shader_path.display());
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use mygraphics_shaders::ShaderConstants;
use wgpu::{
ColorTargetState, ColorWrites, Device, FragmentState, FrontFace, MultisampleState,
PipelineLayoutDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology, RenderPass,
RenderPipeline, RenderPipelineDescriptor, TextureFormat, VertexState, include_spirv,
RenderPipeline, RenderPipelineDescriptor, TextureFormat, VertexState, include_wgsl,
};

#[derive(Debug, Clone)]
Expand All @@ -17,7 +17,7 @@ impl MyRenderPipeline {
global_bind_group_layout: &GlobalBindGroupLayout,
out_format: TextureFormat,
) -> anyhow::Result<Self> {
let module = device.create_shader_module(include_spirv!(env!("SHADER_SPV_PATH")));
let module = device.create_shader_module(include_wgsl!(env!("SHADER_WGSL_PATH")));

let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: Some("MyRenderPipeline layout"),
Expand Down
6 changes: 3 additions & 3 deletions graphics/Cargo.toml.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ pollster = "1.0.1"
# rust-gpu
{% if integration == "spirv-builder" -%}
# The version of the dependencies `spirv-builder` and `spirv-std` must match exactly!
spirv-builder = { version = "0.10.0" }
spirv-builder = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }
{% endif -%}
{% if integration == "cargo-gpu" -%}
# While `cargo-gpu` is backwards compatible with older rust-gpu versions, easiest is to just match the versions exactly.
cargo-gpu-install = { version = "0.10.0" }
cargo-gpu-install = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }
{% endif -%}
spirv-std = { version = "0.10.0" }
spirv-std = { version = "0.10.0", git = "https://github.com/Rust-GPU/rust-gpu.git", rev = "42d2720c67c3c643bf90a6faa8380bd6c6b5fb33" }

# math libraries
glam = { version = "0.33.11", default-features = false, features = ["bytemuck"] }
Expand Down
24 changes: 20 additions & 4 deletions graphics/mygraphics/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,29 @@ pub fn main() -> anyhow::Result<()> {
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");
let mut builder = install.to_spirv_builder(&crate_path, "");
builder.build_script.defaults = true;
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
println!("cargo::rustc-env=SHADER_SPV_PATH={}", spv_path.display());
// SPIR-V
{
builder.target = Some("spirv-unknown-vulkan1.3".to_owned());
let compile_result = builder.build()?;
println!(
"cargo::rustc-env=SHADER_SPV_PATH={}",
compile_result.module.unwrap_single().display()
);
}

// wgsl
{
builder.target = Some("spirv-unknown-naga-wgsl".to_owned());
let compile_result = builder.build()?;
println!(
"cargo::rustc-env=SHADER_WGSL_PATH={}",
compile_result.module.unwrap_single().display()
);
}
Ok(())
}
21 changes: 17 additions & 4 deletions graphics/mygraphics/build.rs.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,34 @@ pub fn main() -> anyhow::Result<()> {
.copied()
.collect::<PathBuf>();

{% if api == "ash" -%}
let target = "spirv-unknown-vulkan1.3";
{% endif -%}
{% if api == "wgpu" -%}
let target = "spirv-unknown-naga-wgsl";
{% endif -%}

{% if integration == "spirv-builder" -%}
let mut builder = SpirvBuilder::new(crate_path, "spirv-unknown-vulkan1.3");
let mut builder = SpirvBuilder::new(crate_path, target);
{% endif -%}
{% if integration == "cargo-gpu" -%}
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");
let mut builder = install.to_spirv_builder(crate_path, target);
{% endif -%}
builder.build_script.defaults = true;
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
println!("cargo::rustc-env=SHADER_SPV_PATH={}", spv_path.display());
let shader_path = compile_result.module.unwrap_single();

{% if api == "ash" -%}
println!("cargo::rustc-env=SHADER_SPV_PATH={}", shader_path.display());
{% endif -%}
{% if api == "wgpu" -%}
println!("cargo::rustc-env=SHADER_WGSL_PATH={}", shader_path.display());
{% endif -%}
Ok(())
}
4 changes: 2 additions & 2 deletions graphics/mygraphics/src/wgpu_renderer/render_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use mygraphics_shaders::ShaderConstants;
use wgpu::{
ColorTargetState, ColorWrites, Device, FragmentState, FrontFace, MultisampleState,
PipelineLayoutDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology, RenderPass,
RenderPipeline, RenderPipelineDescriptor, TextureFormat, VertexState, include_spirv,
RenderPipeline, RenderPipelineDescriptor, TextureFormat, VertexState, include_wgsl,
};

#[derive(Debug, Clone)]
Expand All @@ -17,7 +17,7 @@ impl MyRenderPipeline {
global_bind_group_layout: &GlobalBindGroupLayout,
out_format: TextureFormat,
) -> anyhow::Result<Self> {
let module = device.create_shader_module(include_spirv!(env!("SHADER_SPV_PATH")));
let module = device.create_shader_module(include_wgsl!(env!("SHADER_WGSL_PATH")));

let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: Some("MyRenderPipeline layout"),
Expand Down
Loading