Skip to content

Commit 267d38d

Browse files
authored
Merge pull request #8250 from Unity-Technologies/internal/6000.0/staging
Mirror Internal/6000.0/staging
2 parents 25e3ccf + 5be8b2e commit 267d38d

File tree

64 files changed

+573
-136
lines changed

Some content is hidden

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

64 files changed

+573
-136
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor")]
44
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Tests")]
5+
[assembly: InternalsVisibleTo("UnityEngine.TestTools.Graphics.Contexts")]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ internal static bool IsGPUResidentDrawerSupportedBySRP(GPUResidentDrawerSettings
8989
message = Strings.allowInEditModeDisabled;
9090
return false;
9191
}
92-
92+
9393
// Disable GRD in any external AssetImporter child process. GRD isn't made for AssetImporter workflow/lifetime
9494
// Avoid memory leak warning messages and also some future issues (UUM-90039)
9595
if (AssetDatabase.IsAssetImportWorkerProcess())
9696
return false;
9797
#endif
9898
// If we are forcing the system, no need to perform further checks
99-
if (IsForcedOnViaCommandLine())
99+
if (IsForcedOnViaCommandLine() || MaintainContext)
100100
return true;
101101

102102
if (GraphicsSettings.currentRenderPipeline is not IGPUResidentRenderPipeline asset)

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static void UpdateInstanceOccluders(RenderGraph renderGraph, in OccluderP
113113
public static void ReinitializeIfNeeded()
114114
{
115115
#if UNITY_EDITOR
116-
if (!IsForcedOnViaCommandLine() && (IsProjectSupported() != IsEnabled()))
116+
if (!IsForcedOnViaCommandLine() && !MaintainContext && (IsProjectSupported() != IsEnabled()))
117117
{
118118
Reinitialize();
119119
}
@@ -247,7 +247,7 @@ internal static GPUResidentDrawerSettings GetGlobalSettingsFromRPAsset()
247247
/// Is GRD forced on via the command line via -force-gpuresidentdrawer. Editor only.
248248
/// </summary>
249249
/// <returns>true if forced on</returns>
250-
private static bool IsForcedOnViaCommandLine()
250+
internal static bool IsForcedOnViaCommandLine()
251251
{
252252
#if UNITY_EDITOR
253253
return s_IsForcedOnViaCommandLine;
@@ -260,7 +260,7 @@ private static bool IsForcedOnViaCommandLine()
260260
/// Is occlusion culling forced on via the command line via -force-gpuocclusion. Editor only.
261261
/// </summary>
262262
/// <returns>true if forced on</returns>
263-
private static bool IsOcclusionForcedOnViaCommandLine()
263+
internal static bool IsOcclusionForcedOnViaCommandLine()
264264
{
265265
#if UNITY_EDITOR
266266
return s_IsOcclusionForcedOnViaCommandLine;
@@ -269,6 +269,10 @@ private static bool IsOcclusionForcedOnViaCommandLine()
269269
#endif
270270
}
271271

272+
internal static bool MaintainContext { get; set; } = false;
273+
274+
internal static bool ForceOcclusion { get; set; } = false;
275+
272276
internal static void Reinitialize()
273277
{
274278
var settings = GetGlobalSettingsFromRPAsset();

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class InternalRenderGraphContext
6161
internal RenderGraphDefaultResources defaultResources;
6262
internal RenderGraphPass executingPass;
6363
internal bool contextlessTesting;
64+
internal bool forceResourceCreation;
6465
}
6566

6667
// This whole thing is a bit of a mess InternalRenderGraphContext is public (but all members are internal)
@@ -1186,6 +1187,15 @@ public void BeginRecording(in RenderGraphParameters parameters)
11861187
m_RenderGraphContext.renderGraphPool = m_RenderGraphPool;
11871188
m_RenderGraphContext.defaultResources = m_DefaultResources;
11881189

1190+
// With the actual implementation of the Frame Debugger, we cannot re-use resources during the same frame
1191+
// or it breaks the rendering of the pass preview, since the FD copies the texture after the execution of the RG.
1192+
m_RenderGraphContext.forceResourceCreation =
1193+
#if UNITY_EDITOR || DEVELOPMENT_BUILD
1194+
FrameDebugger.enabled;
1195+
#else
1196+
false;
1197+
#endif
1198+
11891199
if (m_DebugParameters.immediateMode)
11901200
{
11911201
UpdateCurrentCompiledGraph(graphHash: -1, forceNoCaching: true);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ internal bool CreatePooledResource(InternalRenderGraphContext rgContext, int typ
10341034
var resource = m_RenderGraphResources[type].resourceArray[index];
10351035
if (!resource.imported)
10361036
{
1037-
resource.CreatePooledGraphicsResource();
1037+
resource.CreatePooledGraphicsResource(rgContext.forceResourceCreation);
10381038

10391039
if (m_RenderGraphDebug.enableLogging)
10401040
resource.LogCreation(m_FrameInformationLogger);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public virtual bool NeedsFallBack()
188188
return requestFallBack && writeCount == 0;
189189
}
190190

191-
public virtual void CreatePooledGraphicsResource() { }
191+
public virtual void CreatePooledGraphicsResource(bool forceResourceCreation) { }
192192
public virtual void CreateGraphicsResource() { }
193193
public virtual void UpdateGraphicsResource() { }
194194
public virtual void ReleasePooledGraphicsResource(int frameIndex) { }
@@ -236,7 +236,7 @@ public override void ReleaseGraphicsResource()
236236
graphicsResource = null;
237237
}
238238

239-
public override void CreatePooledGraphicsResource()
239+
public override void CreatePooledGraphicsResource(bool forceResourceCreation)
240240
{
241241
Debug.Assert(m_Pool != null, "RenderGraphResource: CreatePooledGraphicsResource should only be called for regular pooled resources");
242242

@@ -247,7 +247,7 @@ public override void CreatePooledGraphicsResource()
247247

248248
// If the pool doesn't have any available resource that we can use, we will create one
249249
// In any case, we will update the graphicsResource name based on the RenderGraph resource name
250-
if (!m_Pool.TryGetResource(hashCode, out graphicsResource))
250+
if (forceResourceCreation || !m_Pool.TryGetResource(hashCode, out graphicsResource))
251251
{
252252
CreateGraphicsResource();
253253
}

Packages/com.unity.render-pipelines.core/Runtime/XR/XRGraphicsAutomatedTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static bool activatedFromCommandLine
2424
/// <summary>
2525
/// Used by render pipelines to initialize XR tests.
2626
/// </summary>
27-
public static bool enabled { get; } = activatedFromCommandLine;
27+
public static bool enabled { get; set; } = activatedFromCommandLine;
2828

2929
/// <summary>
3030
/// Set by automated test framework and read by render pipelines.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ float3 AcesTonemap(float3 aces)
651651

652652
// --- Red modifier --- //
653653
half hue = rgb_2_hue(half3(aces));
654-
half centeredHue = center_hue(hue, RRT_RED_HUE);
654+
float centeredHue = center_hue(hue, RRT_RED_HUE); // UUM-125596 Must be float for subsequent calculations
655655
float hueWeight;
656656
{
657657
//hueWeight = cubic_basis_shaper(centeredHue, RRT_RED_WIDTH);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void SetupDOTSInstanceSelectMasks() {}
294294

295295
#ifdef UNITY_DOTS_INSTANCING_UNIFORM_BUFFER
296296
CBUFFER_START(unity_DOTSInstancing_IndirectInstanceVisibility)
297-
float4 unity_DOTSInstancing_IndirectInstanceVisibilityRaw[4096];
297+
float4 unity_DOTSInstancing_IndirectInstanceVisibilityRaw[1024];
298298
CBUFFER_END
299299
#else
300300
ByteAddressBuffer unity_DOTSInstancing_IndirectInstanceVisibility;

Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/CustomPassNodes.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public CustomColorBufferNode()
1919
UpdateNodeAfterDeserialization();
2020
}
2121

22-
public override string documentationURL => NodeUtils.GetDocumentationString("HD-Custom-Color");
23-
2422
const int kUvInputSlotId = 0;
2523
const string kUvInputSlotName = "UV";
2624

0 commit comments

Comments
 (0)