Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug IndexOutOfRangeException in Unity.Rendering.Occlusion.Masked.Dots.OcclusionMesh.Transform

Discussion in 'Graphics for ECS' started by apkdev, Aug 25, 2023.

  1. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    304
    Reposting IN-52716 here because I haven't seen anyone mention this error. Not sure if I'm doing something wrong here.

    1. What happened
    Errors are logged in the console when an Occluder component is added in the subscene.

    2. How can we reproduce it using the example you attached
    - Open the project in 2022.3.8f1
    - Open the "Main Scene"
    - Move the scene view camera near the scene origin (framing the object)
    - Enable "Force On" safety checks or disable Burst compilation

    The following error is logged in the console:

    Code (csharp):
    1. IndexOutOfRangeException: Index 1 is out of restricted IJobParallelFor range [0...0] in ReadWriteBuffer.
    2. ReadWriteBuffers are restricted to only read & write the element at the job index. You can use double buffering strategies to avoid race conditions due to reading & writing in parallel to the same elements from a job.
    3. Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <10871f9e312b442cb78b9b97db88fdcb>:0)
    4. Unity.Rendering.Occlusion.Masked.Dots.OcclusionMesh.Transform (Unity.Mathematics.float4x4 mvp, UnityEngine.Rendering.BatchCullingProjectionType projectionType, System.Single nearClip, Unity.Burst.Intrinsics.v128* frustumPlanes, System.Single halfWidth, System.Single halfHeight, System.Single pixelCenterX, System.Single pixelCenterY, Unity.Mathematics.float4* transformedVerts, Unity.Collections.NativeArray`1[T] clippedVerts, Unity.Collections.NativeArray`1[T] clippedTriExtents, Unity.Rendering.Occlusion.Masked.ClippedOccluder* clipped) (at ./Library/PackageCache/com.unity.entities.graphics@1.0.14/Unity.Entities.Graphics/Occlusion/Masked/Dots/OccluderMesh.cs:274)
    5. Unity.Rendering.Occlusion.Masked.MeshTransformJob.Execute (System.Int32 i) (at ./Library/PackageCache/com.unity.entities.graphics@1.0.14/Unity.Entities.Graphics/Occlusion/Masked/MeshTransformJob.cs:55)
    6. Unity.Jobs.IJobForExtensions+ForJobStruct`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <10871f9e312b442cb78b9b97db88fdcb>:0)
    Link to minimal repro project: https://cdn.discordapp.com/attachme...675414023872602/indexoutofrange-repro-urp.zip
     
    RafalBlahut likes this.
  2. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    304
    Last edited: Aug 29, 2023
    RafalBlahut likes this.
  3. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    214
    apkdev likes this.
  4. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    304
    Thanks - We've tried your workaround, and it looks like it gets rid of the errors, but enabling
    ENABLE_UNITY_OCCLUSION
    still causes frequent crashes in editor when reloading the domain (eg. entering/exiting play mode) for some reason (in the same minimal "single box with occluder" repro project). It's a separate issue, presumably?
     
    Last edited: Aug 30, 2023
  5. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    214
    Yes, I think so. "It is still experimental" :)
     
  6. ValentinHm

    ValentinHm

    Unity Technologies

    Joined:
    Dec 10, 2020
    Posts:
    14
    Hello, as you might know, Burst Occlusion Culling will be removed so we won't be able to provide support for it in the future.
    However, you should be able to avoid this error by making sure Burst compilation is enabled.
     
    Last edited: Nov 27, 2023
    optimise likes this.
  7. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,137
    Why Burst Occlusion Culling has been removed? Is the Burst Occlusion Culling development has been completely halted?
     
  8. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,790
    This was covered in the november update
    https://forum.unity.com/threads/dots-development-status-and-next-milestones-november-2023.1516672/