-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Many mobile devices have hardware optimizations for uniform buffers which make them faster to read than standard buffers, as long as the uniform buffers are small. The Light Grid data won't all fit into a small uniform buffer, but we can at least get the light data into one. That ends up being most of the memory reads performed for a lit object, resulting in a nice performance boost. Across various test scenes, we measured a performance improvement on Quest 3 between 3% and 25% less total frame time, depending on the scene and number of lights.
This optimization is enabled by the new CVar r.Mobile.PackLightGridLightDataToUBO.Enable. This CVar defaults to off, but depending on the performance across a wider set of devices and the number of lights mobile games tend to use, it might make sense to default it on.
Further improvements are possible by reducing the light limit from 32 to 20 or even 8 lights. Unfortunately, we couldn't find a good way to put this on a CVar. Note that it's extremely important that each array member gets its own SPIR-V declaration, so that unused members can be optimized out. This rules out the strategy that e.g. FBatchedPrimitiveShaderData uses of putting all the data into one big array.
Metadata
Metadata
Assignees
Labels
Projects
Status