Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3626fd7
[Port] [6000.5] [Adaptive Performance] clamp cameraTargetDescriptor v…
svc-reach-platform-support Apr 15, 2026
4c69ca8
[Port] [6000.5] Added missing layer names used by 006-Compositor scene
svc-reach-platform-support Apr 16, 2026
3d4497a
[Port] [6000.5] Graphics/HDRP - [UUM-130925] - Fix null limit.xy valu…
svc-reach-platform-support Apr 16, 2026
b954ff7
[Port] [6000.5] Reference pages for new Shader Graph nodes: Expressio…
svc-reach-platform-support Apr 16, 2026
9e3315c
[UUM-140028] Disabling 027_RWTexture for XboxOne
christian-sasseville Apr 16, 2026
999d154
[Port] [6000.5] Fixed display stats not updating until tab switch in …
svc-reach-platform-support Apr 17, 2026
902a233
[Port] [6000.5] Graphics/URP/UUM-134993 - Fix URP Sample - Blit Depth…
svc-reach-platform-support Apr 17, 2026
75276d4
[Port] [6000.5] [UUM-108868] [URP] Fix GLES unsupported R32_SFloat RT…
svc-reach-platform-support Apr 20, 2026
39e108b
[SRP-1143] Mark Dynamic Batching as deprecated
seungwon-oh Apr 20, 2026
a5f2dfd
[Port] [6000.5] [UUM-139229][URP 2D] Fix preview camera missing light…
svc-reach-platform-support Apr 20, 2026
e009b0d
[Port] [6000.5] [Rendering Debugger] GPU Resident Drawer : Avoid recr…
svc-reach-platform-support Apr 20, 2026
056f958
[Port] [6000.5] Suppress 'potentially uninitialized variable' warning…
svc-reach-platform-support Apr 20, 2026
9a24820
[Port] [6000.5] Fix URP Asset multi-select inspector bugs
svc-reach-platform-support Apr 20, 2026
50d0a61
[Port][6000.5][UUM-135644] Allow shader-build-settings-compatible enu…
april-roszkowski Apr 21, 2026
2dd1727
[Port] [6000.5] Make HDRP Columndrawer more robust
Apr 22, 2026
210d3e5
[Port] [6000.5] [Core] Fix SRP Sample dependency importer
Apr 22, 2026
8cb0fa5
[Port] [6000.5] [UpscalerFramework] fix warnings in HDRP and URP
Apr 22, 2026
0933e21
[Port] [6000.5] Fix color bleeding near edge of screen with HDRP SSGI
Apr 22, 2026
64738f7
[Port] [6000.5] [URP][Shader Graph] Add stereo instancing support to …
Apr 22, 2026
b4284bc
[Port] [6000.5] Fix Rendering Debugger enum dropdowns going blank aft…
Apr 22, 2026
03cbf2d
[Port] [6000.5] [UUM-137604] UnifiedRT: Fixed RayTracingRenderPipelin…
Apr 23, 2026
98fb8ea
[Port] [6000.5] [XR] Fix missing unity_StereoEyeIndex constant in URP…
Apr 23, 2026
0267df8
[Port] [6000.5] [Material Upgrader] Generic system for URP and HDRP M…
Apr 25, 2026
0a04b66
[UUM-140915] Disabling 009-SG-FullScreenTarget
christian-sasseville Apr 27, 2026
04fc1fe
Shader Graph Undo Bug Fixes
FredMoreau Apr 28, 2026
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 @@ -9,7 +9,7 @@ Follow these steps:
## Load the ray tracing resources
The [`RayTracingContext`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext) needs a few utility shaders that the [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) object supplies. You can load these resources in several different ways.

If your project uses SRP (Scriptable Render Pipeline), load the resources via [`RayTracingResources.LoadFromRenderPipelineResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext.LoadFromRenderPipelineResources()). This always works in the Editor.
If your project uses SRP (Scriptable Render Pipeline), load the resources via [`RayTracingResources.LoadFromRenderPipelineResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources.LoadFromRenderPipelineResources()). This always works in the Editor.
```C#
var rtResources = new RayTracingResources();
bool result = rtResources.LoadFromRenderPipelineResources();
Expand Down Expand Up @@ -49,9 +49,12 @@ rtResources.LoadFromAssetBundle(asssetBundle);
## Create the context
Once the [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) are loaded, use them to create the [`RayTracingContext`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext).
```C#
// Choose a backend
var backend = RayTracingContext.IsBackendSupported(RayTracingBackend.Hardware) ? RayTracingBackend.Hardware : RayTracingBackend.Compute;
var context = new RayTracingContext(rtResources);
```

By default, Unity checks if the device supports hardware ray tracing, and selects either hardware ray tracing or compute shaders. To manually select the backend, pass in a `RayTracingBackend`. For example:

// Create the context
```C#
var backend = RayTracingBackend.Compute;
var context = new RayTracingContext(backend, rtResources);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Release your ray tracing objects

You must free up the memory your ray tracing objects use after you finish with them.

Dispose of the following:

- Scratch buffers. Use [`GraphicsBuffer.Dispose`](xref:UnityEngine.GraphicsBuffer.Dispose()) after you've executed the final command buffer.
- Ray tracing acceleration structures. Use [`IRayTracingAccelStruct.Dispose`](xref:UnityEngine.Rendering.UnifiedRayTracing.IRayTracingAccelStruct.Dispose()) after you've executed the final command buffer.
- Ray tracing context. Use [`RayTracingContext.Dispose`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext.Dispose()) after you dispose of all its acceleration structures.

**Note**: Unity automatically disposes of [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) and [`IRayTracingShader`](xref:UnityEngine.Rendering.UnifiedRayTracing.IRayTracingShader).

For example:

```C#
RayTracingContext rtContext = new RayTracingContext(rtResources);
IRayTracingShader rtShader = rtContext.LoadRayTracingShader("Assets/yourShader.urtshader");
IRayTracingAccelStruct rtAccelStruct = rtContext.CreateAccelerationStructure(new AccelerationStructureOptions());
GraphicsBuffer rtScratchBuffer = RayTracingHelper.CreateScratchBufferForBuild(rtAccelStruct);

// ... create and dispatch your ray tracing command buffers ...

rtScratchBuffer.Dispose();
rtAccelStruct.Dispose();
rtContext.Dispose();
```
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ The `UnifiedRayTracing` API enables you to write ray tracing code that can execu
|[Execute your ray tracing code](execute-shader.md)|How to execute your ray tracing shader.|
|[Sample code](trace-camera-rays-full-sample.md)|Complete code example showcasing tracing rays from the scene's camera.|
|[Unified ray tracing shader code reference](shader-code-reference.md)|API reference for the unified ray tracing shader code.|

|[Release your ray tracing objects](release-resources.md)|Learn how to release your ray tracing resources.|
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ To use the API to trace rays in Unity, follow these steps:
3. Create a shader.
4. Build your acceleration structure.
5. Execute your shader.
6. Dispose of your objects.

## Create the ray tracing context

