After some recent changes BLI_math_base got (indirectly) included from DNA file, causing defines conflict in Cycles: Cycles wants the default fast behavior of square root, and BLI color wants it to be more preciese. Proposed solution is to move the SSE block away from the math_base closer to code which uses it. The initial intent was to make those functions reusable, but for a long long time the color utilities are the only users of those functions. This change does not prevent the error from re-occurring in the future if some code includes sse2neon and BLI color utilities, but it makes such conflict situation much less likely to happen, for now. The downside of this change is that the code now need to include BLI_simd.h explicitly to access BLI_HAVE_SSE2 instead of relying on it being included indirectly with math headers. The mitigation for this is to change semantic of the BLI_HAVE_SSE2: now it is defined to 1 if SSE2 is supported and to 0 otherwise. This makes it so the code needs to check if using `#if BLI_HAVE_SSE2` and if the BLI_simd.h is not included it will generate warning when using GCC or Clang. This change in semantic is is something the current patches would need to ensure is handled correctly. Pull Request: https://projects.blender.org/blender/blender/pulls/109664
27 lines
588 B
C
27 lines
588 B
C
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup bli
|
|
*
|
|
* SIMD instruction support.
|
|
*/
|
|
|
|
#if defined(__ARM_NEON) && defined(WITH_SSE2NEON)
|
|
/* SSE/SSE2 emulation on ARM Neon. Match SSE precision. */
|
|
# define SSE2NEON_PRECISE_MINMAX 1
|
|
# define SSE2NEON_PRECISE_DIV 1
|
|
# define SSE2NEON_PRECISE_SQRT 1
|
|
# include <sse2neon.h>
|
|
# define BLI_HAVE_SSE2 1
|
|
#elif defined(__SSE2__)
|
|
/* Native SSE2 on Intel/AMD. */
|
|
# include <emmintrin.h>
|
|
# define BLI_HAVE_SSE2 1
|
|
#else
|
|
# define BLI_HAVE_SSE2 0
|
|
#endif
|