Fix CUDA error with light linking and emissive world volume

The issue was an out-of-bounds read access when checking whether
the world volume emission needs to be accumulated.

Solution is to check for this case. Done in the generic place, so
that the shade_volume kernel is more readable and no branching
added there, and there is no impact on scenes without the light
linking.

Assume that the world emissive volume belongs to the default light
linking group, as there is no way to link it explicitly to anything.

Pull Request: https://projects.blender.org/blender/blender/pulls/110733
This commit is contained in:
Sergey Sharybin
2023-08-03 07:54:06 +02:00
committed by Sergey Sharybin
parent a049f3b5df
commit 8ea68765fc

View File

@@ -79,6 +79,13 @@ ccl_device_inline bool light_link_object_match(KernelGlobals kg,
return true;
}
/* Emitter is OBJECT_NONE when the emitter is a world volume.
* It is not explicitly linkable to any object, so assume it is coming from the default light
* set which affects all objects in the scene. */
if (object_emitter == OBJECT_NONE) {
return true;
}
const uint64_t set_membership = kernel_data_fetch(objects, object_emitter).light_set_membership;
const uint receiver_set = (object_receiver != OBJECT_NONE) ?
kernel_data_fetch(objects, object_receiver).receiver_light_set :