Skip to content

Commit

Permalink
Fix compute shader generation for wgpu 23
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelStruckWO authored and Swoorup committed Dec 13, 2024
1 parent 8ca10ce commit 2b24b5f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions example/src/shader_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,8 @@ fn fragment_main(input_1: VertexOutput) -> @location(0) vec4<f32> {
) -> () {
composer
.add_composable_module(naga_oil::compose::ComposableModuleDescriptor {
source: include_str!("..\\shaders\\utils\\types.wgsl"),
file_path: "..\\shaders\\utils\\types.wgsl",
source: include_str!("../shaders/utils/types.wgsl"),
file_path: "../shaders/utils/types.wgsl",
language: naga_oil::compose::ShaderLanguage::Wgsl,
shader_defs: shader_defs.clone(),
as_name: Some("utils::types".into()),
Expand All @@ -1081,8 +1081,8 @@ fn fragment_main(input_1: VertexOutput) -> @location(0) vec4<f32> {
) -> wgpu::naga::Module {
composer
.make_naga_module(naga_oil::compose::NagaModuleDescriptor {
source: include_str!("..\\shaders\\testbed.wgsl"),
file_path: "..\\shaders\\testbed.wgsl",
source: include_str!("../shaders/testbed.wgsl"),
file_path: "../shaders/testbed.wgsl",
shader_defs,
..Default::default()
})
Expand Down Expand Up @@ -1116,10 +1116,10 @@ fn fragment_main(input_1: VertexOutput) -> @location(0) vec4<f32> {
})
}
pub const SHADER_ENTRY_PATH: &str = include_absolute_path::include_absolute_path!(
"..\\shaders\\testbed.wgsl"
"../shaders/testbed.wgsl"
);
pub const UTILS_TYPES_PATH: &str = include_absolute_path::include_absolute_path!(
"..\\shaders\\utils\\types.wgsl"
"../shaders/utils/types.wgsl"
);
pub const SHADER_PATHS: &[&str] = &[SHADER_ENTRY_PATH, UTILS_TYPES_PATH];
pub fn load_shader_modules_from_path(
Expand All @@ -1132,7 +1132,7 @@ fn fragment_main(input_1: VertexOutput) -> @location(0) vec4<f32> {
composer
.add_composable_module(naga_oil::compose::ComposableModuleDescriptor {
source: &std::fs::read_to_string(UTILS_TYPES_PATH).unwrap(),
file_path: "..\\shaders\\utils\\types.wgsl",
file_path: "../shaders/utils/types.wgsl",
language: naga_oil::compose::ShaderLanguage::Wgsl,
shader_defs: shader_defs.clone(),
as_name: Some("utils::types".into()),
Expand All @@ -1147,7 +1147,7 @@ fn fragment_main(input_1: VertexOutput) -> @location(0) vec4<f32> {
composer
.make_naga_module(naga_oil::compose::NagaModuleDescriptor {
source: &std::fs::read_to_string(SHADER_ENTRY_PATH).unwrap(),
file_path: "..\\shaders\\testbed.wgsl",
file_path: "../shaders/testbed.wgsl",
shader_defs,
..Default::default()
})
Expand Down Expand Up @@ -1551,8 +1551,8 @@ fn fs_main(in_1: VertexOutput) -> @location(0) vec4<f32> {
) -> wgpu::naga::Module {
composer
.make_naga_module(naga_oil::compose::NagaModuleDescriptor {
source: include_str!("..\\shaders\\triangle.wgsl"),
file_path: "..\\shaders\\triangle.wgsl",
source: include_str!("../shaders/triangle.wgsl"),
file_path: "../shaders/triangle.wgsl",
shader_defs,
..Default::default()
})
Expand Down Expand Up @@ -1586,7 +1586,7 @@ fn fs_main(in_1: VertexOutput) -> @location(0) vec4<f32> {
})
}
pub const SHADER_ENTRY_PATH: &str = include_absolute_path::include_absolute_path!(
"..\\shaders\\triangle.wgsl"
"../shaders/triangle.wgsl"
);
pub const SHADER_PATHS: &[&str] = &[SHADER_ENTRY_PATH];
pub fn load_shader_modules_from_path(
Expand All @@ -1605,7 +1605,7 @@ fn fs_main(in_1: VertexOutput) -> @location(0) vec4<f32> {
composer
.make_naga_module(naga_oil::compose::NagaModuleDescriptor {
source: &std::fs::read_to_string(SHADER_ENTRY_PATH).unwrap(),
file_path: "..\\shaders\\triangle.wgsl",
file_path: "../shaders/triangle.wgsl",
shader_defs,
..Default::default()
})
Expand Down
6 changes: 3 additions & 3 deletions wgsl_bindgen/src/generate/shader_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<'a> ComputeModuleBuilder<'a> {
label: Some(#label),
layout: Some(&layout),
module: &module,
entry_point: #entry_point,
entry_point: Some(#entry_point),
compilation_options: Default::default(),
cache: None,
})
Expand Down Expand Up @@ -656,7 +656,7 @@ mod tests {
label: Some("Compute Pipeline main1"),
layout: Some(&layout),
module: &module,
entry_point: "main1",
entry_point: Some("main1"),
compilation_options: Default::default(),
cache: None,
},
Expand All @@ -672,7 +672,7 @@ mod tests {
label: Some("Compute Pipeline main2"),
layout: Some(&layout),
module: &module,
entry_point: "main2",
entry_point: Some("main2"),
compilation_options: Default::default(),
cache: None,
},
Expand Down
4 changes: 2 additions & 2 deletions wgsl_bindgen/tests/output/bindgen_main.expected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub mod main {
label: Some("Compute Pipeline main"),
layout: Some(&layout),
module: &module,
entry_point: "main",
entry_point: Some("main"),
compilation_options: Default::default(),
cache: None,
},
Expand All @@ -341,7 +341,7 @@ pub mod main {
label: Some("Compute Pipeline main"),
layout: Some(&layout),
module: &module,
entry_point: "main",
entry_point: Some("main"),
compilation_options: Default::default(),
cache: None,
},
Expand Down
2 changes: 1 addition & 1 deletion wgsl_bindgen/tests/output/bindgen_minimal.expected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub mod minimal {
label: Some("Compute Pipeline main"),
layout: Some(&layout),
module: &module,
entry_point: "main",
entry_point: Some("main"),
compilation_options: Default::default(),
cache: None,
})
Expand Down
2 changes: 1 addition & 1 deletion wgsl_bindgen/tests/output/bindgen_padding.expected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub mod padding {
label: Some("Compute Pipeline main"),
layout: Some(&layout),
module: &module,
entry_point: "main",
entry_point: Some("main"),
compilation_options: Default::default(),
cache: None,
})
Expand Down

0 comments on commit 2b24b5f

Please sign in to comment.