Skip to content

Commit 6bd8401

Browse files
timcannellunity3dEvergreen
authored andcommitted
[content automatically redacted] touching PlatformDependent folder
1 parent 49825d3 commit 6bd8401

File tree

8 files changed

+107
-58
lines changed

8 files changed

+107
-58
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ public void ExecuteGraph(InternalRenderGraphContext rgContext, RenderGraphResour
14201420
if (pass.waitOnGraphicsFencePassId != -1)
14211421
{
14221422
var fence = contextData.fences[pass.waitOnGraphicsFencePassId];
1423-
rgContext.cmd.WaitOnAsyncGraphicsFence(fence);
1423+
rgContext.cmd.WaitOnAsyncGraphicsFence(fence, SynchronisationStageFlags.PixelProcessing);
14241424
}
14251425

14261426
var nrpBegan = false;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,14 +2263,14 @@ void PreRenderPassExecute(in CompiledPassInfo passInfo, RenderGraphPass pass, In
22632263

22642264
if (executedWorkDuringResourceCreation)
22652265
{
2266-
rgContext.cmd.WaitOnAsyncGraphicsFence(previousFence);
2266+
rgContext.cmd.WaitOnAsyncGraphicsFence(previousFence, SynchronisationStageFlags.PixelProcessing);
22672267
}
22682268
}
22692269

22702270
// Synchronize with graphics or compute pipe if needed.
22712271
if (passInfo.syncToPassIndex != -1)
22722272
{
2273-
rgContext.cmd.WaitOnAsyncGraphicsFence(m_CurrentCompiledGraph.compiledPassInfos[passInfo.syncToPassIndex].fence);
2273+
rgContext.cmd.WaitOnAsyncGraphicsFence(m_CurrentCompiledGraph.compiledPassInfos[passInfo.syncToPassIndex].fence, SynchronisationStageFlags.PixelProcessing);
22742274
}
22752275
}
22762276

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private void InitDefaultResourcesIfNeeded()
4848
m_WhiteTexture2D = RTHandles.Alloc(Texture2D.whiteTexture);
4949

5050
if (m_ShadowTexture2D == null)
51-
m_ShadowTexture2D = RTHandles.Alloc(1, 1, Experimental.Rendering.GraphicsFormat.D32_SFloat, isShadowMap: true, name: "DefaultShadowTexture");
51+
m_ShadowTexture2D = RTHandles.Alloc(1, 1, CoreUtils.GetDefaultDepthOnlyFormat(), isShadowMap: true, name: "DefaultShadowTexture");
5252
}
5353

5454
internal void Cleanup()

Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ public class Styles
350350
public static readonly GUIContent volumeProfileLabel = EditorGUIUtility.TrTextContent("Volume Profile", "Settings that will override the values defined in the Default Volume Profile set in the Render Pipeline Global settings. Local Volumes inside scenes may override these settings further.");
351351
public static System.Lazy<GUIStyle> volumeProfileContextMenuStyle = new(() => new GUIStyle(CoreEditorStyles.contextMenuStyle) { margin = new RectOffset(0, 1, 3, 0) });
352352

353-
public static readonly GUIContent[] shadowBitDepthNames = { new GUIContent("32 bit"), new GUIContent("16 bit") };
354-
public static readonly int[] shadowBitDepthValues = { (int)DepthBits.Depth32, (int)DepthBits.Depth16 };
353+
public static readonly GUIContent[] shadowBitDepthNames = { new GUIContent("32 bit"), new GUIContent("16 bit"), new GUIContent("24 bit") };
354+
public static readonly int[] shadowBitDepthValues = { (int)DepthBits.Depth32, (int)DepthBits.Depth16, (int)DepthBits.Depth24 };
355355

