Skip to content

Commit a2cf1a6

Browse files
authored
Merge pull request #8077 from Unity-Technologies/internal/master
Internal/master
2 parents 0d7092d + 93a9c8e commit a2cf1a6

File tree

1,413 files changed

+584895
-77979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,413 files changed

+584895
-77979
lines changed

Packages/com.unity.render-pipelines.core/Documentation~/Rendering-Debugger.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,47 @@ If your project uses the Universal Render Pipeline (URP) or the High-Definition
99
- [Add controls to the Rendering Debugger in URP](https://docs.unity3d.com/Packages/[email protected]/manual/features/rendering-debugger-add-controls.html)
1010
- [Add controls to the Rendering Debugger in HDRP](https://docs.unity3d.com/Packages/[email protected]/manual/Rendering-Debugger-Add-Controls.html)
1111

12-
## Open the Rendering Debugger
12+
## How to access the Rendering Debugger
1313

14-
You can open the **Rendering Debugger** in the following ways:
14+
The Rendering Debugger window is available in the following modes:
1515

16-
- As a window in the Editor.
17-
- An overlay in the Game view in Play Mode.
18-
- An overlay in your built application.
16+
| Mode | Platform | Availability | How to Open the Rendering Debugger |
17+
|------------|----------------|--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
18+
| Editor | All | Yes (window in the Editor) | Select **Window > Analysis > Rendering Debugger** |
19+
| Play mode | All | Yes (overlay in the Game view) | On a desktop or laptop computer, press **LeftCtrl+Backspace** (**LeftCtrl+Delete** on macOS)<br>On a console controller, press L3 and R3 (Left Stick and Right Stick) |
20+
| Runtime | Desktop/Laptop | Yes (only in Development builds) | Press **LeftCtrl+Backspace** (**LeftCtrl+Delete** on macOS) |
21+
| Runtime | Console | Yes (only in Development builds) | Press L3 and R3 (Left Stick and Right Stick) |
22+
| Runtime | Mobile | Yes (only in Development builds) | Use a three-finger double tap |
1923

20-
### As a window in the Editor
2124

22-
Select **Window > Analysis > Rendering Debugger** in the Editor.
25+
To disable the runtime UI, use the [enableRuntimeUI](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Rendering.DebugManager.html#UnityEngine_Rendering_DebugManager_enableRuntimeUI) property.
2326

24-
### As an overlay
27+
## Navigation at runtime
2528

26-
To enable the **Rendering Debugger** in your built application, you must enable **Development build** in your [build settings](https://docs.unity3d.com/2023.1/Documentation/Manual/BuildSettings.html).
29+
### Keyboard
2730

28-
To open the overlay in your built application, or the Game view in Play Mode:
31+
| Action | Control |
32+
|----------------------------------------------------|-------------------------------------------------------------------------------------------|
33+
| **Change the current active item** | Use the arrow keys |
34+
| **Change the current tab** | Use the Page up and Page down keys (Fn + Up and Fn + Down keys respectively for MacOS) |
35+
| **Display the current active item independently of the debug window** | Press the right Shift key |
36+
37+
### Xbox Controller
38+
39+
| Action | Control |
40+
|----------------------------------------------------|-------------------------------------------------------------------------------------------|
41+
| **Change the current active item** | Use the Directional pad (D-Pad) |
42+
| **Change the current tab** | Use the Left Bumper and Right Bumper |
43+
| **Display the current active item independently of the debug window** | Press the X button |
44+
45+
### PlayStation Controller
46+
47+
| Action | Control |
48+
|----------------------------------------------------|-------------------------------------------------------------------------------------------|
49+
| **Change the current active item** | Use the Directional buttons |
50+
| **Change the current tab** | Use the L1 button and R1 button |
51+
| **Display the current active item independently of the debug window** | Press the Square button |
2952

30-
- On a keyboard, press Left Ctrl + Backspace (macOS: Left Ctrl + Delete).
31-
- On a console controller, press L3 + R3.
32-
- On a mobile device, use a three-finger double tap.
3353

3454
## Add a control
3555

Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CorePreprocessBuild.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace UnityEditor.Rendering
66
//Make CoreBuildData constructed and kept till end of build
77
class CorePreprocessBuild : IPreprocessBuildWithReport, IPostprocessBuildWithReport
88
{
9-
int IOrderedCallback.callbackOrder => -1;
9+
int IOrderedCallback.callbackOrder => int.MinValue + 50;
1010

1111
private static CoreBuildData m_BuildData = null;
1212

@@ -22,4 +22,4 @@ void IPostprocessBuildWithReport.OnPostprocessBuild(BuildReport report)
2222
m_BuildData = null;
2323
}
2424
}
25-
}
25+
}

Packages/com.unity.render-pipelines.core/Editor/Gizmo/HierarchicalBox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public HierarchicalBox(Color baseColor, Color[] polychromeHandleColors = null, H
190190
public void DrawHull(bool filled)
191191
{
192192
Color previousColor = Handles.color;
193-
if (filled)
193+
if (filled && Event.current.type == EventType.Repaint)
194194
{
195195
// Draw the hull
196196
var xSize = new Vector3(size.z, size.y, 1f);

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeAdjustmentVolumeEditor.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ static void DrawBakingHelpers(SerializedProbeAdjustmentVolume p, Editor owner)
274274
if (owner.targets.Length == 1)
275275
{
276276
EditorGUILayout.Space();
277-
using (new EditorGUI.DisabledScope(bakingSet == null))
277+
using (new EditorGUI.DisabledScope(Lightmapping.isRunning || bakingSet == null))
278278
{
279-
if (GUILayout.Button(Styles.s_PreviewLighting))
280-
AdaptiveProbeVolumes.BakeAdjustmentVolume(bakingSet, ptv);
279+
using (new EditorGUI.DisabledScope(AdaptiveProbeVolumes.isRunning))
280+
if (GUILayout.Button(Styles.s_PreviewLighting))
281+
AdaptiveProbeVolumes.BakeAdjustmentVolume(bakingSet, ptv);
281282

282283
ProbeVolumeLightingTab.BakeAPVButton();
283284
}

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Dilate.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ public void Dispose()
172172
static readonly int _NeedDilating = Shader.PropertyToID("_NeedDilating");
173173
static readonly int _DilationParameters = Shader.PropertyToID("_DilationParameters");
174174
static readonly int _OutputProbes = Shader.PropertyToID("_OutputProbes");
175+
176+
// We need to keep the original list of cells that were actually baked to feed it to the dilation process.
177+
// This is because during partial bake we only want to dilate those cells.
178+
static Dictionary<int, BakingCell> m_CellsToDilate = new Dictionary<int, BakingCell>();
179+
static Dictionary<Vector3Int, int> m_CellPosToIndex = new Dictionary<Vector3Int, int>();
180+
181+
// Free up dilation related data
182+
static internal void FinalizeDilation()
183+
{
184+
m_CellPosToIndex.Clear();
185+
m_CellsToDilate.Clear();
186+
}
175187

176188
// Can definitively be optimized later on.
177189
// Also note that all the bookkeeping of all the reference volumes will likely need to change when we move to

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.LightTransport.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ public override bool Step()
117117
context.Dispose();
118118
}
119119

120+
// Fixup lighting for probes part of bricks with different subdivision levels
121+
// When baking reflection probes, we want to skip this step
122+
if (m_BakingBatch != null)
123+
{
124+
FixSeams(s_BakeData.positionRemap, positions, irradiance, validity);
125+
}
126+
120127
return true;
121128
}
122129

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Placement.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ static NativeList<Vector3> ApplySubdivisionResults(ProbeSubdivisionResult result
170170
BakingSetupProfiling.GetProgressRange(out float progress0, out float progress1);
171171

172172
var positions = new NativeList<Vector3>(Allocator.Persistent);
173-
Dictionary<int, int> positionToIndex = new();
174173
foreach ((var position, var bounds, var bricks) in results.cells)
175174
{
176175
if (++cellIdx % freq == 0)
@@ -179,7 +178,7 @@ static NativeList<Vector3> ApplySubdivisionResults(ProbeSubdivisionResult result
179178
int positionStart = positions.Length;
180179

181180
ConvertBricksToPositions(bricks, out var probePositions, out var brickSubdivLevels);
182-
DeduplicateProbePositions(in probePositions, in brickSubdivLevels, positionToIndex, m_BakingBatch, positions, out var probeIndices);
181+
DeduplicateProbePositions(in probePositions, in brickSubdivLevels, m_BakingBatch, positions, out var probeIndices);
183182

184183
BakingCell cell = new BakingCell()
185184
{
@@ -198,19 +197,19 @@ static NativeList<Vector3> ApplySubdivisionResults(ProbeSubdivisionResult result
198197
return positions;
199198
}
200199

201-
private static void DeduplicateProbePositions(in Vector3[] probePositions, in int[] brickSubdivLevel, Dictionary<int, int> positionToIndex, BakingBatch batch,
200+
private static void DeduplicateProbePositions(in Vector3[] probePositions, in int[] brickSubdivLevel, BakingBatch batch,
202201
NativeList<Vector3> uniquePositions, out int[] indices)
203202
{
204203
indices = new int[probePositions.Length];
205-
int uniqueIndex = positionToIndex.Count;
204+
int uniqueIndex = batch.positionToIndex.Count;
206205

207206
for (int i = 0; i < probePositions.Length; i++)
208207
{
209208
var pos = probePositions[i];
210209
var brickSubdiv = brickSubdivLevel[i];
211210
int probeHash = batch.GetProbePositionHash(pos);
212211

213-
if (positionToIndex.TryGetValue(probeHash, out var index))
212+
if (batch.positionToIndex.TryGetValue(probeHash, out var index))
214213
{
215214
indices[i] = index;
216215
int oldBrickLevel = batch.uniqueBrickSubdiv[probeHash];
@@ -219,7 +218,7 @@ private static void DeduplicateProbePositions(in Vector3[] probePositions, in in
219218
}
220219
else
221220
{
222-
positionToIndex[probeHash] = uniqueIndex;
221+
batch.positionToIndex[probeHash] = uniqueIndex;
223222
indices[i] = uniqueIndex;
224223
batch.uniqueBrickSubdiv[probeHash] = brickSubdiv;
225224
uniquePositions.Add(pos);

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class DefaultRenderingLayer : RenderingLayerBaker
5858
NativeArray<uint> layerMask;
5959

6060
public override NativeArray<uint> renderingLayerMasks => layerMask;
61-
61+
6262
CommandBuffer cmd;
6363
IRayTracingAccelStruct m_AccelerationStructure;
6464
GraphicsBuffer scratchBuffer;
@@ -141,7 +141,7 @@ public override bool Step()
141141
{
142142
if (currentStep >= stepCount)
143143
return true;
144-
144+
145145
var shader = s_TracingContext.shaderRL;
146146

147147
int batchOffset = batchIndex * k_MaxProbeCountPerBatch;
@@ -152,7 +152,7 @@ public override bool Step()
152152
shader.SetVectorParam(cmd, _RenderingLayerMasks, regionMasks);
153153
shader.SetBufferParam(cmd, _ProbePositions, probePositionsBuffer);
154154
shader.SetBufferParam(cmd, _LayerMasks, layerMaskBuffer);
155-
155+
156156
shader.Dispatch(cmd, scratchBuffer, (uint)batchSize, 1, 1);
157157
batchIndex++;
158158

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public abstract class SkyOcclusionBaker : IDisposable
4040
/// Performs necessary tasks to free allocated resources.
4141
/// </summary>
4242
public abstract void Dispose();
43-
43+
4444
internal NativeArray<uint> encodedDirections;
4545
internal void Encode() { encodedDirections = EncodeShadingDirection(shadingDirections); }
46-
46+
4747
static int k_MaxProbeCountPerBatch = 65535;
4848
static readonly int _SkyShadingPrecomputedDirection = Shader.PropertyToID("_SkyShadingPrecomputedDirection");
4949
static readonly int _SkyShadingDirections = Shader.PropertyToID("_SkyShadingDirections");
@@ -71,7 +71,7 @@ internal static NativeArray<uint> EncodeShadingDirection(NativeArray<Vector3> di
7171
{
7272
int batchOffset = batchIndex * k_MaxProbeCountPerBatch;
7373
int probeInBatch = Mathf.Min(probeCount - batchOffset, k_MaxProbeCountPerBatch);
74-
74+
7575
directionBuffer.SetData(directions, batchOffset, 0, probeInBatch);
7676

7777
cs.SetBuffer(kernel, _SkyShadingPrecomputedDirection, precomputedShadingDirections);
@@ -84,7 +84,7 @@ internal static NativeArray<uint> EncodeShadingDirection(NativeArray<Vector3> di
8484
var batchResult = directionResults.GetSubArray(batchOffset, probeInBatch);
8585
AsyncGPUReadback.RequestIntoNativeArray(ref batchResult, encodedBuffer, probeInBatch * sizeof(uint), 0).WaitForCompletion();
8686
}
87-
87+
8888
directionBuffer.Dispose();
8989
encodedBuffer.Dispose();
9090

0 commit comments

Comments
 (0)