From bbf919fc16278f83d2071bd139b3998821a6c8ce Mon Sep 17 00:00:00 2001 From: Nicolas Lorusso Date: Tue, 15 Sep 2026 15:42:33 -0300 Subject: [PATCH 1/2] fix anr: preload gpui shader bindings through addressables --- Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs | 6 ++++++ Explorer/Assets/DCL/PluginSystem/Global/LandscapePlugin.cs | 7 +++++++ .../Assets/DCL/PluginSystem/Global/LandscapeSettings.cs | 1 + .../Assets/DCL/PluginSystem/Global/Plugin Settings.asset | 6 ++++++ 4 files changed, 20 insertions(+) diff --git a/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs b/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs index 65823169b3b..bbbcaa6138c 100644 --- a/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs +++ b/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs @@ -69,4 +69,10 @@ public class LandscapeDataRef : AssetReferenceT { public LandscapeDataRef(string guid) : base(guid) { } } + + [Serializable] + public class GPUIShaderBindingsRef : AssetReferenceT + { + public GPUIShaderBindingsRef(string guid) : base(guid) { } + } } diff --git a/Explorer/Assets/DCL/PluginSystem/Global/LandscapePlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/LandscapePlugin.cs index d0ac3cc42b4..7c98b2394f6 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/LandscapePlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/LandscapePlugin.cs @@ -33,6 +33,7 @@ public class LandscapePlugin : IDCLGlobalPlugin private RealmPartitionSettingsAsset realmPartitionSettings; private ProvidedAsset landscapeData; + private ProvidedAsset gpuiShaderBindings; private NativeParallelHashSet emptyParcels; private NativeParallelHashSet ownedParcels; private SatelliteFloor? floor; @@ -79,6 +80,12 @@ public async UniTask InitializeAsync(LandscapeSettings settings, CancellationTok realmPartitionSettings = settings.realmPartitionSettings; + // Fix ANR: creating the GPUI rendering system loads the shader bindings with Addressables + // WaitForCompletion(), which blocks the main thread until Unity's PreloadManager has finished + // every async load already in flight, not just this one. + gpuiShaderBindings = await assetsProvisioner.ProvideMainAssetAsync(settings.gpuiShaderBindings, ct); + GPUIShaderBindings.Instance = gpuiShaderBindings.Value; + GPUIProfile treesProfile = landscapeData.Value.TreesProfile; LandscapeAsset[] treePrototypes = landscapeData.Value.terrainData.treeAssets; int[] treeRendererKeys = new int[treePrototypes.Length]; diff --git a/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs b/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs index db6d7b94a39..6d6b33a696c 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs @@ -13,6 +13,7 @@ public class LandscapeSettings : IDCLPluginSettings [field: Header(nameof(LandscapeSettings))] [field: Space] [field: SerializeField] public RealmPartitionSettingsAsset realmPartitionSettings; [field: SerializeField] public LandscapeDataRef landscapeData; + [field: SerializeField] public GPUIShaderBindingsRef gpuiShaderBindings; } } diff --git a/Explorer/Assets/DCL/PluginSystem/Global/Plugin Settings.asset b/Explorer/Assets/DCL/PluginSystem/Global/Plugin Settings.asset index ef4d0b514c0..e506cd67f64 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/Plugin Settings.asset +++ b/Explorer/Assets/DCL/PluginSystem/Global/Plugin Settings.asset @@ -796,6 +796,12 @@ MonoBehaviour: m_SubObjectType: m_SubObjectGUID: m_EditorAssetChanged: 0 + gpuiShaderBindings: + m_AssetGUID: 50f997bbd4ff89a469f03b9794ff393f + m_SubObjectName: + m_SubObjectType: + m_SubObjectGUID: + m_EditorAssetChanged: 0 - rid: 3414978285727645698 type: {class: PointerInputAudioPlugin/Settings, ns: DCL.PluginSystem.Global, asm: DCL.Plugins} data: From b030d665fdf6dd1833a896d92a60b655265e1a8f Mon Sep 17 00:00:00 2001 From: Nicolas Lorusso Date: Tue, 15 Sep 2026 15:54:29 -0300 Subject: [PATCH 2/2] reduce lint warnings --- .../DCL/Landscape/Settings/LandscapeData.cs | 45 ++++++++++--------- .../PluginSystem/Global/LandscapeSettings.cs | 2 +- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs b/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs index bbbcaa6138c..7f58ff1de97 100644 --- a/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs +++ b/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs @@ -1,6 +1,7 @@ using DCL.Landscape.Utils; using Decentraland.Terrain; using GPUInstancerPro; +using JetBrains.Annotations; using System; using UnityEngine; using UnityEngine.AddressableAssets; @@ -9,15 +10,22 @@ namespace DCL.Landscape.Settings { public class LandscapeData : ScriptableObject { - public Action? OnDetailDistanceChanged; + // ReSharper disable InconsistentNaming + public Transform mapChunk = null!; + public TerrainGenerationData terrainData = null!; + public TerrainGenerationData worldsTerrainData = null!; + // ReSharper restore InconsistentNaming - public Transform mapChunk; - public TerrainGenerationData terrainData; - public TerrainGenerationData worldsTerrainData; + [SerializeField] private float detailDistanceValue = 200; + + [field: SerializeField] public Material? GroundMaterial { get; private set; } + [field: SerializeField] public int GroundInstanceCapacity { get; set; } + [field: SerializeField] public GrassIndirectRenderer? GrassIndirectRenderer { get; private set; } + [field: SerializeField] [field: EnumIndexedArray(typeof(GroundMeshPiece))] + public Mesh?[] GroundMeshes { get; private set; } = null!; [field: SerializeField] public GPUIProfile TreesProfile { get; private set; } = null!; - [SerializeField] private float detailDistanceValue = 200; public float DetailDistance { get => detailDistanceValue; @@ -29,10 +37,14 @@ public float DetailDistance detailDistanceValue = value; ApplyDetailDistanceToTrees(value); - OnDetailDistanceChanged?.Invoke(value); } } + public bool RenderGround { get; set; } = true; + public bool RenderTrees { get; set; } = true; + public bool RenderGrass { get; set; } = true; + public bool ShowSatelliteFloor { get; set; } = true; + private void ApplyDetailDistanceToTrees(float distance) { TreesProfile.minMaxDistance = new Vector2(0, distance); @@ -45,22 +57,11 @@ private void OnEnable() ApplyDetailDistanceToTrees(detailDistanceValue); } - public bool RenderGround { get; set; } = true; - public bool RenderTrees { get; set; } = true; - public bool RenderGrass { get; set; } = true; - public bool ShowSatelliteFloor { get; set; } = true; - [field: SerializeField] public Material? GroundMaterial { get; private set; } - [field: SerializeField] public int GroundInstanceCapacity { get; set; } - [field: SerializeField] public GrassIndirectRenderer? GrassIndirectRenderer { get; private set; } - - [field: SerializeField] [field: EnumIndexedArray(typeof(GroundMeshPiece))] - public Mesh?[] GroundMeshes { get; private set; } = null!; - private enum GroundMeshPiece { - Middle, - Edge, - Corner, + [UsedImplicitly] Middle, + [UsedImplicitly] Edge, + [UsedImplicitly] Corner, } } @@ -71,8 +72,8 @@ public LandscapeDataRef(string guid) : base(guid) { } } [Serializable] - public class GPUIShaderBindingsRef : AssetReferenceT + public class GpuiShaderBindingsRef : AssetReferenceT { - public GPUIShaderBindingsRef(string guid) : base(guid) { } + public GpuiShaderBindingsRef(string guid) : base(guid) { } } } diff --git a/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs b/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs index 6d6b33a696c..37f0548b80a 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/LandscapeSettings.cs @@ -13,7 +13,7 @@ public class LandscapeSettings : IDCLPluginSettings [field: Header(nameof(LandscapeSettings))] [field: Space] [field: SerializeField] public RealmPartitionSettingsAsset realmPartitionSettings; [field: SerializeField] public LandscapeDataRef landscapeData; - [field: SerializeField] public GPUIShaderBindingsRef gpuiShaderBindings; + [field: SerializeField] public GpuiShaderBindingsRef gpuiShaderBindings; } }