356356
public static readonly GUIContent gpuResidentDrawerMode = EditorGUIUtility.TrTextContent("GPU Resident Drawer", "Enables draw submission through the GPU Resident Drawer, which can improve CPU performance");
357357
public static readonly GUIContent smallMeshScreenPercentage = EditorGUIUtility.TrTextContent("Small-Mesh Screen-Percentage", "Default minimum screen percentage (0-20%) gpu-driven Renderers can cover before getting culled. If a Renderer is part of a LODGroup, this will be ignored.");

Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,22 +1429,27 @@ public void RenderFinalSetup(RenderGraph renderGraph, UniversalCameraData camera
14291429
// Scaled FXAA
14301430
using (var builder = renderGraph.AddRasterRenderPass<PostProcessingFinalSetupPassData>("Postprocessing Final Setup Pass", out var passData, ProfilingSampler.Get(URPProfileId.RG_FinalSetup)))
14311431
{
1432+
1433+
builder.AllowGlobalStateModification(true);
1434+
builder.AllowPassCulling(false);
1435+
14321436
Material material = m_Materials.scalingSetup;
14331437
material.shaderKeywords = null;
14341438

1439+
material.shaderKeywords = null;
1440+
14351441
if (settings.isFxaaEnabled)
1436-
material.EnableKeyword(ShaderKeywordStrings.Fxaa);
1442+
CoreUtils.SetKeyword(material, ShaderKeywordStrings.Fxaa, settings.isFxaaEnabled);
14371443

14381444
if (settings.isFsrEnabled)
1439-
material.EnableKeyword(settings.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding) ? ShaderKeywordStrings.Gamma20AndHDRInput : ShaderKeywordStrings.Gamma20);
1445+
CoreUtils.SetKeyword(material, (settings.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding) ? ShaderKeywordStrings.Gamma20AndHDRInput : ShaderKeywordStrings.Gamma20), true);
14401446

14411447
if (settings.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding))
14421448
SetupHDROutput(cameraData.hdrDisplayInformation, cameraData.hdrDisplayColorGamut, material, settings.hdrOperations, cameraData.rendersOverlayUI);
14431449

14441450
if (settings.isAlphaOutputEnabled)
14451451
CoreUtils.SetKeyword(material, ShaderKeywordStrings._ENABLE_ALPHA_OUTPUT, settings.isAlphaOutputEnabled);
14461452

1447-
builder.AllowGlobalStateModification(true);
14481453
passData.destinationTexture = destination;
14491454
builder.SetRenderAttachment(destination, 0, AccessFlags.Write);
14501455
passData.sourceTexture = source;
@@ -1567,6 +1572,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD
15671572
using (var builder = renderGraph.AddRasterRenderPass<PostProcessingFinalBlitPassData>("Postprocessing Final Blit Pass", out var passData, ProfilingSampler.Get(URPProfileId.RG_FinalBlit)))
15681573
{
15691574
builder.AllowGlobalStateModification(true);
1575+
builder.AllowPassCulling(false);
15701576
passData.destinationTexture = postProcessingTarget;
15711577
builder.SetRenderAttachment(postProcessingTarget, 0, AccessFlags.Write);
15721578
passData.sourceTexture = source;
@@ -1602,8 +1608,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD
16021608

16031609
PostProcessUtils.SetSourceSize(cmd, data.sourceTexture);
16041610

1605-
if (isFxaaEnabled)
1606-
material.EnableKeyword(ShaderKeywordStrings.Fxaa);
1611+
CoreUtils.SetKeyword(material, ShaderKeywordStrings.Fxaa, isFxaaEnabled);
16071612

16081613
if (isFsrEnabled)
16091614
{
@@ -1615,15 +1620,15 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD
16151620
if (data.cameraData.fsrSharpness > 0.0f)
16161621
{
16171622
// RCAS is performed during the final post blit, but we set up the parameters here for better logical grouping.
1618-
material.EnableKeyword(requireHDROutput ? ShaderKeywordStrings.EasuRcasAndHDRInput : ShaderKeywordStrings.Rcas);
1623+
CoreUtils.SetKeyword(material, (requireHDROutput ? ShaderKeywordStrings.EasuRcasAndHDRInput : ShaderKeywordStrings.Rcas), true);
16191624
FSRUtils.SetRcasConstantsLinear(cmd, sharpness);
16201625
}
16211626
}
16221627
else if (isRcasEnabled) // RCAS only
16231628
{
16241629
// Reuse RCAS as a standalone sharpening filter for TAA.
16251630
// If FSR is enabled then it overrides the sharpening/TAA setting and we skip it.
1626-
material.EnableKeyword(ShaderKeywordStrings.Rcas);
1631+
CoreUtils.SetKeyword(material, ShaderKeywordStrings.Rcas, true);
16271632
FSRUtils.SetRcasConstantsLinear(cmd, data.cameraData.taaSettings.contrastAdaptiveSharpening);
16281633
}
16291634

@@ -1656,6 +1661,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD
16561661

16571662
public void RenderFinalPassRenderGraph(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle source, in TextureHandle overlayUITexture, in TextureHandle postProcessingTarget, bool enableColorEncodingIfNeeded)
16581663
{
1664+
16591665
var stack = VolumeManager.instance.stack;
16601666
m_Tonemapping = stack.GetComponent<Tonemapping>();
16611667
m_FilmGrain = stack.GetComponent<FilmGrain>();
@@ -1699,7 +1705,7 @@ public void RenderFinalPassRenderGraph(RenderGraph renderGraph, ContextContainer
16991705
}
17001706

17011707
if (RequireSRGBConversionBlitToBackBuffer(cameraData.requireSrgbConversion))
1702-
material.EnableKeyword(ShaderKeywordStrings.LinearToSRGBConversion);
1708+
CoreUtils.SetKeyword(material, ShaderKeywordStrings.LinearToSRGBConversion, true);
17031709

17041710
settings.hdrOperations = HDROutputUtils.Operation.None;
17051711
settings.requireHDROutput = RequireHDROutput(cameraData);
@@ -1927,14 +1933,14 @@ public void RenderUberPost(RenderGraph renderGraph, ContextContainer frameData,
19271933

19281934
if (data.isHdrGrading)
19291935
{
1930-
material.EnableKeyword(ShaderKeywordStrings.HDRGrading);
1936+
CoreUtils.SetKeyword(material, ShaderKeywordStrings.HDRGrading, true);
19311937
}
19321938
else
19331939
{
19341940
switch (data.toneMappingMode)
19351941
{
1936-
case TonemappingMode.Neutral: material.EnableKeyword(ShaderKeywordStrings.TonemapNeutral); break;
1937-
case TonemappingMode.ACES: material.EnableKeyword(ShaderKeywordStrings.TonemapACES); break;
1942+
case TonemappingMode.Neutral: CoreUtils.SetKeyword(material, ShaderKeywordStrings.TonemapNeutral, true); break;
1943+
case TonemappingMode.ACES: CoreUtils.SetKeyword(material, ShaderKeywordStrings.TonemapACES, true); break;
19381944
default: break; // None
19391945
}
19401946
}
@@ -2139,11 +2145,11 @@ public void RenderPostProcessingRenderGraph(RenderGraph renderGraph, ContextCont
21392145
SetupDithering(cameraData, m_Materials.uber);
21402146

21412147
if (RequireSRGBConversionBlitToBackBuffer(cameraData.requireSrgbConversion))
2142-
m_Materials.uber.EnableKeyword(ShaderKeywordStrings.LinearToSRGBConversion);
2148+
CoreUtils.SetKeyword(m_Materials.uber, ShaderKeywordStrings.LinearToSRGBConversion, true);
21432149

21442150
if (m_UseFastSRGBLinearConversion)
21452151
{
2146-
m_Materials.uber.EnableKeyword(ShaderKeywordStrings.UseFastSRGBLinearConversion);
2152+
CoreUtils.SetKeyword(m_Materials.uber, ShaderKeywordStrings.UseFastSRGBLinearConversion, true);
21472153
}
21482154

21492155
bool requireHDROutput = RequireHDROutput(cameraData);

0 commit comments

Comments
 (0)