Skip to content

Commit

Permalink
fix blender segfault with geometry == NULL inside geometries array
Browse files Browse the repository at this point in the history
  • Loading branch information
dopitz committed Dec 16, 2024
1 parent 76f8c1f commit 13c62b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernels/sycl/scene_sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ sycl::event Scene::syncWithDevice(sycl::queue queue)
size_t geometry_data_byte_size_ = 0;
for (size_t i = 0; i < geometries.size(); ++i) {
Geometry* geom = geometries[i].ptr;
const size_t byte_size = geom->getGeometryDataDeviceByteSize();
const size_t byte_size = geom? geom->getGeometryDataDeviceByteSize(): 0;
offsets[i] = geometry_data_byte_size_;
geometry_data_byte_size_ += byte_size;
}
Expand Down Expand Up @@ -203,6 +203,9 @@ sycl::event Scene::syncWithDevice(sycl::queue queue)
geometries[i]->convertToDeviceRepresentation(offsets[i], geometry_data_host, geometry_data_device);
geometries_host[i] = (Geometry*)(geometry_data_device + offsets[i]);
}
else {
geometries_host[i] = NULL;
}
});

sycl::event event_copy_geometry_data = queue.memcpy(geometry_data_device, geometry_data_host, geometry_data_byte_size);
Expand Down

0 comments on commit 13c62b6

Please sign in to comment.