-
Notifications
You must be signed in to change notification settings - Fork 149
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
Add basic logic operations to Vec*Mask
types.
#9
Comments
Sounds good! Ideally please provide a test for each new type method and a scalar fallback implementation that passes the test ( |
Will do! Thank you! For writing tests I'll need a way to construct new arbitrary |
You could create arbitrary masks indirectly by doing comparisons, e.g. |
Okay, thanks! I added a |
@cessen I guess this can be closed now? |
Ah, yes! Implemented in PR #12. Yay! \o/ |
I would like to implement
or
,and
, andnot
operators for the variousVec*Mask
types.My use-case:
In my path tracer I accumulate the results of many ray/box intersection tests via an
or
operation, as part of a ray streaming architecture. Rays are tested against four bounding boxes at once via SIMD, and the results from many rays are accumulated via the SSE_mm_or_ps()
intrinsic.In my specific case, I only need the
or
operation onVec4Mask
. However,or
,and
, andnot
seem like they would be generally useful for the mask types, given that they essentially represent boolean values.Alternative
The same logical result can be achieved with glam already by first converting to a bitmask and using integer operations. But that adds an additional conversion operation in a tight loop, instead of doing the conversion once at the end of the accumulation. Having these operators available directly on the mask types allows writing more efficient code.
The text was updated successfully, but these errors were encountered: