Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Make xsimd required

Ivan Čukić9f2486769f95
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3e69f017f..d7f96fb47b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1295,7 +1295,11 @@ endif()
## write a version range in the find_package call. Instead we
## should try all the supported versions manually
##
-foreach(xsimd_version 8.1.0 9 10 11 12 13)
+## We're trying out more recent versions first to make
+## set_package_properties report the lowest one if no
+## xsimd is found
+##
+foreach(xsimd_version 13 12 11 10 9 8.1.0)
if(NOT xsimd_FOUND)
find_package(xsimd ${xsimd_version})
endif()
@@ -1304,12 +1308,10 @@ endforeach()
set_package_properties(xsimd PROPERTIES
DESCRIPTION "C++ wrappers for SIMD intrinsics"
URL "https://github.com/xtensor-stack/xsimd"
- TYPE OPTIONAL
+ TYPE REQUIRED
PURPOSE "Required by Krita for vectorization")
-macro_bool_to_01(xsimd_FOUND HAVE_XSIMD)
-configure_file(config-xsimd.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-xsimd.h )
-if(HAVE_XSIMD)
+if (xsimd_FOUND)
macro(ko_compile_for_all_implementations_no_scalar _objs _src)
if("aarch64" IN_LIST XSIMD_ARCH)
xsimd_compile_for_all_implementations(${_objs} ${_src} FLAGS ${xsimd_ARCHITECTURE_FLAGS} ONLY NEON64)
@@ -1328,6 +1330,14 @@ if(HAVE_XSIMD)
xsimd_compile_for_all_implementations(${_objs} ${_src} FLAGS ${xsimd_ARCHITECTURE_FLAGS} ONLY Scalar)
ko_compile_for_all_implementations_no_scalar(${_objs} ${_src})
endmacro()
+else()
+ # Make noop functions as they are used in nested cmake files
+ # without guards
+ macro(ko_compile_for_all_implementations_no_scalar _objs _src)
+ endmacro()
+
+ macro(ko_compile_for_all_implementations _objs _src)
+ endmacro()
endif()
##
diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt
index 06d5427c2e..40d6294daa 100644
--- a/benchmarks/CMakeLists.txt
+++ b/benchmarks/CMakeLists.txt
@@ -55,7 +55,6 @@ target_link_libraries(KisLowMemoryBenchmark kritaimage kritatestsdk)
target_link_libraries(KisAnimationRenderingBenchmark kritaimage kritaui kritatestsdk)
target_link_libraries(KisFilterSelectionsBenchmark kritaimage kritatestsdk)
-if(HAVE_XSIMD)
ko_compile_for_all_implementations_no_scalar(__per_arch_composition_objects kis_composition_benchmark.cpp)
message("Following objects are generated for the composition benchmark")
foreach(_obj IN LISTS __per_arch_composition_objects)
@@ -80,7 +79,6 @@ foreach(_obj IN LISTS __per_arch_composition_objects)
target_link_libraries(${_target} kritaimage kritatestsdk kritamultiarch)
endforeach()
-endif()
target_link_libraries(KisMaskGeneratorBenchmark kritaimage kritatestsdk)
target_link_libraries(KisThumbnailBenchmark kritaimage kritatestsdk)
diff --git a/benchmarks/kis_composition_benchmark.cpp b/benchmarks/kis_composition_benchmark.cpp
index 12baa7be5b..14116255f2 100644
--- a/benchmarks/kis_composition_benchmark.cpp
+++ b/benchmarks/kis_composition_benchmark.cpp
@@ -9,7 +9,7 @@
// for calculation of the needed alignment
#include <xsimd_extensions/xsimd.hpp>
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
#include <KoOptimizedCompositeOpOver32.h>
#include <KoOptimizedCompositeOpOver128.h>
#include <KoOptimizedCompositeOpCopy128.h>
@@ -44,7 +44,7 @@
#define MEMALIGN_FREE(p) free((p))
#endif
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
using float_v = xsimd::batch<float, xsimd::current_arch>;
#endif
@@ -231,7 +231,7 @@ QVector<Tile> generateTiles(int size,
{
QVector<Tile> tiles(size);
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
const int vecSize = float_v::size;
#else
const int vecSize = 1;
@@ -505,7 +505,7 @@ void benchmarkCompositeOp(const KoCompositeOp *op, const QString &postfix)
benchmarkCompositeOp(op, false, 1.0, 1.0, 0, 0, ALPHA_UNIT, ALPHA_UNIT);
}
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
template <typename channels_type>
void printError(quint8 *s, quint8 *d1, quint8 *d2, quint8 *msk1, int pos)
@@ -619,7 +619,7 @@ void checkRounding(qreal opacity, qreal flow, qreal averageOpacity = -1, quint32
void KisCompositionBenchmark::detectBuildArchitecture()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
using namespace xsimd;
qDebug() << "built for" << ppVar(current_arch().name());
@@ -646,105 +646,105 @@ void KisCompositionBenchmark::detectBuildArchitecture()
void KisCompositionBenchmark::checkRoundingAlphaDarken_05_03()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<AlphaDarkenCompositor32<quint8, quint32, KoAlphaDarkenParamsWrapperCreamy> >(0.5,0.3);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarken_05_05()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<AlphaDarkenCompositor32<quint8, quint32, KoAlphaDarkenParamsWrapperCreamy> >(0.5,0.5);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarken_05_07()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<AlphaDarkenCompositor32<quint8, quint32, KoAlphaDarkenParamsWrapperCreamy> >(0.5,0.7);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarken_05_10()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<AlphaDarkenCompositor32<quint8, quint32, KoAlphaDarkenParamsWrapperCreamy> >(0.5,1.0);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarken_05_10_08()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<AlphaDarkenCompositor32<quint8, quint32, KoAlphaDarkenParamsWrapperCreamy> >(0.5,1.0,0.8);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_03()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor128<float, false, true> >(0.5, 0.3, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_05()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor128<float, false, true> >(0.5, 0.5, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_07()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor128<float, false, true> >(0.5, 0.7, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_10()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor128<float, false, true> >(0.5, 1.0, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_10_08()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor128<float, false, true> >(0.5, 1.0, 0.8, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingOver()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor32<quint8, quint32, false, true> >(0.5, 0.3);
#endif
}
void KisCompositionBenchmark::checkRoundingOverRgbaU16()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor128<quint16, false, true> >(0.5, 1.0, -1, 8);
#endif
}
void KisCompositionBenchmark::checkRoundingOverRgbaF32()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<OverCompositor128<float, false, true> >(0.5, 1.0, -1, 16);
#endif
}
#include <cfenv>
void KisCompositionBenchmark::checkRoundingCopyRgbaU16()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<CopyCompositor128<quint16, false, true> >(0.5, 1.0, -1, 8);
#endif
}
void KisCompositionBenchmark::checkRoundingCopyRgbaF32()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
checkRounding<CopyCompositor128<float, false, true> >(0.5, 1.0, -1, 16);
#endif
}
@@ -1057,7 +1057,7 @@ void KisCompositionBenchmark::benchmarkMemcpy()
freeTiles(tiles, 0, 0);
}
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
const int vecSize = float_v::size;
const size_t uint8VecAlignment = qMax(vecSize * sizeof(quint8), sizeof(void *));
const size_t uint32VecAlignment = qMax(vecSize * sizeof(quint32), sizeof(void *));
@@ -1066,7 +1066,7 @@ const size_t floatVecAlignment = qMax(vecSize * sizeof(float), sizeof(void *));
void KisCompositionBenchmark::benchmarkUintFloat()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
using uint_v = xsimd::batch<unsigned int, xsimd::current_arch>;
const int dataSize = 4096;
@@ -1100,7 +1100,7 @@ void KisCompositionBenchmark::benchmarkUintFloat()
void KisCompositionBenchmark::benchmarkUintIntFloat()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
using uint_v = xsimd::batch<unsigned int, xsimd::current_arch>;
const int dataSize = 4096;
@@ -1132,7 +1132,7 @@ void KisCompositionBenchmark::benchmarkUintIntFloat()
void KisCompositionBenchmark::benchmarkFloatUint()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
using uint_v = xsimd::batch<unsigned int, xsimd::current_arch>;
const int dataSize = 4096;
@@ -1165,7 +1165,7 @@ void KisCompositionBenchmark::benchmarkFloatUint()
void KisCompositionBenchmark::benchmarkFloatIntUint()
{
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
using uint_v = xsimd::batch<unsigned int, xsimd::current_arch>;
const int dataSize = 4096;
void *ptr = 0;
diff --git a/config-xsimd.h.cmake b/config-xsimd.h.cmake
deleted file mode 100644
index e4bbda03ea..0000000000
--- a/config-xsimd.h.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-/* config-xsimd.h. Generated by cmake from config-xsimd.h.cmake */
-
-/* Define if you have xsimd */
-#cmakedefine HAVE_XSIMD 1
diff --git a/libs/flake/CMakeLists.txt b/libs/flake/CMakeLists.txt
index 6e050b796a..3cd509daef 100644
--- a/libs/flake/CMakeLists.txt
+++ b/libs/flake/CMakeLists.txt
@@ -22,7 +22,7 @@ endif()
# generate krita_xsimd_macos_workaround.h
configure_file(krita_xsimd_macos_workaround.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/krita_xsimd_macos_workaround.h)
-if(HAVE_XSIMD AND NOT DISABLE_CLIP_MASK_PAINTER_ON_MACOS)
+if(NOT DISABLE_CLIP_MASK_PAINTER_ON_MACOS)
ko_compile_for_all_implementations(__per_arch_alpha_applicator_factory_objs xsimd/KoClipMaskApplicatorFactoryImpl.cpp)
else()
set(__per_arch_alpha_applicator_factory_objs xsimd/KoClipMaskApplicatorFactoryImpl.cpp)
diff --git a/libs/flake/xsimd/KoClipMaskApplicator.h b/libs/flake/xsimd/KoClipMaskApplicator.h
index 9344c7cd8f..d051dc2e6e 100644
--- a/libs/flake/xsimd/KoClipMaskApplicator.h
+++ b/libs/flake/xsimd/KoClipMaskApplicator.h
@@ -21,7 +21,7 @@ struct KoClipMaskApplicator : public KoClipMaskApplicatorBase {
}
};
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && !defined(DISABLE_CLIP_MASK_PAINTER_ON_MACOS)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && !defined(DISABLE_CLIP_MASK_PAINTER_ON_MACOS)
template<typename _impl>
struct KoClipMaskApplicator<_impl,
@@ -69,6 +69,6 @@ struct KoClipMaskApplicator<_impl,
}
};
-#endif /* HAVE_XSIMD */
+#endif /* !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && !defined(DISABLE_CLIP_MASK_PAINTER_ON_MACOS) */
#endif // KOCLIPMASKAPPLICATOR_H
diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt
index 5950387b45..6fe5dd5864 100644
--- a/libs/image/CMakeLists.txt
+++ b/libs/image/CMakeLists.txt
@@ -19,15 +19,13 @@ if(FFTW3_FOUND)
include_directories(${FFTW3_INCLUDE_DIR})
endif()
-if(HAVE_XSIMD)
- ko_compile_for_all_implementations_no_scalar(__per_arch_circle_mask_generator_objs kis_brush_mask_applicator_factories.cpp)
- ko_compile_for_all_implementations_no_scalar(_per_arch_processor_objs kis_brush_mask_processor_factories.cpp)
+ko_compile_for_all_implementations_no_scalar(__per_arch_circle_mask_generator_objs kis_brush_mask_applicator_factories.cpp)
+ko_compile_for_all_implementations_no_scalar(_per_arch_processor_objs kis_brush_mask_processor_factories.cpp)
- message("Following objects are generated from the per-arch lib")
- foreach(_obj IN LISTS __per_arch_circle_mask_generator_objs _per_arch_processor_objs)
- message(" * ${_obj}")
- endforeach()
-endif()
+message("Following objects are generated from the per-arch lib")
+foreach(_obj IN LISTS __per_arch_circle_mask_generator_objs _per_arch_processor_objs)
+ message(" * ${_obj}")
+endforeach()
set(kritaimage_LIB_SRCS
tiles3/kis_tile.cc
diff --git a/libs/image/kis_antialiasing_fade_maker.h b/libs/image/kis_antialiasing_fade_maker.h
index befb6ac2b6..7d9cb3b62d 100644
--- a/libs/image/kis_antialiasing_fade_maker.h
+++ b/libs/image/kis_antialiasing_fade_maker.h
@@ -77,7 +77,7 @@ public:
return false;
}
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename A>
xsimd::batch_bool<float, A> needFade(xsimd::batch<float, A> &dist)
{
@@ -106,7 +106,7 @@ public:
return (outsideMask | fadeStartMask);
}
-#endif /* defined HAVE_XSIMD */
+#endif /* !defined XSIMD_NO_SUPPORTED_ARCHITECTURE */
private:
qreal m_radius;
@@ -201,7 +201,7 @@ public:
return false;
}
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename A>
xsimd::batch_bool<float, A> needFade(xsimd::batch<float, A> &xr, xsimd::batch<float, A> &yr) const
{
@@ -262,7 +262,7 @@ public:
}
}
-#endif /* defined HAVE_XSIMD */
+#endif /* !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) */
private:
qreal m_xLimit;
diff --git a/libs/image/kis_brush_mask_processor_factories.cpp b/libs/image/kis_brush_mask_processor_factories.cpp
index b0b107c843..add01cd46d 100644
--- a/libs/image/kis_brush_mask_processor_factories.cpp
+++ b/libs/image/kis_brush_mask_processor_factories.cpp
@@ -7,7 +7,7 @@
#include <xsimd_extensions/xsimd.hpp>
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
#include "kis_circle_mask_generator.h"
#include "kis_circle_mask_generator_p.h"
@@ -547,4 +547,4 @@ void FastRowProcessor<KisCurveRectangleMaskGenerator>::process<xsimd::current_ar
}
}
-#endif /* defined HAVE_XSIMD && XSIMD_UNIVERSAL_BUILD_PASS */
+#endif /* XSIMD_UNIVERSAL_BUILD_PASS */
diff --git a/libs/image/kis_brush_mask_vector_applicator.h b/libs/image/kis_brush_mask_vector_applicator.h
index f649c85767..55c5c45276 100644
--- a/libs/image/kis_brush_mask_vector_applicator.h
+++ b/libs/image/kis_brush_mask_vector_applicator.h
@@ -11,7 +11,7 @@
#include <xsimd_extensions/xsimd.hpp>
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) && XSIMD_UNIVERSAL_BUILD_PASS
#include "kis_brush_mask_scalar_applicator.h"
@@ -138,6 +138,6 @@ void KisBrushMaskVectorApplicator<MaskGenerator, impl>::processVector(const QRec
xsimd::vector_aligned_free(buffer);
}
-#endif /* defined HAVE_XSIMD */
+#endif /* !defined XSIMD_NO_SUPPORTED_ARCHITECTURE */
#endif /* KIS_BRUSH_VECTOR_APPLICATOR_H */
diff --git a/libs/image/vc_extra_math.h b/libs/image/vc_extra_math.h
index 160f59ac59..f250d216a7 100644
--- a/libs/image/vc_extra_math.h
+++ b/libs/image/vc_extra_math.h
@@ -10,7 +10,7 @@
#include <xsimd_extensions/xsimd.hpp>
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
class VcExtraMath
{
@@ -49,7 +49,7 @@ public:
return sign * y;
}
};
-#endif /* defined HAVE_XSIMD */
+#endif /* !defined XSIMD_NO_SUPPORTED_ARCHITECTURE */
#endif // VC_ADDITIONAL_MATH_H
diff --git a/libs/multiarch/CMakeLists.txt b/libs/multiarch/CMakeLists.txt
index 603d9eba3d..5de05e38d9 100644
--- a/libs/multiarch/CMakeLists.txt
+++ b/libs/multiarch/CMakeLists.txt
@@ -7,9 +7,7 @@ kis_add_library(kritamultiarch SHARED ${kritamultiarch_SRCS})
generate_export_header(kritamultiarch)
-if (HAVE_XSIMD)
- target_link_libraries(kritamultiarch PUBLIC xsimd)
-endif()
+target_link_libraries(kritamultiarch PUBLIC xsimd)
target_link_libraries(kritamultiarch
PUBLIC
diff --git a/libs/multiarch/KisSupportedArchitectures.cpp b/libs/multiarch/KisSupportedArchitectures.cpp
index 041b365c71..5ec3ff7ceb 100644
--- a/libs/multiarch/KisSupportedArchitectures.cpp
+++ b/libs/multiarch/KisSupportedArchitectures.cpp
@@ -54,25 +54,16 @@ struct ArchToStringFactory {
QString KisSupportedArchitectures::bestArchName()
{
- QString bestArchName = "<unavailable>";
-
-#ifdef HAVE_XSIMD
- detail::ArchToStringBase *archDetector =
- createOptimizedClass<detail::ArchToStringFactory>();
- bestArchName = archDetector->name();
-#endif
-
- return bestArchName;
+ detail::ArchToStringBase *archDetector = createOptimizedClass<detail::ArchToStringFactory>();
+ return archDetector->name();
}
-#ifdef HAVE_XSIMD
#if (XSIMD_VERSION_MAJOR >= 13 && XSIMD_VERSION_MINOR >=1) \
|| defined(XSIMD_HAS_ARCH_LIST_FIX_PR1032)
#define XSIMD_SUPPORTS_NEW_ARCH_DETECTION
#elif XSIMD_VERSION_MAJOR < 13
#define XSIMD_SUPPORTS_OLD_ARCH_DETECTION
#endif
-#endif
template<typename S>
struct is_supported_arch {
diff --git a/libs/multiarch/KoMultiArchBuildSupport.h b/libs/multiarch/KoMultiArchBuildSupport.h
index 1d3598f6f6..f25867777e 100644
--- a/libs/multiarch/KoMultiArchBuildSupport.h
+++ b/libs/multiarch/KoMultiArchBuildSupport.h
@@ -21,7 +21,6 @@ std::tuple<bool, bool> vectorizationConfiguration();
template<class FactoryType, class... Args>
auto createOptimizedClass(Args &&...param)
{
-#ifdef HAVE_XSIMD
bool useVectorization = true;
bool disableAVXOptimizations = false;
@@ -77,7 +76,6 @@ auto createOptimizedClass(Args &&...param)
std::forward<Args>(param)...);
}
#endif // XSIMD_WITH_SSE2
-#endif // HAVE_XSIMD
return FactoryType::template create<xsimd::generic>(
std::forward<Args>(param)...);
diff --git a/libs/multiarch/xsimd_extensions/config/xsimd_arch.hpp b/libs/multiarch/xsimd_extensions/config/xsimd_arch.hpp
index 840874936d..214e611223 100644
--- a/libs/multiarch/xsimd_extensions/config/xsimd_arch.hpp
+++ b/libs/multiarch/xsimd_extensions/config/xsimd_arch.hpp
@@ -41,7 +41,7 @@
namespace xsimd
{
-#if !defined(HAVE_XSIMD) || defined(XSIMD_IMPL) && (XSIMD_IMPL & IMPL_MASK) == Scalar
+#if defined(XSIMD_IMPL) && (XSIMD_IMPL & IMPL_MASK) == Scalar
using current_arch = generic;
#elif !defined(XSIMD_IMPL)
using current_arch = default_arch;
@@ -93,7 +93,7 @@ using current_arch = neon64;
// If the defined instruction sets don't match what's expected
// from the build flags, zonk out the included file.
-#if !defined(HAVE_XSIMD) || !defined(XSIMD_IMPL) || defined(XSIMD_IMPL) && (XSIMD_IMPL & IMPL_MASK) == Scalar
+#if !defined(XSIMD_IMPL) || defined(XSIMD_IMPL) && (XSIMD_IMPL & IMPL_MASK) == Scalar
#define XSIMD_UNIVERSAL_BUILD_PASS 3
#elif XSIMD_WITH_SSE2 && (XSIMD_IMPL & PLATFORM_MASK) == Intel_Architecture
#define XSIMD_UNIVERSAL_BUILD_PASS 2
diff --git a/libs/multiarch/xsimd_extensions/config/xsimd_config.hpp b/libs/multiarch/xsimd_extensions/config/xsimd_config.hpp
index 6f42f74415..fcbbe4f179 100644
--- a/libs/multiarch/xsimd_extensions/config/xsimd_config.hpp
+++ b/libs/multiarch/xsimd_extensions/config/xsimd_config.hpp
@@ -9,8 +9,6 @@
#include <config-xsimd.h>
-#ifdef HAVE_XSIMD
-
// MSVC patching.
#if defined(_MSC_VER)
#if defined(_M_ARM64)
@@ -33,18 +31,4 @@
#include <xsimd/xsimd.hpp>
-#else /* HAVE_XSIMD */
-
-namespace xsimd
-{
-struct generic
-{
- static constexpr bool supported() noexcept { return true; }
- static constexpr bool available() noexcept { return true; }
- static constexpr char const* name() noexcept { return "xsimd not available, unvectorized"; }
-};
-}; // namespace xsimd
-
-#endif /* HAVE_XSIMD */
-
#endif // KIS_XSIMD_CONFIG_HPP
diff --git a/libs/multiarch/xsimd_extensions/xsimd.hpp b/libs/multiarch/xsimd_extensions/xsimd.hpp
index ac97b0feac..954fdbac15 100644
--- a/libs/multiarch/xsimd_extensions/xsimd.hpp
+++ b/libs/multiarch/xsimd_extensions/xsimd.hpp
@@ -10,9 +10,9 @@
// xsimd detection and architecture setup.
#include "config/xsimd_arch.hpp"
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
// xsimd extensions.
#include "arch/xsimd_isa.hpp"
-#endif // HAVE_XSIMD
+#endif // !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
#endif // XSIMD_EXTENSIONS_H
diff --git a/libs/pigment/CMakeLists.txt b/libs/pigment/CMakeLists.txt
index c5c3e96293..b08c65345c 100644
--- a/libs/pigment/CMakeLists.txt
+++ b/libs/pigment/CMakeLists.txt
@@ -1,18 +1,13 @@
project(kritapigment)
-if(HAVE_XSIMD)
- ko_compile_for_all_implementations_no_scalar(__per_arch_factory_objs compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp)
- ko_compile_for_all_implementations(__per_arch_alpha_applicator_factory_objs KoAlphaMaskApplicatorFactoryImpl.cpp)
- ko_compile_for_all_implementations(__per_arch_rgb_scaler_factory_objs KoOptimizedPixelDataScalerU8ToU16FactoryImpl.cpp)
+ko_compile_for_all_implementations_no_scalar(__per_arch_factory_objs compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp)
+ko_compile_for_all_implementations(__per_arch_alpha_applicator_factory_objs KoAlphaMaskApplicatorFactoryImpl.cpp)
+ko_compile_for_all_implementations(__per_arch_rgb_scaler_factory_objs KoOptimizedPixelDataScalerU8ToU16FactoryImpl.cpp)
- message("Following objects are generated from the per-arch lib")
- foreach(_obj IN LISTS __per_arch_factory_objs __per_arch_alpha_applicator_factory_objs __per_arch_rgb_scaler_factory_objs)
- message(" * ${_obj}")
- endforeach()
-else()
- set(__per_arch_alpha_applicator_factory_objs KoAlphaMaskApplicatorFactoryImpl.cpp)
- set(__per_arch_rgb_scaler_factory_objs KoOptimizedPixelDataScalerU8ToU16FactoryImpl.cpp)
-endif()
+message("Following objects are generated from the per-arch lib")
+foreach(_obj IN LISTS __per_arch_factory_objs __per_arch_alpha_applicator_factory_objs __per_arch_rgb_scaler_factory_objs)
+ message(" * ${_obj}")
+endforeach()
add_subdirectory(tests)
add_subdirectory(benchmarks)
diff --git a/libs/pigment/KoAlphaMaskApplicator.h b/libs/pigment/KoAlphaMaskApplicator.h
index 91a1bbeee5..4f89cef438 100644
--- a/libs/pigment/KoAlphaMaskApplicator.h
+++ b/libs/pigment/KoAlphaMaskApplicator.h
@@ -50,7 +50,7 @@ struct KoAlphaMaskApplicator : public KoAlphaMaskApplicatorBase
}
};
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
#include "KoStreamedMath.h"
@@ -153,6 +153,6 @@ struct KoAlphaMaskApplicator<
}
};
-#endif /* HAVE_XSIMD */
+#endif /* !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE) */
#endif // KOALPHAMASKAPPLICATOR_H
diff --git a/libs/pigment/KoColorTransferFunctions.h b/libs/pigment/KoColorTransferFunctions.h
index a8ecfee817..b64a7a967d 100644
--- a/libs/pigment/KoColorTransferFunctions.h
+++ b/libs/pigment/KoColorTransferFunctions.h
@@ -142,7 +142,7 @@ ALWAYS_INLINE float removeSMPTE_ST_428Curve(float x) noexcept
#include <KoMultiArchBuildSupport.h>
-#if defined(HAVE_XSIMD) && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
#include <KoStreamedMath.h>
@@ -183,6 +183,6 @@ struct KoColorTransferFunctions {
}
};
-#endif // HAVE_XSIMD
+#endif // !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
#endif // KOCOLORTRANSFERFUNCTIONS_H
diff --git a/libs/pigment/KoOptimizedPixelDataScalerU8ToU16.h b/libs/pigment/KoOptimizedPixelDataScalerU8ToU16.h
index 5b97dbf00d..d2883baf05 100644
--- a/libs/pigment/KoOptimizedPixelDataScalerU8ToU16.h
+++ b/libs/pigment/KoOptimizedPixelDataScalerU8ToU16.h
@@ -27,7 +27,7 @@ public:
{
const int numColorChannels = m_channelsPerPixel * numColumns;
-#if defined(HAVE_XSIMD) && XSIMD_WITH_AVX2
+#if XSIMD_WITH_AVX2
using uint16_avx_v = xsimd::batch<uint16_t, xsimd::avx2>;
using uint16_v = xsimd::batch<uint16_t, xsimd::sse4_1>;
using uint8_v = xsimd::batch<uint8_t, xsimd::sse4_1>;
@@ -38,7 +38,7 @@ public:
const int rest = numColorChannels % channelsPerAvx2Block;
const int sse2Block = rest / channelsPerSse2Block;
const int scalarBlock = rest % channelsPerSse2Block;
-#elif defined(HAVE_XSIMD) && (XSIMD_WITH_SSE4_1 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64)
+#elif (XSIMD_WITH_SSE4_1 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64)
#if XSIMD_WITH_SSE4_1
using uint16_v = xsimd::batch<uint16_t, xsimd::sse4_1>;
using uint8_v = xsimd::batch<uint8_t, xsimd::sse4_1>;
@@ -66,7 +66,7 @@ public:
const quint8 *srcPtr = src;
auto *dstPtr = reinterpret_cast<quint16 *>(dst);
-#if defined(HAVE_XSIMD) && XSIMD_WITH_AVX2
+#if XSIMD_WITH_AVX2
for (int i = 0; i < avx2Block; i++) {
const auto x = uint8_v::load_unaligned(srcPtr);
@@ -84,7 +84,7 @@ public:
Q_UNUSED(avx2Block);
#endif
-#if defined(HAVE_XSIMD) && (XSIMD_WITH_SSE4_1 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64)
+#if (XSIMD_WITH_SSE4_1 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64)
for (int i = 0; i < sse2Block; i++) {
#if XSIMD_WITH_SSE4_1
const uint8_v x(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(srcPtr)));
@@ -128,7 +128,7 @@ public:
{
const int numColorChannels = m_channelsPerPixel * numColumns;
-#if defined(HAVE_XSIMD) && XSIMD_WITH_AVX2
+#if XSIMD_WITH_AVX2
using uint16_avx_v = xsimd::batch<uint16_t, xsimd::avx2>;
using uint16_v = xsimd::batch<uint16_t, xsimd::sse4_1>;
@@ -142,7 +142,7 @@ public:
const auto offset1 = uint16_avx_v(128);
const auto offset2 = uint16_v(128);
-#elif defined(HAVE_XSIMD) && XSIMD_WITH_SSE2 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64
+#elif XSIMD_WITH_SSE2 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64
// SSE2, unlike the previous function, is a perfectly valid option
// while under generic.
#if XSIMD_WITH_SSE2
@@ -171,7 +171,7 @@ public:
const quint16 *srcPtr = reinterpret_cast<const quint16 *>(src);
quint8 *dstPtr = dst;
-#if defined(HAVE_XSIMD) && XSIMD_WITH_AVX2
+#if XSIMD_WITH_AVX2
for (int i = 0; i < avx2Block; i++) {
auto x1 = uint16_avx_v::load_unaligned(srcPtr);
auto x2 = uint16_avx_v::load_unaligned(srcPtr + uint16_avx_v::size);
@@ -203,7 +203,7 @@ public:
Q_UNUSED(avx2Block);
#endif
-#if defined(HAVE_XSIMD) && (XSIMD_WITH_SSE2 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64)
+#if (XSIMD_WITH_SSE2 || XSIMD_WITH_NEON || XSIMD_WITH_NEON64)
for (int i = 0; i < sse2Block; i++) {
auto x1 = uint16_v::load_unaligned(srcPtr);
auto x2 = uint16_v::load_unaligned(srcPtr + uint16_v::size);
diff --git a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h
index 558c25fa4e..5a47bdc1ed 100644
--- a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h
+++ b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken128.h
@@ -35,7 +35,6 @@ struct AlphaDarkenCompositor128 {
* \p src_aligned.
* o the \p dst pointer must always(!) be aligned to the boundary
* of a streaming vector. Unaligned writes are really expensive.
- * o This function is *never* used if HAVE_XSIMD is not present
*/
template<bool haveMask, bool src_aligned, typename _impl>
static ALWAYS_INLINE void compositeVector(const quint8 *src, quint8 *dst, const quint8 *mask, float opacity, const ParamsWrapper &oparams)
diff --git a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h
index 95bbe5068d..e8a74d8ca1 100644
--- a/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h
+++ b/libs/pigment/compositeops/KoOptimizedCompositeOpAlphaDarken32.h
@@ -29,7 +29,6 @@ struct AlphaDarkenCompositor32 {
* \p src_aligned.
* o the \p dst pointer must always(!) be aligned to the boundary
* of a streaming vector. Unaligned writes are really expensive.
- * o This function is *never* used if HAVE_XSIMD is not present
*/
template<bool haveMask, bool src_aligned, typename _impl>
static ALWAYS_INLINE void compositeVector(const quint8 *src, quint8 *dst, const quint8 *mask, float opacity, const ParamsWrapper &oparams)
diff --git a/libs/pigment/tests/KoRgbU8ColorSpaceTester.cpp b/libs/pigment/tests/KoRgbU8ColorSpaceTester.cpp
index 3ac4c874ea..3ec359ba3a 100644
--- a/libs/pigment/tests/KoRgbU8ColorSpaceTester.cpp
+++ b/libs/pigment/tests/KoRgbU8ColorSpaceTester.cpp
@@ -362,7 +362,7 @@ void KoRgbU8ColorSpaceTester::testCompositeCopyDivisionByZero()
qDebug() << "oriD" << badDst[0] << badDst[1] << badDst[2] << badDst[3];
qDebug() << "expD" << expectedDst[0] << expectedDst[1] << expectedDst[2] << expectedDst[3];
qDebug() << "dst1" << badPixelDstPtr[0] << badPixelDstPtr[1] << badPixelDstPtr[2] << badPixelDstPtr[3];
-#if defined HAVE_XSIMD && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
QFAIL("Failed to compose pixels");
#else
qWarning() << "Skipping failed test when xsimd library is not used";
diff --git a/plugins/impex/heif/CMakeLists.txt b/plugins/impex/heif/CMakeLists.txt
index b854dd1f4e..6a78b916ae 100644
--- a/plugins/impex/heif/CMakeLists.txt
+++ b/plugins/impex/heif/CMakeLists.txt
@@ -5,16 +5,12 @@ set(kritaheifimport_SOURCES
HeifError.cpp
)
-if(HAVE_XSIMD)
- ko_compile_for_all_implementations(__per_arch_heif kis_heif_import_tools.cpp)
-
- message("Following objects are generated from the per-arch lib")
- foreach(_obj IN LISTS __per_arch_heif)
- message(" * ${_obj}")
- endforeach()
-else()
- set(__per_arch_heif kis_heif_import_tools.cpp)
-endif()
+ko_compile_for_all_implementations(__per_arch_heif kis_heif_import_tools.cpp)
+
+message("Following objects are generated from the per-arch lib")
+foreach(_obj IN LISTS __per_arch_heif)
+ message(" * ${_obj}")
+endforeach()
kis_add_library(kritaheifimport MODULE ${kritaheifimport_SOURCES} ${__per_arch_heif})
diff --git a/plugins/impex/heif/kis_heif_import_tools.cpp b/plugins/impex/heif/kis_heif_import_tools.cpp
index b17dfbacf3..827678fd7c 100644
--- a/plugins/impex/heif/kis_heif_import_tools.cpp
+++ b/plugins/impex/heif/kis_heif_import_tools.cpp
@@ -11,7 +11,7 @@
namespace Planar
{
-#if defined HAVE_XSIMD && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename Arch,
LinearizePolicy linearizePolicy,
bool applyOOTF,
@@ -131,7 +131,7 @@ constexpr int bufferSize()
return 4;
}
-#if defined HAVE_XSIMD && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename Arch,
typename std::enable_if_t<!std::is_same<Arch, xsimd::generic>::value,
int> = 0>
@@ -371,7 +371,7 @@ readLayerImpl::create<xsimd::current_arch>(const int luma,
namespace HDR
{
-#if defined HAVE_XSIMD && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename Arch,
LinearizePolicy linearizePolicy,
bool applyOOTF,
@@ -493,7 +493,7 @@ constexpr int bufferSize()
return channels;
}
-#if defined HAVE_XSIMD && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename Arch,
int channels,
typename std::enable_if_t<!std::is_same<Arch, xsimd::generic>::value,
@@ -700,7 +700,7 @@ readLayerImpl::create<xsimd::current_arch>(const int luma,
namespace SDR
{
-#if defined HAVE_XSIMD && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename Arch,
LinearizePolicy linearizePolicy,
bool applyOOTF,
@@ -795,7 +795,7 @@ constexpr int bufferSize()
return channels;
}
-#if defined HAVE_XSIMD && !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
+#if !defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
template<typename Arch,
int channels,
typename std::enable_if_t<!std::is_same<Arch, xsimd::generic>::value,