spirv: sim: adjust so Step{E,H}Context
does not use ArrayHandle
the specific way to accomplish this is touchy. see <https://github.com/EmbarkStudios/rust-gpu/issues/312#issuecomment-738824131>: > So I'd say placing any of the spirv_std::storage_class types into an aggregate (including capturing it in a closure) is unsupported for now in our specific case, we can't return a tuple where one element is a `&` to a spirv Input, and another element is a `&mut` to a spirv Output. when we have a struct, it can enclose either ONLY inputs, or ONLY outputs -- not a mix. i'm not 100% on how the Serialized stuff works, since it appears to violate that. i guess that's exactly what this ArrayHandle stuff achieves though.
This commit is contained in:
@@ -39,10 +39,9 @@ fn step_h<R: Real, M: Material<R>>(
|
||||
) {
|
||||
if id.x() < meta.dim.x() && id.y() < meta.dim.y() && id.z() < meta.dim.z() {
|
||||
let sim_state = SerializedStepH::new(meta, stimulus_h, material, e, h, m);
|
||||
let (update_state, mut out_h, mut out_m) = sim_state.index(id);
|
||||
let update_state = sim_state.index(id);
|
||||
let (new_h, new_m) = update_state.step_h();
|
||||
out_h.write(new_h);
|
||||
out_m.write(new_m);
|
||||
sim_state.write_output(id, new_h, new_m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +56,9 @@ fn step_e<R: Real, M: Material<R>>(
|
||||
if id.x() < meta.dim.x() && id.y() < meta.dim.y() && id.z() < meta.dim.z() {
|
||||
let sim_state = SerializedStepE::new(meta, stimulus_e, material, e, h);
|
||||
|
||||
let (update_state, mut out_e) = sim_state.index(id);
|
||||
let update_state = sim_state.index(id);
|
||||
let new_e = update_state.step_e();
|
||||
out_e.write(new_e);
|
||||
sim_state.write_output(id, new_e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user