-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[GUI] [mac] Support fast_gui on macOS #1981
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1981 +/- ##
==========================================
- Coverage 43.43% 43.41% -0.03%
==========================================
Files 45 45
Lines 6264 6268 +4
Branches 1108 1109 +1
==========================================
Hits 2721 2721
- Misses 3369 3373 +4
Partials 174 174
Continue to review full report at Codecov.
|
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.
🚀 LGTMig + 2 nits!
python/taichi/lang/meta.py
Outdated
@@ -16,13 +16,24 @@ def tensor_to_ext_arr(tensor: ti.template(), arr: ti.ext_arr()): | |||
|
|||
|
|||
@ti.kernel | |||
def vector_to_fast_image(img: ti.template(), out: ti.ext_arr()): | |||
def vector_to_fast_image(img: ti.template(), small_endian: ti.template(), | |||
out: ti.ext_arr()): | |||
# FIXME: Why is ``for i, j in img:`` slower than: | |||
for i, j in ti.ndrange(*img.shape): | |||
u, v, w = min(255, max(0, int(img[i, img.shape[1] - 1 - j] * 255))) |
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.
Possible my fault, use r, g, b
instead of u, v, w
for clarity?
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.
Yep, fixed
python/taichi/lang/meta.py
Outdated
# We use i32 for |out| since OpenGL and Metal doesn't support u8 types | ||
# TODO: treat Cocoa and Big-endian machines, with XOR logic | ||
out[j * img.shape[0] + i] = w + (v << 8) + (u << 16) | ||
if ti.static(small_endian): |
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.
if ti.static(small_endian): | |
if ti.static(ti.get_os_name() != 'osx'): |
instead of passing a template argument?
Btw, can you confirm if all OS X machines are big-endian (and also all Win and Linux X11 are little-endian)?
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.
Fixed.
can you confirm if all OS X machines are big-endian
Given that the non-fast way is using big-endian and we don't hear users complain, I think this is safe. Let's just roll it out and see what happens, shall we?
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.
LGTM, thanks!
Sorry for the delay! Fixes #1976
Related issue = #1976
[Click here for the format server]