Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefnotch committed Nov 7, 2024
1 parent fad2f59 commit 2fd8353
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion example/src/compute_shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ pub mod compute {
}
}
pub const ENTRY_MAIN: &str = "main";
pub const SOURCE: &str = include_str!("compute_shader.wgsl");
pub fn create_shader_module(device: &wgpu::Device) -> wgpu::ShaderModule {
let source = std::borrow::Cow::Borrowed(include_str!("compute_shader.wgsl"));
let source = std::borrow::Cow::Borrowed(SOURCE);
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl(source),
Expand Down
3 changes: 2 additions & 1 deletion example/src/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ pub fn fs_main_entry(
constants: overrides.constants(),
}
}
pub const SOURCE: &str = include_str!("shader.wgsl");
pub fn create_shader_module(device: &wgpu::Device) -> wgpu::ShaderModule {
let source = std::borrow::Cow::Borrowed(include_str!("shader.wgsl"));
let source = std::borrow::Cow::Borrowed(SOURCE);
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl(source),
Expand Down
3 changes: 2 additions & 1 deletion wgsl_to_wgpu/src/data/fragment_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ pub fn fs_main_entry(targets: [Option<wgpu::ColorTargetState>; 0]) -> FragmentEn
constants: Default::default(),
}
}
pub const SOURCE: &str = "@fragment\nfn fs_main() {}\n";
pub fn create_shader_module(device: &wgpu::Device) -> wgpu::ShaderModule {
let source = std::borrow::Cow::Borrowed("@fragment\nfn fs_main() {}\n");
let source = std::borrow::Cow::Borrowed(SOURCE);
device
.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
Expand Down
3 changes: 2 additions & 1 deletion wgsl_to_wgpu/src/data/fragment_simple_rustfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ pub fn fs_main_entry(targets: [Option<wgpu::ColorTargetState>; 0]) -> FragmentEn
constants: Default::default(),
}
}
pub const SOURCE: &str = "@fragment\nfn fs_main() {}\n";
pub fn create_shader_module(device: &wgpu::Device) -> wgpu::ShaderModule {
let source = std::borrow::Cow::Borrowed("@fragment\nfn fs_main() {}\n");
let source = std::borrow::Cow::Borrowed(SOURCE);
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl(source),
Expand Down
3 changes: 2 additions & 1 deletion wgsl_to_wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,9 @@ mod test {
constants: Default::default(),
}
}
pub const SOURCE: &str = include_str!("shader.wgsl");
pub fn create_shader_module(device: &wgpu::Device) -> wgpu::ShaderModule {
let source = std::borrow::Cow::Borrowed(include_str!("shader.wgsl"));
let source = std::borrow::Cow::Borrowed(SOURCE);
device
.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
Expand Down
3 changes: 2 additions & 1 deletion wgsl_to_wgpu/tests/output/vertex_entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ pub fn vs_main_multiple_entry(
constants: Default::default(),
}
}
pub const SOURCE: &str = include_str!("shader.wgsl");
pub fn create_shader_module(device: &wgpu::Device) -> wgpu::ShaderModule {
let source = std::borrow::Cow::Borrowed(include_str!("shader.wgsl"));
let source = std::borrow::Cow::Borrowed(SOURCE);
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl(source),
Expand Down

0 comments on commit 2fd8353

Please sign in to comment.