Skip to content
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

int: Simplify openexr includes #4304

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Jun 21, 2024

In master, since we have raised the minimum Imath/OpenEXR to 3.x, no more 2.x, we no longer need generate our Imath.h and half.h from templates, they can be turned into regular header files.

Additionally, define IMATH_HALF_NO_LOOKUP_TABLE in half.h before including Imath/half.h, which ensures that the Imath code we include converts float <-> half using actual inline code and not the lookup table. This can reduce or sometimes eliminate the need to link agains Imath only for the sake of accessing that lookup table.

In master, since we have raised the minimum Imath/OpenEXR to 3.x, no
more 2.x, we no longer need generate our Imath.h and half.h from
templates, they can be turned into regular header files.

Additionally, define IMATH_HALF_NO_LOOKUP_TABLE in half.h before
including Imath/half.h, which ensures that the Imath code we include
converts float <-> half using actual inline code and not the lookup
table. This can reduce or sometimes eliminate the need to link agains
Imath only for the sake of accessing that lookup table.

Signed-off-by: Larry Gritz <[email protected]>
@fpsunflower
Copy link
Contributor

A side question that I guess is more about Imath itself -- why is IMATH_HALF_NO_LOOKUP_TABLE even necessary? Wouldn't most people prefer to have the inline implementation that doesn't require linking?

What happens if someone includes the half.h header without that define before they include the OIIO headers?

@lgritz
Copy link
Collaborator Author

lgritz commented Jun 22, 2024

A side question that I guess is more about Imath itself -- why is IMATH_HALF_NO_LOOKUP_TABLE even necessary?

It may have been an escape valve when the inline implementation was added, in case it was found to be broken or had some case where it was not performant enough. It's possible that it's no longer needed or should be the default.

What happens if someone includes the half.h header without that define before they include the OIIO headers?

They would get the table. But if they're using half.h in their code for some reason, they are already linking (or should be) against libImath. That's on them. What this is designed to address is the case where they don't even know that the half conversions are used by OIIO internally, and thus are unaware that they might need to link libImath at all.

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.

None yet

2 participants