mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Remove a bunch of unsafe code
This commit is contained in:
parent
4877e57032
commit
fc048e1667
11 changed files with 188 additions and 259 deletions
|
@ -1,8 +1,5 @@
|
|||
use super::context::Context;
|
||||
|
||||
use graph_craft::executor::{Any, Executor};
|
||||
|
||||
use graph_craft::proto::LocalFuture;
|
||||
use graphene_core::gpu::PushConstants;
|
||||
|
||||
use bytemuck::Pod;
|
||||
|
@ -38,22 +35,6 @@ impl<I: StaticTypeSized, O> GpuExecutor<I, O> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<I: StaticTypeSized + Sync + Pod + Send, O: StaticTypeSized + Send + Sync + Pod> Executor for GpuExecutor<I, O> {
|
||||
fn execute<'i>(&'i self, input: Any<'i>) -> LocalFuture<Result<Any<'i>, Box<dyn std::error::Error>>> {
|
||||
let input = dyn_any::downcast::<Vec<I>>(input).expect("Wrong input type");
|
||||
let context = &self.context;
|
||||
let result: Vec<O> = execute_shader(
|
||||
context.device.clone(),
|
||||
context.queue.clone(),
|
||||
self.shader.entry_point(&self.entry_point).expect("Entry point not found in shader"),
|
||||
&context.allocator,
|
||||
&context.command_buffer_allocator,
|
||||
*input,
|
||||
);
|
||||
Box::pin(async move { Ok(Box::new(result) as Any) })
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: make async
|
||||
fn execute_shader<I: Pod + Send + Sync, O: Pod + Send + Sync>(
|
||||
device: std::sync::Arc<Device>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue