Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2a0998a
[Port] [6000.2] Fix Android glitch by using a different overload for …
svc-reach-platform-support Oct 2, 2025
824a2a7
[Port] [6000.2] [VFX] Fixed an error message because of the node sear…
svc-reach-platform-support Oct 2, 2025
3e48f9c
[Port] [6000.2] [VFX] HLSL compilation issue with comments
svc-reach-platform-support Oct 2, 2025
a20049e
[Port] [6000.2] [VFX] Avoid an exception when creating a new VFX asse…
svc-reach-platform-support Oct 2, 2025
baedfe3
[Port] [6000.2] Fix unselectable None option in Rendering Debugger > …
svc-reach-platform-support Oct 2, 2025
9d268ee
[Port] [6000.2] docg-7282: Add Matrix Data types
svc-reach-platform-support Oct 2, 2025
dd2ca26
[Port] [6000.2] [VFX] Forbid dragging a subgraph block onto the graph…
svc-reach-platform-support Oct 2, 2025
8364f88
[Port] [6000.2] [VFX] Properly support \r special character in custom…
svc-reach-platform-support Oct 2, 2025
dcb3d89
[Port] [6000.2] [VFX] Avoid DPI warning message in the console
svc-reach-platform-support Oct 2, 2025
0857539
[Port] [6000.2] docg-7352: Fix World to Screen code
svc-reach-platform-support Oct 2, 2025
ffb8f22
[Port] [6000.2] UUM-114563: Virtual Offset baking broken on AMD
svc-reach-platform-support Oct 2, 2025
fcd7763
Backport [6000.2] Fix bloom and lens flare on tiny resolutions.
eh-unity Oct 2, 2025
12b2cfc
[Port] [6000.2] [HDRP] Fixing script link in Water sample Cave scene
svc-reach-platform-support Oct 2, 2025
76ba9eb
[Port] [6000.2] Bind default shadowmap uniforms in skybox pass when u…
svc-reach-platform-support Oct 3, 2025
a1ed190
[Port] [6000.2] Ensured that we don't attempt to unload an unsaved scene
svc-reach-platform-support Oct 3, 2025
ffcbc79
[Port] [6000.2] Document missing parameters in Shader Graph Property …
svc-reach-platform-support Oct 6, 2025
5250841
[Port] [6000.2] Fix for shadergraph compilation issues due to spacewarp
svc-reach-platform-support Oct 6, 2025
b5c94e0
Improve Shader Graph documentation structure
sebastienduverne Oct 7, 2025
1f6283b
[Port] [6000.2] Modify resourceData MaxReaders MaxVersions int to an …
svc-reach-platform-support Oct 7, 2025
b26146e
[Port] [6000.2] URP fix missing intermediate texture
UnityAljosha Oct 8, 2025
381f519
[Port] [6000.2] [UUM-115475][URP 2D][6000.4] Remove unsafe light pass…
svc-reach-platform-support Oct 8, 2025
b355ec9
[Port] [6000.2] [Particles] Forcing identity in prevWorldMatrix
svc-reach-platform-support Oct 8, 2025
ad71da3
[Port] [6000.2] [HDRP] Fix graphics issue with PrecomputedAtmospheric…
svc-reach-platform-support Oct 8, 2025
f7c45e9
[Port] [6000.2] docg-7688: describe disable color tint in HDRP canvas…
svc-reach-platform-support Oct 8, 2025
5cb8319
[Port] [6000.2] [UUM-119296][6000.4] Fix memory regression from Light…
svc-reach-platform-support Oct 9, 2025
f8de993
[Port] [6000.2] [UUM-99152] Fix for Depth Priming not enabled in refl…
yvain-raeymaekers Oct 9, 2025
5459fe6
[Port] [6000.2] Fix wrong hasPassesAfterPostProcessing with wrong com…
svc-reach-platform-support Oct 9, 2025
d2efd90
[Port] [6000.2] Add RenderingUtils.ReAllocateHandleIfNeeded with Text…
svc-reach-platform-support Oct 10, 2025
e04b0c5
Missing script correction
SebastienLa Oct 10, 2025
38851bb
[Port] [6000.2] [VFX] Properly handle empty enum values and prevent i…
Oct 14, 2025
aebf846
[Port] [6000.2] docg-7154: VFX Manual docs : Six-way lighting
Oct 14, 2025
e630ebd
[Port 6000.2] RenderGraph Mem Leak with RenderGraphCompilationCache
RoseHirigoyen Oct 16, 2025
a11b4f5
[Port] [6000.2] Fixed GC Alloc in Lens Flare Post Processing Effect
svc-reach-platform-support Oct 16, 2025
725f664
[Port] [6000.2] [VFX][Fix] Remove VFXEdgeDragInfo
svc-reach-platform-support Oct 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,35 @@ public sealed class DebugStateInt : DebugState<int> { }
[Serializable, DebugState(typeof(DebugUI.ObjectPopupField), typeof(DebugUI.CameraSelector), typeof(DebugUI.ObjectField))]
public sealed class DebugStateObject : DebugState<UnityEngine.Object>
{
[SerializeField] string m_UserData;

/// <inheritdoc/>
public override void SetValue(object value, DebugUI.IValueField field)
{
// DebugStateObject is used to serialize the selected camera reference in DebugUI.CameraSelector. For SceneView Camera this doesn't work because
// the camera is never saved and always recreated. So we use a special string to identify this case and restore the reference later.
if (field is DebugUI.CameraSelector && SceneView.lastActiveSceneView != null && (Camera)value == SceneView.lastActiveSceneView.camera)
{
m_UserData = "SceneViewCamera";
}
else
{
m_UserData = null;
}
base.SetValue(value, field);
}

/// <inheritdoc/>
public override object GetValue()
{
if (value == null && m_UserData != null && m_UserData == "SceneViewCamera" && SceneView.lastActiveSceneView != null && SceneView.lastActiveSceneView.camera != null)
{
value = SceneView.lastActiveSceneView.camera;
}

return base.GetValue();
}

/// <summary>
/// Returns the hash code of the Debug Item.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public override void Initialize(ProbeVolumeBakingSet bakingSet, NativeArray<Vect
batchResult = new Vector3[k_MaxProbeCountPerBatch];

var computeBufferTarget = GraphicsBuffer.Target.CopyDestination | GraphicsBuffer.Target.CopySource
| GraphicsBuffer.Target.Structured | GraphicsBuffer.Target.Raw;
| GraphicsBuffer.Target.Structured;

// Create acceletation structure
m_AccelerationStructure = BuildAccelerationStructure(voSettings.collisionMask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void ShowWarnings()
{
for (int i = 0; i < SceneManager.sceneCount; i++)
{
var scene = SceneManager.GetSceneAt(i);
Scene scene = SceneManager.GetSceneAt(i);
if (scene.isLoaded && ProbeVolumeBakingSet.GetBakingSetForScene(scene) != activeSet)
scenesToUnload.Add(scene);
}
Expand Down Expand Up @@ -467,7 +467,7 @@ void ShowWarnings()
if (scenesToUnload.All(s => !s.isDirty) || EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
foreach (var scene in scenesToUnload)
EditorSceneManager.CloseScene(scene, false);
EditorSceneManager.CloseScene(scene, string.IsNullOrEmpty(scene.path)); // Remove the scene from the hierarchy iff it has never been saved.
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ void RayGenExecute(UnifiedRT::DispatchInfo dispatchInfo)
if (!hit.IsValid() || hit.isFrontFace)
{
validHits++;
continue;
}

float distanceDiff = hit.hitDistance - minDist;
if (distanceDiff < DISTANCE_THRESHOLD)
else if (hit.IsValid())
{
UnifiedRT::HitGeomAttributes attributes = UnifiedRT::FetchHitGeomAttributes(hit, UnifiedRT::kGeomAttribFaceNormal);
float dotSurface = dot(ray.direction, attributes.faceNormal);

// If new distance is smaller by at least kDistanceThreshold, or if ray is at least DOT_THRESHOLD more colinear with normal
if (distanceDiff < -DISTANCE_THRESHOLD || dotSurface - maxDotSurface > DOT_THRESHOLD)
float distanceDiff = hit.hitDistance - minDist;
if (distanceDiff < DISTANCE_THRESHOLD)
{
outDirection = ray.direction;
maxDotSurface = dotSurface;
minDist = hit.hitDistance;
UnifiedRT::HitGeomAttributes attributes = UnifiedRT::FetchHitGeomAttributes(hit, UnifiedRT::kGeomAttribFaceNormal);
float dotSurface = dot(ray.direction, attributes.faceNormal);

// If new distance is smaller by at least kDistanceThreshold, or if ray is at least DOT_THRESHOLD more colinear with normal
if (distanceDiff < -DISTANCE_THRESHOLD || dotSurface - maxDotSurface > DOT_THRESHOLD)
{
outDirection = ray.direction;
maxDotSurface = dotSurface;
minDist = hit.hitDistance;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,10 @@ public Type selectedComponentType
/// <summary>Current camera to debug.</summary>
public Camera selectedCamera
{
get
{
#if UNITY_EDITOR
// By default pick the one scene camera
if (m_SelectedCamera == null && SceneView.lastActiveSceneView != null)
{
var sceneCamera = SceneView.lastActiveSceneView.camera;
if (sceneCamera != null)
m_SelectedCamera = sceneCamera;
}
#endif

return m_SelectedCamera;
}
get => m_SelectedCamera;
set
{
if (value != null && value != m_SelectedCamera)
if (value != m_SelectedCamera)
{
m_SelectedCamera = value;
OnSelectionChanged();
Expand Down Expand Up @@ -333,7 +320,7 @@ public static DebugUI.EnumField CreateComponentSelector(SettingsPanel panel, Act
};
}

public static DebugUI.ObjectPopupField CreateCameraSelector(SettingsPanel panel, Action<DebugUI.Field<Object>, Object> refresh)
public static DebugUI.CameraSelector CreateCameraSelector(SettingsPanel panel, Action<DebugUI.Field<Object>, Object> refresh)
{
return new DebugUI.CameraSelector()
{
Expand Down Expand Up @@ -708,7 +695,14 @@ public override void Dispose()
public SettingsPanel(DebugDisplaySettingsVolume data)
: base(data)
{
AddWidget(WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh()));
var cameraSelector = WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh());

// Select first camera if none is selected
var availableCameras = cameraSelector.getObjects() as List<Camera>;
if (data.selectedCamera == null && availableCameras is { Count: > 0 })
data.selectedCamera = availableCameras[0];

AddWidget(cameraSelector);
AddWidget(WidgetFactory.CreateComponentSelector(this, (_, __) => Refresh()));

Func<bool> hiddenCallback = () => data.selectedCamera == null || data.selectedComponent <= 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void SetWritingPass(CompilerContextData ctx, ResourceHandle h, int passId
public void RegisterReadingPass(CompilerContextData ctx, ResourceHandle h, int passId, int index)
{
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (numReaders >= ctx.resources.MaxReaders)
if (numReaders >= ctx.resources.MaxReaders[h.iType])
{
string passName = ctx.GetPassName(passId);
string resourceName = ctx.GetResourceName(h);
Expand Down Expand Up @@ -194,8 +194,8 @@ internal class ResourcesData
public NativeList<ResourceVersionedData>[] versionedData; // Flattened fixed size array storing up to MaxVersions versions per resource id.
public NativeList<ResourceReaderData>[] readerData; // Flattened fixed size array storing up to MaxReaders per resource id per version.

public int MaxVersions;
public int MaxReaders;
public int[] MaxVersions;
public int[] MaxReaders;

public DynamicArray<Name>[] resourceNames;

Expand All @@ -205,6 +205,8 @@ public ResourcesData()
versionedData = new NativeList<ResourceVersionedData>[(int)RenderGraphResourceType.Count];
readerData = new NativeList<ResourceReaderData>[(int)RenderGraphResourceType.Count];
resourceNames = new DynamicArray<Name>[(int)RenderGraphResourceType.Count];
MaxVersions = new int[(int)RenderGraphResourceType.Count];
MaxReaders = new int[(int)RenderGraphResourceType.Count];

for (int t = 0; t < (int)RenderGraphResourceType.Count; t++)
resourceNames[t] = new DynamicArray<Name>(0); // T in NativeList<T> cannot contain managed types, so the names are stored separately
Expand Down Expand Up @@ -241,14 +243,14 @@ void AllocateAndResizeNativeListIfNeeded<T>(ref NativeList<T> nativeList, int si

public void Initialize(RenderGraphResourceRegistry resources)
{
uint maxReaders = 0;
uint maxWriters = 0;

for (int t = 0; t < (int)RenderGraphResourceType.Count; t++)
{
RenderGraphResourceType resourceType = (RenderGraphResourceType) t;
var numResources = resources.GetResourceCount(resourceType);

uint maxReaders = 0;
uint maxWriters = 0;

// We don't clear the list as we reinitialize it right after
AllocateAndResizeNativeListIfNeeded(ref unversionedData[t], numResources, NativeArrayOptions.UninitializedMemory);

Expand Down Expand Up @@ -308,12 +310,12 @@ public void Initialize(RenderGraphResourceRegistry resources)
}

// The first resource is a null resource, so we need to add 1 to the count.
MaxReaders = (int)maxReaders + 1;
MaxVersions = (int)maxWriters + 1;
MaxReaders[t] = (int)maxReaders + 1;
MaxVersions[t] = (int)maxWriters + 1;

// Clear the other caching structures, they will be filled later
AllocateAndResizeNativeListIfNeeded(ref versionedData[t], MaxVersions * numResources, NativeArrayOptions.ClearMemory);
AllocateAndResizeNativeListIfNeeded(ref readerData[t], MaxVersions * MaxReaders * numResources, NativeArrayOptions.ClearMemory);
AllocateAndResizeNativeListIfNeeded(ref versionedData[t], MaxVersions[t] * numResources, NativeArrayOptions.ClearMemory);
AllocateAndResizeNativeListIfNeeded(ref readerData[t], MaxVersions[t] * MaxReaders[t] * numResources, NativeArrayOptions.ClearMemory);
}
}

Expand All @@ -322,23 +324,23 @@ public void Initialize(RenderGraphResourceRegistry resources)
public int Index(ResourceHandle h)
{
#if UNITY_EDITOR // Hot path
if (h.version < 0 || h.version >= MaxVersions)
if (h.version < 0 || h.version >= MaxVersions[h.iType])
throw new Exception("Invalid version: " + h.version);
#endif
return h.index * MaxVersions + h.version;
return h.index * MaxVersions[h.iType] + h.version;
}

// Flatten array index
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int IndexReader(ResourceHandle h, int readerID)
{
#if UNITY_EDITOR // Hot path
if (h.version < 0 || h.version >= MaxVersions)
if (h.version < 0 || h.version >= MaxVersions[h.iType])
throw new Exception("Invalid version");
if (readerID < 0 || readerID >= MaxReaders)
if (readerID < 0 || readerID >= MaxReaders[h.iType])
throw new Exception("Invalid reader");
#endif
return (h.index * MaxVersions + h.version) * MaxReaders + readerID;
return (h.index * MaxVersions[h.iType] + h.version) * MaxReaders[h.iType] + readerID;
}

// Lookup data for a given handle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ internal void ForceCleanup()

nativeCompiler?.Cleanup();

m_CompilationCache?.Clear();
m_CompilationCache?.Cleanup();

DelegateHashCodeUtils.ClearCache();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,41 @@ public bool GetCompilationCache(int hash, int frameIndex, out CompilerContextDat
return GetCompilationCache(hash, frameIndex, out outGraph, m_NativeHashEntries, m_NativeCompiledGraphPool, s_NativeEntryComparer);
}

public void Clear()
public void Cleanup()
{
// We clear the contents of the pools but not the pool themselves, because they are only
// filled at the beginning of the renderer pipeline and never after. This means when we call
// Cleanup() after an error, if we were clearing the pools, the render graph could not gracefully start
// back up because the cache would have a size of 0 (so no room to cache anything).

// Cleanup compiled graphs currently in the cache
for (int i = 0; i < m_HashEntries.size; ++i)
m_CompiledGraphPool.Push(m_HashEntries[i].compiledGraph);
{
var compiledGraph = m_HashEntries[i].compiledGraph;
compiledGraph.Clear();
}
m_HashEntries.Clear();

// Cleanup compiled graphs that might be left in the pool
var compiledGraphs = m_CompiledGraphPool.ToArray();
for (int i = 0; i < compiledGraphs.Length; ++i)
{
compiledGraphs[i].Clear();
}

// Dispose of CompilerContextData currently in the cache
for (int i = 0; i < m_NativeHashEntries.size; ++i)
m_NativeCompiledGraphPool.Push(m_NativeHashEntries[i].compiledGraph);
{
var compiledGraph = m_NativeHashEntries[i].compiledGraph;
compiledGraph.Dispose();
}
m_NativeHashEntries.Clear();

// Dispose of CompilerContextData that might be left in the pool
var nativeCompiledGraphs = m_NativeCompiledGraphPool.ToArray();
for (int i = 0; i < nativeCompiledGraphs.Length; ++i)
{
nativeCompiledGraphs[i].Dispose();
}
}
}
Loading