Skip to content

Commit 38ed08f

Browse files
axolotoEvergreen
authored andcommitted
Graphics/SRP - Enable RenderGraph.nativeRenderPassesEnabled by default and deprecate Legacy Render Graph API
1 parent fde4cd8 commit 38ed08f

File tree

10 files changed

+22
-21
lines changed

10 files changed

+22
-21
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ internal interface IDerivedRendergraphContext
129129
/// in favor of more specific contexts that have more specific command buffer types.
130130
/// </summary>
131131
[MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")]
132+
[Obsolete("RenderGraphContext is deprecated, use RasterGraphContext/ComputeGraphContext/UnsafeGraphContext instead.")]
132133
public struct RenderGraphContext : IDerivedRendergraphContext
133134
{
134135
private InternalRenderGraphContext wrappedContext;
@@ -394,9 +395,9 @@ public void Reset(RenderGraphPass pass, int index)
394395
}
395396

396397
/// <summary>
397-
/// Enable the use of the render pass API by the graph instead of traditional SetRenderTarget. This is an advanced
398-
/// feature and users have to be aware of the specific impact it has on rendergraph/graphics APIs below.
399-
///
398+
/// Enable the use of the render pass API instead of the traditional SetRenderTarget workflow for AddRasterRenderPass() API. Enabled by default since 6000.3.
399+
/// </summary>
400+
/// <remarks>
400401
/// When enabled, the render graph try to use render passes and supasses instead of relying on SetRendertarget. It
401402
/// will try to aggressively optimize the number of BeginRenderPass+EndRenderPass calls as well as calls to NextSubPass.
402403
/// This with the aim to maximize the time spent "on chip" on tile based renderers.
@@ -416,11 +417,8 @@ public void Reset(RenderGraphPass pass, int index)
416417
///
417418
/// Note: that CommandBuffer.BeginRenderPass/EndRenderPass calls are different by design from SetRenderTarget so this could also have
418419
/// effects outside of render graph (e.g. for code relying on the currently active render target as this will not be updated when using render passes).
419-
/// </summary>
420-
public bool nativeRenderPassesEnabled
421-
{
422-
get; set;
423-
}
420+
/// </remarks>
421+
public bool nativeRenderPassesEnabled { get; set; } = true;
424422

425423
internal static bool hasAnyRenderGraphWithNativeRenderPassesEnabled
426424
{
@@ -547,7 +545,7 @@ public RenderGraphDefaultResources defaultResources
547545
/// <summary>
548546
/// Render Graph constructor.
549547
/// </summary>
550-
/// <param name="name">Optional name used to identify the render graph instnace.</param>
548+
/// <param name="name">Optional name used to identify the render graph instance.</param>
551549
public RenderGraph(string name = "RenderGraph")
552550
{
553551
this.name = name;
@@ -843,6 +841,7 @@ public TextureHandle CreateTexture(in TextureDesc desc)
843841
/// <param name="desc">Creation descriptor of the texture.</param>
844842
/// <param name="explicitRelease">Set to true if you want to manage the lifetime of the resource yourself. Otherwise the resource will be released automatically if unused for a time.</param>
845843
/// <returns>A new TextureHandle.</returns>
844+
[Obsolete("CreateSharedTexture() and shared texture workflow are deprecated, use ImportTexture() workflow instead.")]
846845
public TextureHandle CreateSharedTexture(in TextureDesc desc, bool explicitRelease = false)
847846
{
848847
CheckNotUsingNativeRenderPassCompiler();
@@ -859,6 +858,7 @@ public TextureHandle CreateSharedTexture(in TextureDesc desc, bool explicitRelea
859858
/// </remarks>
860859
/// <param name="handle">Shared texture that needs to be updated.</param>
861860
/// <param name="desc">New Descriptor for the texture.</param>
861+
[Obsolete("RefreshSharedTextureDesc() and shared texture workflow are deprecated, use ImportTexture() workflow instead.")]
862862
public void RefreshSharedTextureDesc(TextureHandle handle, in TextureDesc desc)
863863
{
864864
CheckNotUsingNativeRenderPassCompiler();
@@ -873,6 +873,7 @@ public void RefreshSharedTextureDesc(TextureHandle handle, in TextureDesc desc)
873873
/// This API should not be used with URP NRP Render Graph. This API cannot be called when Render Graph is active, please call it outside of RecordRenderGraph().
874874
/// </remarks>
875875
/// <param name="texture">The handle to the texture that needs to be release.</param>
876+
[Obsolete("ReleaseSharedTexture() and shared texture workflow are deprecated, use ImportTexture() workflow instead.")]
876877
public void ReleaseSharedTexture(TextureHandle texture)
877878
{
878879
CheckNotUsingNativeRenderPassCompiler();
@@ -1431,6 +1432,7 @@ public IUnsafeRenderGraphBuilder AddUnsafePass<PassData>(string passName, out Pa
14311432
/// <param name="file">File name of the source file this function is called from. Used for debugging. This parameter is automatically generated by the compiler. Users do not need to pass it.</param>
14321433
/// <param name="line">File line of the source file this function is called from. Used for debugging. This parameter is automatically generated by the compiler. Users do not need to pass it.</param>
14331434
/// <returns>A new instance of a RenderGraphBuilder used to setup the new Render Pass.</returns>
1435+
[Obsolete("AddRenderPass() is deprecated, use AddRasterRenderPass/AddComputePass/AddUnsafePass() instead.")]
14341436
public RenderGraphBuilder AddRenderPass<PassData>(string passName, out PassData passData, ProfilingSampler sampler
14351437
#if !CORE_PACKAGE_DOCTOOLS
14361438
,[CallerFilePath] string file = "",
@@ -1467,6 +1469,7 @@ public RenderGraphBuilder AddRenderPass<PassData>(string passName, out PassData
14671469
/// <param name="file">File name of the source file this function is called from. Used for debugging. This parameter is automatically generated by the compiler. Users do not need to pass it.</param>
14681470
/// <param name="line">File line of the source file this function is called from. Used for debugging. This parameter is automatically generated by the compiler. Users do not need to pass it.</param>
14691471
/// <returns>A new instance of a RenderGraphBuilder used to setup the new Render Pass.</returns>
1472+
[Obsolete("AddRenderPass() is deprecated, use AddRasterRenderPass/AddComputePass/AddUnsafePass() instead.")]
14701473
public RenderGraphBuilder AddRenderPass<PassData>(string passName, out PassData passData
14711474
#if !CORE_PACKAGE_DOCTOOLS
14721475
,[CallerFilePath] string file = "",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace UnityEngine.Rendering.RenderGraphModule
88
/// Use this struct to set up a new Render Pass.
99
/// </summary>
1010
[MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")]
11+
[Obsolete("RenderGraphBuilder is deprecated, use IComputeRenderGraphBuilder/IRasterRenderGraphBuilder/IUnsafeRenderGraphBuilder instead.")]
1112
public struct RenderGraphBuilder : IDisposable
1213
{
1314
RenderGraphPass m_RenderPass;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ private void CheckUseFragment(TextureHandle tex, bool isDepth)
363363

364364
m_Resources.GetRenderTargetInfo(tex.handle, out var info);
365365

366-
// The old path is full of invalid uses that somehow work (or seemt to work) so we skip the tests if not using actual native renderpass
366+
// The old path is full of invalid uses that somehow work (or seem to work) so we skip validation if not using actual native renderpass
367367
if (m_RenderGraph.nativeRenderPassesEnabled)
368368
{
369369
if (isDepth)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ public override int GetRenderFuncHash()
640640
}
641641

642642
[DebuggerDisplay("RenderPass: {name} (Index:{index} Async:{enableAsyncCompute})")]
643+
[Obsolete("RenderGraphPass is deprecated, use RasterRenderGraphPass/ComputeRenderGraphPass/UnsafeRenderGraphPass instead.")]
643644
internal sealed class RenderGraphPass<PassData> : BaseRenderGraphPass<PassData, RenderGraphContext>
644645
where PassData : class, new()
645646
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public static RenderGraphResources Create(int newMaxElementCount, RenderGraph re
8989
return resources;
9090
}
9191

92+
#pragma warning disable CS0618 // Type or member is obsolete
9293
void Initialize(int newMaxElementCount, RenderGraph renderGraph, RenderGraphBuilder builder, bool outputIsTemp = false)
9394
{
9495
newMaxElementCount = Math.Max(newMaxElementCount, 1);
@@ -104,6 +105,7 @@ void Initialize(int newMaxElementCount, RenderGraph renderGraph, RenderGraphBuil
104105
maxBufferCount = totalSize;
105106
maxLevelCount = levelCounts;
106107
}
108+
#pragma warning restore CS0618 // Type or member is obsolete
107109

108110
/// <summary>
109111
/// Creates the render graph buffer resources from an input count.

Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public void OneTimeTearDown()
8383
RenderGraph AllocateRenderGraph()
8484
{
8585
RenderGraph g = new RenderGraph();
86-
g.nativeRenderPassesEnabled = true;
8786
return g;
8887
}
8988

Packages/com.unity.render-pipelines.core/Tests/Editor/RenderGraphTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,13 @@ public void ExceptionsOnExecuteAreHandledAsExpected()
812812
[Test]
813813
public void UsingAddRenderPassWithNRPThrows()
814814
{
815-
// m_RenderGraph.nativeRenderPassesEnabled is set to true in the setup
815+
// m_RenderGraph.nativeRenderPassesEnabled is true by default
816816
// record and execute render graph calls
817817
m_RenderGraphTestPipeline.recordRenderGraphBody = (context, camera, cmd) =>
818818
{
819+
#pragma warning disable CS0618 // Type or member is obsolete
819820
using var builder = m_RenderGraph.AddRenderPass<RenderGraphTestPassData>("HDRP Render Pass", out var passData);
821+
#pragma warning restore CS0618 // Type or member is obsolete
820822
};
821823

822824
LogAssert.Expect(LogType.Error, "Render Graph Execution error");

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,6 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest,
461461
commandBuffer = commandBuffer
462462
};
463463

464-
m_RenderGraph.nativeRenderPassesEnabled = true;
465-
466464
try
467465
{
468466
m_RenderGraph.BeginRecording(parameters);

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ internal bool useRenderGraph
209209
}
210210

211211
/// <inheritdoc/>
212-
public bool isImmediateModeSupported => true;
212+
public bool isImmediateModeSupported => false;
213213

214214
[SerializeField] private CustomPostProcessVolumeComponentList m_CompositorCustomVolumeComponentsList = new(CustomPostProcessInjectionPoint.BeforePostProcess);
215215

Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -746,12 +746,7 @@ static void RenderSingleCamera(ScriptableRenderContext context, UniversalCameraD
746746
return;
747747

748748
ScriptableRenderer.current = renderer;
749-
#if RENDER_GRAPH_OLD_COMPILER
750-
s_RenderGraph.nativeRenderPassesEnabled = false;
751-
Debug.LogWarning("The native render pass compiler is disabled. Use this for debugging only. Mobile performance may be sub-optimal.");
752-
#else
753-
s_RenderGraph.nativeRenderPassesEnabled = renderer.supportsNativeRenderPassRendergraphCompiler;
754-
#endif
749+
755750
bool isSceneViewCamera = cameraData.isSceneViewCamera;
756751

757752
// NOTE: Do NOT mix ProfilingScope with named CommandBuffers i.e. CommandBufferPool.Get("name").

0 commit comments

Comments
 (0)