Skip to content

Commit 9b5e4a1

Browse files
authored
fix(simd.h): fix leaking of Imath.h into public headers (#4062)
A recent change (PR 4026) tried to include Imath.h in cases where there was no SSE support (to provide a fallback implementation of matrix invert, because simd.h's native one requires SSE), but it had a mistake -- it used `#if !OIIO_SIMD_SSE` prior to that symbol being defined! This caused the header to always be included, which is not what we wanted, as we desired for that header to not be exposed in the public headers. This patch offers a temporary/partial fix by simply moving that guarded include later in the file to after OIIO_SIMD_SSE is defined. For architectures that support SSE, at least, this achieves our goal of not exposing Imath.h in public headers. I need this patch right away to solve a particular problem I'm running into. Longer term, we note that this isn't a full solution -- on non-SSE architectures (like ARM), it still ends up exposing Imath.h against our desire. For today, so be it. A better fix would be to rewrite our current SSE-requiring invert to change the SSE intrinsics therein to the wrapped kind we use with our simd classes, which will let it work fine with ARM. But I feel like that needs to be done carefully and with more testing than I can afford at this minute when I need this fix. I will return to it shortly, but need this patch now. Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent f2ebf59 commit 9b5e4a1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/include/OpenImageIO/simd.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@
4646

4747
#include <OpenImageIO/detail/fmt.h>
4848

49-
// Without SSE, we need to fall back on Imath for matrix44 invert
50-
#if !OIIO_SIMD_SSE
51-
# include <OpenImageIO/Imath.h>
52-
#endif
5349

5450

5551
//////////////////////////////////////////////////////////////////////////
@@ -279,6 +275,12 @@
279275
#endif
280276

281277

278+
// Without SSE, we need to fall back on Imath for matrix44 invert
279+
#if !OIIO_SIMD_SSE
280+
# include <OpenImageIO/Imath.h>
281+
#endif
282+
283+
282284
OIIO_NAMESPACE_BEGIN
283285

284286
namespace simd {

0 commit comments

Comments
 (0)