blender/intern/cycles/device
Michael Jones 5508b41a40 Cycles: MetalRT optimisations (scene_intersect_shadow + random_walk)
This PR contains optimisations and a general tidy-up of the MetalRT backend.

- Currently `scene_intersect` is used for both normal and (opaque) shadow rays, however the usage patterns are different enough to warrant specialisation. Shadow intersection tests (flagged with `PATH_RAY_SHADOW_OPAQUE`) only need a bool result, but need a larger "self" payload in order to exclude hits against target lights. By specialising we can minimise the payload size in each case (which is helps performance) and avoid some dynamic branching. This PR introduces a new `scene_intersect_shadow` function which is specialised in Metal, and currently redirects to `scene_intersect` in the other backends.

- Currently `scene_intersect_local` is implemented for worst-case payload requirements as demanded by `subsurface_disk` (where `max_hits` is 4). The random_walk case only demands 1 hit result which we can retrieve directly from the intersector object (rather than stashing it in the payload). By specialising, we significantly reduce the payload size for random_walk queries, which has a big impact on performance. Additionally, we only need to use a custom intersection function for the first ray test in a random walk (for self-primitive filtering), so this PR forces faster `opaque` intersection testing for all but the first random walk test.

- Currently `scene_intersect_volume` has a lot of redundant code to handle non-triangle primitives despite volumes only being enclosed by trimeshes. This PR removes this code.

Additionally, this PR tidies up the convoluted intersection function linking code, removes some redundant intersection handlers, and uses more consistent naming of intersection functions.

On a M3 MacBook Pro, these changes give 2-3% performance increase on typical scenes with opaque trimesh materials (e.g. barbershop, classroom junkshop), but can give over 15% performance increase for certain scenes using random walk SSS (e.g. monster).

Pull Request: https://projects.blender.org/blender/blender/pulls/121397
2024-05-10 16:38:02 +02:00
..
cpu Cycles: Increase minimum target on x86 to SSE4.2 2024-02-26 14:49:19 +01:00
cuda Cycles: Enable OIDN 2.3 lazy device module loading 2024-05-07 14:07:39 +02:00
dummy License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
hip Cycles: Enable OIDN 2.3 lazy device module loading 2024-05-07 14:07:39 +02:00
hiprt Fix #118709: Crash in OIDN GPU detection for unsupported HIP device 2024-03-11 15:09:24 +01:00
metal Cycles: MetalRT optimisations (scene_intersect_shadow + random_walk) 2024-05-10 16:38:02 +02:00
multi Cleanup: use braces for sources in intern/ 2023-09-17 09:05:40 +10:00
oneapi Cycles: Enable OIDN 2.3 lazy device module loading 2024-05-07 14:07:39 +02:00
optix Cycles: Enable OIDN 2.3 lazy device module loading 2024-05-07 14:07:39 +02:00
CMakeLists.txt Build: Improve OSL library dependency handling in Cycles 2024-03-29 15:24:30 +01:00
denoise.cpp Cycles: Add OpenImageDenoise quality option 2024-05-06 18:56:16 +02:00
denoise.h Cycles: Add OpenImageDenoise quality option 2024-05-06 18:56:16 +02:00
device.cpp Cycles: Disable OpenImageDenoise support for AMD GPUs in Blender 4.1 2024-03-14 18:18:18 +01:00
device.h Fix #117566: Cycles persistent data not updated by device preferences 2024-03-27 18:55:46 +01:00
graphics_interop.cpp License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
graphics_interop.h License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
kernel.cpp License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
kernel.h Cleanup: fewer iostreams related includes in Cycles 2023-08-15 13:55:38 +02:00
memory.cpp Cleanup: spelling in comments 2023-07-05 14:09:33 +10:00
memory.h License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
queue.cpp Cleanup: use braces for sources in intern/ 2023-09-17 09:05:40 +10:00
queue.h Cycles: Metal support for OpenImageDenoise 2024-02-06 21:13:23 +01:00