-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to accommodate upcoming Imath vector conversion changes (#2878)
I have submitted a PR to Imath that adds "interopability" constructors and assignment, that use some templates to allow seamless construction, assignment, and passing of "foreign" vector types to Imath vectors. This makes it easier library A that uses Imath vector types in its API to interact with app or library B that has a custom internal vector type, without a ton of ugly casts and copies. (See AcademySoftwareFoundation/Imath#91) These created a few minor conflicts with OIIO's internal SIMD classes and their construction and casting from Imath types. This patch cleans up the ambiguities: * Make Imath::V4f -> simd::vfloat4 and Imath::M44f -> simd::matrix44 constructor `explicit`. * Make the simd types `simd()` method (returning the underlying raw SIMD type) also have a variety that returns a ref to a non-const vector, to ensure proper working of the _MM_TRANSPOSE4_PS macro. Now I am going to commit a sin. This MUST get backported to OIIO 2.2 in order for it to not break against the upcoming Imath 3.0. This doesn't break ABI compatibility, nor change OIIO's primary advertised public APIs, but it does change the technically/informally public APIs of simd.h in ways that introduce the possibility that an app using those simd vector classes *might* need minor source code editing if they relied on those implicit constructors. Such software might need certain `simd::vector4 foo = imath_bar` to become `foo = vector4(bar)` and the same for certain matrix44 assignments. It is usually a big no-no to backport any change that could require editing of source code. But since the alternative is not being able to use the new Imath, I think this is the lesser evil, and maybe nobody out there is doing the thing that would need to be changed?
- Loading branch information
Showing
2 changed files
with
44 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters