Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UUM-74682: Fix LightBaking not working properly on AMD
See [UUM-74682](https://jira.unity3d.com/browse/UUM-74682) See slack conversation [here](https://unity.slack.com/archives/C05T20SDVNH/p1724775737786409) (it is private so please ask a lighting dev to add you if you want to read it). Several probe baking tests are consistently failing on AMD, they work fine on NVidia. It turns out that AMD is sensitive to the stride in the `GraphicsBuffers` that are bound to a compute shader. If you use a stride that does not match the access pattern of the structured buffer in HLSL (say `float` or `float3`) the buffer access will be incorrect. The solution was to change `IDeviceContext.CreateBuffer` API to take stride as an input. The API was `IDeviceContext.CreateBuffer(ulong size)` before and now it is `IDeviceContext.CreateBuffer(ulong count, ulong stride)`. This is a breaking change to an API that was also introduced in Unity6, but without it we will have functionality that does not work on AMD. We found this issue recently as we have added a local Yamato runner in Copenhagen that runs baking tests on a machine with an AMD GPU (these do not exist in our Yamato test farm). This fixes: * [UUM-74682](https://jira.unity3d.com/browse/UUM-74682) * [UUM-66562](https://jira.unity3d.com/browse/UUM-66562) * [UUM-73375](https://jira.unity3d.com/browse/UUM-73375) * [GFXFEAT-573](https://jira.unity3d.com/browse/GFXFEAT-573) Also fixed the `PostProcessingGPU` which were incorrectly handling the lifetime of the `IDeviceContext` causing the test to fail on a second run. Finally fixed three cases where buffers created with `IDeviceContext` were not disposed of correctly. When this happens with the OpenCL context the test itself and any subsequently ran test can become unstable.
- Loading branch information