From 09e4375706133477287b29ab50a3baad7edffea6 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Mon, 25 Mar 2024 14:44:59 +0000 Subject: [PATCH 01/27] [2022.3][URP] Fixing a NullReferenceException when logging an error in Server Builds (UUM-56965) When running server builds calling `{GetType().DeclaringType.Name}` will give a NullReferenceException. This happens in two places inside the URP Codebase. To fix this the calls are simply removed as they don't provide much value. --- .../Runtime/Passes/ColorGradingLutPass.cs | 2 +- .../Runtime/Passes/PostProcessPass.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ColorGradingLutPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ColorGradingLutPass.cs index 9fdc1401af4..25fa79bc09b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ColorGradingLutPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ColorGradingLutPass.cs @@ -36,7 +36,7 @@ Material Load(Shader shader) { if (shader == null) { - Debug.LogError($"Missing shader. {GetType().DeclaringType.Name} render pass will not execute. Check for missing reference in the renderer resources."); + Debug.LogError($"Missing shader. ColorGradingLutPass render pass will not execute. Check for missing reference in the renderer resources."); return null; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs index e9c2d8622f5..d9635acc256 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs @@ -1617,7 +1617,7 @@ Material Load(Shader shader) { if (shader == null) { - Debug.LogErrorFormat($"Missing shader. {GetType().DeclaringType.Name} render pass will not execute. Check for missing reference in the renderer resources."); + Debug.LogErrorFormat($"Missing shader. PostProcessing render passes will not execute. Check for missing reference in the renderer resources."); return null; } else if (!shader.isSupported) From 7e23de351c57b36ebf95ec74f0f153e569e6ae08 Mon Sep 17 00:00:00 2001 From: Louis-Philippe Ledoux Date: Tue, 26 Mar 2024 03:09:30 +0000 Subject: [PATCH 02/27] Fix for distortion bug when using direct render to eye texture in XR Fix for a distorted viewport when using no intermediate texture in XR rendering. When activating dynamic resolution and using a scale of < 1, the image becomes distorted. This fixes this issue. --- .../Runtime/Passes/DrawObjectsPass.cs | 1 + .../Runtime/Passes/DrawSkyboxPass.cs | 73 +++++++++---------- .../Runtime/UniversalRenderer.cs | 2 + 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs index ff26e021419..928b75b95ef 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs @@ -149,6 +149,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData m_PassData.m_FilteringSettings = m_FilteringSettings; m_PassData.m_ShaderTagIdList = m_ShaderTagIdList; m_PassData.m_ProfilingSampler = m_ProfilingSampler; + m_PassData.m_IsActiveTargetBackBuffer = m_IsActiveTargetBackBuffer; m_PassData.pass = this; CameraSetup(renderingData.commandBuffer, m_PassData, ref renderingData); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs index 7d89c8a1f24..99d2e00af7d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs @@ -9,6 +9,11 @@ namespace UnityEngine.Rendering.Universal /// public class DrawSkyboxPass : ScriptableRenderPass { + /// + /// Used to indicate if the active target of the pass is the back buffer + /// + public bool m_IsActiveTargetBackBuffer; // TODO: Remove this when we remove non-RG path + /// /// Creates a new DrawSkyboxPass instance. /// @@ -37,60 +42,52 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData return; } } + var skyRendererList = CreateSkyboxRendererList(context, cameraData); +#if ENABLE_VR && ENABLE_XR_MODULE + if (cameraData.xr.enabled) + { + if (cameraData.xr.singlePassEnabled) + renderingData.commandBuffer.SetSinglePassStereo(SystemInfo.supportsMultiview ? SinglePassStereoMode.Multiview : SinglePassStereoMode.Instancing); + + if (m_IsActiveTargetBackBuffer) + renderingData.commandBuffer.SetViewport(cameraData.xr.GetViewport()); + } +#endif + renderingData.commandBuffer.DrawRendererList(skyRendererList); + +#if ENABLE_VR && ENABLE_XR_MODULE + if (cameraData.xr.enabled && cameraData.xr.singlePassEnabled) + renderingData.commandBuffer.SetSinglePassStereo(SinglePassStereoMode.None); +#endif + } + + // For non-RG path + private RendererList CreateSkyboxRendererList(ScriptableRenderContext context, CameraData cameraData) + { + var skyRendererList = new RendererList(); #if ENABLE_VR && ENABLE_XR_MODULE - // XRTODO: Remove this code once Skybox pass is moved to SRP land. if (cameraData.xr.enabled) { // Setup Legacy XR buffer states if (cameraData.xr.singlePassEnabled) { - // Setup legacy skybox stereo buffer - camera.SetStereoProjectionMatrix(Camera.StereoscopicEye.Left, cameraData.GetProjectionMatrix(0)); - camera.SetStereoViewMatrix(Camera.StereoscopicEye.Left, cameraData.GetViewMatrix(0)); - camera.SetStereoProjectionMatrix(Camera.StereoscopicEye.Right, cameraData.GetProjectionMatrix(1)); - camera.SetStereoViewMatrix(Camera.StereoscopicEye.Right, cameraData.GetViewMatrix(1)); - - var cmd = renderingData.commandBuffer; - - // Use legacy stereo instancing mode to have legacy XR code path configured - cmd.SetSinglePassStereo(SystemInfo.supportsMultiview ? SinglePassStereoMode.Multiview : SinglePassStereoMode.Instancing); - context.ExecuteCommandBuffer(cmd); - cmd.Clear(); - - // Calling into built-in skybox pass - context.DrawSkybox(camera); - - // Disable Legacy XR path - cmd.SetSinglePassStereo(SinglePassStereoMode.None); - context.ExecuteCommandBuffer(cmd); - // We do not need to submit here due to special handling of stereo matrices in core. - // context.Submit(); - cmd.Clear(); - - camera.ResetStereoProjectionMatrices(); - camera.ResetStereoViewMatrices(); + skyRendererList = context.CreateSkyboxRendererList(cameraData.camera, + cameraData.GetProjectionMatrix(0), cameraData.GetViewMatrix(0), + cameraData.GetProjectionMatrix(1), cameraData.GetViewMatrix(1)); } else { - camera.projectionMatrix = cameraData.GetProjectionMatrix(0); - camera.worldToCameraMatrix = cameraData.GetViewMatrix(0); - - context.DrawSkybox(camera); - - // XRTODO: remove this call because it creates issues with nested profiling scopes - // See examples in UniversalRenderPipeline.RenderSingleCamera() and in ScriptableRenderer.Execute() - context.Submit(); // Submit and execute the skybox pass before resetting the matrices - - camera.ResetProjectionMatrix(); - camera.ResetWorldToCameraMatrix(); + skyRendererList = context.CreateSkyboxRendererList(cameraData.camera, cameraData.GetProjectionMatrix(0), cameraData.GetViewMatrix(0)); } } else #endif { - context.DrawSkybox(camera); + skyRendererList = context.CreateSkyboxRendererList(cameraData.camera); } + + return skyRendererList; } private class PassData diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index 9ed1508f497..d9b7ec62d85 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -792,6 +792,8 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re CreateCameraRenderTarget(context, ref cameraTargetDescriptor, useDepthPriming, cmd, ref cameraData); m_RenderOpaqueForwardPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture; + m_RenderTransparentForwardPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture; + m_DrawSkyboxPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture; #if ENABLE_VR && ENABLE_XR_MODULE m_XROcclusionMeshPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture; #endif From 2839b21c3c676954fad35eb290edc463e4bfa05e Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Tue, 26 Mar 2024 03:09:32 +0000 Subject: [PATCH 03/27] [Port] [2022.3] URP: Ensure ScriptableRendererFeatures are compiled before validating them. This PR add an extra check to `ScriptableRendererData.OnValidate` to ensure we only validate `ScriptableRendererFeatures` when all scripts have been compiled. Not doing so can lead to errors being thrown to the console during import (see attached Jira ticket). Jira: https://jira.unity3d.com/browse/UUM-58944 --- .../Runtime/ScriptableRendererData.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRendererData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRendererData.cs index fa8a3c92f8d..5ed141eaed2 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRendererData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRendererData.cs @@ -82,7 +82,9 @@ protected virtual void OnValidate() { SetDirty(); #if UNITY_EDITOR - if (m_RendererFeatures.Contains(null)) + // Only validate ScriptableRendererFeatures when all scripts have finished compiling (to avoid false-negatives + // when ScriptableRendererFeatures haven't been compiled before this check). + if (!EditorApplication.isCompiling && m_RendererFeatures.Contains(null)) ValidateRendererFeatures(); #endif } From 3246ee2bb4273e431b954d773f6486a3c71a9cf2 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Tue, 26 Mar 2024 17:24:22 +0000 Subject: [PATCH 04/27] [Port] [2022.3] Fix URP & HDRP material UI leaking LabelWidth state Fix https://jira.unity3d.com/browse/UUM-66215 where the layout of elements in DOTS Entity Baking Preview panel changes depending on if Material foldout UI is expanded or not. When the material foldout GUI is expanded on URP or HDRP, it affects other UI drawn afterwards because the UI logic modified persistent `EditorGUIUtility.labelWidth` value and didn't restore it properly after drawing its widgets. This PR fixes that by resetting the value to 0 after drawing the material options. The fix is made separately on CoreRP (used by URP Material Editor) and HDRP because the UI has separate implementations. Note: we are simply setting the labelWidth to 0 instead of restoring whatever value it was before, because 0 is a special value that cannot be retrieved by using the property getter of `EditorGUIUtility.labelWidth` - if the internal value is 0, it will return some predetermined values instead (see [implementation](https://github.cds.internal.unity3d.com/unity/unity/blob/trunk/Editor/Mono/EditorGUIUtility.cs#L1367-L1379)). Therefore we must make the assumption that 0 is the correct value to be restored in this case. --- .../Editor/Material/MaterialHeaderScopeList.cs | 5 +++++ .../Editor/Material/UIBlocks/MaterialUIBlockList.cs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Packages/com.unity.render-pipelines.core/Editor/Material/MaterialHeaderScopeList.cs b/Packages/com.unity.render-pipelines.core/Editor/Material/MaterialHeaderScopeList.cs index b364f1c97c2..aa3ec4cd5fb 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Material/MaterialHeaderScopeList.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Material/MaterialHeaderScopeList.cs @@ -69,6 +69,11 @@ public void DrawHeaders(MaterialEditor materialEditor, Material material) EditorGUILayout.Space(); } + + // Reset label width back to the default of 0 (fix UUM-66215) + // NOTE: Because of how EditorGUIUtility.labelWidth works, when the internal value is 0, + // we cannot read that value back from the property getter. So we just set it to 0 here. + EditorGUIUtility.labelWidth = 0; } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/MaterialUIBlockList.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/MaterialUIBlockList.cs index 5fcc0e3245c..bf4ae45fae5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/MaterialUIBlockList.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/MaterialUIBlockList.cs @@ -71,6 +71,11 @@ public void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) Debug.LogException(e); } } + + // Reset label width back to the default of 0 (fix UUM-66215) + // NOTE: Because of how EditorGUIUtility.labelWidth works, when the internal value is 0, + // we cannot read that value back from the property getter. So we just set it to 0 here. + EditorGUIUtility.labelWidth = 0; } /// From 50d95678da5cfefdf8461728c25032e51eeffde9 Mon Sep 17 00:00:00 2001 From: Pushpa Latha Pandi Date: Wed, 27 Mar 2024 12:52:58 +0000 Subject: [PATCH 05/27] 2022.3:[HDRP] multiply spec by opacity when not preserving spec in premultiplied alpha This PR fixes the issue Adds an option to multiply specular by opacity by disabling preserve specular This is not technically correct but offers similar control to transparents that are not in premultiply mode and helps for VFX. Disabling affect specular in material settings provides the same result as before, but now you have an option to get a different result, so maybe not really needed to mention in upgrade guide as now it's working more as expected (previously the option had no effect) Bug:https://jira.unity3d.com/browse/UUM-48661 Backport:https://jira.unity3d.com/browse/UUM-51549 --- .../Runtime/Material/Material.hlsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl index 24fe7c072dc..f8f649f270b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl @@ -62,7 +62,11 @@ float4 ApplyBlendMode(float3 diffuseLighting, float3 specularLighting, float opa #endif opacity), opacity); else - return float4(diffuseLighting + specularLighting, opacity); + return float4(diffuseLighting + specularLighting * ( +#ifdef SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + _EnableBlendModePreserveSpecularLighting ? 1.0f : +#endif + opacity), opacity); #endif } From acf9f28e01ec2e8ad5c31469da8fe708b7fb15e0 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Wed, 27 Mar 2024 19:52:17 +0000 Subject: [PATCH 06/27] [Port] [2022.3] [URP] Fix screenspace shadows clashing when depth priming is forced depth copy after depth priming happens after screenspace shadows and it should be vice versa due to the fact, that both events are the same. this PR increases the event of screenspace shadows by one just to guarantee the correct sequencing of the passes --- .../Runtime/RendererFeatures/ScreenSpaceShadows.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs index 8b85f1cab23..b07d62a8706 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs @@ -67,7 +67,7 @@ public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingD m_SSShadowsPass.renderPassEvent = isDeferredRenderingMode ? RenderPassEvent.AfterRenderingGbuffer - : RenderPassEvent.AfterRenderingPrePasses; + : RenderPassEvent.AfterRenderingPrePasses + 1; // We add 1 to ensure this happens after depth priming depth copy pass that might be scheduled renderer.EnqueuePass(m_SSShadowsPass); renderer.EnqueuePass(m_SSShadowsPostPass); From ac3bad464978b724fcdb41fbdd9b354c42871da7 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 28 Mar 2024 00:56:21 +0000 Subject: [PATCH 07/27] [Port] [2022.3] [URP] Fixed the NativeRenderPass camera target MSAA logic to match the non-NRP path In some edge cases, when NativeRenderPass is enabled, MSAA resolve errors are thrown, because of incorrect render target setup when using a camera target texture. This PR makes sure the same logic used in the non-NRP path is used when NRP is enabled --- .../Runtime/NativeRenderPass.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/NativeRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/NativeRenderPass.cs index 1a74575c5e4..0b0d06c304d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/NativeRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/NativeRenderPass.cs @@ -160,6 +160,10 @@ internal void UpdateFinalStoreActions(int[] currentMergeablePasses, ref CameraDa var samples = pass.overrideCameraTarget ? GetFirstAllocatedRTHandle(pass).rt.descriptor.msaaSamples : (cameraData.targetTexture != null ? cameraData.targetTexture.descriptor.msaaSamples : cameraData.cameraTargetDescriptor.msaaSamples); + bool rendererSupportsMSAA = cameraData.renderer != null && cameraData.renderer.supportedRenderingFeatures.msaa; + if (!cameraData.camera.allowMSAA || !rendererSupportsMSAA) + samples = 1; + // only override existing non destructive actions for (int i = 0; i < m_FinalColorStoreAction.Length; ++i) { From 8045058a1d34564b02baf7b7d7af5848d6ec0a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elvar=20=C3=96rn=20Unn=C3=BE=C3=B3rsson?= Date: Thu, 28 Mar 2024 21:34:11 +0000 Subject: [PATCH 08/27] [2022.3][URP] Select correct depth target when doing SwapColorBuffer (UUM-44446) Backport of #38151. --- .../Runtime/UniversalRenderer.cs | 2 +- .../URPAssets/DefaultURPAsset.asset | 1 + .../Assets/Scenes/310_Swapbuffer_Depth.meta | 8 + .../Assets/Scenes/310_Swapbuffer_Depth.unity | 675 ++++++++++++++++++ .../Scenes/310_Swapbuffer_Depth.unity.meta | 7 + .../Scenes/310_Swapbuffer_Depth/Opaque.mat | 136 ++++ .../310_Swapbuffer_Depth/Opaque.mat.meta | 8 + .../SwapbufferBlitFeature.cs | 56 ++ .../SwapbufferBlitFeature.cs.meta | 11 + .../SwapbufferBlitRenderer.asset | 93 +++ .../SwapbufferBlitRenderer.asset.meta | 8 + .../310_Swapbuffer_Depth/Transparent.mat | 140 ++++ .../310_Swapbuffer_Depth/Transparent.mat.meta | 8 + .../ProjectSettings/EditorBuildSettings.asset | 3 + 14 files changed, 1155 insertions(+), 1 deletion(-) create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.meta create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity.meta create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat.meta create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs.meta create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset.meta create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat create mode 100644 Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat.meta diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index d9b7ec62d85..f1ea4855ca7 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -1607,7 +1607,7 @@ internal override void SwapColorBuffer(CommandBuffer cmd) //Check if we are using the depth that is attached to color buffer if (m_ActiveCameraDepthAttachment.nameID != BuiltinRenderTextureType.CameraTarget) - ConfigureCameraTarget(m_ColorBufferSystem.GetBackBuffer(cmd), m_ColorBufferSystem.GetBufferA()); + ConfigureCameraTarget(m_ColorBufferSystem.GetBackBuffer(cmd), m_ActiveCameraDepthAttachment); else ConfigureCameraColorTarget(m_ColorBufferSystem.GetBackBuffer(cmd)); diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/CommonAssets/URPAssets/DefaultURPAsset.asset b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/CommonAssets/URPAssets/DefaultURPAsset.asset index f1949ccdc2f..7eeaa045fb4 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/CommonAssets/URPAssets/DefaultURPAsset.asset +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/CommonAssets/URPAssets/DefaultURPAsset.asset @@ -35,6 +35,7 @@ MonoBehaviour: - {fileID: 11400000, guid: 1f0ec70d2f6284f04a23236fd067dec1, type: 2} - {fileID: 11400000, guid: 81c60c102f7364ff7a219d5723b5a355, type: 2} - {fileID: 11400000, guid: 458bd0c3cd85a465bb7a902869fb61eb, type: 2} + - {fileID: 11400000, guid: 846bf2a7afe0943388665d187143c7f6, type: 2} m_DefaultRendererIndex: 0 m_RequireDepthTexture: 1 m_RequireOpaqueTexture: 1 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.meta b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.meta new file mode 100644 index 00000000000..8aff6a15629 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ef89b754fe2442bdab8b8adc413b451 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity new file mode 100644 index 00000000000..81b79727f50 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity @@ -0,0 +1,675 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &161925053 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 161925055} + - component: {fileID: 161925054} + - component: {fileID: 161925056} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &161925054 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161925053} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.802082 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &161925055 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161925053} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &161925056 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 161925053} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 3 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_RenderingLayers: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_ShadowRenderingLayers: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} + m_SoftShadowQuality: 0 +--- !u!1 &475638796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 475638800} + - component: {fileID: 475638799} + - component: {fileID: 475638798} + - component: {fileID: 475638797} + m_Layer: 0 + m_Name: Opaque Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &475638797 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 475638796} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &475638798 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 475638796} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: aaa8efae3188745e9b7f446656f0b72c, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &475638799 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 475638796} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &475638800 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 475638796} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: 0} + m_LocalScale: {x: 10, y: 10, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1650638173 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1650638177} + - component: {fileID: 1650638176} + - component: {fileID: 1650638175} + - component: {fileID: 1650638174} + m_Layer: 0 + m_Name: Transparent Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &1650638174 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650638173} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1650638175 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650638173} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 0738807e6aa69416db76f46f7878582a, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1650638176 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650638173} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1650638177 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650638173} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: 5} + m_LocalScale: {x: 5, y: 5, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2108972670 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2108972673} + - component: {fileID: 2108972672} + - component: {fileID: 2108972671} + - component: {fileID: 2108972674} + - component: {fileID: 2108972675} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2108972671 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2108972670} + m_Enabled: 1 +--- !u!20 &2108972672 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2108972670} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &2108972673 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2108972670} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2108972674 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2108972670} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: 18 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_Version: 2 + m_TaaSettings: + quality: 3 + frameInfluence: 0.1 + jitterScale: 1 + mipBias: 0 + varianceClampScale: 0.9 + contrastAdaptiveSharpening: 0 +--- !u!114 &2108972675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2108972670} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73231aa468d81ea49bc3d914080de185, type: 3} + m_Name: + m_EditorClassIdentifier: + ImageComparisonSettings: + TargetWidth: 512 + TargetHeight: 512 + TargetMSAASamples: 1 + PerPixelCorrectnessThreshold: 0.001 + PerPixelGammaThreshold: 0.003921569 + PerPixelAlphaThreshold: 0.003921569 + RMSEThreshold: 0 + AverageCorrectnessThreshold: 0.005 + IncorrectPixelsThreshold: 0.0000038146973 + UseHDR: 0 + UseBackBuffer: 0 + ImageResolution: 4 + ActiveImageTests: 1 + ActivePixelTests: -1 + WaitFrames: 0 + XRCompatible: 1 + CheckMemoryAllocation: 1 +--- !u!1 &2127457706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127457708} + - component: {fileID: 2127457707} + m_Layer: 0 + m_Name: SelectQualitySetting + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2127457707 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127457706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f1decc188d2f3146ab93291a5c743e9, type: 3} + m_Name: + m_EditorClassIdentifier: + qualityLevelIndex: 0 +--- !u!4 &2127457708 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127457706} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.5195698, y: 1.3765798, z: 0.5559635} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 2127457708} + - {fileID: 2108972673} + - {fileID: 161925055} + - {fileID: 475638800} + - {fileID: 1650638177} diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity.meta b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity.meta new file mode 100644 index 00000000000..4732aa3e5cf --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: aec68106d2ff047868f32b8853c6abf0 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat new file mode 100644 index 00000000000..9f22d73f242 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Opaque + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.3750689, g: 1, b: 0, a: 1} + - _Color: {r: 0.37506887, g: 1, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &33754567308635639 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat.meta b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat.meta new file mode 100644 index 00000000000..43f049a3644 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Opaque.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aaa8efae3188745e9b7f446656f0b72c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs new file mode 100644 index 00000000000..00100278e61 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs @@ -0,0 +1,56 @@ +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +public class SwapbufferBlitFeature : ScriptableRendererFeature +{ + class CustomRenderPass : ScriptableRenderPass + { + // This method is called before executing the render pass. + // It can be used to configure render targets and their clear state. Also to create temporary render target textures. + // When empty this render pass will render to the active camera render target. + // You should never call CommandBuffer.SetRenderTarget. Instead call ConfigureTarget and ConfigureClear. + // The render pipeline will ensure target setup and clearing happens in a performant manner. + public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) + { + } + + // Here you can implement the rendering logic. + // Use ScriptableRenderContext to issue drawing commands or execute command buffers + // https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html + // You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline. + public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) + { + + CommandBuffer cmd = CommandBufferPool.Get(name: "SwapColorBufferPass"); + Blit(cmd, ref renderingData, null); + + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); + } + + // Cleanup any allocated resources that were created during the execution of this render pass. + public override void OnCameraCleanup(CommandBuffer cmd) + { + } + } + + CustomRenderPass m_ScriptablePass; + + /// + public override void Create() + { + m_ScriptablePass = new CustomRenderPass(); + + // Configures where the render pass should be injected. + m_ScriptablePass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox; + } + + // Here you can inject one or multiple render passes in the renderer. + // This method is called when setting up the renderer once per-camera. + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) + { + renderer.EnqueuePass(m_ScriptablePass); + } +} + + diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs.meta b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs.meta new file mode 100644 index 00000000000..0e3540c2f48 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitFeature.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c07f97e2f25874e729f6080d76cd5284 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset new file mode 100644 index 00000000000..ebf6fac3ef1 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset @@ -0,0 +1,93 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-2547017031689811349 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c07f97e2f25874e729f6080d76cd5284, type: 3} + m_Name: SwapbufferBlitFeature + m_EditorClassIdentifier: + m_Active: 1 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} + m_Name: SwapbufferBlitRenderer + m_EditorClassIdentifier: + debugShaders: + debugReplacementPS: {fileID: 4800000, guid: cf852408f2e174538bcd9b7fda1c5ae7, + type: 3} + hdrDebugViewPS: {fileID: 4800000, guid: 573620ae32aec764abd4d728906d2587, type: 3} + probeVolumeSamplingDebugComputeShader: {fileID: 7200000, guid: 53626a513ea68ce47b59dc1299fe3959, + type: 3} + probeVolumeResources: + probeVolumeDebugShader: {fileID: 4800000, guid: e5c6678ed2aaa91408dd3df699057aae, + type: 3} + probeVolumeFragmentationDebugShader: {fileID: 4800000, guid: 03cfc4915c15d504a9ed85ecc404e607, + type: 3} + probeVolumeOffsetDebugShader: {fileID: 4800000, guid: 53a11f4ebaebf4049b3638ef78dc9664, + type: 3} + probeVolumeSamplingDebugShader: {fileID: 4800000, guid: 8f96cd657dc40064aa21efcc7e50a2e7, + type: 3} + probeSamplingDebugMesh: {fileID: -3555484719484374845, guid: 57d7c4c16e2765b47a4d2069b311bffe, + type: 3} + probeSamplingDebugTexture: {fileID: 2800000, guid: 24ec0e140fb444a44ab96ee80844e18e, + type: 3} + probeVolumeBlendStatesCS: {fileID: 7200000, guid: b9a23f869c4fd45f19c5ada54dd82176, + type: 3} + m_RendererFeatures: + - {fileID: -2547017031689811349} + m_RendererFeatureMap: 6b4a421d812da7dc + m_UseNativeRenderPass: 0 + postProcessData: {fileID: 0} + xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2} + shaders: + blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} + copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3} + screenSpaceShadowPS: {fileID: 0} + samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} + stencilDeferredPS: {fileID: 4800000, guid: e9155b26e1bc55942a41e518703fe304, type: 3} + fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3} + fallbackLoadingPS: {fileID: 4800000, guid: 7f888aff2ac86494babad1c2c5daeee2, type: 3} + materialErrorPS: {fileID: 0} + coreBlitPS: {fileID: 4800000, guid: 93446b5c5339d4f00b85c159e1159b7c, type: 3} + coreBlitColorAndDepthPS: {fileID: 4800000, guid: d104b2fc1ca6445babb8e90b0758136b, + type: 3} + blitHDROverlay: {fileID: 4800000, guid: a89bee29cffa951418fc1e2da94d1959, type: 3} + cameraMotionVector: {fileID: 4800000, guid: c56b7e0d4c7cb484e959caeeedae9bbf, + type: 3} + screenSpaceLensFlare: {fileID: 4800000, guid: 701880fecb344ea4c9cd0db3407ab287, + type: 3} + dataDrivenLensFlare: {fileID: 4800000, guid: 6cda457ac28612740adb23da5d39ea92, + type: 3} + m_AssetVersion: 2 + m_OpaqueLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_TransparentLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_DefaultStencilState: + overrideStencilState: 0 + stencilReference: 0 + stencilCompareFunction: 8 + passOperation: 2 + failOperation: 0 + zFailOperation: 0 + m_ShadowTransparentReceive: 1 + m_RenderingMode: 0 + m_DepthPrimingMode: 0 + m_CopyDepthMode: 1 + m_AccurateGbufferNormals: 0 + m_IntermediateTextureMode: 1 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset.meta b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset.meta new file mode 100644 index 00000000000..d1e3c084c4f --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/SwapbufferBlitRenderer.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 846bf2a7afe0943388665d187143c7f6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat new file mode 100644 index 00000000000..6c69c800f38 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat @@ -0,0 +1,140 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Transparent + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 1, g: 0.0832793, b: 0, a: 0.21960784} + - _Color: {r: 1, g: 0.08327926, b: 0, a: 0.21960784} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &33754567308635639 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat.meta b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat.meta new file mode 100644 index 00000000000..e7044b5a074 --- /dev/null +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/310_Swapbuffer_Depth/Transparent.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0738807e6aa69416db76f46f7878582a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/ProjectSettings/EditorBuildSettings.asset b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/ProjectSettings/EditorBuildSettings.asset index b1854ea65db..16993c239a8 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/ProjectSettings/EditorBuildSettings.asset +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/ProjectSettings/EditorBuildSettings.asset @@ -365,4 +365,7 @@ EditorBuildSettings: - enabled: 1 path: Assets/Scenes/262_RenderingLayers_Decals.unity guid: f07beec5ff4e7744383242b8ed2eefff + - enabled: 1 + path: Assets/Scenes/310_Swapbuffer_Depth.unity + guid: aec68106d2ff047868f32b8853c6abf0 m_configObjects: {} From a386e80e6cfd62e1aa4070c8c76e5f2160c8a36b Mon Sep 17 00:00:00 2001 From: Julien Fryer Date: Fri, 29 Mar 2024 18:08:51 +0000 Subject: [PATCH 09/27] [2022.3][VFX] Backport model invalidation fixes 2022.3 model invalidation backports This PR includes fixes from several trunk PRs: - https://github.cds.internal.unity3d.com/unity/unity/pull/41986 - https://github.cds.internal.unity3d.com/unity/unity/pull/45606 - https://github.cds.internal.unity3d.com/unity/unity/pull/40877 --- .../Editor/Compiler/VFXCodeGenerator.cs | 35 ++++++--- .../Controllers/VFXOperatorController.cs | 3 +- .../Implementations/ConstructMatrix.cs | 2 +- .../Operators/VFXAbstractOperatorNew.cs | 7 +- .../Editor/Models/Operators/VFXOperator.cs | 43 +++-------- .../Models/Operators/VFXSubgraphOperator.cs | 3 + .../Editor/Models/Parameters/VFXParameter.cs | 13 ++-- .../Editor/Models/Slots/VFXSlot.cs | 15 +++- .../Editor/Models/VFXGraph.cs | 26 +++++-- .../Editor/Models/VFXModel.cs | 3 +- .../Editor/Models/VFXSlotContainerModel.cs | 29 +++++++- .../Editor/Types/VFXPropertyAttribute.cs | 4 + .../AllTests/Editor/Tests/VFXModelTests.cs | 73 +++++++++++++++++++ 13 files changed, 192 insertions(+), 64 deletions(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs b/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs index 06abfc8ac90..7829a4298f6 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs @@ -538,6 +538,20 @@ static private StringBuilder Build(VFXContext context, string templatePath, VFXC if (!context.SetupCompilation()) return null; + var data = context.GetData(); + + // Readable identifier for the profile marker + string shaderIdStr = string.Empty; + if (!string.IsNullOrEmpty(data.title)) + shaderIdStr += data.title; + if (!string.IsNullOrEmpty(context.name)) + shaderIdStr += "/" + context.name; + if (!string.IsNullOrEmpty(context.label)) + shaderIdStr += "/" + context.label; + shaderIdStr = shaderIdStr.Replace("\n", " "); + + Profiler.BeginSample($"GenerateShader ({shaderIdStr})"); + if (context is VFXShaderGraphParticleOutput shaderGraphContext && shaderGraphContext.GetOrRefreshShaderGraphObject() != null && shaderGraphContext.GetOrRefreshShaderGraphObject().generatesWithShaderGraph && @@ -549,22 +563,23 @@ static private StringBuilder Build(VFXContext context, string templatePath, VFXC if (result != null) { context.EndCompilation(); + Profiler.EndSample(); return result; } } var stringBuilder = GetFlattenedTemplateContent(templatePath, new List(), context.additionalDefines, dependencies); - var allCurrentAttributes = context.GetData().GetAttributes().Where(a => - (context.GetData().IsCurrentAttributeUsed(a.attrib, context)) || - (context.contextType == VFXContextType.Init && context.GetData().IsAttributeStored(a.attrib))); // In init, needs to declare all stored attributes for intialization + var allCurrentAttributes = data.GetAttributes().Where(a => + (data.IsCurrentAttributeUsed(a.attrib, context)) || + (context.contextType == VFXContextType.Init && data.IsAttributeStored(a.attrib))); // In init, needs to declare all stored attributes for intialization - var allSourceAttributes = context.GetData().GetAttributes().Where(a => (context.GetData().IsSourceAttributeUsed(a.attrib, context))); + var allSourceAttributes = data.GetAttributes().Where(a => (data.IsSourceAttributeUsed(a.attrib, context))); var globalDeclaration = new VFXShaderWriter(); globalDeclaration.WriteBufferTypeDeclaration(contextData.graphicsBufferUsage.Values); globalDeclaration.WriteLine(); - var particleData = (context.GetData() as VFXDataParticle); + var particleData = (data as VFXDataParticle); var systemUniformMapper = particleData.systemUniformMapper; contextData.uniformMapper.OverrideUniformsNamesWithOther(systemUniformMapper); var needsGraphValueStruct = globalDeclaration.WriteGraphValuesStruct(contextData.uniformMapper); @@ -585,9 +600,10 @@ static private StringBuilder Build(VFXContext context, string templatePath, VFXC var blockCallFunction = new VFXShaderWriter(); var blockDeclared = new HashSet(); - var expressionToName = context.GetData().GetAttributes() + var expressionToName = data.GetAttributes() .ToDictionary(o => new VFXAttributeExpression(o.attrib) as VFXExpression, o => (new VFXAttributeExpression(o.attrib)).GetCodeString(null)); - expressionToName = expressionToName.Union(contextData.uniformMapper.expressionToCode) + expressionToName = expressionToName + .Union(contextData.uniformMapper.expressionToCode) .ToDictionary(s => s.Key, s => s.Value); int cpt = 0; @@ -632,9 +648,9 @@ static private StringBuilder Build(VFXContext context, string templatePath, VFXC globalIncludeContent.Write(GetFlattenedTemplateContent(renderPipePasses, new List(), context.additionalDefines, dependencies)); } - if (context.GetData() is ISpaceable) + if (data is ISpaceable) { - var spaceable = context.GetData() as ISpaceable; + var spaceable = data as ISpaceable; globalIncludeContent.WriteLineFormat("#define {0} 1", spaceable.space == VFXCoordinateSpace.World ? "VFX_WORLD_SPACE" : "VFX_LOCAL_SPACE"); } globalIncludeContent.WriteLineFormat("#include \"{0}/VFXDefines.hlsl\"", renderRuntimePipePath); @@ -738,6 +754,7 @@ static private StringBuilder Build(VFXContext context, string templatePath, VFXC Debug.LogFormat("GENERATED_OUTPUT_FILE_FOR : {0}\n{1}", context.ToString(), stringBuilder.ToString()); context.EndCompilation(); + Profiler.EndSample(); return stringBuilder; } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXOperatorController.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXOperatorController.cs index 758523464dc..aae78f45ccc 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXOperatorController.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXOperatorController.cs @@ -34,7 +34,8 @@ public VFXOperatorController(VFXOperator model, VFXViewController viewController { subgraphOperator.RecreateCopy(); model.ResyncSlots(false); - model.UpdateOutputExpressions(); + model.MarkOutputExpressionsAsOutOfDate(); + model.UpdateOutputExpressionsIfNeeded(); } catch (Exception e) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/ConstructMatrix.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/ConstructMatrix.cs index fdbc886c91f..f0e777c32b6 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/ConstructMatrix.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/ConstructMatrix.cs @@ -4,7 +4,7 @@ namespace UnityEditor.VFX.Operator { [VFXHelpURL("Operator-ConstructMatrix")] [VFXInfo(category = "Math/Vector")] - class MatrixFromVector4 : VFXOperator + class ConstructMatrix : VFXOperator { public class InputProperties { diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXAbstractOperatorNew.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXAbstractOperatorNew.cs index 44f4c3e36d5..430556df105 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXAbstractOperatorNew.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXAbstractOperatorNew.cs @@ -598,8 +598,11 @@ public void SetOperandType(int index, Type type) return; } - m_Operands[index].type = type; - Invalidate(InvalidationCause.kSettingChanged); + if (!m_Operands[index].type.Equals(type)) + { + m_Operands[index].type = type; + Invalidate(InvalidationCause.kSettingChanged); + } } public void OperandMoved(int movedIndex, int targetIndex) diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs index 793314ca163..be132aaa9ed 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs @@ -28,31 +28,6 @@ private static void GetSlotPredicateRecursive(List result, IEnumerable< } } - // As connections changed can be triggered from ResyncSlots, we need to make sure it is not reentrant - [NonSerialized] - private bool m_ResyncingSlots = false; - - public override bool ResyncSlots(bool notify) - { - bool changed = false; - if (!m_ResyncingSlots) - { - m_ResyncingSlots = true; - try - { - changed = base.ResyncSlots(notify); - if (notify) - foreach (var slot in outputSlots) // invalidate expressions on output slots - slot.InvalidateExpressionTree(); - } - finally - { - m_ResyncingSlots = false; - } - } - return changed; - } - protected override void OnInvalidate(VFXModel model, InvalidationCause cause) { var outputSlotSpaceable = outputSlots.Where(o => o.spaceable); @@ -79,16 +54,12 @@ protected override void OnInvalidate(VFXModel model, InvalidationCause cause) } } - if (cause == InvalidationCause.kConnectionChanged) - { - if (model is VFXSlot slot && slot.direction == VFXSlot.Direction.kInput) - ResyncSlots(true); - } + bool isInputSlot = model is VFXSlot && ((VFXSlot)model).direction == VFXSlot.Direction.kInput; if (cause == InvalidationCause.kParamChanged || cause == InvalidationCause.kExpressionValueInvalidated) { - if (model is VFXSlot && ((VFXSlot)model).direction == VFXSlot.Direction.kInput) + if (isInputSlot) { foreach (var slot in outputSlots) slot.Invalidate(InvalidationCause.kExpressionValueInvalidated); @@ -96,6 +67,14 @@ protected override void OnInvalidate(VFXModel model, InvalidationCause cause) } base.OnInvalidate(model, cause); + + if (cause == InvalidationCause.kSettingChanged || + (isInputSlot && (cause == InvalidationCause.kExpressionInvalidated || cause == InvalidationCause.kConnectionChanged))) + { + MarkOutputExpressionsAsOutOfDate(); + foreach (var slot in outputSlots) // invalidate expressions on output slots + slot.InvalidateExpressionTree(); + } } public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot) @@ -116,7 +95,7 @@ public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot) return space; } - public override sealed void UpdateOutputExpressions() + protected override sealed void UpdateOutputExpressions() { var outputSlotWithExpression = new List(); var inputSlotWithExpression = new List(); diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs index 37dd70b0d51..850d65ab5f6 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs @@ -228,7 +228,10 @@ public override void CheckGraphBeforeImport() // If the graph is reimported it can be because one of its dependency such as the subgraphs, has been changed. if (!VFXGraph.explicitCompile) + { + MarkOutputExpressionsAsOutOfDate(); ResyncSlots(true); + } } protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression) diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs index d5862e76edf..8f00116db84 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs @@ -212,10 +212,12 @@ public bool isOutput public void ResetOutputValueExpression() { - Debug.Assert(!m_IsOutput); - - m_ExprSlots = outputSlots[0].GetVFXValueTypeSlots().ToArray(); - m_ValueExpr = m_ExprSlots.Select(t => t.DefaultExpression(valueMode)).ToArray(); + if (!isOutput) + { + MarkOutputExpressionsAsOutOfDate(); + m_ExprSlots = outputSlots[0].GetVFXValueTypeSlots().ToArray(); + m_ValueExpr = m_ExprSlots.Select(t => t.DefaultExpression(valueMode)).ToArray(); + } } public bool canHaveValueFilter @@ -420,6 +422,7 @@ protected sealed override void OnInvalidate(VFXModel model, InvalidationCause ca if (valueExprChanged) { + MarkOutputExpressionsAsOutOfDate(); m_ValueExpr = valueExpr; outputSlots[0].InvalidateExpressionTree(); Invalidate(InvalidationCause.kExpressionGraphChanged); // As we need to update exposed list event if not connected to a compilable context @@ -735,7 +738,7 @@ public void UpdateDefaultExpressionValue() } } - public override void UpdateOutputExpressions() + protected override void UpdateOutputExpressions() { if (!isOutput) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs index 53bee31c4f7..e0ceadaaaf6 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs @@ -730,10 +730,12 @@ public void UpdateAttributes(VFXPropertyAttributes attributes, bool notify) { if (notify) { + bool wasInitialized = m_Property.attributes.IsInitialized; if (!m_Property.attributes.IsEqual(attributes)) { m_Property.attributes = attributes; - Invalidate(InvalidationCause.kUIChangedTransient); // TODO This will trigger a setDirty while it shouldn't as property attributes are not serialized + if (wasInitialized) // No invalidate at init + Invalidate(InvalidationCause.kUIChangedTransient); // TODO This will trigger a setDirty while it shouldn't as property attributes are not serialized } } else // fast path without comparison @@ -907,6 +909,7 @@ private void RecomputeExpressionTree() { // Start from the top most parent var masterSlot = GetMasterSlot(); + bool wasUpToDate = masterSlot.m_ExpressionTreeUpToDate; // When deserializing, default expression wont be initialized if (!m_DefaultExpressionInitialized) @@ -933,7 +936,7 @@ private void RecomputeExpressionTree() { if (owner != null) { - owner.UpdateOutputExpressions(); + owner.UpdateOutputExpressionsIfNeeded(); // Update outputs can trigger an invalidate, it can be reentrant. Just check if we're up to date after that and early out if (m_ExpressionTreeUpToDate) return; @@ -983,8 +986,9 @@ private void RecomputeExpressionTree() s[i].SetOutExpression(exp != null ? exp[i] : s[i].m_InExpression, toInvalidate, masterSlot.owner != null ? masterSlot.owner.GetOutputSpaceFromSlot(s) : VFXCoordinateSpace.None); }); - foreach (var slot in toInvalidate) - slot.InvalidateExpressionTree(); + if (wasUpToDate) + foreach (var slot in toInvalidate) + slot.InvalidateExpressionTree(); } private static VFXExpression ApplySpaceConversion(VFXExpression exp, VFXSlot destSlot, VFXSlot sourceSlot) @@ -1056,6 +1060,9 @@ private string GetOwnerType() public void InvalidateExpressionTree() { + if (!m_ExpressionTreeUpToDate) + return; + var masterSlot = GetMasterSlot(); masterSlot.PropagateToChildren(s => diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 73744629e22..5d281031ab3 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -132,7 +132,15 @@ static void OnCompileResource(VisualEffectResource resource) graph.CompileForImport(); - VFXMemorySerializer.ExtractObjects(backup, false); + VFXGraph.restoringGraph = true; + try + { + VFXMemorySerializer.ExtractObjects(backup, false); + } + finally + { + VFXGraph.restoringGraph = false; + } //The backup during undo/redo is actually calling UnknownChange after ExtractObjects //You have to avoid because it will call ResyncSlot } @@ -757,10 +765,12 @@ protected override void OnInvalidate(VFXModel model, VFXModel.InvalidationCause m_DependentDirty = true; } - if (cause != VFXModel.InvalidationCause.kExpressionInvalidated && - cause != VFXModel.InvalidationCause.kExpressionGraphChanged && - cause != VFXModel.InvalidationCause.kExpressionValueInvalidated && - cause != VFXModel.InvalidationCause.kUIChangedTransient && + if ((cause == InvalidationCause.kStructureChanged || + cause == InvalidationCause.kParamChanged || + cause == InvalidationCause.kSettingChanged || + cause == InvalidationCause.kSpaceChanged || + cause == InvalidationCause.kConnectionChanged || + cause == InvalidationCause.kUIChanged) && (model.hideFlags & HideFlags.DontSave) == 0) { EditorUtility.SetDirty(this); @@ -938,7 +948,7 @@ void RecurseSubgraphRecreateCopy(IEnumerable children) { operatorChild.RecreateCopy(); if (operatorChild.ResyncSlots(true)) - operatorChild.UpdateOutputExpressions(); + operatorChild.UpdateOutputExpressionsIfNeeded(); } } } @@ -973,7 +983,7 @@ void RecurseSubgraphPatchInputExpression(IEnumerable children) else if (child is VFXSubgraphOperator operatorChild) { operatorChild.ResyncSlots(false); - operatorChild.UpdateOutputExpressions(); + operatorChild.UpdateOutputExpressionsIfNeeded(); } } foreach (var child in children) @@ -1034,6 +1044,8 @@ IEnumerable GetAllGraphs() where T : VisualEffectObject //Explicit compile must be used if we want to force compilation even if a dependency is needed, which me must not do on a deleted library import. public static bool explicitCompile { get; set; } = false; + //Set to true when restoring graph post compilation. Some costly behavior can be skipped in that situation (like reloading the whole UI). This is a safe hack. + public static bool restoringGraph { get; set; } = false; public void SanitizeForImport() diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXModel.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXModel.cs index b7b2f274073..ab59578273d 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXModel.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXModel.cs @@ -28,7 +28,8 @@ static bool ValidateDummyReset() public Action onModified; void OnValidate() { - Modified(false); + if (!VFXGraph.restoringGraph) + Modified(false); } public void Modified(bool uiChange) diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs index def546f8030..51d9646afd4 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs @@ -27,7 +27,7 @@ interface IVFXSlotContainer int GetSlotIndex(VFXSlot slot); - void UpdateOutputExpressions(); + void UpdateOutputExpressionsIfNeeded(); void ClearSlots(); bool ResyncSlots(bool notify); @@ -232,6 +232,7 @@ public override void Sanitize(int version) public override void OnUnknownChange() { base.OnUnknownChange(); + m_OutputExpressionsUpToDate = false; ResyncSlots(false); } @@ -448,13 +449,37 @@ public bool IsPathExpanded(string fieldPath) return m_expandedPaths.Contains(fieldPath); } - public virtual void UpdateOutputExpressions() { } + protected virtual void UpdateOutputExpressions() { } + + [NonSerialized] + private bool m_OutputExpressionsUpToDate = false; + public void UpdateOutputExpressionsIfNeeded() + { + if (!m_OutputExpressionsUpToDate) + { + UpdateOutputExpressions(); + m_OutputExpressionsUpToDate = true; + } + } + + public void MarkOutputExpressionsAsOutOfDate() + { + m_OutputExpressionsUpToDate = false; + } public virtual VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot slot) { return VFXCoordinateSpace.None; } + public override void CheckGraphBeforeImport() + { + // The cache is here to avoid multiple output recomputation when updating the expression graph + // So It's marked as out of date before compilation just to minimize risk of cache missed invalidation between different compilation + MarkOutputExpressionsAsOutOfDate(); + base.CheckGraphBeforeImport(); + } + //[SerializeField] HashSet m_expandedPaths = new HashSet(); diff --git a/Packages/com.unity.visualeffectgraph/Editor/Types/VFXPropertyAttribute.cs b/Packages/com.unity.visualeffectgraph/Editor/Types/VFXPropertyAttribute.cs index 8e943a6e2ee..c64846fab97 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Types/VFXPropertyAttribute.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Types/VFXPropertyAttribute.cs @@ -112,6 +112,8 @@ public VFXPropertyAttributes(params object[] attributes) : this() m_Flag |= attributeType; } } + else + m_AllAttributes = Array.Empty(); // Just to discriminate between uninitialized and no properties } public bool IsEqual(VFXPropertyAttributes other) @@ -300,6 +302,8 @@ public bool Is(VFXPropertyAttributes.Type type) return (m_Flag & type) == type; } + public bool IsInitialized => m_AllAttributes != null; + public IReadOnlyCollection attributes => m_AllAttributes != null ? m_AllAttributes : new Attribute[0]; private Attribute[] m_GraphAttributes; diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXModelTests.cs b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXModelTests.cs index cd7bc952da6..d2b46430aba 100644 --- a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXModelTests.cs +++ b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXModelTests.cs @@ -233,6 +233,79 @@ public void OnInvalidateDelegate() Assert.AreEqual("OnInvalidateDelegate (UnityEditor.VFX.VFXGraph) kStructureChanged", s_logs[4]); } + + private class DummyModel : VFXSlotContainerModel + { + public class InputProperties + { + public float a; + } + + protected override void OnInvalidate(VFXModel model, InvalidationCause cause) + { + s_logs.Add("OnInvalidate DummyModel " + model + " " + cause); + } + } + + [Test] + public void OnExpressionInvalidationPropagation() + { + s_logs.Clear(); + + var graph = ScriptableObject.CreateInstance(); + var testModel = ScriptableObject.CreateInstance(); + + var op = ScriptableObject.CreateInstance(); + var add = ScriptableObject.CreateInstance(); + var f = ScriptableObject.CreateInstance(); + f.SetSettingValue("m_Type", (SerializableType)typeof(float)); + + graph.AddChild(testModel); + graph.AddChild(op); + graph.AddChild(add); + graph.AddChild(f); + + // Noise --| + // |-- Add --> model0 + // f ------| + + op.GetOutputSlot(0).Link(add.GetInputSlot(0)); + f.GetOutputSlot(0).Link(add.GetInputSlot(1)); + + Assert.AreEqual(0, s_logs.Count); + + add.GetOutputSlot(0).Link(testModel.GetInputSlot(0)); + + Assert.AreEqual(1, s_logs.Count); + Assert.AreEqual("OnInvalidate DummyModel (UnityEditor.VFX.VFXSlotFloat) kConnectionChanged", s_logs[0]); + + // Change f value + f.GetInputSlot(0).value = 42.0f; + + Assert.AreEqual(2, s_logs.Count); + Assert.AreEqual("OnInvalidate DummyModel (UnityEditor.VFX.VFXSlotFloat) kExpressionValueInvalidated", s_logs[1]); + + testModel.GetInputSlot(0).GetExpression(); // Just to trigger recomputation of expression graph + + // Disconnect f + f.GetOutputSlot(0).UnlinkAll(); + + Assert.AreEqual(3, s_logs.Count); + Assert.AreEqual("OnInvalidate DummyModel (UnityEditor.VFX.VFXSlotFloat) kExpressionInvalidated", s_logs[2]); + + testModel.GetInputSlot(0).GetExpression(); // Just to trigger recomputation of expression graph + + // Change noise setting + op.SetSettingValue("type", Operator.Noise.NoiseType.Cellular); + + Assert.AreEqual(4, s_logs.Count); + Assert.AreEqual("OnInvalidate DummyModel (UnityEditor.VFX.VFXSlotFloat) kExpressionInvalidated", s_logs[3]); + + testModel.GetInputSlot(0).GetExpression(); // Just to trigger recomputation of expression graph + + Assert.AreEqual(4, s_logs.Count); + } + private void OnModelInvalidated(VFXModel model, VFXModel.InvalidationCause cause) { s_logs.Add("OnInvalidateDelegate " + model + " " + cause); From 7a4baad20b036b2765a36376529643338c314712 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Fri, 29 Mar 2024 18:08:53 +0000 Subject: [PATCH 10/27] [Port] [2022.3] Fixed the recorder output to render target Fixed an issue in recorder with output textures caused by a previous PR: https://github.cds.internal.unity3d.com/unity/unity/pull/46637 --- .../Runtime/RenderPipeline/Camera/HDCamera.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index 3fd399a7118..18e87dd8e76 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -1382,7 +1382,8 @@ internal void ExecuteCaptureActions(RenderGraph renderGraph, TextureHandle input { var inputDesc = renderGraph.GetTextureDesc(input); var targetSize = RTHandles.rtHandleProperties.currentRenderTargetSize; - passData.viewportScale = new Vector2(targetSize.x / finalViewport.width, targetSize.y / finalViewport.height); + passData.viewportScale = new Vector2(finalViewport.width / targetSize.x, finalViewport.height / targetSize.y); + passData.blitMaterial = HDUtils.GetBlitMaterial(inputDesc.dimension); passData.recorderCaptureActions = m_RecorderCaptureActions; From 23115935417dc9856b578dc23e10b6787b966ea0 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Fri, 29 Mar 2024 18:08:55 +0000 Subject: [PATCH 11/27] [Port] [2022.3] Fixed _ScreenParams after upscaling and update screen node doc As in title --- .../Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs | 4 +++- Packages/com.unity.shadergraph/Documentation~/Screen-Node.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 3d943ee4785..359ddafb3d4 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -2026,7 +2026,9 @@ void ResetCameraSizeForAfterPostProcess(RenderGraph renderGraph, HDCamera hdCame builder.SetRenderFunc( (ResetCameraSizeForAfterPostProcessPassData data, RenderGraphContext ctx) => { - data.shaderVariablesGlobal._ScreenSize = new Vector4(data.hdCamera.finalViewport.width, data.hdCamera.finalViewport.height, 1.0f / data.hdCamera.finalViewport.width, 1.0f / data.hdCamera.finalViewport.height); + var screenSize = new Vector4(data.hdCamera.finalViewport.width, data.hdCamera.finalViewport.height, 1.0f / data.hdCamera.finalViewport.width, 1.0f / data.hdCamera.finalViewport.height); + data.shaderVariablesGlobal._ScreenSize = screenSize; + data.shaderVariablesGlobal._ScreenParams = new Vector4(screenSize.x, screenSize.y, 1 + screenSize.z, 1 + screenSize.w); data.shaderVariablesGlobal._RTHandleScale = RTHandles.rtHandleProperties.rtHandleScale; ConstantBuffer.PushGlobal(ctx.cmd, data.shaderVariablesGlobal, HDShaderIDs._ShaderVariablesGlobal); RTHandles.SetReferenceSize((int)data.hdCamera.finalViewport.width, (int)data.hdCamera.finalViewport.height); diff --git a/Packages/com.unity.shadergraph/Documentation~/Screen-Node.md b/Packages/com.unity.shadergraph/Documentation~/Screen-Node.md index e3cfdbf5b6b..2be18e2df22 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Screen-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Screen-Node.md @@ -7,7 +7,7 @@ Provides access to parameters of the screen. #### Unity Render Pipelines Support - Universal Render Pipeline -The High Definition Render Pipeline does **not** support this Node. +Note: when dynamic resolution is enabled, this node will return the current viewport of the rendering camera. After the upscaling pass, the output of this node will be equal to the screen size. ## Ports From dc1df875a0fe003791230bd537d8fa5612693c21 Mon Sep 17 00:00:00 2001 From: Zoe Bare Date: Wed, 3 Apr 2024 20:48:18 +0000 Subject: [PATCH 12/27] [Port] [2022.3] Fixed Unity-specific #pragma directives being reported in #include files Backport of https://github.cds.internal.unity3d.com/unity/unity/pull/45790 From trunk PR: Fixes [UUM-62756](https://jira.unity3d.com/browse/UUM-62756). The public documentation states the shader compiler will ignore Unity-specific #pragma directives in files included through #include, however this behavior was broken as they were being reported in both #include and #include_with_pragmas. This change fixes that so they're not reported in #include files. Also, added a warning message when someone uses #include_with_pragmas within a file that was itself included with #include. In that particular case, #include_with_pragmas will be treated as #include, meaning all Unity-specific pragmas it might contain will be ignored. Bug: https://jira.unity3d.com/browse/UUM-62756 Backport: https://jira.unity3d.com/browse/UUM-63801 --- .../Shaders/Utils/StencilDeferred.shader | 16 ++++++++-------- .../Editor/Data/Util/FunctionRegistry.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.shader index 338d5164d2b..0164ce8b0eb 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.shader @@ -76,7 +76,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } @@ -139,7 +139,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } @@ -202,7 +202,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } @@ -267,7 +267,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } @@ -332,7 +332,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } @@ -373,7 +373,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } @@ -423,7 +423,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } @@ -466,7 +466,7 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Includes - #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" ENDHLSL } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Util/FunctionRegistry.cs b/Packages/com.unity.shadergraph/Editor/Data/Util/FunctionRegistry.cs index a887f2393fe..1e2a9b6fb54 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Util/FunctionRegistry.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Util/FunctionRegistry.cs @@ -37,9 +37,9 @@ public void RequiresIncludes(IncludeCollection includes) m_Includes.Add(includes); } - public void RequiresIncludePath(string includePath) + public void RequiresIncludePath(string includePath, bool shouldIncludeWithPragmas = false) { - m_Includes.Add(includePath, IncludeLocation.Graph); + m_Includes.Add(includePath, IncludeLocation.Graph, shouldIncludeWithPragmas); } // this list is somewhat redundant, but it preserves function declaration ordering From de52d1693265a5e8663117293f144f4220c5847b Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 4 Apr 2024 10:54:52 +0000 Subject: [PATCH 13/27] [Port] [2022.3] [VFX] Remove error popup when cancelling a drag edge with escape key Jira: UUM-61583 Steps to repro: - Create a new HDRP/URP project - Create a new VFX Graph - Create two operators that have incompatible slots (`Float` and `Sample Gradient` for instance) - Drag `Float` connection out and hover it over gradient input slot - Hit escape to cancel - Observe wrong type popup gets stuck and moves around with graph ![Unity_IrNrWdfUSY](https://media.github.cds.internal.unity3d.com/user/4003/files/2a6b8809-0eb9-4e74-bc33-dd4ed7e326b4) ![video](https://jira.unity3d.com/secure/attachment/1368545/WrontTypePopup.mp4) --- .../GraphView/Elements/VFXEdgeConnector.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs index 287c849e773..f346686a53f 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs @@ -2,14 +2,7 @@ using System.Linq; using UnityEditor.Experimental.GraphView; -using UnityEngine; using UnityEngine.UIElements; -using UnityEngine.Profiling; - -using Type = System.Type; - - -using PositionType = UnityEngine.UIElements.Position; namespace UnityEditor.VFX.UI { @@ -62,6 +55,15 @@ protected override void OnMouseUp(MouseUpEvent e) view.StopEdgeDragInfo(); } + protected override void Abort() + { + base.Abort(); + if (m_Anchor.GetFirstAncestorOfType() is { } view) + { + view.StopEdgeDragInfo(); + } + } + static List s_PickedList = new List(); } } From acc98529a7d4a9d03a5ecd45f3ce64ff38dfbb21 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 4 Apr 2024 17:37:46 +0000 Subject: [PATCH 14/27] [Port] [2022.3] [URP] [2D] ShaderGraph Pass name is not generated when the pass is "LightMode" = "Universal2D" Fix missing pass name https://jira.unity3d.com/browse/UUM-36358 --- .../Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs index 2a0f1b548cc..42fe76c9a22 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs @@ -579,6 +579,7 @@ public static PassDescriptor _2D(UniversalTarget target) var result = new PassDescriptor() { // Definition + displayName = "Universal 2D", referenceName = "SHADERPASS_2D", lightMode = "Universal2D", From 6119e1fef6c1f207e863efc2f758e02785ac3be5 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 4 Apr 2024 17:37:47 +0000 Subject: [PATCH 15/27] [Port] [2022.3] Use half instead of float on mobile for octahedral normal packing functions. Fixes https://jira.unity3d.com/browse/UUM-62216, in which artifacts appear (looks like uninitialized memory) when using the accurate G-buffer normals feature when targeting mobile. This feature uses a pair for function for performing octrahedral encoding and decoding of normals. The function misbehaves when targeting mobile, but not desktop. The main difference between mobile and desktop in shadercode is that desktop treats `half` as float, whereas on mobile `half` actually works. The functions for octahedral encoding take `float`'s as input, and are given `half`'s in the mobile path. In the function, we use `abs()` on the input and then negate it. This combination seems to cause a miscompilation of some sort, presumably because `abs` and negation are both input modifiers rather than real instructions - I'm not entirely sure, but it's some mix of those 3 things - half to float conversion, abs and negation. The most minimal fix that worked was this: ``` float3 UnpackNormalOctQuadEncode(float2 f) { - float3 n = float3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y)); + float3 n = float3(f.x, f.y, 1.0 - abs(real(f.x)) - abs(real(f.y))); ``` But I instead decided to change the functions to use `real` instead of `float` throughout, as it it seemed cleaner. `real` is just an alias for `half` on mobile and `float` on desktop. --- .../ShaderLibrary/Packing.hlsl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl index 8a0de9a0165..4543600b0e3 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl @@ -54,7 +54,7 @@ real3 UnpackNormalOctRectEncode(real2 f) // Ref: http://jcgt.org/published/0003/02/01/paper.pdf "A Survey of Efficient Representations for Independent Unit Vectors" // Encode with Oct, this function work with any size of output // return float between [-1, 1] -float2 PackNormalOctQuadEncode(float3 n) +real2 PackNormalOctQuadEncode(float3 n) { //float l1norm = dot(abs(n), 1.0); //float2 res0 = n.xy * (1.0 / l1norm); @@ -64,20 +64,20 @@ float2 PackNormalOctQuadEncode(float3 n) // Optimized version of above code: n *= rcp(max(dot(abs(n), 1.0), 1e-6)); - float t = saturate(-n.z); - return n.xy + float2(n.x >= 0.0 ? t : -t, n.y >= 0.0 ? t : -t); + real t = saturate(-n.z); + return n.xy + real2(n.x >= 0.0 ? t : -t, n.y >= 0.0 ? t : -t); } -float3 UnpackNormalOctQuadEncode(float2 f) +real3 UnpackNormalOctQuadEncode(real2 f) { - float3 n = float3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y)); + real3 n = real3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y)); //float2 val = 1.0 - abs(n.yx); //n.xy = (n.zz < float2(0.0, 0.0) ? (n.xy >= 0.0 ? val : -val) : n.xy); // Optimized version of above code: - float t = max(-n.z, 0.0); - n.xy += float2(n.x >= 0.0 ? -t : t, n.y >= 0.0 ? -t : t); + real t = max(-n.z, 0.0); + n.xy += real2(n.x >= 0.0 ? -t : t, n.y >= 0.0 ? -t : t); return normalize(n); } From 6bba4b36fa113de9b199a81f6ee539466e0bd085 Mon Sep 17 00:00:00 2001 From: Pema Malling Date: Thu, 4 Apr 2024 17:37:47 +0000 Subject: [PATCH 16/27] [Port] [2022.3] Add missing LightCookies keyword to screenspace decal projector pass Fixes https://jira.unity3d.com/browse/UUM-54404, where screen space decals weren't taking into account light cookies. The code to sample cookies is already present in the relevant shader (a shader made with shadergraph decal template), but the keyword for light cookies, `_LIGHT_COOKIES` is not declared. The fix is simply to add the keyword to the relevant pass descriptor. The keyword will automatically be set earlier in the render loop, in `LightCookiesManager.Setup`. --- .../Editor/ShaderGraph/Targets/UniversalDecalSubTarget.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalDecalSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalDecalSubTarget.cs index 6cec5c847d4..0b37feff8ba 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalDecalSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalDecalSubTarget.cs @@ -1011,6 +1011,7 @@ static class Descriptors { CoreKeywordDescriptors.AdditionalLightShadows }, { CoreKeywordDescriptors.ShadowsSoft }, { CoreKeywordDescriptors.ForwardPlus }, + { CoreKeywordDescriptors.LightCookies }, { Descriptors.DecalsNormalBlend }, { Descriptors.DecalLayers }, }; From 6ba535dd6ca3359669f707874e8f2767c3aa1ef4 Mon Sep 17 00:00:00 2001 From: Julien Amsellem Date: Fri, 5 Apr 2024 08:32:28 +0000 Subject: [PATCH 17/27] [Backport][2022.3][VFX] Keep activation slot visible when collapsing a block Jira: UUM-59123 When a block is collapsed the activation slot is not visible anymore. Before: ![Unity_JyNrRODGTR](https://media.github.cds.internal.unity3d.com/user/4003/files/b9c5467d-f237-4e52-bd5c-2a9bad57bd26) After: ![Unity_2XV2CCHlve](https://media.github.cds.internal.unity3d.com/user/4003/files/c83c5751-7340-4546-8320-1a43bfd11d5a) Slack thread: https://unity.slack.com/archives/G1BTWN88Z/p1702479571472809 --- .../Editor/GraphView/Elements/VFXNodeUI.cs | 21 ++++++++++++++++--- .../Editor/UIResources/uss/VFXBlock.uss | 7 +------ .../Editor/UIResources/uss/VFXDataAnchor.uss | 12 ++++++----- .../Editor/UIResources/uss/VFXOperator.uss | 4 ++++ 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs index eb9a51c53de..787a55a16b8 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs @@ -283,7 +283,9 @@ void SyncAnchors(ReadOnlyCollection ports, VisualElemen if (needsResync) { - var existingAnchors = container.Children().Cast().ToDictionary(t => t.controller, t => t); + var existingAnchors = container.Children().Cast() + .Union(titleContainer.Query().ToList()) + .ToDictionary(t => t.controller, t => t); container.Clear(); for (int i = 0; i < ports.Count; ++i) { @@ -323,8 +325,6 @@ private void UpdateActivationPortPosition(VFXDataAnchor anchor) if (anchor.controller.isSubgraphActivation) anchor.AddToClassList("subgraphblock"); - var settingsCount = expanded ? settingsContainer.childCount : 0; - anchor.style.top = -30 - settingsCount * 17 - (settingsCount > 0 ? 17 : -1); titleContainer.AddToClassList("activationslot"); anchor.AddToClassList("activationslot"); AddToClassList("activationslot"); @@ -338,6 +338,16 @@ private bool UpdateActivationPortPositionIfAny() var anchor = inputContainer.Children() .Cast() .SingleOrDefault(x => x.controller == anchorController); + + if (anchor != null) + { + anchor.RemoveFromHierarchy(); + titleContainer.Insert(0, anchor); + } + else + { + anchor = titleContainer.Q(); + } if (anchor != null) { UpdateActivationPortPosition(anchor); @@ -451,6 +461,11 @@ public IEnumerable GetPorts(bool input, bool output) if (child is VFXDataAnchor) yield return child as VFXDataAnchor; } + + if (titleContainer.Q() is { } activationSlot) + { + yield return activationSlot; + } } if (output) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXBlock.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXBlock.uss index 58633d29544..630059180d4 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXBlock.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXBlock.uss @@ -54,7 +54,7 @@ VFXBlockUI.VFXNodeUI.node.invalid #node-border VFXContextUI VFXBlockUI.node #node-border #title #title-label { - margin-left: 4px; + margin-left: 54px; flex: 1 0 auto; } @@ -107,11 +107,6 @@ VFXEditableDataAnchor.activationslot > BoolPropertyRM > Label display: none; } -VFXContextUI VFXBlockUI.node #node-border #title.activationslot > #title-label -{ - margin-left: 44px; -} - #title.activationslot > #collapse-button { flex-grow: 1; diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXDataAnchor.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXDataAnchor.uss index 4e5d73ab993..270aefe2182 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXDataAnchor.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXDataAnchor.uss @@ -139,11 +139,13 @@ VFXContextUI #output .VFXDataAnchor.port #connector -unity-text-align: middle-center; } - .VFXOutputDataAnchor #icon - { - width: 13px; - height: 13px; - } +.activationslot.VFXDataAnchor .propertyrm { + margin-left: 10px; +} +.activationslot.VFXDataAnchor .propertyrm > #icon { + display: none; +} + .VFXOutputDataAnchor.icon-expandable #icon { diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXOperator.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXOperator.uss index b04ff217210..d81bf957989 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXOperator.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXOperator.uss @@ -19,6 +19,10 @@ VFXOperatorUI #title #edit #icon align-self: center; } +VFXOperatorUI.node #node-border > #title > Label { + margin-left: 16px; +} + OperandInfo PopupField { height: 16px; From 0d1525e775de28422db0169be1cce12d6fc7cf5b Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Fri, 5 Apr 2024 17:34:01 +0000 Subject: [PATCH 18/27] [Port] [2022.3] Fix undersized cluster data buffer Fix bug described here: https://forum.unity.com/threads/argumentexception-when-rendering-lots-of-runtime-lights-w-o-shadows.1462619/#post-9737638 --- .../Runtime/Lighting/LightLoop/LightLoop.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index 58e1753242d..063c80b5829 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -743,7 +743,7 @@ void InitializeLightLoop(IBLFilterBSDF[] iBLFilterBSDFArray) // All the allocation of the compute buffers need to happened after the kernel finding in order to avoid the leak loop when a shader does not compile or is not available m_LightLoopLightData.Initialize(m_MaxDirectionalLightsOnScreen, m_MaxPunctualLightsOnScreen, m_MaxAreaLightsOnScreen, m_MaxEnvLightsOnScreen, m_MaxDecalsOnScreen); - m_TileAndClusterData.Initialize(allocateTileBuffers: true, clusterNeedsDepth: k_UseDepthBuffer, maxLightCount: m_MaxLightsOnScreen); + m_TileAndClusterData.Initialize(allocateTileBuffers: true, clusterNeedsDepth: k_UseDepthBuffer, maxLightCount: m_MaxLightsOnScreen + m_MaxDecalsOnScreen); // both light and decals are stored in the cluster // OUTPUT_SPLIT_LIGHTING - SHADOWS_SHADOWMASK - DEBUG_DISPLAY m_deferredLightingMaterial = new Material[8]; @@ -940,7 +940,7 @@ static int NumLightIndicesPerClusteredTile() void LightLoopAllocResolutionDependentBuffers(HDCamera hdCamera, int width, int height) { - m_TileAndClusterData.AllocateResolutionDependentBuffers(hdCamera, width, height, m_MaxViewCount, m_MaxLightsOnScreen); + m_TileAndClusterData.AllocateResolutionDependentBuffers(hdCamera, width, height, m_MaxViewCount, m_MaxLightsOnScreen + m_MaxDecalsOnScreen); } void LightLoopReleaseResolutionDependentBuffers() From 9aeb329b70d9ea288cb3a79fb607fa84d2b8430b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Penavaire?= Date: Fri, 5 Apr 2024 21:44:13 +0000 Subject: [PATCH 19/27] [22.3] Bump graphics packages - Bumped SRP packages from 14.0.10 to 14.0.11. - For consistency, added the urp-config package to the editor manifest (see [thread](https://unity.slack.com/archives/C89KFUUCT/p1712083056017469)). --- .../CHANGELOG.md | 9 +++++ .../package.json | 2 +- .../CHANGELOG.md | 8 ++++ .../package.json | 4 +- .../CHANGELOG.md | 24 ++++++++++++ .../package.json | 10 ++--- .../CHANGELOG.md | 1 + .../package.json | 6 +-- .../CHANGELOG.md | 37 +++++++++++++++++++ .../ValidationExceptions.json | 6 +-- .../package.json | 6 +-- Packages/com.unity.shadergraph/CHANGELOG.md | 8 ++++ Packages/com.unity.shadergraph/package.json | 6 +-- .../com.unity.visualeffectgraph/CHANGELOG.md | 19 ++++++++++ .../com.unity.visualeffectgraph/package.json | 6 +-- .../package.json | 6 +-- 16 files changed, 132 insertions(+), 26 deletions(-) diff --git a/Packages/com.unity.render-pipelines.core/CHANGELOG.md b/Packages/com.unity.render-pipelines.core/CHANGELOG.md index 64f0b15cd1f..c1cb0174fad 100644 --- a/Packages/com.unity.render-pipelines.core/CHANGELOG.md +++ b/Packages/com.unity.render-pipelines.core/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -9,6 +10,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [14.0.10] - 2024-04-03 + +This version is compatible with Unity 2022.3.24f1. + +### Fixed +- Fixed lens flare occlusion format support test. +- Fixed DebugUI.Button not working in Rendering Debugger runtime UI. + ## [14.0.9] - 2023-12-21 This version is compatible with Unity 2022.3.18f1. diff --git a/Packages/com.unity.render-pipelines.core/package.json b/Packages/com.unity.render-pipelines.core/package.json index 778dde1867c..a2c3af01d82 100644 --- a/Packages/com.unity.render-pipelines.core/package.json +++ b/Packages/com.unity.render-pipelines.core/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.render-pipelines.core", "description": "SRP Core makes it easier to create or customize a Scriptable Render Pipeline (SRP). SRP Core contains reusable code, including boilerplate code for working with platform-specific graphics APIs, utility functions for common rendering operations, and shader libraries. The code in SRP Core is use by the High Definition Render Pipeline (HDRP) and Universal Render Pipeline (URP). If you are creating a custom SRP from scratch or customizing a prebuilt SRP, using SRP Core will save you time.", - "version": "14.0.10", + "version": "14.0.11", "unity": "2022.3", "displayName": "Core RP Library", "dependencies": { diff --git a/Packages/com.unity.render-pipelines.high-definition-config/CHANGELOG.md b/Packages/com.unity.render-pipelines.high-definition-config/CHANGELOG.md index 766893f0a98..c7c7d62a242 100644 --- a/Packages/com.unity.render-pipelines.high-definition-config/CHANGELOG.md +++ b/Packages/com.unity.render-pipelines.high-definition-config/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -9,6 +10,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [14.0.10] - 2024-04-03 + +This version is compatible with Unity 2022.3.24f1. + +Version Updated +The version number for this package has increased due to a version update of a related graphics package. + ## [14.0.9] - 2023-12-21 This version is compatible with Unity 2022.3.18f1. diff --git a/Packages/com.unity.render-pipelines.high-definition-config/package.json b/Packages/com.unity.render-pipelines.high-definition-config/package.json index 7dfe2a22c48..193ff3d97c9 100644 --- a/Packages/com.unity.render-pipelines.high-definition-config/package.json +++ b/Packages/com.unity.render-pipelines.high-definition-config/package.json @@ -1,10 +1,10 @@ { "name": "com.unity.render-pipelines.high-definition-config", "description": "Configuration files for the High Definition Render Pipeline.", - "version": "14.0.10", + "version": "14.0.11", "unity": "2022.3", "displayName": "High Definition RP Config", "dependencies": { - "com.unity.render-pipelines.core": "14.0.10" + "com.unity.render-pipelines.core": "14.0.11" } } \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.high-definition/CHANGELOG.md b/Packages/com.unity.render-pipelines.high-definition/CHANGELOG.md index 1772706217e..1af6ead3c86 100644 --- a/Packages/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/Packages/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -9,6 +10,29 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [14.0.10] - 2024-04-03 + +This version is compatible with Unity 2022.3.24f1. + +### Changed +- Improved performance entering and leaving playmode for scenes containing large numbers of decal projectors. +- Improved scene culling performance when APV is enabled in the project. + +### Fixed +- Removed screen space overlay UI being rendered in offscreen camera. +- Fixed XR texture 2D creation failure due to invalid slice configuration. The slice is misconfigured to 2 when creating Texture2D, causing internal failures. +- Optimize the OnDisable of DecalProjector component when disabling a lot of decals at the same time. +- Removed the error message "Decal texture atlas out of space..." in release builds (it now only appears in the Editor or Development Builds). +- Fixed artifacts on low resolution SSGI when dynamic resolution values are low. +- Fixed internally created Game Objects being deallocated on scene changes. +- Fixed misuse of ternary operators in shaders. +- Fixed a NaN issue in volumetric fog reprojection causing black to propagate in the fog. +- Fixed invalid AABB error in the console when using the APV with reflection probes. +- Fixed a scaling issue with the recorder. +- Restore `EditorGUIUtility.labelWidth` to default after drawing Material GUI. +- Fix specular blend in premultiplied alpha +- Fixed screen node not returning correct resolution after post-processing when dynamic resolution is enabled. + ## [14.0.9] - 2023-12-21 This version is compatible with Unity 2022.3.18f1. diff --git a/Packages/com.unity.render-pipelines.high-definition/package.json b/Packages/com.unity.render-pipelines.high-definition/package.json index 37dbd2e15ce..68811f4cc95 100644 --- a/Packages/com.unity.render-pipelines.high-definition/package.json +++ b/Packages/com.unity.render-pipelines.high-definition/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.render-pipelines.high-definition", "description": "The High Definition Render Pipeline (HDRP) is a high-fidelity Scriptable Render Pipeline built by Unity to target modern (Compute Shader compatible) platforms. HDRP utilizes Physically-Based Lighting techniques, linear lighting, HDR lighting, and a configurable hybrid Tile/Cluster deferred/Forward lighting architecture and gives you the tools you need to create games, technical demos, animations, and more to a high graphical standard.", - "version": "14.0.10", + "version": "14.0.11", "unity": "2022.3", "displayName": "High Definition RP", "dependencies": { @@ -11,10 +11,10 @@ "com.unity.modules.animation": "1.0.0", "com.unity.modules.imageconversion": "1.0.0", "com.unity.modules.terrain": "1.0.0", - "com.unity.render-pipelines.core": "14.0.10", - "com.unity.shadergraph": "14.0.10", - "com.unity.visualeffectgraph": "14.0.10", - "com.unity.render-pipelines.high-definition-config": "14.0.10" + "com.unity.render-pipelines.core": "14.0.11", + "com.unity.shadergraph": "14.0.11", + "com.unity.visualeffectgraph": "14.0.11", + "com.unity.render-pipelines.high-definition-config": "14.0.11" }, "keywords": [ "graphics", diff --git a/Packages/com.unity.render-pipelines.universal-config/CHANGELOG.md b/Packages/com.unity.render-pipelines.universal-config/CHANGELOG.md index 1edfad4315e..fe3e636d9c3 100644 --- a/Packages/com.unity.render-pipelines.universal-config/CHANGELOG.md +++ b/Packages/com.unity.render-pipelines.universal-config/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) diff --git a/Packages/com.unity.render-pipelines.universal-config/package.json b/Packages/com.unity.render-pipelines.universal-config/package.json index 1bce1042c65..850f8b24510 100644 --- a/Packages/com.unity.render-pipelines.universal-config/package.json +++ b/Packages/com.unity.render-pipelines.universal-config/package.json @@ -1,10 +1,10 @@ { "name": "com.unity.render-pipelines.universal-config", "description": "Configuration files for the Universal Render Pipeline.", - "version": "14.0.9", + "version": "14.0.10", "unity": "2022.3", "displayName": "Universal RP Config", "dependencies": { - "com.unity.render-pipelines.core": "14.0.9" + "com.unity.render-pipelines.core": "14.0.10" } -} \ No newline at end of file +} diff --git a/Packages/com.unity.render-pipelines.universal/CHANGELOG.md b/Packages/com.unity.render-pipelines.universal/CHANGELOG.md index 0bfe0810eb6..74eeb5a1ef9 100644 --- a/Packages/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/Packages/com.unity.render-pipelines.universal/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -9,6 +10,42 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [14.0.10] - 2024-04-03 + +This version is compatible with Unity 2022.3.24f1. + +### Changed +- The Auto option in SH Evaluation Mode, in the URP Asset, now chooses Per Vertex instead of Per Pixel on mobile and similar devices. + +### Fixed +- Fixed sRGB conversion without PostProcessing. +- Fixed an issue with missing variant in builds when using Strict Variant Matching and Deferred Rendering. +- Fixed RenderRequest using wrong renderer. +- Fixed an issue where downsampled SSAO had serious artefacts on Android. +- Fixed an issue where Screen Space Decals keyword was missing when Strip Unused Variants was turned off. +- Added UI features to encourage the use of Rendering Layers in URP to control selective lighting, instead of using culling mask. The former works across Deferred, Forward and Forward+, while the latter only works with Forward. +- Fixed incorrect alpha-clip behavior on transparent surfaces. +- Fixed an issue where using Alpha Clipped shaders and Depth Priming resulted in invisible objects. +- Ensure motion vector depth buffer is valid for cameras with motion vectors enabled. +- Fixed an issue where keywords were incorrectly enabled/disabled when shadows were enabled in the URP Asset and "Transparent Receive Shadows" was disabled on the renderer. +- SSAO is now rendered in deferred when no light is present. +- Early exit from URP RendererFeatures if they require color and is rendered to a depth on target. +- Reflection probes now works correctly using mip maps with forward+. +- Preview cameras now skip render objects. +- Reflection probes are now sorted in the correct order. +- Fixed an issue where setting light position, direction and shadow bias allocated due to using strings instead of integers. +- Motion Vector pass can now render after opaques. It correctly follows its depth dependency in pass order. +- Disabled depth priming for cameras with depth only render targets. +- Added logic to enforce consistent hardware dynamic resolution settings during rendering to avoid issues when external code changes the global setting. +- Fixed an issue where an incorrect WorldToCamera matrix was used in the main and additional light shadow passes. +- Fixed an issue where errors appeared due to _CameraDepthTexture_TexelSize being added to DeclareDepthTexture. +- Fixed an issue where logging an error gave a NullReferenceException for Server Builds. +- Fixed false-negative missing RendererFeatures errors. +- Restore `EditorGUIUtility.labelWidth` to default after drawing MaterialHeaderScopes. +- Fix shadow flickering when using Screen Space shadows and have depth priming enabled +- Fixed the NativeRenderPass camera target MSAA logic to match the non-NRP path +- Fix depth buffer disappearing after using SwapColorBuffer + ## [14.0.9] - 2023-12-21 This version is compatible with Unity 2022.3.18f1. diff --git a/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json b/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json index 20a9776e9af..cf2e8ce0b01 100644 --- a/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json +++ b/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json @@ -2,12 +2,12 @@ "Exceptions": [ { "ValidationTest": "Package Lifecycle Validation", - "ExceptionError": "Package com.unity.render-pipelines.universal@14.0.10 depends on package com.unity.burst@1.5.0 which is in an invalid track for release purposes. Release versions can only depend on Release versions.", - "PackageVersion": "14.0.10" + "ExceptionError": "Package com.unity.render-pipelines.universal@14.0.11 depends on package com.unity.burst@1.5.0 which is in an invalid track for release purposes. Release versions can only depend on Release versions.", + "PackageVersion": "14.0.11" }, { "ValidationTest": "API Updater Configuration Validation", - "PackageVersion": "14.0.10" + "PackageVersion": "14.0.11" } ] } \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/package.json b/Packages/com.unity.render-pipelines.universal/package.json index b34e0d0d9ce..f16fdb12935 100644 --- a/Packages/com.unity.render-pipelines.universal/package.json +++ b/Packages/com.unity.render-pipelines.universal/package.json @@ -1,14 +1,14 @@ { "name": "com.unity.render-pipelines.universal", "description": "The Universal Render Pipeline (URP) is a prebuilt Scriptable Render Pipeline, made by Unity. URP provides artist-friendly workflows that let you quickly and easily create optimized graphics across a range of platforms, from mobile to high-end consoles and PCs.", - "version": "14.0.10", + "version": "14.0.11", "unity": "2022.3", "displayName": "Universal RP", "dependencies": { "com.unity.mathematics": "1.2.1", "com.unity.burst": "1.8.9", - "com.unity.render-pipelines.core": "14.0.10", - "com.unity.shadergraph": "14.0.10", + "com.unity.render-pipelines.core": "14.0.11", + "com.unity.shadergraph": "14.0.11", "com.unity.render-pipelines.universal-config": "14.0.9" }, "keywords": [ diff --git a/Packages/com.unity.shadergraph/CHANGELOG.md b/Packages/com.unity.shadergraph/CHANGELOG.md index e2d09ac8380..54c4491d46d 100644 --- a/Packages/com.unity.shadergraph/CHANGELOG.md +++ b/Packages/com.unity.shadergraph/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this package are documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -9,6 +10,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [14.0.10] - 2024-04-03 + +This version is compatible with Unity 2022.3.24f1. + +Version Updated +The version number for this package has increased due to a version update of a related graphics package. + ## [14.0.9] - 2024-01-22 This version is compatible with Unity 2022.3.19f1. diff --git a/Packages/com.unity.shadergraph/package.json b/Packages/com.unity.shadergraph/package.json index 98f63572198..a5656df02dc 100644 --- a/Packages/com.unity.shadergraph/package.json +++ b/Packages/com.unity.shadergraph/package.json @@ -1,11 +1,11 @@ { "name": "com.unity.shadergraph", "description": "The Shader Graph package adds a visual Shader editing tool to Unity. You can use this tool to create Shaders in a visual way instead of writing code. Specific render pipelines can implement specific graph features. Currently, both the High Definition Rendering Pipeline and the Universal Rendering Pipeline support Shader Graph.", - "version": "14.0.10", + "version": "14.0.11", "unity": "2022.3", "displayName": "Shader Graph", "dependencies": { - "com.unity.render-pipelines.core": "14.0.10", + "com.unity.render-pipelines.core": "14.0.11", "com.unity.searcher": "4.9.2" }, "samples": [ @@ -23,6 +23,6 @@ "displayName": "Feature Examples", "description": "This set of assets provides examples for how to achieve specific features and effects in Shader Graph - such as parallax occlusion mapping, interior cube mapping, vertex animation, various types of UV projection, and more. While not intended to be used directly, these examples should help you learn how to achieve these specific effects in your own shaders.", "path": "Samples~/FeatureExamples" - } + } ] } \ No newline at end of file diff --git a/Packages/com.unity.visualeffectgraph/CHANGELOG.md b/Packages/com.unity.visualeffectgraph/CHANGELOG.md index 492b4e09b88..f3c0476e351 100644 --- a/Packages/com.unity.visualeffectgraph/CHANGELOG.md +++ b/Packages/com.unity.visualeffectgraph/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -9,6 +10,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [14.0.10] - 2024-04-03 + +This version is compatible with Unity 2022.3.24f1. + +### Changed +- Improve compilation times with VFX Graph using Subgraphs + +### Fixed +- Instancing when gradient selection was based on a branch was wrong. +- Unexpected material listing in animation window. +- Disabled MeshToSDFBaker shaders on GLES3 to avoid warnings. +- Incompatibility with HLSL 2021. +- Removed GetParticleIndex shader warning in particle strip systems. +- PCache exporter insure color in linear space. +- Added tooltips to the VFX Control panel. +- Fix Construct Matrix operator serialization issue +- Fix some VFX being always considered dirty + ## [14.0.9] - 2023-12-21 This version is compatible with Unity 2022.3.18f1. diff --git a/Packages/com.unity.visualeffectgraph/package.json b/Packages/com.unity.visualeffectgraph/package.json index 406589a12ab..bf2657481d0 100644 --- a/Packages/com.unity.visualeffectgraph/package.json +++ b/Packages/com.unity.visualeffectgraph/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.visualeffectgraph", "displayName": "Visual Effect Graph", - "version": "14.0.10", + "version": "14.0.11", "unity": "2022.3", "description": "The Visual Effect Graph is a node based visual effect editor. It allows you to author next generation visual effects that Unity simulates directly on the GPU. The Visual Effect Graph is production-ready for the High Definition Render Pipeline and runs on all platforms supported by it. Full support for the Universal Render Pipeline and compatible mobile devices is still in development.", "keywords": [ @@ -12,8 +12,8 @@ "particles" ], "dependencies": { - "com.unity.shadergraph": "14.0.10", - "com.unity.render-pipelines.core": "14.0.10" + "com.unity.shadergraph": "14.0.11", + "com.unity.render-pipelines.core": "14.0.11" }, "samples": [ { diff --git a/Tests/SRPTests/Packages/com.unity.testing.graphics-performance/package.json b/Tests/SRPTests/Packages/com.unity.testing.graphics-performance/package.json index ad00bc56c4e..b14c4d3c773 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.graphics-performance/package.json +++ b/Tests/SRPTests/Packages/com.unity.testing.graphics-performance/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.testing.graphics-performance", "displayName": "Performance Graphics Tests Framework", - "version": "14.0.10", + "version": "14.0.11", "unity": "2022.3", "unityRelease": "0a1", "description": "Provides performance framework helpers for writing tests for graphics code, such as test scene asset description, performance performance report and shader static analysis.", @@ -16,6 +16,6 @@ "dependencies": { "com.unity.test-framework.performance": "3.0.3", "com.unity.shaderanalysis": "1.0.0", - "com.unity.render-pipelines.core": "14.0.10" + "com.unity.render-pipelines.core": "14.0.11" } -} +} \ No newline at end of file From c027d053ff5dab478972359a18f831620a130452 Mon Sep 17 00:00:00 2001 From: Adrian Smith Date: Mon, 8 Apr 2024 11:00:06 +0000 Subject: [PATCH 20/27] [content automatically redacted] touching PlatformDependent folder --- .../com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl | 4 ++-- .../com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl | 4 ++-- .../com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl | 4 ++-- .../com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl | 4 ++-- .../ShaderLibrary/CommonLighting.hlsl | 4 ++-- .../ShaderLibrary/CommonMaterial.hlsl | 4 ++-- .../ShaderLibrary/EntityLighting.hlsl | 4 ++-- .../ShaderLibrary/ImageBasedLighting.hlsl | 4 ++-- .../ShaderLibrary/Packing.hlsl | 4 ++-- .../ShaderLibrary/Sampling/Fibonacci.hlsl | 4 ++-- .../ShaderLibrary/Sampling/Hammersley.hlsl | 4 ++-- .../ShaderLibrary/Sampling/Sampling.hlsl | 4 ++-- .../ShaderLibrary/SpaceTransforms.hlsl | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl index 39700e86b75..87b4cee3f38 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl @@ -1,7 +1,7 @@ #ifndef __ACES__ #define __ACES__ -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -1513,7 +1513,7 @@ half3 ODT_4000nits_ToAP1(half3 oces) return rgbPost; } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl index cddc4165f3b..e5c2ce7e7d1 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_BSDF_INCLUDED #define UNITY_BSDF_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -658,7 +658,7 @@ real3 D_KajiyaKay(real3 T, real3 H, real specularExponent) return dirAttn * norm * PositivePow(sinTHSq, 0.5 * n); } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl index 9e797ea3193..6fc810dbe4c 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_COLOR_INCLUDED #define UNITY_COLOR_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -728,7 +728,7 @@ half3 DecodeRGBM(half4 rgbm) return rgbm.xyz * rgbm.w * kRGBMRange; } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl index 1f561dfab68..270cafc434d 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_COMMON_INCLUDED #define UNITY_COMMON_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -1618,7 +1618,7 @@ float SharpenAlpha(float alpha, float alphaClipTreshold) // These clamping function to max of floating point 16 bit are use to prevent INF in code in case of extreme value TEMPLATE_1_REAL(ClampToFloat16Max, value, return min(value, HALF_MAX)) -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl index c218322160d..3d03b1829e2 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_COMMON_LIGHTING_INCLUDED #define UNITY_COMMON_LIGHTING_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -503,7 +503,7 @@ bool IsMatchingLightLayer(uint lightLayers, uint renderingLayers) return (lightLayers & renderingLayers) != 0; } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl index 706b738607c..c6caca3e107 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_COMMON_MATERIAL_INCLUDED #define UNITY_COMMON_MATERIAL_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -363,7 +363,7 @@ real3 LerpWhiteTo(real3 b, real t) } #endif -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl index 163e85322f9..6b3667298a1 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_ENTITY_LIGHTING_INCLUDED #define UNITY_ENTITY_LIGHTING_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -281,7 +281,7 @@ real3 SampleDirectionalLightmap(TEXTURE2D_LIGHTMAP_PARAM(lightmapTex, lightmapSa return bakeDiffuseLighting; } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl index dcec7b5234e..2d84b6d7665 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_IMAGE_BASED_LIGHTING_HLSL_INCLUDED #define UNITY_IMAGE_BASED_LIGHTING_HLSL_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -706,7 +706,7 @@ float InfluenceFadeNormalWeight(float3 normal, float3 centerToPos) return saturate((-1.0f / 0.4f) * dot(normal, centerToPos) + (0.6f / 0.4f)); } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl index 4543600b0e3..2a57334253a 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_PACKING_INCLUDED #define UNITY_PACKING_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -599,7 +599,7 @@ float2 Unpack8ToFloat2(float f) return float2(x, y); } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Fibonacci.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Fibonacci.hlsl index 0fa2682f2af..f7f35858e05 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Fibonacci.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Fibonacci.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_FIBONACCI_INCLUDED #define UNITY_FIBONACCI_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -299,7 +299,7 @@ real2 SampleSphereFibonacci(uint i, uint sampleCount) return real2(1 - 2 * f.x, TWO_PI * f.y); } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Hammersley.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Hammersley.hlsl index 002ab5f27a6..3035713b7a5 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Hammersley.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Hammersley.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_HAMMERSLEY_INCLUDED #define UNITY_HAMMERSLEY_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -437,7 +437,7 @@ real2 Hammersley2d(uint i, uint sampleCount) } } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl index a1b2fc60a5b..361297074c5 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_SAMPLING_INCLUDED #define UNITY_SAMPLING_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -322,7 +322,7 @@ real3 SampleConeStrata(uint sampleIdx, real rcpSampleCount, real cosHalfApexAngl return real3(r * cphi, r * sphi, z); } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl index 85b24744dc6..9ca17effcfd 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl @@ -1,7 +1,7 @@ #ifndef UNITY_SPACE_TRANSFORMS_INCLUDED #define UNITY_SPACE_TRANSFORMS_INCLUDED -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -340,7 +340,7 @@ real3 TransformObjectToTangent(real3 dirOS, real3x3 tangentToWorld) return TransformWorldToTangent(normalWS, tangentToWorld); } -#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 +#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_SWITCH #pragma warning (enable : 3205) // conversion of larger type to smaller #endif From e07adadf237736f69869a0f689f8adb278672954 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Mon, 8 Apr 2024 11:00:16 +0000 Subject: [PATCH 21/27] [Port] [2022.3] Fix scene dirtiness issue with the HDRP compositor https://jira.unity3d.com/browse/UUM-58350 An internal operation (addComponent) was registering an editor Undo, marking the scene as dirty every time we entered the playmode. --- .../Runtime/Compositor/CompositionLayer.cs | 12 ++++++++---- .../Runtime/Compositor/CompositionManager.cs | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index a2f0dc9b02f..d8a36a55bd1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -191,10 +191,14 @@ static float EnumToScale(ResolutionScale scale) return 1.0f / (int)scale; } - static T AddComponent(GameObject go) where T : Component + static T AddComponent(GameObject go, bool allowUndo = false) where T : Component { #if UNITY_EDITOR - return UnityEditor.Undo.AddComponent(go); + if (allowUndo) + return UnityEditor.Undo.AddComponent(go); + else + return go.AddComponent(); + #else return go.AddComponent(); #endif @@ -226,7 +230,7 @@ public int pixelHeight return 0; } } - public void Init(string layerID = "") + public void Init(string layerID = "", bool allowUndo = false) { if (m_LayerName == "") { @@ -357,7 +361,7 @@ public void Init(string layerID = "") // create the component if it is required and does not exist if (layerData == null) { - layerData = AddComponent(m_LayerCamera.gameObject); + layerData = AddComponent(m_LayerCamera.gameObject, allowUndo); layerData.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector; } // Reset the layer params (in case we cloned a camera which already had AdditionalCompositorData) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index 4878aa49723..e2070d1561f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -326,7 +326,7 @@ public void Init() SetupCompositionMaterial(); - SetupCompositorLayers(); + SetupCompositorLayers(false); SetupGlobalCompositorVolume(); @@ -401,11 +401,11 @@ public void UpdateDisplayNumber() } } - void SetupCompositorLayers() + void SetupCompositorLayers(bool allowUndo = true) { for (int i = 0; i < m_InputLayers.Count; ++i) { - m_InputLayers[i].Init($"Layer{i}"); + m_InputLayers[i].Init($"Layer{i}", allowUndo); } SetLayerRenderTargets(); From 8df9658fba0d7253f9e0a21909c90ca901c64698 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Mon, 8 Apr 2024 11:00:17 +0000 Subject: [PATCH 22/27] [Port] [2022.3] [UUM-31719] Set default orthographic for pixel perfect camera Set default projection orthographic for pixel perfect camera --- .../Editor/2D/GameObjectCreation.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/GameObjectCreation.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/GameObjectCreation.cs index 61491ba7da6..12583ab4f89 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/GameObjectCreation.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/GameObjectCreation.cs @@ -14,6 +14,7 @@ static void GameObjectCreatePixelPerfectCamera(MenuCommand menuCommand) { var go = CreateGameObject("Pixel Perfect Camera", menuCommand, new[] { typeof(PixelPerfectCamera) }); go.GetComponent().gridSnapping = PixelPerfectCamera.GridSnapping.PixelSnapping; + go.GetComponent().orthographic = true; } static public GameObject CreateGameObject(string name, MenuCommand menuCommand, params Type[] components) From cd105f2a2c72fa0d3027c645715605c17c5dd4ff Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Mon, 8 Apr 2024 18:44:29 +0000 Subject: [PATCH 23/27] [Port] [2022.3] Fix for the preview rendering issue (no default sky ambient) In the initial rendering of the preview in the inspector window, the ambient color of the default sky may not be ready (black ambient color), due to the lag of GPU readback of the SH coefficients. The ambient color is not updated until the preview is updated by some triggers like hovering the cursor over the inspector. This PR fixes the issue by using the hard-coded value of the default sky's SH. --- .../Runtime/RenderPipeline/Camera/HDCamera.cs | 2 +- .../Runtime/Sky/SkyManager.cs | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index 18e87dd8e76..aa95b89d652 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -1420,7 +1420,7 @@ internal void UpdateCurrentSky(SkyManager skyManager) visualSky.cloudSettings = null; visualSky.volumetricClouds = null; lightingSky = visualSky; - skyAmbientMode = SkyAmbientMode.Dynamic; + skyAmbientMode = SkyAmbientMode.Static; } else #endif diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index f540d6d38e6..c3a8945101e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -185,6 +185,11 @@ class SkyManager #if UNITY_EDITOR // For Preview windows we want to have a 'fixed' sky, so we can display chrome metal and have always the same look HDRISky m_DefaultPreviewSky; + + // Hard-coded SH for DefaultHDRISky.exr + // This is a temporary solution for the preview rendering issue when SH is not ready. + // A proper fix is needed when we want to expose the control of sky for preview. + SphericalHarmonicsL2 m_DefaultPreviewSkyAmbientProbe = new SphericalHarmonicsL2(); #endif // Shared resources for sky rendering. @@ -434,6 +439,36 @@ public void Build(HDRenderPipelineAsset hdAsset, HDRenderPipelineRuntimeResource #if UNITY_EDITOR UnityEditor.Lightmapping.bakeStarted += OnBakeStarted; + + { + m_DefaultPreviewSkyAmbientProbe[0, 0] = 0.1279895f; + m_DefaultPreviewSkyAmbientProbe[0, 1] = -0.01244975f; + m_DefaultPreviewSkyAmbientProbe[0, 2] = 0.002333597f; + m_DefaultPreviewSkyAmbientProbe[0, 3] = -0.01013585f; + m_DefaultPreviewSkyAmbientProbe[0, 4] = -0.006032045f; + m_DefaultPreviewSkyAmbientProbe[0, 5] = 0.0005331814f; + m_DefaultPreviewSkyAmbientProbe[0, 6] = 0.002311948f; + m_DefaultPreviewSkyAmbientProbe[0, 7] = -0.001873836f; + m_DefaultPreviewSkyAmbientProbe[0, 8] = 0.0231871f; + m_DefaultPreviewSkyAmbientProbe[1, 0] = 0.1585829f; + m_DefaultPreviewSkyAmbientProbe[1, 1] = 0.01596837f; + m_DefaultPreviewSkyAmbientProbe[1, 2] = 0.003311858f; + m_DefaultPreviewSkyAmbientProbe[1, 3] = -0.01475812f; + m_DefaultPreviewSkyAmbientProbe[1, 4] = -0.009350514f; + m_DefaultPreviewSkyAmbientProbe[1, 5] = 0.000841937f; + m_DefaultPreviewSkyAmbientProbe[1, 6] = 0.003378667f; + m_DefaultPreviewSkyAmbientProbe[1, 7] = -0.002562553f; + m_DefaultPreviewSkyAmbientProbe[1, 8] = 0.03318842f; + m_DefaultPreviewSkyAmbientProbe[2, 0] = 0.209883f; + m_DefaultPreviewSkyAmbientProbe[2, 1] = 0.06525062f; + m_DefaultPreviewSkyAmbientProbe[2, 2] = 0.004639104f; + m_DefaultPreviewSkyAmbientProbe[2, 3] = -0.02339679f; + m_DefaultPreviewSkyAmbientProbe[2, 4] = -0.01619671f; + m_DefaultPreviewSkyAmbientProbe[2, 5] = 0.001453806f; + m_DefaultPreviewSkyAmbientProbe[2, 6] = 0.003758613f; + m_DefaultPreviewSkyAmbientProbe[2, 7] = -0.003646188f; + m_DefaultPreviewSkyAmbientProbe[2, 8] = 0.04316145f; + } #endif } @@ -584,6 +619,13 @@ internal SphericalHarmonicsL2 GetAmbientProbe(HDCamera hdCamera) return m_BlackAmbientProbe; } +#if UNITY_EDITOR + if (HDUtils.IsRegularPreviewCamera(hdCamera.camera)) + { + return m_DefaultPreviewSkyAmbientProbe; + } +#endif + return GetAmbientProbe(GetLightingSky(hdCamera)); } From 0bf16482fc6ebf64f905b2ca297b7149831fc6b0 Mon Sep 17 00:00:00 2001 From: Erik Hakala Date: Tue, 9 Apr 2024 13:03:19 +0000 Subject: [PATCH 24/27] 2022.3/graphics/urp/backport/uum 49324 taa api Add public scripting API for URP TAA settings. --- ...enderPipelineCameraUI.Rendering.Drawers.cs | 2 +- ...UniversalRenderPipelineSerializedCamera.cs | 12 +- .../Runtime/TemporalAA.cs | 156 +++++++++++++++--- .../Runtime/UniversalAdditionalCameraData.cs | 5 +- .../Runtime/UniversalRenderPipeline.cs | 6 +- 5 files changed, 149 insertions(+), 32 deletions(-) diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineCameraUI.Rendering.Drawers.cs b/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineCameraUI.Rendering.Drawers.cs index 332d879b283..4c1f11c642c 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineCameraUI.Rendering.Drawers.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineCameraUI.Rendering.Drawers.cs @@ -253,7 +253,7 @@ static void DrawerRenderingTAAQuality(UniversalRenderPipelineSerializedCamera p, { p.taaFrameInfluence.floatValue = 1.0f - EditorGUILayout.Slider(Styles.taaBaseBlendFactor, 1.0f - p.taaFrameInfluence.floatValue, 0.6f, 0.98f); EditorGUILayout.Slider(p.taaJitterScale, 0.0f, 1.0f, Styles.taaJitterScale); - EditorGUILayout.Slider(p.taaMipBias, -0.5f, 0.0f, Styles.taaMipBias); + EditorGUILayout.Slider(p.taaMipBias, -1.0f, 0.0f, Styles.taaMipBias); if(p.taaQuality.intValue >= (int)TemporalAAQuality.Medium) EditorGUILayout.Slider(p.taaVarianceClampScale, 0.6f, 1.2f, Styles.taaVarianceClampScale); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineSerializedCamera.cs b/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineSerializedCamera.cs index 3836f407be5..277b7ee5777 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineSerializedCamera.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineSerializedCamera.cs @@ -106,12 +106,12 @@ public UniversalRenderPipelineSerializedCamera(SerializedObject serializedObject #endif var taaSettings = serializedAdditionalDataObject.FindProperty(nameof(UniversalAdditionalCameraData.m_TaaSettings)); - taaQuality = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.quality)); - taaFrameInfluence = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.frameInfluence)); - taaJitterScale = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.jitterScale)); - taaMipBias = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.mipBias)); - taaVarianceClampScale = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.varianceClampScale)); - taaContrastAdaptiveSharpening = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.contrastAdaptiveSharpening)); + taaQuality = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.m_Quality)); + taaFrameInfluence = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.m_FrameInfluence)); + taaJitterScale = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.m_JitterScale)); + taaMipBias = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.m_MipBias)); + taaVarianceClampScale = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.m_VarianceClampScale)); + taaContrastAdaptiveSharpening = taaSettings.FindPropertyRelative(nameof(TemporalAA.Settings.m_ContrastAdaptiveSharpening)); allowHDROutput = serializedAdditionalDataObject.FindProperty("m_AllowHDROutput"); } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs b/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs index 32fdff5c8f6..de926866351 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs @@ -1,15 +1,44 @@ using System; using UnityEngine.Experimental.Rendering; using UnityEngine.Experimental.Rendering.RenderGraphModule; +using UnityEngine.Serialization; namespace UnityEngine.Rendering.Universal { - internal enum TemporalAAQuality + /// + /// Temporal Anti-aliasing quality setting. + /// + public enum TemporalAAQuality { + // Quality options were tuned to give meaningful performance differences on mobile hardware. + + /// + /// 5-tap RGB clamp. No motion dilation. Suitable for no/low motion scenes. + /// VeryLow = 0, + + /// + /// 5-tap RGB clamp. 5-tap motion dilation. + /// Low, + + /// + /// 9-tap YCoCg variance clamp. 9-tap motion dilation. + /// Medium, + + /// + /// 9-tap YCoCg variance clamp and bicubic history. + /// High, + + // VeryHigh is a catch all option for enabling all the implemented features regardless of cost. + // Currently, 9-tap YCoCg variance clip, bicubic history and center sample filtering. + // In the future, VeryHigh mode could read additional buffers to improve the quality further. + + /// + /// Best quality, everything enabled. + /// VeryHigh } @@ -133,7 +162,10 @@ public void DeallocateTargets() }; // All of TAA here, work on TAA == work on this file. - static class TemporalAA + /// + /// Temporal anti-aliasing. + /// + public static class TemporalAA { static internal class ShaderConstants { @@ -153,31 +185,113 @@ static internal class ShaderKeywords public static readonly string TAA_LOW_PRECISION_SOURCE = "TAA_LOW_PRECISION_SOURCE"; } + /// + /// Temporal anti-aliasing settings. + /// [Serializable] - internal struct Settings + public struct Settings { - public TemporalAAQuality quality; - public float frameInfluence; - public float jitterScale; - public float mipBias; - public float varianceClampScale; - public float contrastAdaptiveSharpening; + [SerializeField] + [FormerlySerializedAs("quality")] + internal TemporalAAQuality m_Quality; + [SerializeField] + [FormerlySerializedAs("frameInfluence")] + internal float m_FrameInfluence; + [SerializeField] + [FormerlySerializedAs("jitterScale")] + internal float m_JitterScale; + [SerializeField] + [FormerlySerializedAs("mipBias")] + internal float m_MipBias; + [SerializeField] + [FormerlySerializedAs("varianceClampScale")] + internal float m_VarianceClampScale; + [SerializeField] + [FormerlySerializedAs("contrastAdaptiveSharpening")] + internal float m_ContrastAdaptiveSharpening; + + // Internal API + [NonSerialized] internal int resetHistoryFrames; // Number of frames the history is reset. 0 no reset, 1 normal reset, 2 XR reset, -1 infinite (toggle on) + [NonSerialized] internal int jitterFrameCountOffset; // Jitter "seed" == Time.frameCount + jitterFrameCountOffset. Used for testing determinism. + + /// + /// The quality level to use for the temporal anti-aliasing. + /// + public TemporalAAQuality quality + { + get => m_Quality; + set => m_Quality = (TemporalAAQuality)Mathf.Clamp((int)value, (int)TemporalAAQuality.VeryLow, (int)TemporalAAQuality.VeryHigh); + } + /// + /// Determines how much the history buffer is blended together with current frame result. Higher values means more history contribution, which leads to better anti aliasing, but also more prone to ghosting. + /// Between 0.0 - 1.0. + /// + public float baseBlendFactor + { + // URP uses frame influence, amount of current frame to blend with history. + // HDRP uses base blend factor, the amount of history to blend with current frame. + // We flip the value here to match HDRP for consistent API/UI. + get => 1.0f - m_FrameInfluence; + set => m_FrameInfluence = Mathf.Clamp01(1.0f - value); + } + + /// + /// Determines the scale to the jitter applied when TAA is enabled. Lowering this value will lead to less visible flickering and jittering, but also will produce more aliased images. + /// + public float jitterScale + { + get => m_JitterScale; + set => m_JitterScale = Mathf.Clamp01(value); + } - [NonSerialized] public int resetHistoryFrames; // Number of frames the history is reset. 0 no reset, 1 normal reset, 2 XR reset, -1 infinite (toggle on) - [NonSerialized] public int jitterFrameCountOffset; // Jitter "seed" == Time.frameCount + jitterFrameCountOffset. Used for testing determinism. + /// + /// Determines how much texture mip map selection is biased when rendering. Lowering this can slightly reduce blur on textures at the cost of performance. Requires mip maps in textures. + /// Between -1.0 - 0.0. + /// + public float mipBias + { + get => m_MipBias; + set => m_MipBias = Mathf.Clamp(value, -1.0f, 0.0f); + } + /// + /// Determines the strength of the history color rectification clamp. Lower values can reduce ghosting, but produce more flickering. Higher values reduce flickering, but are prone to blur and ghosting. + /// Between 0.001 - 10.0. + /// Good values around 1.0. + /// + public float varianceClampScale + { + get => m_VarianceClampScale; + set => m_VarianceClampScale = Mathf.Clamp(value, 0.001f, 10.0f); + } + + /// + /// Enables high quality post sharpening to reduce TAA blur. The FSR upscaling overrides this setting if enabled. + /// Between 0.0 - 1.0. + /// Use 0.0 to disable. + /// + public float contrastAdaptiveSharpening + { + get => m_ContrastAdaptiveSharpening; + set => m_ContrastAdaptiveSharpening = Mathf.Clamp01(value); + } + + /// + /// Creates a new instance of the settings with default values. + /// + /// Default settings. public static Settings Create() { Settings s; - s.quality = TemporalAAQuality.High; - s.frameInfluence = 0.1f; - s.jitterScale = 1.0f; - s.mipBias = 0.0f; - s.varianceClampScale = 0.9f; - s.contrastAdaptiveSharpening = 0.0f; // Disabled + s.m_Quality = TemporalAAQuality.High; + s.m_FrameInfluence = 0.1f; + s.m_JitterScale = 1.0f; + s.m_MipBias = 0.0f; + s.m_VarianceClampScale = 0.9f; + s.m_ContrastAdaptiveSharpening = 0.0f; // Disabled - s.resetHistoryFrames = 0; + s.resetHistoryFrames = 0; s.jitterFrameCountOffset = 0; return s; @@ -300,7 +414,7 @@ static internal string ValidateAndWarn(ref CameraData cameraData) const int warningThrottleFrames = 60 * 1; // 60 FPS * 1 sec if(Time.frameCount % warningThrottleFrames == 0) Debug.LogWarning(warning); - + return warning; } @@ -332,7 +446,7 @@ internal static void ExecutePass(CommandBuffer cmd, Material taaMaterial, ref Ca taaMaterial.SetTexture(ShaderConstants._TaaMotionVectorTex, isNewFrame ? motionVectors : Texture2D.blackTexture); ref var taa = ref cameraData.taaSettings; - float taaInfluence = taa.resetHistoryFrames == 0 ? taa.frameInfluence : 1.0f; + float taaInfluence = taa.resetHistoryFrames == 0 ? taa.m_FrameInfluence : 1.0f; taaMaterial.SetFloat(ShaderConstants._TaaFrameInfluence, taaInfluence); taaMaterial.SetFloat(ShaderConstants._TaaVarianceClampScale, taa.varianceClampScale); @@ -391,7 +505,7 @@ internal static void Render(RenderGraph renderGraph, Material taaMaterial, ref C ref var taa = ref cameraData.taaSettings; bool isNewFrame = cameraData.taaPersistentData.GetLastAccumFrameIndex(multipassId) != Time.frameCount; - float taaInfluence = taa.resetHistoryFrames == 0 ? taa.frameInfluence : 1.0f; + float taaInfluence = taa.resetHistoryFrames == 0 ? taa.m_FrameInfluence : 1.0f; RTHandle accumulationTexture = cameraData.taaPersistentData.accumulationTexture(multipassId); TextureHandle srcAccumulation = renderGraph.ImportTexture(accumulationTexture); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs index f3806ed626e..e47a7606b15 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs @@ -661,7 +661,10 @@ public AntialiasingQuality antialiasingQuality set => m_AntialiasingQuality = value; } - internal ref TemporalAA.Settings taaSettings + /// + /// Returns the current temporal anti-aliasing settings used by this camera. + /// + public ref TemporalAA.Settings taaSettings { get { return ref m_TaaSettings; } } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index 423c4c31e72..f358c56373f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -1499,15 +1499,15 @@ private static void ApplyTaaRenderingDebugOverrides(ref TemporalAA.Settings taaS switch (renderingSettings.taaDebugMode) { case DebugDisplaySettingsRendering.TaaDebugMode.ShowClampedHistory: - taaSettings.frameInfluence = 0; + taaSettings.m_FrameInfluence = 0; break; case DebugDisplaySettingsRendering.TaaDebugMode.ShowRawFrame: - taaSettings.frameInfluence = 1; + taaSettings.m_FrameInfluence = 1; break; case DebugDisplaySettingsRendering.TaaDebugMode.ShowRawFrameNoJitter: - taaSettings.frameInfluence = 1; + taaSettings.m_FrameInfluence = 1; taaSettings.jitterScale = 0; break; } From 7cc1c261f6dcd35cd88d26a158a16bae1922f2c5 Mon Sep 17 00:00:00 2001 From: Yohann Vaast Date: Wed, 10 Apr 2024 02:52:00 +0000 Subject: [PATCH 25/27] [Port] [2022.3] Add doc for 'Screen Space - Overlay' in Graphics Compositor. Added documentation on how to use the Screen Space Overlay render mode alongside the Graphics Compositor. We decided not to change the actual behavior of SupportedRenderingFeatures.active.rendersUIOverlay when the Graphics Compositor is in use, but instead, to document a way force the rendering of the UI in this context. When the user follows the new documentation steps, the UI is indeed well renderer in the GameView. Tested manually and locally on my Windows machine. --- .../Documentation~/Compositor-User-Guide.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md index 8de4bc7cf99..c85fbee1f6f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md @@ -85,6 +85,14 @@ You can use the Graphics Compositor to compose screen space Canvas (UI) elements Furthermore, you can't use the **Output Camera** of the Graphics Compositor as the **Render Camera** to draw Canvas elements on top of the compositor's output. To achieve the same effect, you can add a new Sub-layer in the Render Schedule, use the camera of this layer as the **Render Camera** for the UI, and then compose the resulting layer with the available compositing operations (stacking or graph-bsed composition). +To use the **Screen Space - Overlay** render mode alongside the Graphics Compositor, you must make sure that the function to render the UI overlays is called by the engine, and not by SRP. If SRP calls the function, the Graphics Compositor's final compositing call overrides the UI. + +To force the engine to call the function rather than SRP, use the following line: + +``` +SupportedRenderingFeatures.active.rendersUIOverlay = false; +``` + ## Performance Considerations The Graphics Compositor has a rather high CPU and GPU overhead and it's not recommended to be used in performance critical applications such as video games. From 65b778c87e5cd51cc64626b8a02f85fc9ac2a3f0 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Wed, 10 Apr 2024 02:52:01 +0000 Subject: [PATCH 26/27] [Port] [2022.3] Update reflection probe atlas if probe runtime intensity changes https://jira.unity3d.com/browse/UUM-67982 The update logic in the reflection probe atlas was not taking into account the runtime intensity of non real-time probes --- .../Runtime/ReflectionProbeManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs index 930386c9c1b..a7bb8c05429 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs @@ -204,6 +204,7 @@ public unsafe void UpdateGpuData(CommandBuffer cmd, ref RenderingData renderingD #if UNITY_EDITOR needsUpdate |= cachedProbe.imageContentsHash != texture.imageContentsHash; #endif + needsUpdate |= cachedProbe.hdrData != probe.hdrData; // The probe needs update if the runtime intensity multiplier changes if (needsUpdate) { From 948d39db5b5ed1a32e0bacbefb146d352a2d1661 Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Wed, 10 Apr 2024 02:52:02 +0000 Subject: [PATCH 27/27] [2022.3] [HDRP] update graphics compositor limitation for VR update graphics compositor limitation for VR --- .../Documentation~/Compositor-User-Guide.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md index c85fbee1f6f..f51299b4bfe 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md @@ -104,3 +104,7 @@ Here are some tips that can help you improve the performance of applications tha 2. In the Inspector select the **Custom Frame Settings**. 3. Disable as many HDRP features as possible. For example you can disable the support for Screen Space Reflections (SSR) if you know that you aren't going to need SSR for this Sub-layer. * Reduce the resolution of specific Composition Layers, while keeping the visually important elements in separate Layers at full resolution. This will affect all Sub-layers that are stacked on this Layer. + +## Limitation + +The Graphics Compositor is not compatible with Virtual Reality. \ No newline at end of file