Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Possible errors in URP Foward+ code

Discussion in '2022.2 Beta' started by cqarthur, Aug 9, 2022.

  1. cqarthur


    May 30, 2013
    Unity 2022.2.0b3, URP 14.0.3

    I'm reading Foward+ related code. In ForwardLights.cs, after radixSortJob, line 300, indices is sorted from near to far, and I think the element in indices at that time is the light's old index in visibleLights(defined in line 255).

    The code in ReorderJob is as below:
    Code (CSharp):
    1.         public void Execute(int index)
    2.         {
    3.             var newIndex = indices[index];
    4.             output[newIndex] = input[index];
    5.         }
    But I think it should be:
    Code (CSharp):
    1.         public void Execute(int index)
    2.         {
    3.             var oldIndex = indices[index];
    4.             output[index] = input[oldIndex];
    5.         }
    The results of these two are different.

    If I'm right about this, then the code from line 370 to 384 in ForwardLights.cs will have the same problem.

    Do I misunderstand the code or I find some errors?