Skip to content

Commit 594725a

Browse files
authored
Merge pull request #8257 from Unity-Technologies/internal/6000.3/staging
Mirror Internal/6000.3/staging
2 parents db423c4 + d6be21c commit 594725a

31 files changed

+376
-391
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ public BakingBatch(Vector3Int cellCount, ProbeReferenceVolume refVolume)
306306
maxBrickCount = cellCount * ProbeReferenceVolume.CellSize(refVolume.GetMaxSubdivision());
307307
inverseScale = ProbeBrickPool.kBrickCellCount / refVolume.MinBrickSize();
308308
offset = refVolume.ProbeOffset();
309-
309+
310310
// Initialize NativeHashMaps with reasonable initial capacity
311311
// Using a larger capacity to reduce allocations during baking
312312
positionToIndex = new NativeHashMap<int, int>(100000, Allocator.Persistent);
313313
uniqueBrickSubdiv = new NativeHashMap<int, int>(100000, Allocator.Persistent);
314314
}
315-
315+
316316
public void Dispose()
317317
{
318318
if (positionToIndex.IsCreated)
@@ -1098,7 +1098,7 @@ static void BakeDelegate(ref float progress, ref bool done)
10981098
{
10991099
FixSeams(
11001100
s_BakeData.positionRemap,
1101-
s_BakeData.originalPositions,
1101+
s_BakeData.sortedPositions,
11021102
s_BakeData.lightingJob.irradiance,
11031103
s_BakeData.lightingJob.validity,
11041104
s_BakeData.lightingJob.occlusion,
@@ -1323,7 +1323,7 @@ internal static void FixSeams(
13231323
NativeArray<Vector4> skyOcclusion,
13241324
NativeArray<uint> renderingLayerMasks)
13251325
{
1326-
// Seams are caused are caused by probes on the boundary between two subdivision levels
1326+
// Seams are caused by probes on the boundary between two subdivision levels
13271327
// The idea is to find first them and do a kind of dilation to smooth the values on the boundary
13281328
// the dilation process consits in doing a trilinear sample of the higher subdivision brick and override the lower subdiv with that
13291329
// We have to mark the probes on the boundary as valid otherwise leak reduction at runtime will interfere with this method
@@ -1443,7 +1443,8 @@ Vector3Int GetCellPositionFromVoxel(Vector3Int voxelToLookup, int cellSizeInBric
14431443
{
14441444
uint renderingLayerMask = renderingLayerMasks[positionRemap[index]];
14451445
bool commonRenderingLayer = (renderingLayerMask & probeRenderingLayerMask) != 0;
1446-
if (!commonRenderingLayer) continue; // We do not use this probe contribution if it does not share at least a common rendering layer
1446+
if (!commonRenderingLayer)
1447+
continue; // We do not use this probe contribution if it does not share at least a common rendering layer
14471448
}
14481449

14491450
// Do the lerp in compressed format to match result on GPU
@@ -1512,7 +1513,7 @@ static void ApplyPostBakeOperations()
15121513
var chunkSizeInProbes = ProbeBrickPool.GetChunkSizeInProbeCount();
15131514
var hasVirtualOffsets = m_BakingSet.settings.virtualOffsetSettings.useVirtualOffset;
15141515
var hasRenderingLayers = m_BakingSet.useRenderingLayers;
1515-
1516+
15161517
if (!ValidateBakingCellsSize(bakingCellsArray, chunkSizeInProbes, hasVirtualOffsets, hasRenderingLayers))
15171518
return; // Early exit if validation fails
15181519

Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.PlayerConnection.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ public PlayerConnection(IConnectionState connectionState, UnityEngine.Events.Uni
2424
EditorConnection.instance.Initialize();
2525
EditorConnection.instance.RegisterConnection(m_OnPlayerConnected);
2626
EditorConnection.instance.RegisterDisconnection(m_OnPlayerDisconnected);
27-
28-
EditorApplication.quitting += OnEditorQuitting;
2927
}
3028

3129
public void Dispose()
@@ -35,27 +33,15 @@ public void Dispose()
3533
EditorConnection.instance.UnregisterConnection(m_OnPlayerConnected);
3634
EditorConnection.instance.UnregisterDisconnection(m_OnPlayerDisconnected);
3735

38-
// NOTE: There is a bug where editor crashes if we call DisconnectAll during shutdown flow. In this case
39-
// it's fine to skip the disconnect as the player will get notified of it anyway.
40-
if (!m_EditorQuitting)
41-
EditorConnection.instance.DisconnectAll();
42-
4336
m_ConnectionState.Dispose();
4437
m_ConnectionState = null;
45-
46-
EditorApplication.quitting -= OnEditorQuitting;
4738
}
4839
}
4940

5041
public void OnConnectionDropdownIMGUI()
5142
{
5243
PlayerConnectionGUILayout.ConnectionTargetSelectionDropdown(m_ConnectionState, EditorStyles.toolbarDropDown, 250);
5344
}
54-
55-
void OnEditorQuitting()
56-
{
57-
m_EditorQuitting = true;
58-
}
5945
}
6046
}
6147
}

Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ void SetSelectedExecutionIndex(int executionIndex)
11311131
if (m_SelectedExecutionIndex != executionIndex)
11321132
{
11331133
m_SelectedExecutionIndex = executionIndex;
1134-
UpdateCurrentDebugData();
1134+
UpdateCurrentDebugData(true);
11351135
}
11361136

11371137
// Using a custom toolbar menu instead of default Dropdown in order to get access to allowDuplicateNames,
@@ -2032,7 +2032,7 @@ void UpdateStatusLabel()
20322032

20332033
string connectionStatus = m_IsDeviceConnected ? "Online" : "Offline";
20342034

2035-
bool isEditor = m_ConnectedDeviceName == "Editor";
2035+
bool isEditor = m_ConnectedDeviceName == k_EditorName;
20362036
string sourceLabel = isEditor ? "Source: Editor" : $"Source: {m_ConnectedDeviceName} ({connectionStatus})";
20372037

20382038
bool hasCapture = HasValidDebugData && m_LastDataCaptureTime != DateTime.MinValue;
@@ -2052,7 +2052,8 @@ void UpdateCurrentDebugData(bool force = false)
20522052
{
20532053
m_CurrentDebugData = RenderGraphDebugSession.GetDebugData(m_SelectedRenderGraph, selectedExecutionItem.id);
20542054

2055-
if (HasValidDebugData)
2055+
// Update timestamp when we get valid data, or when forcing an update
2056+
if (HasValidDebugData || force)
20562057
m_LastDataCaptureTime = DateTime.Now;
20572058
}
20582059
else
@@ -2066,6 +2067,8 @@ void UpdateCurrentDebugData(bool force = false)
20662067
currentGraphDropdown.style.display = DisplayStyle.None;
20672068
if (currentExecutionToolbarMenu != null)
20682069
currentExecutionToolbarMenu.style.display = DisplayStyle.None;
2070+
2071+
m_LastDataCaptureTime = DateTime.MinValue;
20692072
}
20702073

20712074
UpdateStatusLabel();
@@ -2170,6 +2173,7 @@ void OnPlayerConnected(int playerID)
21702173
void OnPlayerDisconnected(int playerID)
21712174
{
21722175
m_IsDeviceConnected = false;
2176+
m_ConnectedDeviceName = k_EditorName;
21732177

21742178
if (!m_Paused)
21752179
{

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Debug/RenderGraphDebugSession.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,27 @@ public static void EndSession()
158158
}
159159
}
160160

161-
public static List<string> GetRegisteredGraphs() => s_CurrentDebugSession.debugDataContainer.GetRenderGraphs();
161+
public static List<string> s_EmptyRegisteredGraphs = new();
162+
public static List<string> GetRegisteredGraphs()
163+
{
164+
if (s_CurrentDebugSession == null || s_CurrentDebugSession.debugDataContainer == null)
165+
{
166+
return s_EmptyRegisteredGraphs;
167+
}
168+
169+
return s_CurrentDebugSession.debugDataContainer.GetRenderGraphs();
170+
}
162171

163-
public static List<DebugExecutionItem> GetExecutions(string graphName) => s_CurrentDebugSession.debugDataContainer.GetExecutions(graphName);
172+
public static List<DebugExecutionItem> s_EmptyExecutions = new();
173+
public static List<DebugExecutionItem> GetExecutions(string graphName)
174+
{
175+
if (s_CurrentDebugSession == null || s_CurrentDebugSession.debugDataContainer == null)
176+
{
177+
return s_EmptyExecutions;
178+
}
179+
180+
return s_CurrentDebugSession.debugDataContainer.GetExecutions(graphName);
181+
}
164182

165183
public static DebugData GetDebugData(string renderGraph, EntityId executionId)
166184
{

Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ real ConvertLuminanceToEv(real luminance)
7979

8080
// Non physically based hack to limit light influence to attenuationRadius.
8181
// Square the result to smoothen the function.
82-
real DistanceWindowing(real distSquare, real rangeAttenuationScale, real rangeAttenuationBias)
82+
real DistanceWindowing(float distSquare, real rangeAttenuationScale, real rangeAttenuationBias)
8383
{
8484
// If (range attenuation is enabled)
8585
// rangeAttenuationScale = 1 / r^2

Packages/com.unity.render-pipelines.core/ShaderLibrary/Shadow/ShadowSamplingTent.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void SampleShadow_GetTexelWeights_Tent_7x7(real offset, out real4 texelsWeightsA
106106
}
107107

108108
// 3x3 Tent filter (45 degree sloped triangles in U and V)
109-
void SampleShadow_ComputeSamples_Tent_3x3(real4 shadowMapTexture_TexelSize, real2 coord, out real fetchesWeights[4], out real2 fetchesUV[4])
109+
void SampleShadow_ComputeSamples_Tent_3x3(real4 shadowMapTexture_TexelSize, float2 coord, out real fetchesWeights[4], out real2 fetchesUV[4])
110110
{
111111
// tent base is 3x3 base thus covering from 9 to 12 texels, thus we need 4 bilinear PCF fetches
112112
real2 tentCenterInTexelSpace = coord.xy * shadowMapTexture_TexelSize.zw;
@@ -186,7 +186,7 @@ void SampleShadow_ComputeSamples_Tent_3x3(real4 shadowMapTexture_TexelSize, real
186186
(fetchesWeights)[8] = fetchesWeightsU.z * fetchesWeightsV.z; \
187187
}
188188

189-
void SampleShadow_ComputeSamples_Tent_5x5(real4 shadowMapTexture_TexelSize, real2 coord, out real fetchesWeights[9], out real2 fetchesUV[9])
189+
void SampleShadow_ComputeSamples_Tent_5x5(real4 shadowMapTexture_TexelSize, float2 coord, out real fetchesWeights[9], out real2 fetchesUV[9])
190190
{
191191
SampleShadow_ComputeSamples_Tent_Filter_5x5(real, shadowMapTexture_TexelSize, coord, fetchesWeights, fetchesUV);
192192
}
@@ -254,7 +254,7 @@ void SampleShadow_ComputeSamples_Tent_5x5(real4 shadowMapTexture_TexelSize, real
254254

255255

256256

257-
void SampleShadow_ComputeSamples_Tent_7x7(real4 shadowMapTexture_TexelSize, real2 coord, out real fetchesWeights[16], out real2 fetchesUV[16])
257+
void SampleShadow_ComputeSamples_Tent_7x7(real4 shadowMapTexture_TexelSize, float2 coord, out real fetchesWeights[16], out real2 fetchesUV[16])
258258
{
259259
SampleShadow_ComputeSamples_Tent_Filter_7x7(real, shadowMapTexture_TexelSize, coord, fetchesWeights, fetchesUV);
260260
}

Packages/com.unity.render-pipelines.high-definition/Documentation~/fog-volume-master-stack-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ These settings appear when you select the Fog’s material in the Asset window.
6868
| **Fog Volume options** | | |
6969
| | **Single Scattering Albedo** | Control the color of each fog particle. The fog’s density doesn’t affect this color. |
7070
| | **Fog Distance** | Control how far you can see through the fog in meters. This controls how far the light passes through fog to affect how opaque it appears. A value of 0 makes the fog appear opaque. |
71-
| | **Blend mode** | Determine how this fog shader blends with existing fog in the scene. This property overwrites the Blend mode you set in the Surface Options:<br />&#8226; **Overwrite:** Replaces existing fog in the volume area with this fog shader.Presented **content strategy** initiatives to leads in key team meetings.&#8226;**Additive:** Adds the color and density of this fog shader to other fog in the scene. This is the default value.<br /> **Multiply:** Multiplies the color and density of this fog shader with other fog in the scene. You can use this to create effects relative to a specific fog density.<br />&#8226; **Min:** Determines the minimum density value of this fog shader and the scene fog inside its bounding box. For example, a value of 0 appears to remove fog in a certain area.<br />&#8226; **Max:** Determines the maximum density value of this fog shader and the scene fog inside its bounding box. |
71+
| | **Blend mode** | Determine how this fog shader blends with existing fog in the scene. This property overwrites the Blend mode you set in the Surface Options:<br />&#8226; **Overwrite:** Replaces existing fog in the volume area with this fog shader.<br/>&#8226;**Additive:** Adds the color and density of this fog shader to other fog in the scene. This is the default value.<br /> **Multiply:** Multiplies the color and density of this fog shader with other fog in the scene. You can use this to create effects relative to a specific fog density.<br />&#8226; **Min:** Determines the minimum density value of this fog shader and the scene fog inside its bounding box. For example, a value of 0 appears to remove fog in a certain area.<br />&#8226; **Max:** Determines the maximum density value of this fog shader and the scene fog inside its bounding box. |

Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPBuildData.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using UnityEditor.SceneManagement;
43
using UnityEngine;
54
using UnityEngine.Rendering;
65
using UnityEngine.Rendering.HighDefinition;
@@ -17,7 +16,6 @@ internal class HDRPBuildData : IDisposable
1716
public List<HDRenderPipelineAsset> renderPipelineAssets { get; private set; } = new List<HDRenderPipelineAsset>();
1817
public bool playerNeedRaytracing { get; private set; }
1918
public bool stripDebugVariants { get; private set; } = true;
20-
public bool dynamicLightmapsUsed { get; private set; }
2119
public bool waterDecalMaskAndCurrent { get; private set; }
2220
public Dictionary<int, ComputeShader> rayTracingComputeShaderCache { get; private set; } = new();
2321
public Dictionary<int, ComputeShader> computeShaderCache { get; private set; } = new();
@@ -71,43 +69,13 @@ public HDRPBuildData(BuildTarget buildTarget, bool isDevelopmentBuild)
7169
m_Instance = this;
7270
}
7371

74-
public void SetDynamicLightmapsUsedInBuildScenes()
75-
{
76-
dynamicLightmapsUsed = DynamicLightmapsUsedInBuildScenes();
77-
}
78-
79-
static bool DynamicLightmapsUsedInBuildScenes()
80-
{
81-
var originalSetup = EditorSceneManager.GetSceneManagerSetup();
82-
83-
bool dynamicLightmapsUsed = false;
84-
foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes)
85-
{
86-
if (!scene.enabled) continue;
87-
88-
EditorSceneManager.OpenScene(scene.path, OpenSceneMode.Single);
89-
90-
if (Lightmapping.HasDynamicGILightmapTextures())
91-
{
92-
dynamicLightmapsUsed = true;
93-
break;
94-
}
95-
}
96-
97-
if (originalSetup.Length > 0)
98-
EditorSceneManager.RestoreSceneManagerSetup(originalSetup);
99-
100-
return dynamicLightmapsUsed;
101-
}
102-
10372
public void Dispose()
10473
{
10574
renderPipelineAssets?.Clear();
10675
rayTracingComputeShaderCache?.Clear();
10776
computeShaderCache?.Clear();
10877
playerNeedRaytracing = false;
10978
stripDebugVariants = true;
110-
dynamicLightmapsUsed = false;
11179
waterDecalMaskAndCurrent = false;
11280
buildingPlayerForHDRenderPipeline = false;
11381
runtimeShaders = null;

Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ public void OnPreprocessBuild(BuildReport report)
3333
bool isDevelopmentBuild = (report.summary.options & BuildOptions.Development) != 0;
3434
m_BuildData = new HDRPBuildData(EditorUserBuildSettings.activeBuildTarget, isDevelopmentBuild);
3535

36-
// Since the HDRPBuildData instance is used in a lot of places, doing this check here ensures that it is done before the build starts.
37-
m_BuildData.SetDynamicLightmapsUsedInBuildScenes();
38-
3936
if (m_BuildData.buildingPlayerForHDRenderPipeline)
4037
{
4138
// Now that we know that we are on HDRP we need to make sure everything is correct, otherwise we break the build.

Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessShaders.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using UnityEditor.SceneManagement;
21
using UnityEngine;
32
using UnityEngine.Rendering;
43
using UnityEngine.Rendering.HighDefinition;
@@ -71,10 +70,8 @@ protected override bool DoShadersStripper(HDRenderPipelineAsset hdrpAsset, Shade
7170
// Remove editor only pass
7271
bool isSceneSelectionPass = snippet.passName == "SceneSelectionPass";
7372
bool isScenePickingPass = snippet.passName == "ScenePickingPass";
74-
75-
bool isEnlightenSupported = SupportedRenderingFeatures.active.enlighten && ((int)SupportedRenderingFeatures.active.lightmapBakeTypes | (int)LightmapBakeType.Realtime) != 0;
76-
bool metaPassUnused = (snippet.passName == "META") && (!isEnlightenSupported || !HDRPBuildData.instance.dynamicLightmapsUsed);
77-
73+
bool metaPassUnused = (snippet.passName == "META") && (SupportedRenderingFeatures.active.enlighten == false ||
74+
((int)SupportedRenderingFeatures.active.lightmapBakeTypes | (int)LightmapBakeType.Realtime) == 0);
7875
bool editorVisualization = inputData.shaderKeywordSet.IsEnabled(m_EditorVisualization);
7976
if (isSceneSelectionPass || isScenePickingPass || metaPassUnused || editorVisualization)
8077
return true;

0 commit comments

Comments
 (0)