blender-hip: manual backport of hiprt 3 support

Minimal backport that applies on current blender of
https://projects.blender.org/blender/blender/pulls/144889
This commit is contained in:
Luna Nova
2026-01-16 10:44:23 -08:00
parent c01d90f756
commit c23f22dd5b
2 changed files with 75 additions and 0 deletions
@@ -0,0 +1,72 @@
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
+++ b/extern/hipew/src/hipew.c
@@ -241,13 +241,13 @@ static int hipewHipInit(void) {
/* ROCm 6 changes paths from /opt/rocm/hip/lib to /opt/rocm/lib, so
* search for libraries there. */
- const char* hip_paths[] = { "libamdhip64.so",
+ const char* hip_paths[] = { "libamdhip64.so.7",
+ "/opt/rocm/lib/libamdhip64.so.7",
+ "/opt/rocm/hip/lib/libamdhip64.so.7",
"libamdhip64.so.6",
"/opt/rocm/lib/libamdhip64.so.6",
"/opt/rocm/hip/lib/libamdhip64.so.6",
- "libamdhip64.so.7",
- "/opt/rocm/lib/libamdhip64.so.7",
- "/opt/rocm/hip/lib/libamdhip64.so.7",
+ "libamdhip64.so",
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
set(SRC_KERNEL_DEVICE_HIPRT_SDK
hiprt/impl/Aabb.h
hiprt/impl/BvhNode.h
- hiprt/impl/Geometry.h
+ hiprt/impl/Header.h
hiprt/impl/hiprt_device_impl.h
hiprt/impl/hiprt_kernels_bitcode.h
hiprt/impl/Instance.h
+ hiprt/impl/Obb.h
hiprt/impl/QrDecomposition.h
hiprt/impl/Quaternion.h
- hiprt/impl/Scene.h
hiprt/impl/Transform.h
hiprt/impl/Triangle.h
)
+3
View File
@@ -126,6 +126,9 @@ stdenv'.mkDerivation (finalAttrs: {
hash = "sha256-fNnQRfGfNc7rbk8npkcYtoAqRjJc6MaV4mqtSJxd0EM=";
};
# Minimal backport of hiprt 3.x support from https://projects.blender.org/blender/blender/pulls/144889
patches = lib.optional rocmSupport ./hiprt-3-compat.patch;
postPatch =
(lib.optionalString stdenv.hostPlatform.isDarwin ''
: > build_files/cmake/platform/platform_apple_xcode.cmake