Skip to content

Commit 6d59ace

Browse files
theo-at-unityEvergreen
authored andcommitted
[6.0][RP Core & URP] Expose context internals for GTF9 test project support
1 parent 1949990 commit 6d59ace

6 files changed

Lines changed: 14 additions & 9 deletions

File tree

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/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.universal/Runtime/Data/UniversalRenderPipelineAsset.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,10 +1676,10 @@ static class Strings
16761676
}
16771677

16781678
/// <inheritdoc/>
1679-
public bool IsGPUResidentDrawerSupportedBySRP(out string message, out LogType severty)
1679+
public bool IsGPUResidentDrawerSupportedBySRP(out string message, out LogType severity)
16801680
{
16811681
message = string.Empty;
1682-
severty = LogType.Warning;
1682+
severity = LogType.Warning;
16831683

16841684
// if any of the renderers are not set to Forward+ return false
16851685
foreach (var rendererData in m_RendererDataList)

Packages/com.unity.render-pipelines.universal/Runtime/RenderGraph/RenderGraphGraphicsAutomatedTests.cs

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

2727
}
2828
}

0 commit comments

Comments
 (0)