Merge branch 'blender-v4.3-release'
This commit is contained in:
@@ -178,9 +178,8 @@ void BVHEmbree::build(Progress &progress,
|
||||
rtcCommitScene(scene);
|
||||
}
|
||||
|
||||
const char *BVHEmbree::get_last_error_message()
|
||||
const char *BVHEmbree::get_error_string(RTCError error_code)
|
||||
{
|
||||
const RTCError error_code = rtcGetDeviceError(rtc_device);
|
||||
switch (error_code) {
|
||||
case RTC_ERROR_NONE:
|
||||
return "no error";
|
||||
@@ -203,7 +202,9 @@ const char *BVHEmbree::get_last_error_message()
|
||||
}
|
||||
|
||||
# if defined(WITH_EMBREE_GPU) && RTC_VERSION >= 40302
|
||||
bool BVHEmbree::offload_scenes_to_gpu(const vector<RTCScene> &scenes)
|
||||
/* offload_scenes_to_gpu() uses rtcGetDeviceError() which also resets Embree error status,
|
||||
* we propagate its value so it doesn't get lost. */
|
||||
RTCError BVHEmbree::offload_scenes_to_gpu(const vector<RTCScene> &scenes)
|
||||
{
|
||||
/* Having BVH on GPU is more performance-critical than texture data.
|
||||
* In order to ensure good performance even when running out of GPU
|
||||
@@ -216,10 +217,11 @@ bool BVHEmbree::offload_scenes_to_gpu(const vector<RTCScene> &scenes)
|
||||
rtcCommitScene(embree_scene);
|
||||
/* In case of any errors from Embree, we should stop
|
||||
* the execution and propagate the error. */
|
||||
if (rtcGetDeviceError(rtc_device) != RTC_ERROR_NONE)
|
||||
return false;
|
||||
RTCError error_code = rtcGetDeviceError(rtc_device);
|
||||
if (error_code != RTC_ERROR_NONE)
|
||||
return error_code;
|
||||
}
|
||||
return true;
|
||||
return RTC_ERROR_NONE;
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ class BVHEmbree : public BVH {
|
||||
void refit(Progress &progress);
|
||||
|
||||
# if defined(WITH_EMBREE_GPU) && RTC_VERSION >= 40302
|
||||
bool offload_scenes_to_gpu(const vector<RTCScene> &scenes);
|
||||
RTCError offload_scenes_to_gpu(const vector<RTCScene> &scenes);
|
||||
# endif
|
||||
|
||||
const char *get_last_error_message();
|
||||
const char *get_error_string(RTCError error_code);
|
||||
|
||||
RTCScene scene;
|
||||
|
||||
|
||||
@@ -190,10 +190,11 @@ void OneapiDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
if (bvh->params.top_level) {
|
||||
embree_scene = bvh_embree->scene;
|
||||
# if RTC_VERSION >= 40302
|
||||
if (bvh_embree->offload_scenes_to_gpu(all_embree_scenes) == false) {
|
||||
RTCError error_code = bvh_embree->offload_scenes_to_gpu(all_embree_scenes);
|
||||
if (error_code != RTC_ERROR_NONE) {
|
||||
set_error(
|
||||
string_printf("BVH failed to to migrate to the GPU due to Embree library error (%s)",
|
||||
bvh_embree->get_last_error_message()));
|
||||
string_printf("BVH failed to migrate to the GPU due to Embree library error (%s)",
|
||||
bvh_embree->get_error_string(error_code)));
|
||||
}
|
||||
all_embree_scenes.clear();
|
||||
# endif
|
||||
|
||||
Reference in New Issue
Block a user