Unity 2021.3.23f1 + HDRP 12.1.7 (tried 12.1.10 as well);
I’m getting weird exception that pops up randomly when looking through different portions of the scene.
Nothing gets rendered at all, since it stalls the entire pipeline.
This happens in both editor and build. If I pause in playmode and switch to the scene view, look from the same place - scene view stops rendering as well.
Previously I thought it was tied to VRAM usage, but its actually unrelated.
Here’s a full stack:
ArgumentException: SetData(): Accessing 36848 bytes at offset 0 for Buffer of size 36736 bytes is not possible.
UnityEngine.ComputeBuffer.SetData[T] (Unity.Collections.NativeArray`1[T] data, System.Int32 nativeBufferStartIndex, System.Int32 computeBufferStartIndex, System.Int32 count) (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0)
UnityEngine.Rendering.HighDefinition.HDRenderPipeline.PushLightDataGlobalParams (UnityEngine.Rendering.CommandBuffer cmd) (at Library/PackageCache/com.unity.render-pipelines.high-definition@12.1.11/Runtime/Lighting/LightLoop/LightLoop.cs:2130)
UnityEngine.Rendering.HighDefinition.HDRenderPipeline.PrepareLightsForGPU (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.HighDefinition.HDCamera hdCamera, UnityEngine.Rendering.CullingResults cullResults, UnityEngine.Rendering.HighDefinition.HDProbeCullingResults hdProbeCullingResults, UnityEngine.Rendering.HighDefinition.LocalVolumetricFogList localVolumetricFogList, UnityEngine.Rendering.HighDefinition.DebugDisplaySettings debugDisplaySettings, UnityEngine.Rendering.HighDefinition.AOVRequestData aovRequest) (at Library/PackageCache/com.unity.render-pipelines.high-definition@12.1.11/Runtime/Lighting/LightLoop/LightLoop.cs:1939)
UnityEngine.Rendering.HighDefinition.HDRenderPipeline.ExecuteRenderRequest (UnityEngine.Rendering.HighDefinition.HDRenderPipeline+RenderRequest renderRequest, UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.HighDefinition.AOVRequestData aovRequest) (at Library/PackageCache/com.unity.render-pipelines.high-definition@12.1.11/Runtime/RenderPipeline/HDRenderPipeline.cs:2139)
UnityEngine.Rendering.HighDefinition.HDRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.high-definition@12.1.11/Runtime/RenderPipeline/HDRenderPipeline.cs:1915)
UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0)
UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, System.Collections.Generic.List`1[T] renderRequests, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Here’s where it fails:
void PushLightDataGlobalParams(CommandBuffer cmd)
{
m_LightLoopLightData.directionalLightData.SetData(m_GpuLightsBuilder.directionalLights, 0, 0, m_GpuLightsBuilder.directionalLightCount);
m_LightLoopLightData.lightData.SetData(m_GpuLightsBuilder.lights, 0, 0, m_GpuLightsBuilder.lightsCount);
m_LightLoopLightData.envLightData.SetData(m_lightList.envLights);
m_LightLoopLightData.decalData.SetData(DecalSystem.m_DecalDatas, 0, 0, Math.Min(DecalSystem.m_DecalDatasCount, m_MaxDecalsOnScreen)); // don't add more than the size of the buffer
for (int viewId = 0; viewId < m_GpuLightsBuilder.lightsPerViewCount; ++viewId)
{
HDGpuLightsBuilder.LightsPerView lightsPerView = m_GpuLightsBuilder.lightsPerView[viewId];
Debug.Assert(lightsPerView.boundsCount <= m_TotalLightCount, "Encountered bounds counts that are greater than the total light count.");
/// In the CPU we have stored the left and right eye in one single array, offset by the LightsPerView.boundsOffset. This is before trivial rejection.
/// In the GPU we compact them, and access each eye by the actual m_TotalLightCount, which contains the post trivial rejection offset.
int inputStartIndex = lightsPerView.boundsOffset;
int outputStartIndex = viewId * m_TotalLightCount;
// <------------------------------------------- Here ------------------ >
// These two buffers have been set in Rebuild(). At this point, view 0 contains combined data from all views
m_TileAndClusterData.convexBoundsBuffer.SetData(m_GpuLightsBuilder.lightBounds, inputStartIndex, outputStartIndex, lightsPerView.boundsCount);
m_TileAndClusterData.lightVolumeDataBuffer.SetData(m_GpuLightsBuilder.lightVolumes, inputStartIndex, outputStartIndex, lightsPerView.boundsCount);
}
cmd.SetGlobalTexture(HDShaderIDs._CookieAtlas, m_TextureCaches.lightCookieManager.atlasTexture);
cmd.SetGlobalTexture(HDShaderIDs._EnvCubemapTextures, m_TextureCaches.reflectionProbeCache.GetTexCache());
cmd.SetGlobalTexture(HDShaderIDs._Env2DTextures, m_TextureCaches.reflectionPlanarProbeCache.GetTexCache());
cmd.SetGlobalBuffer(HDShaderIDs._LightDatas, m_LightLoopLightData.lightData);
cmd.SetGlobalBuffer(HDShaderIDs._EnvLightDatas, m_LightLoopLightData.envLightData);
cmd.SetGlobalBuffer(HDShaderIDs._DecalDatas, m_LightLoopLightData.decalData);
cmd.SetGlobalBuffer(HDShaderIDs._DirectionalLightDatas, m_LightLoopLightData.directionalLightData);
}
Does anyone know what could be causing this and if there is a workaround?
Edit: From investigation it seems like HDRP does not like when there are lots of lights stacked in the same frustum volume. Lights are small radius, no shadow maps, no volumetrics. Disabling some lights prevents pipeline from exploding. But any light count should be supported for the deferred, right?


