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

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:

IndexOutOfRangeException: Index 1 is out of restricted IJobParallelFor range [0...0] in ReadWriteBuffer.
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.
Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <10871f9e312b442cb78b9b97db88fdcb>:0)
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)
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)
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/attachments/1018784593513562113/1144675414023872602/indexoutofrange-repro-urp.zip

1 Like

Issue tracker link: Unity Issue Tracker - IndexOutOfRangeException in Unity.Rendering.Occlusion.Masked.Dots.OcclusionMesh.Transform when Safety Checks are &quot;Force On&quot; or Burst Compilation is disabled

This is currently blocking us from implementing occlusion culling before Next Fest, so I’d appreciate an update. I think this error might also be causing crashes (reported separately as IN-52679).

1 Like

I have reported this some time ago with a fix: Burst Occlusion is in broken state

1 Like

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?

Yes, I think so. “It is still experimental” :slight_smile:

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.

1 Like

Why Burst Occlusion Culling has been removed? Is the Burst Occlusion Culling development has been completely halted?

This was covered in the november update
https://discussions.unity.com/t/933505