spirv_backend: strip out the glam stuff, except for the lib.rs interface
This commit is contained in:
@@ -8,8 +8,7 @@
|
||||
|
||||
extern crate spirv_std;
|
||||
|
||||
pub use glam::{UVec3, Vec3};
|
||||
use spirv_std::glam;
|
||||
pub use spirv_std::glam::{UVec3, Vec3};
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
use spirv_std::macros::spirv;
|
||||
|
||||
@@ -24,8 +23,12 @@ use mat::{IsoConductorOr, Ferroxcube3R1MH, FullyGenericMaterial, Material};
|
||||
|
||||
type Iso3R1 = IsoConductorOr<Ferroxcube3R1MH>;
|
||||
|
||||
fn glam_vec_to_internal(v: UVec3) -> UVec3Std {
|
||||
UVec3Std::new(v.x, v.y, v.z)
|
||||
}
|
||||
|
||||
fn step_h<M: Material>(
|
||||
id: UVec3,
|
||||
id: UVec3Std,
|
||||
meta: &SerializedSimMeta,
|
||||
stimulus_h: &UnsizedArray<Vec3Std>,
|
||||
material: &UnsizedArray<M>,
|
||||
@@ -33,7 +36,7 @@ fn step_h<M: Material>(
|
||||
h: &mut UnsizedArray<Vec3Std>,
|
||||
m: &mut UnsizedArray<Vec3Std>,
|
||||
) {
|
||||
if id.x < meta.dim.x() && id.y < meta.dim.y() && id.z < meta.dim.z() {
|
||||
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 = sim_state.index(id);
|
||||
update_state.step_h();
|
||||
@@ -41,14 +44,14 @@ fn step_h<M: Material>(
|
||||
}
|
||||
|
||||
fn step_e<M: Material>(
|
||||
id: UVec3,
|
||||
id: UVec3Std,
|
||||
meta: &SerializedSimMeta,
|
||||
stimulus_e: &UnsizedArray<Vec3Std>,
|
||||
material: &UnsizedArray<M>,
|
||||
e: &mut UnsizedArray<Vec3Std>,
|
||||
h: &UnsizedArray<Vec3Std>,
|
||||
) {
|
||||
if id.x < meta.dim.x() && id.y < meta.dim.y() && id.z < meta.dim.z() {
|
||||
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 = sim_state.index(id);
|
||||
@@ -91,7 +94,7 @@ macro_rules! steps {
|
||||
#[spirv(storage_buffer, descriptor_set = 0, binding = 5)] h: &mut UnsizedArray<Vec3Std>,
|
||||
#[spirv(storage_buffer, descriptor_set = 0, binding = 6)] m: &mut UnsizedArray<Vec3Std>,
|
||||
) {
|
||||
step_h(id, meta, stimulus_h, material, e, h, m)
|
||||
step_h(glam_vec_to_internal(id), meta, stimulus_h, material, e, h, m)
|
||||
}
|
||||
|
||||
#[spirv(compute(threads(4, 4, 4)))]
|
||||
@@ -107,7 +110,7 @@ macro_rules! steps {
|
||||
// XXX: can/should this m input be deleted?
|
||||
#[spirv(storage_buffer, descriptor_set = 0, binding = 6)] _unused_m: &UnsizedArray<Vec3Std>,
|
||||
) {
|
||||
step_e(id, meta, stimulus_e, material, e, h)
|
||||
step_e(glam_vec_to_internal(id), meta, stimulus_e, material, e, h)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user