Skip to content

More changes to hide Imath: new half.h, improve vecparam.h #3406

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

Merged
merged 1 commit into from
May 7, 2022

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented May 2, 2022

Another round to hide Imath externally to OIIO public headers as well
as speed up our own builds.

  • Remove the external reference to Imath::M44f from color.h, and instead
    use M44fParam.

  • The <OpenImageIO/Imath.h> includes the most commonly used Imath
    headers including half.h. But this is unnecessarily expensive (and
    presumptuous about wanting other Imath types as well as fmt.h) if
    you just need to know about half. So we create a new
    <OpenImageIO/half.h> that only includes what you need for half
    (as before, with logic to handle the changing location of the half.h
    header depending on whether you're using Imath 3.x or OpenEXR 2.x).

  • Several files that included Imath.h, but in reality only needed half
    all along, change to including OpenImageIO/half.h.

  • simd.h leans more on vecparam.h and other template trickery to
    reduce exposure of methods that only work in the presence of Imath
    headers, and make fewer use cases that would care whether the Imath
    headers are included before or after simd.h (which is less
    controllable for unity builds).

  • Vec3Param gains a cast<V>() templated method that allows easy
    casting to foreign vector types even if Imath headers are not
    included prior to vecparam.h being included (which is less
    controllable for unity builds).

Another round to hide Imath externally to OIIO public headers as well
as speed up our own builds.

* Remove the external reference to Imath::M44f from color.h, and instead
  use M44fParam.

* The `<OpenImageIO/Imath.h>` includes the most commonly used Imath
  headers including half.h. But this is unnecessarily expensive (and
  presumptuous about wanting other Imath types as well as fmt.h) if
  you just need to know about `half`.  So we create a new
  `<OpenImageIO/half.h>` that only includes what you need for `half`
  (as before, with logic to handle the changing location of the half.h
  header depending on whether you're using Imath 3.x or OpenEXR 2.x).

* Several files that included Imath.h, but in reality only needed half
  all along, change to including OpenImageIO/half.h.

* simd.h leans more on vecparam.h and other template trickery to
  reduce exposure of methods that only work in the presence of Imath
  headers, and make fewer use cases that would care whether the Imath
  headers are included before or after simd.h (which is less
  controllable for unity builds).

* Vec3Param gains a `cast<V>()` templated method that allows easy
  casting to foreign vector types even if Imath headers are not
  included prior to vecparam.h being included (which is less
  controllable for unity builds).
@lgritz lgritz merged commit 3f58a8d into AcademySoftwareFoundation:master May 7, 2022
@lgritz lgritz deleted the lg-half branch May 7, 2022 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant