Skip to content

Commit 4bf2467

Browse files
Internal/6000.3/staging
Internal/6000.3/staging
2 parents 1f57cb5 + 076c476 commit 4bf2467

File tree

1,520 files changed

+247312
-400
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,520 files changed

+247312
-400
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ void BakingGUI()
361361
activeSet = newSet;
362362

363363
ProbeReferenceVolume.instance.Clear();
364+
ProbeReferenceVolume.instance.SetActiveBakingSet(newSet);
364365
}
365366

366367
if (activeSet != null)

Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCuller.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,6 +2614,7 @@ private void OnEndSceneViewCameraRendering()
26142614

26152615
public void UpdateFrame(int cameraCount)
26162616
{
2617+
DisposeSceneViewHiddenBits();
26172618
DisposeCompactVisibilityMasks();
26182619
if (cameraCount > m_LODParamsToCameraID.Capacity)
26192620
m_LODParamsToCameraID.Capacity = cameraCount;

Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ struct APVResources
7777

7878
struct APVResourcesRW
7979
{
80+
#ifdef SHADER_API_METAL
81+
// We need to use float4 on Metal, since HLSLcc will generate invalid MSL otherwise.
82+
// See https://jira.unity3d.com/browse/UUM-127198
83+
RWTexture3D<float4> L0_L1Rx;
84+
#else
8085
RWTexture3D<half4> L0_L1Rx;
86+
#endif
8187
RWTexture3D<unorm float4> L1G_L1Ry;
8288
RWTexture3D<unorm float4> L1B_L1Rz;
8389
RWTexture3D<unorm float4> L2_0;

Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ Texture3D<float4> _State1_L0_L1Rx;
1515
Texture3D<float4> _State1_L1G_L1Ry;
1616
Texture3D<float4> _State1_L1B_L1Rz;
1717

18+
#ifdef SHADER_API_METAL
19+
// We need to use float4 on Metal, since HLSLcc will generate invalid MSL otherwise.
20+
// See https://jira.unity3d.com/browse/UUM-127198
21+
RWTexture3D<float4> _Out_L0_L1Rx;
22+
#else
1823
RWTexture3D<half4> _Out_L0_L1Rx;
24+
#endif
1925
RWTexture3D<unorm float4> _Out_L1G_L1Ry;
2026
RWTexture3D<unorm float4> _Out_L1B_L1Rz;
2127

Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
#pragma multi_compile_local _ PROBE_VOLUMES_SKY_SHADING_DIRECTION
1010
#pragma multi_compile_local _ PROBE_VOLUMES_PROBE_OCCLUSION
1111

12+
#ifdef SHADER_API_METAL
13+
// We need to use float4 on Metal, since HLSLcc will generate invalid MSL otherwise.
14+
// See https://jira.unity3d.com/browse/UUM-127198
15+
RWTexture3D<float4> _Out_L0_L1Rx;
16+
#else
1217
RWTexture3D<half4> _Out_L0_L1Rx;
18+
#endif
1319
RWTexture3D<unorm float4> _Out_L1G_L1Ry;
1420
RWTexture3D<unorm float4> _Out_L1B_L1Rz;
1521

Packages/com.unity.render-pipelines.core/Runtime/PostProcessing/LensFlareComponentSRP.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace UnityEngine.Rendering
1313
/// </summary>
1414
[ExecuteAlways]
1515
[AddComponentMenu("Rendering/Lens Flare (SRP)")]
16+
[CurrentPipelineHelpURL("shared/lens-flare/lens-flare-component")]
1617
public sealed class LensFlareComponentSRP : MonoBehaviour
1718
{
1819
[SerializeField]

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ void DetectMemoryLessResources()
10761076
foreach (ref readonly var nativePass in contextData.NativePasses)
10771077
{
10781078
// Loop over all created resources by this nrp
1079-
var graphPasses = nativePass.GraphPasses(contextData);
1079+
var graphPasses = nativePass.GraphPasses(contextData, out var actualPasses);
10801080
foreach (ref readonly var subPass in graphPasses)
10811081
{
10821082
foreach (ref readonly var createdRes in subPass.FirstUsedResources(contextData))
@@ -1118,6 +1118,8 @@ void DetectMemoryLessResources()
11181118
}
11191119
}
11201120
}
1121+
if (actualPasses.IsCreated)
1122+
actualPasses.Dispose();
11211123
}
11221124
}
11231125
}
@@ -1168,7 +1170,8 @@ private bool ExecuteInitializeResource(InternalRenderGraphContext rgContext, Ren
11681170
if (pass.mergeState == PassMergeState.Begin || pass.mergeState == PassMergeState.None)
11691171
{
11701172
ref var nativePass = ref contextData.nativePassData.ElementAt(pass.nativePassIndex);
1171-
foreach (ref readonly var subPass in nativePass.GraphPasses(contextData))
1173+
var graphPasses = nativePass.GraphPasses(contextData, out var actualPasses);
1174+
foreach (ref readonly var subPass in graphPasses)
11721175
{
11731176
foreach (ref readonly var res in subPass.FirstUsedResources(contextData))
11741177
{
@@ -1204,6 +1207,8 @@ private bool ExecuteInitializeResource(InternalRenderGraphContext rgContext, Ren
12041207
}
12051208
}
12061209
}
1210+
if (actualPasses.IsCreated)
1211+
actualPasses.Dispose();
12071212
}
12081213
}
12091214
// Other passes just create them at the beginning of the individual pass
@@ -1689,28 +1694,24 @@ internal unsafe void ExecuteBeginRenderPass(InternalRenderGraphContext rgContext
16891694
currBeginAttachment = new AttachmentDescriptor(renderTargetInfo.format);
16901695

16911696
// Set up the RT pointers
1692-
if (attachments[i].memoryless == false)
1697+
var rtHandle = resources.GetTexture(currAttachmentHandle.index);
1698+
1699+
//HACK: Always set the loadstore target even if StoreAction == DontCare or Resolve
1700+
//and LoadAction == Clear or DontCare
1701+
//in these cases you could argue setting the loadStoreTarget to NULL and only set the resolveTarget
1702+
//but this confuses the backend (on vulkan) and in general is not how the lower level APIs tend to work.
1703+
//because of the RenderTexture duality where we always bundle store+resolve targets as one RTex
1704+
//it does become impossible to have a memoryless loadStore texture with a memoryfull resolve
1705+
//but that is why we mark this as a hack and future work to fix.
1706+
//The proper (and planned) solution would be to move away from the render texture duality.
1707+
RenderTargetIdentifier rtidAllSlices = rtHandle;
1708+
currBeginAttachment.loadStoreTarget = new RenderTargetIdentifier(rtidAllSlices, attachments[i].mipLevel, CubemapFace.Unknown, attachments[i].depthSlice);
1709+
1710+
if (attachments[i].storeAction == RenderBufferStoreAction.Resolve ||
1711+
attachments[i].storeAction == RenderBufferStoreAction.StoreAndResolve)
16931712
{
1694-
var rtHandle = resources.GetTexture(currAttachmentHandle.index);
1695-
1696-
//HACK: Always set the loadstore target even if StoreAction == DontCare or Resolve
1697-
//and LoadAction == Clear or DontCare
1698-
//in these cases you could argue setting the loadStoreTarget to NULL and only set the resolveTarget
1699-
//but this confuses the backend (on vulkan) and in general is not how the lower level APIs tend to work.
1700-
//because of the RenderTexture duality where we always bundle store+resolve targets as one RTex
1701-
//it does become impossible to have a memoryless loadStore texture with a memoryfull resolve
1702-
//but that is why we mark this as a hack and future work to fix.
1703-
//The proper (and planned) solution would be to move away from the render texture duality.
1704-
RenderTargetIdentifier rtidAllSlices = rtHandle;
1705-
currBeginAttachment.loadStoreTarget = new RenderTargetIdentifier(rtidAllSlices, attachments[i].mipLevel, CubemapFace.Unknown, attachments[i].depthSlice);
1706-
1707-
if (attachments[i].storeAction == RenderBufferStoreAction.Resolve ||
1708-
attachments[i].storeAction == RenderBufferStoreAction.StoreAndResolve)
1709-
{
1710-
currBeginAttachment.resolveTarget = rtHandle;
1711-
}
1713+
currBeginAttachment.resolveTarget = rtHandle;
17121714
}
1713-
// In the memoryless case it's valid to not set both loadStoreTarget/and resolveTarget as the backend will allocate a transient one
17141715

17151716
currBeginAttachment.loadAction = attachments[i].loadAction;
17161717
currBeginAttachment.storeAction = attachments[i].storeAction;
@@ -1830,7 +1831,8 @@ private void ExecuteDestroyResource(InternalRenderGraphContext rgContext, Render
18301831
if (pass.mergeState == PassMergeState.End || pass.mergeState == PassMergeState.None)
18311832
{
18321833
ref var nativePass = ref contextData.nativePassData.ElementAt(pass.nativePassIndex);
1833-
foreach (ref readonly var subPass in nativePass.GraphPasses(contextData))
1834+
var graphPasses = nativePass.GraphPasses(contextData, out var actualPasses);
1835+
foreach (ref readonly var subPass in graphPasses)
18341836
{
18351837
foreach (ref readonly var res in subPass.LastUsedResources(contextData))
18361838
{
@@ -1841,6 +1843,8 @@ private void ExecuteDestroyResource(InternalRenderGraphContext rgContext, Render
18411843
}
18421844
}
18431845
}
1846+
if (actualPasses.IsCreated)
1847+
actualPasses.Dispose();
18441848
}
18451849
}
18461850
else

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,15 +781,16 @@ public readonly bool IsValid()
781781
}
782782

783783
[MethodImpl(MethodImplOptions.AggressiveInlining)]
784-
public readonly ReadOnlySpan<PassData> GraphPasses(CompilerContextData ctx)
784+
public readonly ReadOnlySpan<PassData> GraphPasses(CompilerContextData ctx, out NativeArray<PassData> actualPasses)
785785
{
786786
// When there's no pass being culled, we can directly return a Span of the Native List
787787
if (lastGraphPass - firstGraphPass + 1 == numGraphPasses)
788788
{
789+
actualPasses = default;
789790
return ctx.passData.MakeReadOnlySpan(firstGraphPass, numGraphPasses);
790791
}
791792

792-
var actualPasses =
793+
actualPasses =
793794
new NativeArray<PassData>(numGraphPasses, Allocator.Temp,
794795
NativeArrayOptions.UninitializedMemory);
795796

@@ -808,10 +809,14 @@ public readonly ReadOnlySpan<PassData> GraphPasses(CompilerContextData ctx)
808809
[MethodImpl(MethodImplOptions.AggressiveInlining)]
809810
public readonly void GetGraphPassNames(CompilerContextData ctx, DynamicArray<Name> dest)
810811
{
811-
foreach (ref readonly var pass in GraphPasses(ctx))
812+
var span = GraphPasses(ctx, out var actualPasses);
813+
foreach (ref readonly var pass in span)
812814
{
813815
dest.Add(pass.GetName(ctx));
814816
}
817+
818+
if (actualPasses.IsCreated)
819+
actualPasses.Dispose();
815820
}
816821

817822
static bool CanMergeMSAASamples(ref NativePassData nativePass, ref PassData passToMerge)
@@ -953,7 +958,7 @@ public static PassBreakAudit CanMerge(CompilerContextData contextData, int activ
953958
// Temporary cache of sampled textures in current Native Render Pass for conflict detection against fragments
954959
using (HashSetPool<int>.Get(out var tempSampledTextures))
955960
{
956-
var graphPasses = nativePass.GraphPasses(contextData);
961+
var graphPasses = nativePass.GraphPasses(contextData, out var actualPasses);
957962
foreach (ref readonly var graphPass in graphPasses)
958963
{
959964
if (graphPass.numSampledOnlyRaster > 0) // Skip passes with no sampled textures
@@ -965,6 +970,9 @@ public static PassBreakAudit CanMerge(CompilerContextData contextData, int activ
965970
}
966971
}
967972

973+
if (actualPasses.IsCreated)
974+
actualPasses.Dispose();
975+
968976
foreach (ref readonly var fragment in passToMerge.Fragments(contextData))
969977
{
970978
bool alreadyAttached = false;

Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,6 +1951,37 @@ public static DepthBits GetDefaultDepthBufferBits()
19511951
#endif
19521952
}
19531953

1954+
/// <summary>
1955+
/// Indicates whether the combined camera viewports fully cover the screen area.
1956+
/// </summary>
1957+
/// <param name="cameras">List of cameras to render.</param>
1958+
/// <returns>True if the combined camera viewports fully cover the screen area.</returns>
1959+
public static bool IsScreenFullyCoveredByCameras(List<Camera> cameras)
1960+
{
1961+
if (cameras == null || cameras.Count == 0)
1962+
return false;
1963+
1964+
bool isScreenFullyCovered = false;
1965+
using (ListPool<Rect>.Get(out var cameraRects))
1966+
{
1967+
// We don't need to exclude stacked cameras for the input camera list because the overlay camera have the same viewport with its base camera.
1968+
foreach (var camera in cameras)
1969+
{
1970+
if (camera.targetTexture != null || camera.cameraType != CameraType.Game)
1971+
continue;
1972+
1973+
// Skip test if any viewport is full-screen
1974+
if (Mathf.Approximately(camera.rect.xMin, 0f) && Mathf.Approximately(camera.rect.yMin, 0f) && camera.rect.width >= Screen.width && camera.rect.height >= Screen.height)
1975+
return true;
1976+
1977+
cameraRects.Add(camera.rect);
1978+
}
1979+
isScreenFullyCovered = Mathf.Approximately(SweepLineRectUtils.CalculateRectUnionArea(cameraRects), 1f);
1980+
}
1981+
1982+
return isScreenFullyCovered;
1983+
}
1984+
19541985
#if UNITY_EDITOR
19551986
/// <summary>
19561987
/// Populates null fields or collection elements in a target object from a source object of the same type.

0 commit comments

Comments
 (0)