diff --git a/pkgs/by-name/bl/blender/eigen-3-compat.patch b/pkgs/by-name/bl/blender/eigen-3-compat.patch new file mode 100644 index 000000000000..e48b2d44bf9e --- /dev/null +++ b/pkgs/by-name/bl/blender/eigen-3-compat.patch @@ -0,0 +1,59 @@ +diff --git a/intern/dualcon/intern/octree.cpp b/intern/dualcon/intern/octree.cpp +index aac041848c..1544667e44 100644 +--- a/intern/dualcon/intern/octree.cpp ++++ b/intern/dualcon/intern/octree.cpp +@@ -2183,9 +2183,7 @@ + /* from http://eigen.tuxfamily.org/bz/show_bug.cgi?id=257 */ + static void pseudoInverse(const Eigen::Matrix3f &a, Eigen::Matrix3f &result, float tolerance) + { +- const int Options = Eigen::ComputeFullU | Eigen::ComputeFullV; +- Eigen::JacobiSVD svd = a.jacobiSvd(); +- ++ Eigen::JacobiSVD svd = a.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV); + result = svd.matrixV() * + Eigen::Vector3f((svd.singularValues().array().abs() > tolerance) + .select(svd.singularValues().array().inverse(), 0)) +diff --git a/intern/libmv/libmv/multiview/euclidean_resection.cc b/intern/libmv/libmv/multiview/euclidean_resection.cc +index 7d20e9d518..7b3144991c 100644 +--- a/intern/libmv/libmv/multiview/euclidean_resection.cc ++++ b/intern/libmv/libmv/multiview/euclidean_resection.cc +@@ -107,7 +107,7 @@ + + // Find the unit quaternion q that maximizes qNq. It is the eigenvector + // corresponding to the lagest eigenvalue. +- Vec4 q = N.jacobiSvd().matrixU().col(0); ++ Vec4 q = N.jacobiSvd(Eigen::ComputeFullU).matrixU().col(0); + + // Retrieve the 3x3 rotation matrix. + Vec4 qq = q.array() * q.array(); +@@ -246,7 +246,7 @@ + } + + int num_lambda = num_points + 1; // Dimension of the null space of M. +- Mat V = M.jacobiSvd().matrixV().block( ++ Mat V = M.jacobiSvd(Eigen::ComputeFullU).matrixV().block( + 0, num_m_rows, num_m_columns, num_lambda); + + // TODO(vess): The number of constraint equations in K (num_k_rows) must be +@@ -303,7 +303,7 @@ + } + } + Vec L_sq = +- K.jacobiSvd().matrixV().col(num_k_columns - 1); ++ K.jacobiSvd(Eigen::ComputeFullU).matrixV().col(num_k_columns - 1); + + // Pivot on the largest element for numerical stability. Afterwards recover + // the sign of the lambda solution. +diff --git a/intern/libmv/libmv/tracking/track_region.cc b/intern/libmv/libmv/tracking/track_region.cc +index ec808ac9ac..620367a455 100644 +--- a/intern/libmv/libmv/tracking/track_region.cc ++++ b/intern/libmv/libmv/tracking/track_region.cc +@@ -940,7 +940,7 @@ + } + + // TODO(keir): Check solution quality. +- Vec4 a = Q1.jacobiSvd().solve(Q2); ++ Vec4 a = Q1.jacobiSvd(Eigen::ComputeThinU | Eigen::ComputeThinV).solve(Q2); + parameters[2] = a[0]; + parameters[3] = a[1]; + parameters[4] = a[2]; diff --git a/pkgs/by-name/bl/blender/hiprt-3-compat.patch b/pkgs/by-name/bl/blender/hiprt-3-compat.patch index b3f410128507..ab42ff8ae27b 100644 --- a/pkgs/by-name/bl/blender/hiprt-3-compat.patch +++ b/pkgs/by-name/bl/blender/hiprt-3-compat.patch @@ -1,16 +1,3 @@ -diff --git a/extern/hipew/include/hiprtew.h b/extern/hipew/include/hiprtew.h -index d245cb76..952ed805 100644 ---- a/extern/hipew/include/hiprtew.h -+++ b/extern/hipew/include/hiprtew.h -@@ -157,7 +157,7 @@ typedef hiprtError (thiprtDestroyGlobalStackBuffer)( hiprtContext context, hiprt - - typedef hiprtError(thiprtDestroyFuncTable)(hiprtContext context, - hiprtFuncTable funcTable); --typedef void(thiprtSetLogLevel)( hiprtLogLevel level ); -+typedef hiprtError(thiprtSetLogLevel)( hiprtContext context, hiprtLogLevel level ); - - /* Function declarations. */ - extern thiprtCreateContext *hiprtCreateContext; diff --git a/extern/hipew/src/hipew.c b/extern/hipew/src/hipew.c index e72ccde6..138e1efc 100644 --- a/extern/hipew/src/hipew.c @@ -33,28 +20,11 @@ index e72ccde6..138e1efc 100644 NULL }; #endif static int initialized = 0; -diff --git a/intern/cycles/device/hiprt/device_impl.cpp b/intern/cycles/device/hiprt/device_impl.cpp -index c251a8d0..b54bc36c 100644 ---- a/intern/cycles/device/hiprt/device_impl.cpp -+++ b/intern/cycles/device/hiprt/device_impl.cpp -@@ -104,10 +104,10 @@ HIPRTDevice::HIPRTDevice(const DeviceInfo &info, - } - - if (LOG_IS_ON(LOG_LEVEL_TRACE)) { -- hiprtSetLogLevel(hiprtLogLevelInfo | hiprtLogLevelWarn | hiprtLogLevelError); -+ hiprtSetLogLevel(hiprt_context, hiprtLogLevelInfo | hiprtLogLevelWarn | hiprtLogLevelError); - } - else { -- hiprtSetLogLevel(hiprtLogLevelNone); -+ hiprtSetLogLevel(hiprt_context, hiprtLogLevelNone); - } - } - -diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt -index bcaf4e16..aa6a3d17 100644 ---- a/intern/cycles/kernel/CMakeLists.txt -+++ b/intern/cycles/kernel/CMakeLists.txt -@@ -93,13 +93,13 @@ set(SRC_KERNEL_DEVICE_HIPRT_HEADERS +diff --git a/intern/cycles/kernel/device/hiprt/CMakeLists.txt b/intern/cycles/kernel/device/hiprt/CMakeLists.txt +index 9f48fb9be3..01e05159c9 100644 +--- a/intern/cycles/kernel/device/hiprt/CMakeLists.txt ++++ b/intern/cycles/kernel/device/hiprt/CMakeLists.txt +@@ -30,13 +30,13 @@ set(SRC_KERNEL_DEVICE_HIPRT_SDK hiprt/impl/Aabb.h hiprt/impl/BvhNode.h diff --git a/pkgs/by-name/bl/blender/package.nix b/pkgs/by-name/bl/blender/package.nix index 19199e6d468a..91df7b38b283 100644 --- a/pkgs/by-name/bl/blender/package.nix +++ b/pkgs/by-name/bl/blender/package.nix @@ -7,6 +7,7 @@ boost, brotli, callPackage, + ceres-solver, cmake, colladaSupport ? true, config, @@ -66,7 +67,7 @@ pkg-config, potrace, pugixml, - python311Packages, # must use python3Packages instead of python3.pkgs, see https://github.com/NixOS/nixpkgs/issues/211340 + python313Packages, # must use python3Packages instead of python3.pkgs, see https://github.com/NixOS/nixpkgs/issues/211340 rocmPackages, rocmSupport ? config.rocmSupport, rubberband, @@ -95,7 +96,7 @@ let (!stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) || stdenv.hostPlatform.isDarwin; vulkanSupport = !stdenv.hostPlatform.isDarwin; - python3Packages = python311Packages; + python3Packages = python313Packages; python3 = python3Packages.python; pyPkgsOpenusd = python3Packages.openusd.override (old: { opensubdiv = old.opensubdiv.override { inherit cudaSupport; }; @@ -117,16 +118,24 @@ in stdenv'.mkDerivation (finalAttrs: { pname = "blender"; - version = "5.0.1"; + version = "5.1.0"; src = fetchzip { name = "source"; url = "https://download.blender.org/source/blender-${finalAttrs.version}.tar.xz"; - hash = "sha256-fNnQRfGfNc7rbk8npkcYtoAqRjJc6MaV4mqtSJxd0EM="; + hash = "sha256-knXAK3mW0tDz5ukuYkAZMv/zF9NLR8pofc3ujabcsys="; }; + patches = [ + # Blender actually wants a more recent version of eigen. However, the + # ceres-solver dependency propagates eigen 3 and appears to be incompatible + # with more recent versions. + ./eigen-3-compat.patch + ] # Minimal backport of hiprt 3.x support from https://projects.blender.org/blender/blender/pulls/144889 - patches = lib.optional rocmSupport ./hiprt-3-compat.patch; + ++ lib.optionals rocmSupport [ + ./hiprt-3-compat.patch + ]; postPatch = (lib.optionalString stdenv.hostPlatform.isDarwin '' @@ -156,8 +165,8 @@ stdenv'.mkDerivation (finalAttrs: { (lib.cmakeFeature "PYTHON_INCLUDE_DIR" "${python3}/include/${python3.libPrefix}") (lib.cmakeFeature "PYTHON_LIBPATH" "${python3}/lib") (lib.cmakeFeature "PYTHON_LIBRARY" "${python3.libPrefix}") - (lib.cmakeFeature "PYTHON_NUMPY_INCLUDE_DIRS" "${python3Packages.numpy_1}/${python3.sitePackages}/numpy/core/include") - (lib.cmakeFeature "PYTHON_NUMPY_PATH" "${python3Packages.numpy_1}/${python3.sitePackages}") + (lib.cmakeFeature "PYTHON_NUMPY_INCLUDE_DIRS" "${python3Packages.numpy}/${python3.sitePackages}/numpy/_core/include") + (lib.cmakeFeature "PYTHON_NUMPY_PATH" "${python3Packages.numpy}/${python3.sitePackages}") (lib.cmakeFeature "PYTHON_VERSION" "${python3.pythonVersion}") (lib.cmakeBool "WITH_BUILDINFO" false) @@ -168,6 +177,7 @@ stdenv'.mkDerivation (finalAttrs: { (lib.cmakeBool "WITH_CYCLES_DEVICE_OPTIX" cudaSupport) (lib.cmakeBool "WITH_CYCLES_EMBREE" embreeSupport) (lib.cmakeBool "WITH_CYCLES_OSL" true) + (lib.cmakeBool "WITH_SYSTEM_GLOG" true) (lib.cmakeBool "WITH_HYDRA" openUsdSupport) (lib.cmakeBool "WITH_INSTALL_PORTABLE" false) (lib.cmakeBool "WITH_JACK" jackaudioSupport) @@ -238,6 +248,7 @@ stdenv'.mkDerivation (finalAttrs: { buildInputs = [ alembic boost + ceres-solver ffmpeg_7 fftw fftwFloat @@ -324,7 +335,7 @@ stdenv'.mkDerivation (finalAttrs: { in [ ps.materialx - ps.numpy_1 + ps.numpy ps.openshadinglanguage ps.requests ps.zstandard