Search Issue Tracker

Won't Fix

Won't Fix in 2021.3.X, 2022.1.X, 2022.2.X, 2023.1.X

Votes

0

Found in

2020.3.40f1

2021.3.11f1

2022.1.19f1

2022.2.0b10

2023.1.0a13

Issue ID

UUM-16526

Regression

No

PrepareLightsForGPU incurs a CPU cost in a scene with no realtime/mixed lights

--

-

*Steps to reproduce*
# Download the attached project (BakedLightsCPUSpike-HDRP.zip)
# Open the EmptyScene
# Open the Profiler window, and in the search box, type in PrepareLightsForGPU
# Enter Play mode
# Press T on the keyboard to load a scene additively
# Scrub through the graph until you find the PrepareLightsForGPU event

*Expected behavior*
* PrepareLightsForGPU event incurs no performance cost, or is not called at all

*Actual behavior*
* PrepareLightsForGPU can cost up to 11ms of CPU time upon loading a scene that contains only baked lights (see the attached image)

*Notes*
* Reproduces in: 2020.3.40f1, 2021.3.11f1, 2022.1.13f1, 2022.2.0b8, 2023.1.0a11
* Tested on macOS
* Only reproduces upon the loading the scene initially; does not reproduce upon loading and unloading that same scene after it had been initialized

  1. Resolution Note:

    The issue is happening because of Just in time compilation. That is, when the mono runtime just see's the function for the first time, it will lazily compile the scripts, which costs around 11ms in this instance. The issue is not caused by lights, or their number.
    This issue won't happen when you actually ship a game and compile using IL2CPP.
    I recommend doing profiling with an actual player with IL2CPP to see the real world performance costs. Editor profiling has to be taken with a grain of salt because of all the tooling.

    Wont fix this issue because its by design.

  2. Resolution Note (2023.1.X):

    The issue is happening because of Just in time compilation. That is, when the mono runtime just see's the function for the first time, it will lazily compile the scripts, which costs around 11ms in this instance. The issue is not caused by lights, or their number.
    This issue won't happen when you actually ship a game and compile using IL2CPP.
    I recommend doing profiling with an actual player with IL2CPP to see the real world performance costs. Editor profiling has to be taken with a grain of salt because of all the tooling.

    Wont fix this issue because its by design.

  3. Resolution Note (2022.2.X):

    The issue is happening because of Just in time compilation. That is, when the mono runtime just see's the function for the first time, it will lazily compile the scripts, which costs around 11ms in this instance. The issue is not caused by lights, or their number.
    This issue won't happen when you actually ship a game and compile using IL2CPP.
    I recommend doing profiling with an actual player with IL2CPP to see the real world performance costs. Editor profiling has to be taken with a grain of salt because of all the tooling.

    Wont fix this issue because its by design.

  4. Resolution Note (2022.1.X):

    The issue is happening because of Just in time compilation. That is, when the mono runtime just see's the function for the first time, it will lazily compile the scripts, which costs around 11ms in this instance. The issue is not caused by lights, or their number.
    This issue won't happen when you actually ship a game and compile using IL2CPP.
    I recommend doing profiling with an actual player with IL2CPP to see the real world performance costs. Editor profiling has to be taken with a grain of salt because of all the tooling.

    Wont fix this issue because its by design.

  5. Resolution Note (2021.3.X):

    The issue is happening because of Just in time compilation. That is, when the mono runtime just see's the function for the first time, it will lazily compile the scripts, which costs around 11ms in this instance. The issue is not caused by lights, or their number.
    This issue won't happen when you actually ship a game and compile using IL2CPP.
    I recommend doing profiling with an actual player with IL2CPP to see the real world performance costs. Editor profiling has to be taken with a grain of salt because of all the tooling.

    Wont fix this issue because its by design.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.