Skip to content

Commit

Permalink
Use impl_retriever macro for WebGL retriever
Browse files Browse the repository at this point in the history
  • Loading branch information
elftausend committed Sep 24, 2024
1 parent 40603f9 commit b6d9ed0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ min-cl = { git = "https://github.com/elftausend/min-cl", optional = true }

[features]
# default = ["cpu", "opencl", "cuda", "blas", "static-api", "stack", "macro", "nnapi", "untyped", "autograd", "autograd", "cached", "lazy", "fork", "graph", "serde"]
default = ["cpu", "untyped", "lazy", "graph", "webgl"]
default = ["cpu", "untyped", "lazy", "graph", "webgl", "cached"]
# default = [ "cpu", "lazy", "autograd", "graph"]
# default = ["untyped", "cpu", "lazy", "graph", "autograd", "fork", "serde", "json", "half", "cached", "static-api", "stack", "opencl", ]

Expand Down
22 changes: 1 addition & 21 deletions src/devices/webgl/webgl_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl Default for WebGL {
}
}

crate::impl_retriever!(WebGL, WebGlNumber + Copy + Default);
crate::impl_buffer_hook_traits!(WebGL);
crate::impl_wrapped_data!(WebGL);

Expand Down Expand Up @@ -191,27 +192,6 @@ where
}
}

impl<T, Mods, S> Retriever<T, S> for WebGL<Mods>
where
T: WebGlNumber + Default + Copy,
Mods: Retrieve<Self, T, S>,
S: Shape,
{
fn retrieve<const NUM_PARENTS: usize>(
&self,
len: usize,
parents: impl crate::Parents<NUM_PARENTS>,
) -> crate::Result<Buffer<T, Self, S>> {
let data = unsafe { self.modules.retrieve::<NUM_PARENTS>(self, len, parents)? };
let buf = Buffer {
data,
device: Some(self),
};
self.modules.on_retrieve_finish(&buf);
Ok(buf)
}
}

impl<T, Mods, S> Read<T, S> for WebGL<Mods>
where
T: WebGlNumber + Default + Clone + 'static,
Expand Down

0 comments on commit b6d9ed0

Please sign in to comment.