Expand Down Expand Up @@ -53,3 +54,5 @@ rtShader.Dispatch(cmd, traceScratchBuffer, threadCountX, threadCountY, threadCou

For more information, refer to [Execute your ray tracing code](execute-shader.md).

## Dispose of your objects
For more information, refer to [Release your ray tracing objects](release-resources.md).
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
Expand Down Expand Up @@ -40,7 +39,6 @@ static SampleDependencyImporter()

PackageInfo m_PackageInfo;
SampleList m_SampleList;
List<Sample> m_Samples;

VisualElement injectingElement;
VisualElement _panelRoot;
Expand Down Expand Up @@ -100,6 +98,7 @@ internal void RefreshSampleButtons()

var bound = Mathf.Min(sampleContainers.Count, m_SampleList.samples.Length);

// Foreach sample
for (int i=0; i<bound; i++)
{
// Check if the sample has dependencies, if not just skip the injection.
Expand Down Expand Up @@ -155,16 +154,20 @@ internal void RefreshSampleButtons()

// Need to copy i for the lambda.
var index = i;
// On click of the imported button, import the dependencies first then call the original button logic.
// On click of the imported button, import the dependencies first then use the package manager API to trigger the regular sample import logic.
injectedButton.clicked += () =>
{
ImportSampleDependencies(index);

using (var ev = NavigationSubmitEvent.GetPooled())
// After importing the dependencies, we can call the package manager API import logic.
foreach (Sample sample in Sample.FindByPackage(m_PackageInfo.name, m_PackageInfo.version))
{
ev.target = importButton;
importButton.SendEvent(ev);
if (sample.displayName == m_SampleList.samples[index].displayName)
{
sample.Import(Sample.ImportOptions.HideImportWindow | Sample.ImportOptions.OverridePreviousImports);
}
}

};
}
else // We may need to update the button text after the sample import here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace UnityEditor.Rendering
/// </summary>
public partial class MaterialUpgrader
{
internal static readonly string k_DialogKey = $"{nameof(UnityEditor)}.{nameof(Rendering)}.{nameof(MaterialUpgrader)}.ConfirmMaterialConversion";

#region Internal API
/// <summary>
/// Represents an entry describing material properties
Expand Down Expand Up @@ -344,15 +346,15 @@ static void PerformUpgrade(List<MaterialUpgradeEntry> materialUpgrades, List<Mat

bool CanPerformUpgrade()
{
const string title = "Material Upgrader";
const string message = "This operation will overwrite existing materials in your project.\n\nPlease ensure you have a backup before proceeding.";
const string title = "Confirm Material Conversion";
const string message = "This action will modify materials and cannot be easily undone. It is strongly recommended to have a backup or use version control before continuing.";
const string proceed = "Proceed";
const string cancel = "Cancel";

if (Application.isBatchMode)
return true;

return EditorUtility.DisplayDialog(title, message, proceed, cancel);
return EditorUtility.DisplayDialog(title, message, proceed, cancel, DialogOptOutDecisionType.ForThisMachine, k_DialogKey);
}

if (CanPerformUpgrade())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering
{
class MaterialUpgraderEditMenus
{
private static readonly List<MaterialUpgrader> s_Empty = new List<MaterialUpgrader>();

public static List<MaterialUpgrader> GetCurrentSRPUpgraders()
{
if (!GraphicsSettings.isScriptableRenderPipelineEnabled)
return s_Empty;

return MaterialUpgrader.FetchAllUpgradersForPipeline(GraphicsSettings.currentRenderPipelineAssetType);
}

[MenuItem("Edit/Rendering/Materials/Convert All Built-In Materials to Current SRP", true)]
internal static bool UpgradeMaterialsProjectValidate()
{
return GraphicsSettings.isScriptableRenderPipelineEnabled;
}

[MenuItem("Edit/Rendering/Materials/Convert All Built-In Materials to Current SRP", priority = CoreUtils.Priorities.editMenuPriority + 1)]
internal static void UpgradeMaterialsProject()
{
MaterialUpgrader.UpgradeProjectFolder(GetCurrentSRPUpgraders(), "Upgrade to SRP Material");
}

[MenuItem("Edit/Rendering/Materials/Convert Selected Built-In Materials to Current SRP", true)]
internal static bool UpgradeMaterialsSelectionValidate()
{
if (Selection.objects.Length == 0 || !GraphicsSettings.isScriptableRenderPipelineEnabled)
return false;

foreach (var obj in Selection.objects)
{
if (obj is not Material)
return false;
}

return true;
}

[MenuItem("Edit/Rendering/Materials/Convert Selected Built-In Materials to Current SRP", priority = CoreUtils.Priorities.editMenuPriority + 2)]
internal static void UpgradeMaterialsSelection()
{
MaterialUpgrader.UpgradeSelection(GetCurrentSRPUpgraders(), "Upgrade to SRP Material");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,11 @@ protected override VisualElement Create()

this.ScheduleTracked(field, () => field.schedule.Execute(() =>
{
if (currentIndex >= 0 && currentIndex < enumNames.Length)
field.SetValueWithoutNotify(enumNames[currentIndex].text);
// https://jira.unity3d.com/browse/UUM-138138: Clamp currentIndex to 0. This matches old IMGUI
// DebugUIDrawer behavior where a negative index is sometimes used to denote an invalid/none value.
int index = Mathf.Max(0, currentIndex);
if (index < enumNames.Length)
field.SetValueWithoutNotify(enumNames[index].text);
}).Every(100));

m_AdditionalSearchText = string.Join(",", field.choices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public VisualElement Create(DebugUI.Context context)
container.AddToClassList("unity-inspector-element");

var content = new VisualElement();

foreach (var child in children)
{
if (context == Context.Editor && child.isRuntimeOnly)
Expand All @@ -67,6 +68,7 @@ public VisualElement Create(DebugUI.Context context)
if (childUIElement != null)
content.Add(childUIElement);
}

container.Add(content);

return container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ void BuildDebugUI()
else
selectedPanelName = m_SelectedPanel.displayName;

SetSelectedPanel(selectedPanelName);
// Defer until after layout so all AttachToPanelEvent callbacks from ScheduleTracked
// have fired and registered their schedulers before SetHierarchyEnabled is called.
m_TabViewElement.schedule.Execute(_ => SetSelectedPanel(selectedPanelName)).StartingIn(100);
}

void OnDestroy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,11 @@ private static DebugUI.Table.Row AddOcclusionContextDataRow(int index)
};
}

static bool s_GRDWasEnabled;

[DisplayInfo(name = "Rendering", order = 5)]
private class SettingsPanel : DebugDisplaySettingsPanel
{
public SettingsPanel(DebugDisplayGPUResidentDrawer data)
{
s_GRDWasEnabled = GPUResidentDrawer.IsInitialized();

DocumentationUtils.TryGetHelpURL(typeof(DebugDisplayGPUResidentDrawer), out var documentationUrl);
var foldout = new DebugUI.Foldout()
{
Expand All @@ -257,21 +253,16 @@ public SettingsPanel(DebugDisplayGPUResidentDrawer data)
style = MessageBox.Style.Warning,
messageCallback = () =>
{
// HACK: Reload the UI if GRD enabled state changes
if (s_GRDWasEnabled != GPUResidentDrawer.IsInitialized())
{
s_GRDWasEnabled = GPUResidentDrawer.IsInitialized();
DebugManager.instance.Reset();
}

var settings = GPUResidentDrawer.GetGlobalSettingsFromRPAsset();
return GPUResidentDrawer.IsGPUResidentDrawerSupportedBySRP(settings, out var msg, out var _) ? string.Empty : msg;
},
isHiddenCallback = () => GPUResidentDrawer.IsInitialized()
};
foldout.children.Add(helpBox);

// HACK: Avoid creating GRD debug modes when it's not enabled.
GPUResidentDrawer.initializedChanged += OnGPUResidentDrawerInitialzedChanged;

// Avoid creating GRD debug modes when it's not enabled.
// This debug UI currently creates ~650 DebugUI Widgets (over 80% of all debug widgets in URP).
// To avoid the overhead, we don't create them if GRD is not enabled. If GRD gets enabled while window is open,
// we refresh the window. It would probably be a good idea to rethink how the stats tables are implemented.
Expand Down Expand Up @@ -307,6 +298,21 @@ public SettingsPanel(DebugDisplayGPUResidentDrawer data)
AddInstanceCullingStatsWidget(data);
}

private void OnGPUResidentDrawerInitialzedChanged(bool previousValue, bool currentValue)
{
// Reload the UI if GRD enabled state changes, from disabled to enabled only, as the UI did not have all the widgets and we need to add them
// in assembly reloads, or entering playmode we do not have this code path and the SettingsPanel will be recreated itself by the Rendering Debugger
// reconstruction.
if ( previousValue == false && currentValue == true )
DebugManager.instance.Reset();
}

public override void Dispose()
{
base.Dispose();
GPUResidentDrawer.initializedChanged -= OnGPUResidentDrawerInitialzedChanged;
}

private void AddInstanceCullingStatsWidget(DebugDisplayGPUResidentDrawer data)
{
var instanceCullerStats = new DebugUI.Foldout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ internal static void Reinitialize()
#endif
}

internal static Action<bool, bool> initializedChanged; // previousValue, currentValue

private static void Cleanup()
{
if (s_Instance == null)
Expand All @@ -352,6 +354,8 @@ private static void Cleanup()

private static void Recreate(GPUResidentDrawerSettings settings)
{
bool wasInitialized = IsInitialized();

Cleanup();

if (IsGPUResidentDrawerSupportedBySRP(settings, out var message, out var severity))
Expand All @@ -363,6 +367,10 @@ private static void Recreate(GPUResidentDrawerSettings settings)
{
LogMessage(message, severity);
}

bool isInitialized = IsInitialized();
if (wasInitialized != isInitialized)
initializedChanged?.Invoke(wasInitialized, isInitialized);
}

private IntPtr m_ContextIntPtr = IntPtr.Zero;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ static public GraphicsBuffer CreateScratchBufferForTrace(IRayTracingShader shade
/// Resizes a scratch buffer if its size doesn't fit the requirement of <see cref="IRayTracingShader.Dispatch"/>.
/// </summary>
/// <remarks>
/// The resize is accomplished by disposing of the GraphicsBuffer and instanciating a new one at the proper size.
/// Unity resizes the buffer by disposing of the `GraphicsBuffer` and instantiating a new one with the proper size.
/// **Important:** If you reference the current <paramref name="scratchBuffer"/> in a command buffer, you must
/// only call this method after you submit the command buffer. See <see cref="Graphics.ExecuteCommandBuffer"/> or <see cref="ScriptableRenderContext.ExecuteCommandBuffer"/>.
/// </remarks>
/// <param name="shader">The shader that will be passed to <see cref="IRayTracingShader.Dispatch"/>.</param>
/// <param name="dispatchWidth">Number of threads in the X dimension that will be passed to <see cref="IRayTracingShader.Dispatch"/>.</param>
Expand Down Expand Up @@ -362,7 +364,9 @@ static public void ResizeScratchBufferForTrace(
/// Resizes a scratch buffer if its size doesn't fit the requirement of <see cref="IRayTracingAccelStruct.Build"/>.
/// </summary>
/// <remarks>
/// The resize is accomplished by disposing of the GraphicsBuffer and instanciating a new one at the proper size.
/// Unity resizes the buffer by disposing of the `GraphicsBuffer` and instantiating a new one with the proper size.
/// **Important:** If you reference the current <paramref name="scratchBuffer"/> in a command buffer, you must
/// only call this method after you submit the command buffer. See <see cref="Graphics.ExecuteCommandBuffer"/> or <see cref="ScriptableRenderContext.ExecuteCommandBuffer"/>.
/// </remarks>
/// <param name="accelStruct">The acceleration structure that will be passed to <see cref="IRayTracingAccelStruct.Build"/>.</param>
/// <param name="scratchBuffer">The scratch buffer.</param>
Expand Down
Loading
Loading