Skip to content

Commit fdfbeb1

Browse files
committed
Add tests
Signed-off-by: sagudev <[email protected]>
1 parent 7fde061 commit fdfbeb1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

examples/standalone/custom_backend/src/custom.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl DeviceInterface for CustomDevice {
262262
}
263263

264264
#[derive(Debug)]
265-
struct CustomShaderModule(Counter);
265+
pub struct CustomShaderModule(pub Counter);
266266

267267
impl ShaderModuleInterface for CustomShaderModule {
268268
fn get_compilation_info(&self) -> Pin<Box<dyn wgpu::custom::ShaderCompilationInfoFuture>> {

examples/standalone/custom_backend/src/main.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::marker::PhantomData;
22

3-
use custom::Counter;
3+
use custom::{Counter, CustomShaderModule};
44
use wgpu::{DeviceDescriptor, RequestAdapterOptions};
55

66
mod custom;
@@ -31,11 +31,15 @@ async fn main() {
3131
.unwrap();
3232
assert_eq!(counter.count(), 5);
3333

34-
let _module = device.create_shader_module(wgpu::ShaderModuleDescriptor {
34+
let module = device.create_shader_module(wgpu::ShaderModuleDescriptor {
3535
label: Some("shader"),
3636
source: wgpu::ShaderSource::Dummy(PhantomData),
3737
});
3838

39+
let custom_module = module.as_custom::<CustomShaderModule>().unwrap();
40+
assert_eq!(custom_module.0.count(), 6);
41+
let _module_clone = module.clone();
42+
3943
assert_eq!(counter.count(), 6);
4044
}
4145
assert_eq!(counter.count(), 1);

0 commit comments

Comments
 (0)