-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ext/geometry): Geometry Interfaces Module Level 1 #27527
base: main
Are you sure you want to change the base?
Conversation
I'll work on using denoland/deno_core#1003 to reduce the JavaScript code. |
e7aa097
to
f3e416f
Compare
// SAFETY: in-range access | ||
unsafe { | ||
*self.inner.borrow_mut().get_unchecked_mut(INDEX_M11) = value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest a normal array assignment.
pub fn m11(&self, value: f64) {
self.inner.borrow_mut().data.0[0][0] = value;
}
Since the array index is constant, and since Matrix4 internals are fixed-width arrays and the compiler knows the length of the array, the boundary checks disappear in the compiler's optimization. The execution efficiency will be exactly the same as get_unchecked_mut.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion! I will simply do the following to remove unsafe:
self.inner.borrow_mut().m11 = value;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the order of subscripts differs between nalgebra and DOMMatrix, so it would be easier to understand the code using unsafe as it is.
f3e416f
to
8102120
Compare
After I finish the implementation around Web IDL conversion, I will check if I can migrate from nalgebra to wgpu crate. I have concerns about the possibility of synchronously retrieving |
closes #21608
needs denoland/deno_core#1024