diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Placement.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Placement.cs index 112732aac4c..4be435c2442 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Placement.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Placement.cs @@ -241,6 +241,13 @@ static ProbeSubdivisionResult GetBricksFromLoaded() var dataList = GetPerSceneDataList(); var result = new ProbeSubdivisionResult(); + // We read bricks from the asset rather than using the currently loaded cells. + // This is because not all bricks from the previous bake are guaranteed to be currently loaded, + // we may for example have hit the max brick count given the selected memory budget. + ProbeVolumeStreamableAsset bricksDataAsset = m_BakingSet.cellBricksDataAsset; + bricksDataAsset.EnsureAssetLoaded(); + using NativeArray previousBricks = bricksDataAsset.asset.GetData(); + foreach (var data in dataList) { var cellSize = m_ProfileInfo.minDistanceBetweenProbes * 3.0f * m_ProfileInfo.cellSizeInBricks; @@ -252,7 +259,6 @@ static ProbeSubdivisionResult GetBricksFromLoaded() foreach (var cellIndex in cells) { var cellDesc = m_BakingSet.GetCellDesc(cellIndex); - var cellData = m_BakingSet.GetCellData(cellIndex); var cellPos = cellDesc.position; if (!result.scenesPerCells.ContainsKey(cellPos)) @@ -260,7 +266,13 @@ static ProbeSubdivisionResult GetBricksFromLoaded() result.scenesPerCells[cellPos] = new HashSet(); var center = new Vector3((cellPos.x + 0.5f) * cellSize, (cellPos.y + 0.5f) * cellSize, (cellPos.z + 0.5f) * cellSize); - result.cells.Add((cellPos, new Bounds(center, cellDimensions), cellData.bricks.ToArray())); + + var cellStreamingDesc = bricksDataAsset.streamableCellDescs[cellIndex]; + int bricksOffset = cellStreamingDesc.offset / bricksDataAsset.elementSize; + int bricksCount = Mathf.Min(cellStreamingDesc.elementCount, cellDesc.bricksCount); + Brick[] bricks = previousBricks.GetSubArray(bricksOffset, bricksCount).ToArray(); + + result.cells.Add((cellPos, new Bounds(center, cellDimensions), bricks)); } result.scenesPerCells[cellPos].Add(data.sceneGUID); } diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeCellDilation.compute b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeCellDilation.compute index 04dd0fa3d1f..c4a4e85c677 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeCellDilation.compute +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeCellDilation.compute @@ -1,6 +1,6 @@ #pragma kernel DilateCell -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeSubdivide.compute b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeSubdivide.compute index 2b7fb853aee..d6e74780aea 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeSubdivide.compute +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeSubdivide.compute @@ -6,7 +6,7 @@ #pragma kernel VoxelizeProbeVolumeData #pragma kernel Subdivide -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader index f15265fdf19..4c14df9ce41 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal webgpu switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal webgpu switch switch2 #define UNIFIED_RT_GROUP_SIZE_X 64 #define UNIFIED_RT_GROUP_SIZE_Y 1 diff --git a/Packages/com.unity.render-pipelines.core/Editor/Settings/DefaultVolumeProfileEditor.cs b/Packages/com.unity.render-pipelines.core/Editor/Settings/DefaultVolumeProfileEditor.cs index 0ac19fc3367..d8bda86627e 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Settings/DefaultVolumeProfileEditor.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Settings/DefaultVolumeProfileEditor.cs @@ -242,7 +242,7 @@ void OnVolumeComponentContextClick(Vector2 position, VolumeComponentEditor targe menu.AddItem(VolumeProfileUtils.Styles.copySettings, false, () => VolumeComponentCopyPaste.CopySettings(targetComponent)); if (VolumeComponentCopyPaste.CanPaste(targetComponent)) - menu.AddItem(VolumeProfileUtils.Styles.pasteSettings, false, () => VolumeComponentCopyPaste.PasteSettings(targetComponent)); + menu.AddItem(VolumeProfileUtils.Styles.pasteSettings, false, () => VolumeComponentCopyPaste.PasteSettings(targetComponent, m_Profile)); else menu.AddDisabledItem(VolumeProfileUtils.Styles.pasteSettings); diff --git a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentCopyPaste.cs b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentCopyPaste.cs index 6dda2991f2b..439365c2e2f 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentCopyPaste.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentCopyPaste.cs @@ -62,7 +62,7 @@ public static void CopySettings(VolumeComponent targetComponent) EditorGUIUtility.systemCopyBuffer = writer.ToString(); } - public static void PasteSettings(VolumeComponent targetComponent) + public static void PasteSettings(VolumeComponent targetComponent, VolumeProfile asset) { if (targetComponent == null) return; @@ -72,6 +72,11 @@ public static void PasteSettings(VolumeComponent targetComponent) using var reader = new StringReader(EditorGUIUtility.systemCopyBuffer); if (TryReadCopyBuffer(reader, out var typeAndValue)) JsonUtility.FromJsonOverwrite(typeAndValue[1], targetComponent); + + if (EditorUtility.IsPersistent(asset)) + { + EditorUtility.SetDirty(asset); + } } public static void CopySettings(List targetComponents) @@ -87,7 +92,7 @@ public static void CopySettings(List targetComponents) EditorGUIUtility.systemCopyBuffer = writer.ToString(); } - public static void PasteSettings(List targetComponents) + public static void PasteSettings(List targetComponents, VolumeProfile asset) { if (targetComponents == null || targetComponents.Count == 0) return; @@ -113,6 +118,11 @@ public static void PasteSettings(List targetComponents) JsonUtility.FromJsonOverwrite(typeAndValue[1], targetComponent); } } + + if (EditorUtility.IsPersistent(asset)) + { + EditorUtility.SetDirty(asset); + } } } } diff --git a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs index 69af1c4dcdc..bc12819098b 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs @@ -470,7 +470,7 @@ void OnContextClick(Vector2 position, VolumeComponentEditor targetEditor, int id if (VolumeComponentCopyPaste.CanPaste(targetComponent)) menu.AddItem(EditorGUIUtility.TrTextContent("Paste Settings"), false, () => { - VolumeComponentCopyPaste.PasteSettings(targetComponent); + VolumeComponentCopyPaste.PasteSettings(targetComponent, asset); VolumeManager.instance.OnVolumeProfileChanged(asset); }); else diff --git a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs index a6cedcc6e5c..2dc76946e55 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs @@ -266,29 +266,62 @@ void OnVolumeProfileContextClick() if (profileRef != null) { + bool hasNoComponents = profileRef.components.Count == 0; + var cloneLabel = targetVolume.HasInstantiatedProfile() ? Styles.saveLabel : Styles.cloneLabel; menu.AddItem(cloneLabel, false, CloneProfile); menu.AddSeparator(string.Empty); - menu.AddItem(VolumeProfileUtils.Styles.collapseAll, false, () => + + if (hasNoComponents) { - VolumeProfileUtils.SetComponentEditorsExpanded(m_ComponentList.editors, false); - }); - menu.AddItem(VolumeProfileUtils.Styles.expandAll, false, () => + menu.AddDisabledItem(VolumeProfileUtils.Styles.collapseAll); + menu.AddDisabledItem(VolumeProfileUtils.Styles.expandAll); + } + else { - VolumeProfileUtils.SetComponentEditorsExpanded(m_ComponentList.editors, true); - }); + menu.AddItem(VolumeProfileUtils.Styles.collapseAll, false, () => + { + VolumeProfileUtils.SetComponentEditorsExpanded(m_ComponentList.editors, false); + }); + menu.AddItem(VolumeProfileUtils.Styles.expandAll, false, () => + { + VolumeProfileUtils.SetComponentEditorsExpanded(m_ComponentList.editors, true); + }); + } + menu.AddSeparator(string.Empty); - menu.AddItem(Styles.enableAll, false, () => SetComponentsActive(true)); - menu.AddItem(Styles.disableAll, false, () => SetComponentsActive(false)); - menu.AddItem(Styles.removeAll, false, () => m_ComponentList.RemoveAllComponents()); - menu.AddItem(VolumeProfileUtils.Styles.resetAll, false, () => m_ComponentList.ResetAllComponents()); + + if (hasNoComponents) + { + menu.AddDisabledItem(Styles.enableAll); + menu.AddDisabledItem(Styles.disableAll); + menu.AddDisabledItem(Styles.removeAll); + menu.AddDisabledItem(VolumeProfileUtils.Styles.resetAll); + } + else + { + menu.AddItem(Styles.enableAll, false, () => SetComponentsActive(true)); + menu.AddItem(Styles.disableAll, false, () => SetComponentsActive(false)); + menu.AddItem(Styles.removeAll, false, () => m_ComponentList.RemoveAllComponents()); + menu.AddItem(VolumeProfileUtils.Styles.resetAll, false, () => m_ComponentList.ResetAllComponents()); + } + menu.AddSeparator(string.Empty); - menu.AddItem(VolumeProfileUtils.Styles.copyAllSettings, false, - () => VolumeComponentCopyPaste.CopySettings(profileRef.components)); + + if (hasNoComponents) + { + menu.AddDisabledItem(VolumeProfileUtils.Styles.copyAllSettings); + } + else + { + menu.AddItem(VolumeProfileUtils.Styles.copyAllSettings, false, + () => VolumeComponentCopyPaste.CopySettings(profileRef.components)); + } + if (VolumeComponentCopyPaste.CanPaste(profileRef.components)) menu.AddItem(VolumeProfileUtils.Styles.pasteSettings, false, () => { - VolumeComponentCopyPaste.PasteSettings(profileRef.components); + VolumeComponentCopyPaste.PasteSettings(profileRef.components, profileRef); VolumeManager.instance.OnVolumeProfileChanged(profileRef); }); else diff --git a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileUtils.cs b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileUtils.cs index df9d6cc4285..f7f1082c6dc 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileUtils.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileUtils.cs @@ -325,7 +325,7 @@ public static void AddVolumeProfileContextMenuItems( if (VolumeComponentCopyPaste.CanPaste(volumeProfile.components)) menu.AddItem(Styles.pasteSettings, false, () => { - VolumeComponentCopyPaste.PasteSettings(volumeProfile.components); + VolumeComponentCopyPaste.PasteSettings(volumeProfile.components, volumeProfile); VolumeManager.instance.OnVolumeProfileChanged(volumeProfile); }); else @@ -411,7 +411,7 @@ public static void OnVolumeProfileContextClick( if (VolumeComponentCopyPaste.CanPaste(volumeProfile.components)) menu.AddItem(Styles.pasteSettings, false, () => { - VolumeComponentCopyPaste.PasteSettings(volumeProfile.components); + VolumeComponentCopyPaste.PasteSettings(volumeProfile.components, volumeProfile); VolumeManager.instance.OnVolumeProfileChanged(volumeProfile); }); else diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeDebug.shader b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeDebug.shader index 7fce64773b0..a6a1ee4d5c5 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeDebug.shader +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeDebug.shader @@ -7,7 +7,7 @@ Shader "Hidden/Core/ProbeVolumeDebug" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 // Central render pipeline specific includes diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeFragmentationDebug.shader b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeFragmentationDebug.shader index 48fd203bd3e..a845ec3ed05 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeFragmentationDebug.shader +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeFragmentationDebug.shader @@ -13,7 +13,7 @@ Shader "Hidden/Core/ProbeVolumeFragmentationDebug" HLSLPROGRAM #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols #pragma vertex Vert diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeOffsetDebug.shader b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeOffsetDebug.shader index f345c3857db..4d5f20a52f8 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeOffsetDebug.shader +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeOffsetDebug.shader @@ -8,7 +8,7 @@ Shader "Hidden/Core/ProbeVolumeOffsetDebug" HLSLINCLUDE #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 // Central render pipeline specific includes diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeSamplingDebug.shader b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeSamplingDebug.shader index e03f043b9dd..dc1395e9a07 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeSamplingDebug.shader +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeSamplingDebug.shader @@ -9,7 +9,7 @@ Shader "Hidden/Core/ProbeVolumeSamplingDebug" HLSLINCLUDE #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 //#pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.UIState.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.UIState.cs index f80b0058759..edcdd3623b4 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.UIState.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.UIState.cs @@ -6,7 +6,7 @@ using UnityEditor; #endif -#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH +#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_SWITCH2 using UnityEngine.UI; #endif @@ -104,7 +104,7 @@ public bool displayRuntimeUI m_Root.transform.localPosition = Vector3.zero; m_RootUICanvas = m_Root.GetComponent(); -#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH +#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_SWITCH2 var canvasScaler = m_Root.GetComponent(); canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; #endif diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/VolumeDebugSettings.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/VolumeDebugSettings.cs index d2310ebd81b..df143e7d3b5 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/VolumeDebugSettings.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/VolumeDebugSettings.cs @@ -183,7 +183,7 @@ float ComputeWeight(Volume volume, Vector3 triggerPos) public Volume[] GetVolumes() { return VolumeManager.instance.GetVolumes(selectedCameraLayerMask) - .Where(v => v.sharedProfile != null) + .Where(v => v.profileRef != null) .Reverse().ToArray(); } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs index f76c930b549..d1a4065ae61 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs @@ -18,6 +18,7 @@ static class Strings public static readonly string batchRendererGroupShaderStrippingModeInvalid = $"{nameof(GPUResidentDrawer)} \"BatchRendererGroup Variants\" setting must be \"Keep All\". " + " The current setting will cause errors when building a player because all DOTS instancing shaders will be stripped" + " To fix, modify Graphics settings and set \"BatchRendererGroup Variants\" to \"Keep All\"."; + public static readonly string visionOSNotSupported = $"{nameof(GPUResidentDrawer)} Disabled on VisionOS as it is non applicable. This platform uses a custom rendering path and doesn't go through the resident drawer."; } internal static bool IsProjectSupported() @@ -30,6 +31,13 @@ internal static bool IsProjectSupported(out string message, out LogType severity message = string.Empty; severity = LogType.Log; + if (Application.platform == RuntimePlatform.VisionOS) + { + message = Strings.visionOSNotSupported; + severity = LogType.Log; + return false; + } + // The GPUResidentDrawer only has support when the RawBuffer path of providing data // ConstantBuffer path and any other unsupported platforms early out here if (BatchRendererGroup.BufferTarget != BatchBufferTarget.RawBuffer) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl index 73e63fd81e9..b7ae5454872 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl @@ -1,9 +1,9 @@ #ifndef __PROBEVOLUME_HLSL__ #define __PROBEVOLUME_HLSL__ -#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) +#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) //#define USE_APV_TEXTURE_HALF -#endif // SHADER_API_MOBILE || SHADER_API_SWITCH +#endif // SHADER_API_MOBILE || SHADER_API_SWITCH || SHADER_API_SWITCH2 #include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ShaderVariablesProbeVolumes.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/SphericalHarmonics.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute index 3376ed3489b..4e19d5cfd32 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu gles3 +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu gles3 //#pragma enable_d3d11_debug_symbols #pragma kernel BlendScenarios diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute index f95fd582706..1b172b3116b 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadData.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu gles3 +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu gles3 //#pragma enable_d3d11_debug_symbols #include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadDataCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadDataL2.compute b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadDataL2.compute index 881eeac7f32..03e6a557af1 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadDataL2.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadDataL2.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu gles3 +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu gles3 //#pragma enable_d3d11_debug_symbols #include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeUploadDataCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs index 848e55ca20e..d1b59b84ff3 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs @@ -76,7 +76,10 @@ internal static string MakePassMergeMessage(CompilerContextData ctx, in PassData $"- {passName}: {pass.fragmentInfoWidth}x{pass.fragmentInfoHeight}, {pass.fragmentInfoSamples} sample(s)."; break; case PassBreakReason.NextPassReadsTexture: - message += "The next pass reads one of the outputs as a regular texture, the pass needs to break."; + message += $"{prevPassName} output is sampled by {passName} as a regular texture, the pass needs to break."; + break; + case PassBreakReason.NextPassTargetsTexture: + message += $"{prevPassName} reads a texture that {passName} targets to, the pass needs to break."; break; case PassBreakReason.NonRasterPass: message += $"{prevPassName} is type {prevPass.type}. Only Raster passes can be merged."; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs index 4d7af1048fe..cbe1831b195 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs @@ -468,6 +468,7 @@ internal enum PassBreakReason NotOptimized, // Optimize never ran on this pass TargetSizeMismatch, // Target Sizes or msaa samples don't match NextPassReadsTexture, // The next pass reads data written by this pass as a texture + NextPassTargetsTexture, // The next pass targets the texture that this pass is reading NonRasterPass, // The next pass is a non-raster pass DifferentDepthTextures, // The next pass uses a different depth texture (and we only allow one in a whole NRP) AttachmentLimitReached, // Adding the next pass would have used more attachments than allowed @@ -500,6 +501,7 @@ public PassBreakAudit(PassBreakReason reason, int breakPass) "The native render pass optimizer never ran on this pass. Pass is standalone and not merged.", "The render target sizes of the next pass do not match.", "The next pass reads data output by this pass as a regular texture.", + "The next pass uses a texture sampled in this pass as a render target.", "The next pass is not a raster render pass.", "The next pass uses a different depth buffer. All passes in the native render pass need to use the same depth buffer.", $"The limit of {FixedAttachmentArray.MaxAttachments} native pass attachments would be exceeded when merging with the next pass.", @@ -748,6 +750,24 @@ public static PassBreakAudit CanMerge(CompilerContextData contextData, int activ currAvailableAttachmentSlots--; } } + + // Check if this fragment is already sampled in the native renderpass not as a fragment but as an input + for (int i = nativePass.firstGraphPass; i <= nativePass.lastGraphPass; ++i) + { + ref var earlierPassData = ref contextData.passData.ElementAt(i); + foreach (ref readonly var earlierInput in earlierPassData.Inputs(contextData)) + { + // If this fragment is already used in current native render pass + if (earlierInput.resource.index == fragment.resource.index) + { + // If it's not used as a fragment, it's used as some sort of texture read of load so we need to sync it out + if (!earlierPassData.IsUsedAsFragment(earlierInput.resource, contextData)) + { + return new PassBreakAudit(PassBreakReason.NextPassTargetsTexture, passIdToMerge); + } + } + } + } } foreach (ref readonly var fragmentInput in passToMerge.FragmentInputs(contextData)) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOccluder.shader b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOccluder.shader index c5a6d602d51..24149a67fb8 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOccluder.shader +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOccluder.shader @@ -2,7 +2,7 @@ Shader "Hidden/Core/DebugOccluder" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu //#pragma enable_d3d11_debug_symbols #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOcclusionTest.shader b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOcclusionTest.shader index 2513172f098..ac340d0bd4e 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOcclusionTest.shader +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/DebugOcclusionTest.shader @@ -12,7 +12,7 @@ Shader "Hidden/Core/DebugOcclusionTest" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu #pragma vertex Vert #pragma fragment Frag @@ -90,7 +90,7 @@ Shader "Hidden/Core/DebugOcclusionTest" if(total == 0) return float4(0, 0, 0, 0); - + float cost = log2((float)total); uint screenTotal = _OcclusionDebugOverlay[0]; // This should be always >= 1, because total >= 1 at this point. diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/GPUResidentDrawerResources.asset b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/GPUResidentDrawerResources.asset deleted file mode 100644 index 52c5ae1ce46..00000000000 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/GPUResidentDrawerResources.asset +++ /dev/null @@ -1,18 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !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: abd488482a604ce28bd6a034eb28b22a, type: 3} - m_Name: GPUResidentDrawerResources - m_EditorClassIdentifier: - instanceDataBufferCopyKernels: {fileID: 7200000, guid: f984aeb540ded8b4fbb8a2047ab5b2e2, type: 3} - instanceDataBufferUploadKernels: {fileID: 7200000, guid: 53864816eb00f2343b60e1a2c5a262ef, type: 3} - transformUpdaterKernels: {fileID: 7200000, guid: 2a567b9b2733f8d47a700c3c85bed75b, type: 3} - windDataUpdaterKernels: {fileID: 7200000, guid: fde76746e4fd0ed418c224f6b4084114, type: 3} diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/OccluderDepthPyramidKernels.compute b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/OccluderDepthPyramidKernels.compute index f01cb36f907..4a2c3dce7a8 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/OccluderDepthPyramidKernels.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/OccluderDepthPyramidKernels.compute @@ -1,6 +1,6 @@ #pragma kernel OccluderDepthDownscale -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 webgpu #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/OccluderDepthPyramidConstants.cs.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpCommon.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpCommon.hlsl index 423d5bed3e8..4e21a5a2324 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpCommon.hlsl +++ b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpCommon.hlsl @@ -38,11 +38,11 @@ #endif // Mobile platforms use a simplified version of STP to reduce runtime overhead. -#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) +#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) #define STP_TAA_Q 0 #endif -#if defined(SHADER_API_SWITCH) +#if defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) #define STP_BUG_SAT_INF 1 #endif diff --git a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpPreTaa.compute b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpPreTaa.compute index 5c89ff78bfc..5e5286ffffd 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpPreTaa.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpPreTaa.compute @@ -7,7 +7,7 @@ #pragma multi_compile _ DISABLE_TEXTURE2D_X_ARRAY -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch glcore +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 glcore #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpSetup.compute b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpSetup.compute index 4d98f8bb130..c0614aabcc7 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpSetup.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpSetup.compute @@ -14,7 +14,7 @@ #pragma multi_compile _ DISABLE_TEXTURE2D_X_ARRAY -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch glcore +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 glcore #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" @@ -59,7 +59,7 @@ TEXTURE2D_X(_StpPriorFeedback); #define STP_SETUP_PER_VIEW_CONSTANTS_STEREO_OFFSET (SLICE_ARRAY_INDEX * STPSETUPPERVIEWCONSTANTS_COUNT) -#if defined(SHADER_API_PSSL) || defined(SHADER_API_SWITCH) || (defined(SHADER_API_METAL) && !defined(SHADER_API_MOBILE)) +#if defined(SHADER_API_PSSL) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) || (defined(SHADER_API_METAL) && !defined(SHADER_API_MOBILE)) // Force usage of the 32-bit reduction path even in 16-bit environments #define STP_FORCE_32BIT_REDUCTION #endif diff --git a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpTaa.compute b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpTaa.compute index c9904044acc..7e26bd633de 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/STP/StpTaa.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/STP/StpTaa.compute @@ -7,7 +7,7 @@ #pragma multi_compile _ DISABLE_TEXTURE2D_X_ARRAY -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch glcore +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 glcore #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl index 64a6ae1ec17..56044f41362 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -347,7 +347,7 @@ half rgb_2_yc(half3 rgb) half b = rgb.z; half k = b * (b - g) + g * (g - r) + r * (r - b); k = max(k, 0.0); // Clamp to avoid precision issue causing k < 0, making sqrt(k) undefined -#if defined(SHADER_API_SWITCH) +#if defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) half chroma = k == 0.0 ? 0.0 : sqrt(k); // Avoid Nan #else half chroma = sqrt(k); @@ -1514,7 +1514,7 @@ half3 ODT_4000nits_ToAP1(half3 oces) return rgbPost; } -#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/GLES3.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/GLES3.hlsl index b5e9d13e745..9dacf8d91c3 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/GLES3.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/GLES3.hlsl @@ -38,6 +38,15 @@ #define GLES3_1_AEP 0 #endif +// GLES3 causes a performance regression in some devices when using CBUFFER. +// WebGL needs to put LightShadow uniforms into a uniform buffer, +// despite being a GLES3 API. Some mobile devices, such as Adreno GPUs, +// have a small GL_MAX_FRAGMENT_UNIFORM_VECTORS limit, causing Lit shaders +// to fail on those devices. https://jira.unity3d.com/browse/UUM-87232 +#if !defined(UNITY_PLATFORM_WEBGL) +#define LIGHT_SHADOWS_NO_CBUFFER +#endif + // Initialize arbitrary structure with zero values. // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 #define ZERO_INITIALIZE(type, name) name = (type)0; diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch2.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch2.hlsl new file mode 100644 index 00000000000..fa7c10ba347 --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch2.hlsl @@ -0,0 +1,155 @@ +// This file assume SHADER_API_SWITCH2 is defined +// TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + +#define UNITY_UV_STARTS_AT_TOP 1 +#define UNITY_REVERSED_Z 1 +#define UNITY_NEAR_CLIP_VALUE (1.0) +// This value will not go through any matrix projection conversion +#define UNITY_RAW_FAR_CLIP_VALUE (0.0) +#define VERTEXID_SEMANTIC SV_VertexID +#define INSTANCEID_SEMANTIC SV_InstanceID +#define FRONT_FACE_SEMANTIC SV_IsFrontFace +#define FRONT_FACE_TYPE bool +#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK)) + +#define CBUFFER_START(name) cbuffer name { +#define CBUFFER_END }; + +#define PLATFORM_SUPPORTS_EXPLICIT_BINDING +#define PLATFORM_NEEDS_UNORM_UAV_SPECIFIER +#define PLATFORM_LANE_COUNT 32 + +// flow control attributes +#define UNITY_BRANCH [branch] +#define UNITY_FLATTEN [flatten] +#define UNITY_UNROLL [unroll] +#define UNITY_UNROLLX(_x) [unroll(_x)] +#define UNITY_LOOP [loop] + +// Initialize arbitrary structure with zero values. +// Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 +#define ZERO_INITIALIZE(type, name) name = (type)0; +#define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + +// Texture util abstraction + +#define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + +// Texture abstraction + +#define TEXTURE2D(textureName) Texture2D textureName +#define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName +#define TEXTURECUBE(textureName) TextureCube textureName +#define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName +#define TEXTURE3D(textureName) Texture3D textureName + +#define TEXTURE2D_FLOAT(textureName) Texture2D textureName +#define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName +#define TEXTURECUBE_FLOAT(textureName) TextureCube textureName +#define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName +#define TEXTURE3D_FLOAT(textureName) Texture3D textureName + +#define TEXTURE2D_HALF(textureName) Texture2D textureName +#define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName +#define TEXTURECUBE_HALF(textureName) TextureCube textureName +#define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName +#define TEXTURE3D_HALF(textureName) Texture3D textureName + +#define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) +#define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) +#define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) +#define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + +#define TYPED_TEXTURE2D(type, textureName) Texture2D textureName +#define TYPED_TEXTURE2D_ARRAY(type, textureName) Texture2DArray textureName +#define TYPED_TEXTURE3D(type, textureName) Texture3D textureName +#define RW_TEXTURE2D(type, textureName) RWTexture2D textureName +#define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName +#define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + +#define SAMPLER(samplerName) SamplerState samplerName +#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName +#define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + +#define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) +#define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) +#define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) +#define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) +#define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + +#define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) +#define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) +#define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) +#define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + +#define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName +#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName +#define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName +#define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName +#define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + +#define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName +#define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName +#define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName +#define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + +#define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) +#define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) +#define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) +#define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) +#define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) +#define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) +#define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) +#define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) +#define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) +#define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) +#define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) +#define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) +#define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) +#define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) +#define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) +#define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + +#define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) +#define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) +#define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) +#define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) +#define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) +#define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) +#define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) +#define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) +#define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) +#define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) +#define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) +#define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) +#define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) +#define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) +#define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) +#define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + +#define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) +#define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) +#define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) +#define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + +#define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r +#define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + +#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) +#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) +#define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) +#define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) +#define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) +#define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) +#define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) +#define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + +#define PLATFORM_SUPPORT_GATHER +#define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) +#define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) +#define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) +#define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) +#define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) +#define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) +#define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) +#define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/GPUResidentDrawerResources.asset.meta b/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch2.hlsl.meta similarity index 52% rename from Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/GPUResidentDrawerResources.asset.meta rename to Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch2.hlsl.meta index f264944b9c0..9e90741feda 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/GPUResidentDrawerResources.asset.meta +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch2.hlsl.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 -guid: 0393c27fa7a52694f9e231193061b433 -NativeFormatImporter: +guid: 27b804a87c546b2429017809b12cd1c9 +ShaderIncludeImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl index 9f4a72f19a0..979202c5b0c 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #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_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH2 || 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 a67c8ae337e..bf20910ed5f 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -676,7 +676,7 @@ float3 AcesTonemap(float3 aces) const float d = 0.4329510f; const float e = 0.238081f; -#if defined(SHADER_API_SWITCH) +#if defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) // To reduce the likelyhood of extremely large values, we avoid using the x^2 term and therefore // divide numerator and denominator by it. This will lead to the constant factors of the // quadratic in the numerator and denominator to be divided by x; we add a tiny epsilon to avoid divide by 0. @@ -729,7 +729,7 @@ half3 DecodeRGBM(half4 rgbm) return rgbm.xyz * rgbm.w * kRGBMRange; } -#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 f42b1699501..85ba800115c 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -118,6 +118,9 @@ // The including shader should define whether half // precision is suitable for its needs. The shader // API (for now) can indicate whether half is possible. +// +// We do not define this on Switch2 currently, this would cause function DV_SmithJointGGX (that refers to value REAL_MIN) +// to return incorrect values, which then would cause specular highlights to look extremely bright and incorrect. #if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #define HAS_HALF 1 #else @@ -228,6 +231,8 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Vulkan.hlsl" #elif defined(SHADER_API_SWITCH) #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch.hlsl" +#elif defined(SHADER_API_SWITCH2) +#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/Switch2.hlsl" #elif defined(SHADER_API_GLCORE) #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/GLCore.hlsl" #elif defined(SHADER_API_GLES3) @@ -995,7 +1000,7 @@ float ComputeTextureLOD(float3 duvw_dx, float3 duvw_dy, float3 duvw_dz, float sc #define MIP_COUNT_SUPPORTED 1 #endif // TODO: Bug workaround, switch defines GLCORE when it shouldn't -#if ((defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_VULKAN)) && !defined(SHADER_STAGE_COMPUTE) +#if ((defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2)) || defined(SHADER_API_VULKAN)) && !defined(SHADER_STAGE_COMPUTE) // OpenGL only supports textureSize for width, height, depth // textureQueryLevels (GL_ARB_texture_query_levels) needs OpenGL 4.3 or above and doesn't compile in compute shaders // tex.GetDimensions converted to textureQueryLevels @@ -1025,7 +1030,7 @@ uint GetMipCount(TEXTURE2D_PARAM(tex, smp)) #define DXC_SAMPLER_COMPATIBILITY 1 // On DXC platforms which don't care about explicit sampler precison we want the emulated types to work directly e.g without needing to redefine 'sampler2D' to 'sampler2D_f' -#if !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !defined(SHADER_API_METAL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_WEBGPU) +#if !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !defined(SHADER_API_METAL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2) && !defined(SHADER_API_WEBGPU) #define sampler1D_f sampler1D #define sampler2D_f sampler2D #define sampler3D_f sampler3D @@ -1662,7 +1667,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_FLT(ClampToFloat16Max, value, return min(value, HALF_MAX)) -#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 8344c4fc420..ccb2ab7e75d 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -552,7 +552,7 @@ bool IsMatchingLightLayer(uint lightLayers, uint renderingLayers) return (lightLayers & renderingLayers) != 0; } -#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 71ea6299b45..1ecccb074c7 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #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_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 01b3fe6bd06..dba194b2737 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2|| defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -307,7 +307,7 @@ real3 SampleDirectionalLightmap(TEXTURE2D_LIGHTMAP_PARAM(lightmapTex, lightmapSa return SampleDirectionalLightmap(TEXTURE2D_LIGHTMAP_ARGS(lightmapTex, lightmapSampler), TEXTURE2D_LIGHTMAP_ARGS(lightmapDirTex, lightmapDirSampler), LIGHTMAP_EXTRA_ARGS_USE, transform, normalWS, isStaticLightmap); } -#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 8cdf6028a5b..ff95352b518 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -399,7 +399,7 @@ uint GetIBLRuntimeFilterSampleCount(uint mipLevel) { case 1: sampleCount = 21; break; case 2: sampleCount = 34; break; -#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) +#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) || defined(SHADER_API_SWITCH2) case 3: sampleCount = 34; break; case 4: sampleCount = 34; break; case 5: sampleCount = 34; break; @@ -696,7 +696,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_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 1815093115a..0f9c96c91a9 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #pragma warning (disable : 3205) // conversion of larger type to smaller #endif @@ -621,7 +621,7 @@ float3 UnpackFromR7G7B6(uint rgb) } -#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 64c792125e3..69bb653deec 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #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_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 f74372049ea..06d99ed5abf 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #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_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 ba16bd5acd0..3e840e61562 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #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_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #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 38e138a6200..86b259e577b 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_GLES3 || SHADER_API_SWITCH || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 || defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) #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_GLES3 || SHADER_API_SWITCH +#if SHADER_API_MOBILE || SHADER_API_GLES3 || SHADER_API_SWITCH || SHADER_API_SWITCH2 #pragma warning (enable : 3205) // conversion of larger type to smaller #endif diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl index 05b865f2bb7..9d9e407c995 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl @@ -5,7 +5,7 @@ #define UNITY_SUPPORT_INSTANCING #endif -#if defined(SHADER_API_SWITCH) +#if defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) #define UNITY_SUPPORT_INSTANCING #endif @@ -14,7 +14,7 @@ #endif // These platforms support dynamically adjusting the instancing CB size according to the current batch. -#if defined(SHADER_API_D3D11) || defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3) || defined(SHADER_API_METAL) || defined(SHADER_API_PSSL) || defined(SHADER_API_VULKAN) || defined(SHADER_API_SWITCH) || defined(SHADER_API_WEBGPU) +#if defined(SHADER_API_D3D11) || defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3) || defined(SHADER_API_METAL) || defined(SHADER_API_PSSL) || defined(SHADER_API_VULKAN) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) || defined(SHADER_API_WEBGPU) #define UNITY_INSTANCING_SUPPORT_FLEXIBLE_ARRAY_SIZE #endif @@ -38,7 +38,7 @@ #define UNITY_DOTS_INSTANCING_ENABLED // On GL & GLES, use UBO path, on every other platform use SSBO path (including Switch, even if it defines SHADER_API_GLCORE) - #if (defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3)) && (!defined(SHADER_API_SWITCH)) + #if (defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3)) && (!defined(SHADER_API_SWITCH)) && (!defined(SHADER_API_SWITCH2)) #define UNITY_DOTS_INSTANCING_UNIFORM_BUFFER #endif @@ -262,7 +262,7 @@ #elif defined(UNITY_MAX_INSTANCE_COUNT) #define UNITY_INSTANCED_ARRAY_SIZE UNITY_MAX_INSTANCE_COUNT #else - #if (defined(SHADER_API_VULKAN) && defined(SHADER_API_MOBILE)) || defined(SHADER_API_SWITCH) || defined(SHADER_API_WEBGPU) + #if (defined(SHADER_API_VULKAN) && defined(SHADER_API_MOBILE)) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) || defined(SHADER_API_WEBGPU) #define UNITY_INSTANCED_ARRAY_SIZE 250 #else #define UNITY_INSTANCED_ARRAY_SIZE 500 diff --git a/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs b/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs index e40a401b225..cdf7c17c2ca 100644 --- a/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs +++ b/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs @@ -352,7 +352,7 @@ public void VerifyMergeStateAfterMergingPasses() } [Test] - public void NonFragmentUseBreaksPass() + public void NonFragmentSamplingBreaksPass() { var g = AllocateRenderGraph(); var buffers = ImportAndCreateBuffers(g); @@ -379,6 +379,64 @@ public void NonFragmentUseBreaksPass() Assert.AreEqual(Rendering.RenderGraphModule.NativeRenderPassCompiler.PassBreakReason.NextPassReadsTexture, passes[0].breakAudit.reason); } + [Test] + public void FragmentAfterSamplingWithInputAttachmentBreaksPass() + { + var g = AllocateRenderGraph(); + var buffers = ImportAndCreateBuffers(g); + + using (var builder = g.AddRasterRenderPass("TestPass0", out var passData)) + { + builder.SetRenderAttachmentDepth(buffers.depthBuffer, AccessFlags.Write); + builder.UseTexture(buffers.extraBuffers[0], AccessFlags.Read); + builder.SetRenderAttachment(buffers.extraBuffers[1], 0, AccessFlags.Write); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + + using (var builder = g.AddRasterRenderPass("TestPass1", out var passData)) + { + builder.SetRenderAttachmentDepth(buffers.depthBuffer, AccessFlags.Write); + builder.SetInputAttachment(buffers.extraBuffers[1], 1, AccessFlags.Read); + builder.SetRenderAttachment(buffers.extraBuffers[0], 2, AccessFlags.Write); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + + var result = g.CompileNativeRenderGraph(g.ComputeGraphHash()); + var passes = result.contextData.GetNativePasses(); + + Assert.AreEqual(2, passes.Count); + Assert.AreEqual(Rendering.RenderGraphModule.NativeRenderPassCompiler.PassBreakReason.NextPassTargetsTexture, passes[0].breakAudit.reason); + } + + [Test] + public void FragmentAfterSamplingBreaksPass() + { + var g = AllocateRenderGraph(); + var buffers = ImportAndCreateBuffers(g); + + using (var builder = g.AddRasterRenderPass("TestPass0", out var passData)) + { + builder.SetRenderAttachmentDepth(buffers.depthBuffer, AccessFlags.Write); + builder.UseTexture(buffers.extraBuffers[0], AccessFlags.Read); + builder.SetRenderAttachment(buffers.extraBuffers[1], 0, AccessFlags.Write); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + + using (var builder = g.AddRasterRenderPass("TestPass1", out var passData)) + { + builder.SetRenderAttachmentDepth(buffers.depthBuffer, AccessFlags.Write); + builder.SetRenderAttachment(buffers.extraBuffers[2], 1, AccessFlags.Read); + builder.SetRenderAttachment(buffers.extraBuffers[0], 2, AccessFlags.Write); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + + var result = g.CompileNativeRenderGraph(g.ComputeGraphHash()); + var passes = result.contextData.GetNativePasses(); + + Assert.AreEqual(2, passes.Count); + Assert.AreEqual(Rendering.RenderGraphModule.NativeRenderPassCompiler.PassBreakReason.NextPassTargetsTexture, passes[0].breakAudit.reason); + } + [Test] public void NonRasterBreaksPass() { diff --git a/Packages/com.unity.render-pipelines.core/Tests/Runtime/Threading/FunctionTestsWave.compute b/Packages/com.unity.render-pipelines.core/Tests/Runtime/Threading/FunctionTestsWave.compute index 9105fdf348a..f6a1ca315f4 100644 --- a/Packages/com.unity.render-pipelines.core/Tests/Runtime/Threading/FunctionTestsWave.compute +++ b/Packages/com.unity.render-pipelines.core/Tests/Runtime/Threading/FunctionTestsWave.compute @@ -46,7 +46,9 @@ // 1. The BitXor, Product, and PrefixProduct SM6 intrinsics fail to compile on Xbox One because they aren't supported. // We could potentially emulate these if necessary, but they aren't particularly useful. // For now, we just skip the native path tests on Xbox One. -#define ENABLE_SM6_WORKAROUND (defined(SHADER_API_GAMECORE_XBOXONE) || defined(SHADER_API_XBOXONE)) +// +// 2. On some platforms, we probably cannot access SM6 instrinsics when using the HLSLcc pipeline +#define ENABLE_SM6_WORKAROUND (defined(SHADER_API_GAMECORE_XBOXONE) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_SWITCH2)) // Force emulation on whenever a specific wave size is provided #if defined(THREADING_WAVE_SIZE) || ENABLE_SM6_WORKAROUND diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Scene-Color-Read.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Scene-Color-Read.md new file mode 100644 index 00000000000..474594bf641 --- /dev/null +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Scene-Color-Read.md @@ -0,0 +1,58 @@ +# Scene Color Sampling in AfterPostProcess Custom Pass + +## Overview +When using AfterPostProcess injection point with FullScreenShaderGraph that samples scene color, you might need to handle concurrent read/write operations on the color buffer. This page explains the recommended implementation for proper scene color sampling. + +## Technical Details +At the AfterPostProcess injection point, the color buffer serves as both the render target and the source for scene color sampling. To ensure correct sampling, you can implement a solution using a temporary buffer. + +## Implementation Example + +Here's an example of how to properly sample scene color in an AfterPostProcess Custom Pass: + +```c# +class SceneColorSamplingPass : CustomPass +{ + RTHandle m_TempColorBuffer; + + protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) + { + // Create temporary buffer with the same properties as camera color buffer + m_TempColorBuffer = RTHandles.Alloc( + Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, + colorFormat: GetColorBufferFormat(), + name: "SceneColorSamplingBuffer" + ); + } + + protected override void Execute(CustomPassContext ctx) + { + // Copy the scene color to temporary buffer + ctx.cmd.CopyTexture(ctx.cameraColorBuffer, m_TempColorBuffer); + + // Bind temporary buffer for sampling + ctx.cmd.SetGlobalTexture("_AfterPostProcessColorBuffer", m_TempColorBuffer); + + // Your custom pass rendering code here + // ... + } + + protected override void Cleanup() + { + // Release the temporary buffer + RTHandles.Release(m_TempColorBuffer); + } +} +``` +## Performance Considerations + +When implementing this solution, keep in mind: +- This approach allocates an additional full-resolution color buffer +- Only implement this solution when you need to sample the scene color +- Consider using a different injection point if your use case allows it + +## See Also +- [Custom Pass Injection Points](Custom-Pass-Injection-Points.md) +- [Custom Pass Volume Workflow](Custom-Pass-Volume-Workflow.md) +- [Full Screen Custom Pass](custom-pass-create-gameobject.md) + diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-a-custom-sky.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-a-custom-sky.md index a9e26f8ad35..21094a019d0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-a-custom-sky.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-a-custom-sky.md @@ -205,7 +205,7 @@ Shader "Hidden/HDRP/Sky/NewSky" #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-custom-cloud-effects.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-custom-cloud-effects.md index 62181aea561..5932b32d1e9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-custom-cloud-effects.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/create-custom-cloud-effects.md @@ -144,7 +144,7 @@ Shader "Hidden/HDRP/Sky/NewCloud" #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbesPreview.shader b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbesPreview.shader index f289e86dc25..81609a31409 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbesPreview.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbesPreview.shader @@ -23,7 +23,7 @@ Shader "Hidden/Debug/PlanarReflectionProbePreview" #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex vert #pragma fragment frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionProbesPreview.shader b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionProbesPreview.shader index 7f44d1a6fb2..30d2b65d979 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionProbesPreview.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionProbesPreview.shader @@ -22,7 +22,7 @@ Shader "Hidden/Debug/ReflectionProbePreview" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma editor_sync_compilation #pragma vertex vert diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricClouds/WorleyEvaluator.compute b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricClouds/WorleyEvaluator.compute index ccac46616c3..724a6a1c1bd 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricClouds/WorleyEvaluator.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricClouds/WorleyEvaluator.compute @@ -2,7 +2,7 @@ #pragma kernel WorleyNoiseEvaluator #pragma kernel PerlinNoiseEvaluator -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/BRGPicking.shader b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/BRGPicking.shader index fe81f4b78bc..f166edf3b29 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/BRGPicking.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/BRGPicking.shader @@ -5,7 +5,7 @@ Shader "Hidden/HDRP/BRGPicking" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma editor_sync_compilation #pragma multi_compile DOTS_INSTANCING_ON //#pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawDiffusionProfile.shader b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawDiffusionProfile.shader index c6e060daa34..857e8cb7883 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawDiffusionProfile.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawDiffusionProfile.shader @@ -13,7 +13,7 @@ Shader "Hidden/HDRP/DrawDiffusionProfile" HLSLPROGRAM #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawTransmittanceGraph.shader b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawTransmittanceGraph.shader index e1de7a86bcd..d91562b2687 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawTransmittanceGraph.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DrawTransmittanceGraph.shader @@ -13,7 +13,7 @@ Shader "Hidden/HDRP/DrawTransmittanceGraph" HLSLPROGRAM #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubTarget.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubTarget.cs index 02c1f8fbab2..64bb92c72ea 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubTarget.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubTarget.cs @@ -78,7 +78,7 @@ public virtual ScriptableObject GetMetadataObject(GraphDataReadOnly graph) hdMetadata.migrateFromOldCrossPipelineSG = m_MigrateFromOldCrossPipelineSG; hdMetadata.hdSubTargetVersion = systemData.version; hdMetadata.hasVertexModificationInMotionVector = systemData.customVelocity || systemData.tessellation || graph.AnyVertexAnimationActive(); - hdMetadata.isVFXCompatible = graph.IsVFXCompatible(); + hdMetadata.isVFXCompatible = target.SupportsVFX(); return hdMetadata; } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Water/ShaderGraph/WaterSubTarget.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Water/ShaderGraph/WaterSubTarget.cs index fb38cedf2f2..860def892bd 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Water/ShaderGraph/WaterSubTarget.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Water/ShaderGraph/WaterSubTarget.cs @@ -461,8 +461,8 @@ PassCollection GetWaterPasses() GenerateWaterGBufferPass(false, true, systemData.debugSymbols), // Low res gbuffer GenerateWaterGBufferPass(true, false, systemData.debugSymbols), - // Debug pass, always use tessellation to reduce variants - GenerateWaterDebugPass(false, true, systemData.debugSymbols), + // Debug pass, never use tessellation to reduce variants + GenerateWaterDebugPass(false, false, systemData.debugSymbols), GenerateWaterDebugPass(true, false, systemData.debugSymbols), }; return passes; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/PostProcessing/Templates/CustomPostProcessingShader.template b/Packages/com.unity.render-pipelines.high-definition/Editor/PostProcessing/Templates/CustomPostProcessingShader.template index 0a339966683..9d18cfde76d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/PostProcessing/Templates/CustomPostProcessingShader.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/PostProcessing/Templates/CustomPostProcessingShader.template @@ -9,7 +9,7 @@ Shader "Hidden/Shader/#SCRIPTNAME#" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassFullScreenShader.template b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassFullScreenShader.template index a8247cd31bf..66e2f62ba26 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassFullScreenShader.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassFullScreenShader.template @@ -5,7 +5,7 @@ Shader "FullScreen/#SCRIPTNAME#" #pragma vertex Vert #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassRenderersShader.template b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassRenderersShader.template index d06752bddf3..aedd36d7d7b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassRenderersShader.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassRenderersShader.template @@ -13,7 +13,7 @@ Shader "Renderers/#SCRIPTNAME#" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/Shaders/GUITextureBlit2SRGB.shader b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/Shaders/GUITextureBlit2SRGB.shader index c94622ae56a..34ef15d0f37 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/Shaders/GUITextureBlit2SRGB.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/Shaders/GUITextureBlit2SRGB.shader @@ -15,7 +15,7 @@ Shader "Hidden/GUITextureBlit2SRGB" { HLSLPROGRAM #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex vert #pragma fragment frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Common/PassRayTracingDebug.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Common/PassRayTracingDebug.template index 3f5fdf41b19..085d354d84b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Common/PassRayTracingDebug.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Common/PassRayTracingDebug.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassForwardDXRLit.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassForwardDXRLit.template index c47e8156557..4652bdd1ba9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassForwardDXRLit.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassForwardDXRLit.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassGBufferDXRLit.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassGBufferDXRLit.template index 16b84b916b0..20dcaf90370 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassGBufferDXRLit.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassGBufferDXRLit.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ MINIMAL_GBUFFER #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassIndirectDXRLit.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassIndirectDXRLit.template index 85e5c1cd946..3dc601fbf55 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassIndirectDXRLit.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassIndirectDXRLit.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassVisibilityDXRLit.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassVisibilityDXRLit.template index 293490c3c72..98253c1a47b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassVisibilityDXRLit.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Lit/PassVisibilityDXRLit.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ TRANSPARENT_COLOR_SHADOW #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassForwardDXR.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassForwardDXR.template index f93816576b7..5af5dc458d5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassForwardDXR.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassForwardDXR.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassGBufferDXR.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassGBufferDXR.template index 590629e5951..e0b33f8ad91 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassGBufferDXR.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassGBufferDXR.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassIndirectDXR.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassIndirectDXR.template index 0f482e5c6c1..b33be5539f5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassIndirectDXR.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassIndirectDXR.template @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassVisibilityDXR.template b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassVisibilityDXR.template index a33831ebe84..a4d8300fad5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassVisibilityDXR.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/DXR/Unlit/PassVisibilityDXR.template @@ -1,4 +1,4 @@ - + Pass { Name "VisibilityDXR" @@ -6,7 +6,7 @@ HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ TRANSPARENT_COLOR_SHADOW #pragma skip_variants INSTANCING_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs index 94db4490e1e..2f983226e34 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs @@ -402,6 +402,7 @@ bool IsLightmapCorrect() && GetLightmapEncodingQualityForPlatform(BuildTarget.Android) == LightmapEncodingQualityCopy.High && GetLightmapEncodingQualityForPlatform(BuildTarget.iOS) == LightmapEncodingQualityCopy.High && GetLightmapEncodingQualityForPlatform(BuildTarget.Switch) == LightmapEncodingQualityCopy.High + && GetLightmapEncodingQualityForPlatform(BuildTarget.Switch2) == LightmapEncodingQualityCopy.High && GetLightmapEncodingQualityForPlatform(BuildTarget.WSAPlayer) == LightmapEncodingQualityCopy.High; } @@ -414,6 +415,7 @@ void FixLightmap(bool fromAsyncUnused) SetLightmapEncodingQualityForPlatform(BuildTarget.Android, LightmapEncodingQualityCopy.High); SetLightmapEncodingQualityForPlatform(BuildTarget.iOS, LightmapEncodingQualityCopy.High); SetLightmapEncodingQualityForPlatform(BuildTarget.Switch, LightmapEncodingQualityCopy.High); + SetLightmapEncodingQualityForPlatform(BuildTarget.Switch2, LightmapEncodingQualityCopy.High); SetLightmapEncodingQualityForPlatform(BuildTarget.WSAPlayer, LightmapEncodingQualityCopy.High); // After we update the lightmap encoding, we need to notify the C++ lightmapping logic so it can re-encode the lightmaps. @@ -461,7 +463,7 @@ bool IsHdrpAssetQualityUsedCorrect() return true; } - + void FixHdrpAssetQualityUsed(bool fromAsync) => QualitySettings.renderPipeline = null; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader index eeaeff94773..9a4ab1d1337 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader @@ -3,7 +3,7 @@ Shader "Hidden/Shader/AlphaInjection" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader index f6b6204f0d5..29fedabfb03 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader @@ -3,7 +3,7 @@ Shader "Hidden/Shader/ChromaKeying" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader index 0d3388f5776..522fc4b8672 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader @@ -3,7 +3,7 @@ Shader "Hidden/HDRP/CustomClear" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DynamicScaling.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/BlitCubeTextureFace.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/BlitCubeTextureFace.shader index 48f1022e556..aac86d28df5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/BlitCubeTextureFace.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/BlitCubeTextureFace.shader @@ -20,7 +20,7 @@ Shader "Hidden/SRP/BlitCubeTextureFace" #pragma vertex vert #pragma fragment frag #pragma target 3.0 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 TEXTURECUBE(_InputTex); SAMPLER(sampler_InputTex); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearBuffer2D.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearBuffer2D.compute index 2492e2a7ac6..b52cd1f64fe 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearBuffer2D.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearBuffer2D.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel ClearBuffer2DMain #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition-config/Runtime/ShaderConfig.cs.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearUIntTextureArray.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearUIntTextureArray.compute index 71a89bf153d..0d45edaebdf 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearUIntTextureArray.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/ClearUIntTextureArray.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 RW_TEXTURE2D_ARRAY(uint, _TargetArray); RW_TEXTURE2D(uint, _Target); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/CubeToPano.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/CubeToPano.shader index 25a81a3c8ea..642f046f71d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/CubeToPano.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/CubeToPano.shader @@ -20,7 +20,7 @@ CGPROGRAM #pragma target 4.5 #pragma vertex vert #pragma fragment frag -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "UnityCG.cginc" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/EncodeBC6H.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/EncodeBC6H.compute index 13c2e13249d..1d646206340 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/EncodeBC6H.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/EncodeBC6H.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/BC6H.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 TextureCube _Source; RWTexture2DArray _Target; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/GPUCopy.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/GPUCopy.compute index 90bbfb93e8b..1a3e7017d12 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/GPUCopy.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/CoreResources/GPUCopy.compute @@ -1,5 +1,5 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureXR.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ClearDebugBuffer.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ClearDebugBuffer.compute index 7366febb8c9..2731f79dfed 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ClearDebugBuffer.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ClearDebugBuffer.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel clearMain #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition-config/Runtime/ShaderConfig.cs.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugBlitQuad.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugBlitQuad.shader index 8c5fcb5e6e6..ac5678282be 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugBlitQuad.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugBlitQuad.shader @@ -3,7 +3,7 @@ Shader "Hidden/HDRP/DebugBlitQuad" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugColorPicker.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugColorPicker.shader index 88db0a6d960..f9a17787c4d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugColorPicker.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugColorPicker.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/DebugColorPicker" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 07f2a024f5a..407f7ab06ed 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -482,7 +482,7 @@ internal DebugDisplaySettings() FillMipmapDebugMaterialTextureSlotArrays(ref s_RenderingMipmapDebugMaterialTextureSlotStrings, ref s_RenderingMipmapDebugMaterialTextureSlotValues); var device = SystemInfo.graphicsDeviceType; - if (device == GraphicsDeviceType.Metal || device == GraphicsDeviceType.PlayStation4 || device == GraphicsDeviceType.PlayStation5 || device == GraphicsDeviceType.PlayStation5NGGC) + if (device == GraphicsDeviceType.Metal || device == GraphicsDeviceType.PlayStation4 || device == GraphicsDeviceType.PlayStation5 || device == GraphicsDeviceType.PlayStation5NGGC || device == GraphicsDeviceType.Switch2) { s_RenderingFullScreenDebugStrings = s_RenderingFullScreenDebugStrings.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.VertexDensity).ToArray(); s_RenderingFullScreenDebugValues = s_RenderingFullScreenDebugValues.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.VertexDensity).ToArray(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplayLatlong.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplayLatlong.shader index 78254e82fc1..50b2b611da5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplayLatlong.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplayLatlong.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/DebugDisplayLatlong" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader index 11a5953aa71..84d78945fc0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/DebugExposure" #pragma vertex Vert #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define PERCENTILE_AS_BARS 0 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugFullScreen.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugFullScreen.shader index 089f050ff1f..d3c9c525019 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugFullScreen.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugFullScreen.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/DebugFullScreen" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugHDR.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugHDR.shader index d78b4841f83..879a4a736ef 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugHDR.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugHDR.shader @@ -16,7 +16,7 @@ Shader "Hidden/HDRP/DebugHDR" #pragma vertex Vert #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 TEXTURE2D_X(_DebugFullScreenTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.compute index 089b11127de..4c3b5915120 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.compute @@ -1,7 +1,7 @@ #pragma kernel LightVolumeGradient #pragma kernel LightVolumeColors -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.shader index 78d0c87a5d2..b905f2be3db 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.shader @@ -19,7 +19,7 @@ Shader "Hidden/HDRP/DebugLightVolumes" HLSLPROGRAM #pragma vertex vert #pragma fragment frag - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" @@ -69,7 +69,7 @@ Shader "Hidden/HDRP/DebugLightVolumes" HLSLPROGRAM #pragma vertex vert #pragma fragment frag - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVTBlit.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVTBlit.shader index 0027ac94498..195b20a539e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVTBlit.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVTBlit.shader @@ -64,7 +64,7 @@ Shader "Hidden/DebugVTBlit" HLSLPROGRAM #pragma vertex vert #pragma fragment frag - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 ENDHLSL } @@ -73,7 +73,7 @@ Shader "Hidden/DebugVTBlit" HLSLPROGRAM #pragma vertex vert #pragma fragment fragMSAA - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 ENDHLSL } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.compute index 1d89411ea79..1805b5b79df 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.compute @@ -1,7 +1,7 @@ #pragma warning(disable : 3568) // Warning: Unknown pragma #pragma kernel KVectorscopeGather #pragma kernel KVectorscopeClear -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.shader index 1f20d937a9f..8d14ed370bb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVectorscope.shader @@ -4,7 +4,7 @@ Shader "Hidden/PostProcessing/Debug/Vectorscope" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 4.5 StructuredBuffer _VectorscopeBuffer; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewMaterialGBuffer.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewMaterialGBuffer.shader index d7573e04e64..fcdfc6cc4f5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewMaterialGBuffer.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewMaterialGBuffer.shader @@ -10,7 +10,7 @@ Shader "Hidden/HDRP/DebugViewMaterialGBuffer" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewTiles.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewTiles.shader index 48dbb56659c..b35b92900d9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewTiles.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugViewTiles.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/DebugViewTiles" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.compute index b7f43de7897..fdd64a847c7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.compute @@ -1,7 +1,7 @@ #pragma warning(disable : 3568) // Warning: Unknown pragma #pragma kernel KWaveformGather #pragma kernel KWaveformClear -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.shader index e7cb11d4c56..9a91556f4c0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugWaveform.shader @@ -3,7 +3,7 @@ Shader "Hidden/PostProcessing/Debug/Waveform" HLSLINCLUDE #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 4.5 StructuredBuffer _WaveformBuffer; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/GPUInlineDebugDrawer.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/GPUInlineDebugDrawer.shader index 135501b2f85..6075b321dfe 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/GPUInlineDebugDrawer.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/GPUInlineDebugDrawer.shader @@ -17,7 +17,7 @@ Shader "Hidden/HDRP/GPUInlineDebugDrawer" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -46,7 +46,7 @@ Shader "Hidden/HDRP/GPUInlineDebugDrawer" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -74,7 +74,7 @@ Shader "Hidden/HDRP/GPUInlineDebugDrawer" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vertPlotRingBuffer diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialError.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialError.shader index 42ca1374ed4..2b9a1b464be 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialError.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialError.shader @@ -8,7 +8,7 @@ Shader "Hidden/HDRP/MaterialError" { HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex vert #pragma fragment frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialLoading.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialLoading.shader index 187ccd4bd36..9d85e0709ff 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialLoading.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/MaterialLoading.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/MaterialLoading" #pragma target 4.5 #pragma multi_compile _ STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON #pragma multi_compile _ DOTS_INSTANCING_ON - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma editor_sync_compilation #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ProbeVolumeSamplingDebugPositionNormal.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ProbeVolumeSamplingDebugPositionNormal.compute index acd2a9a6823..117bf1aa9d6 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ProbeVolumeSamplingDebugPositionNormal.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/ProbeVolumeSamplingDebugPositionNormal.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinGIUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Compute worldspace position and normal at given screenspace position and write it in the ResultBuffer #pragma kernel ComputePositionNormal diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/OpaqueAtmosphericScattering.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/OpaqueAtmosphericScattering.shader index 48b9c5821ec..b41a909660f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/OpaqueAtmosphericScattering.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/OpaqueAtmosphericScattering.shader @@ -3,7 +3,7 @@ Shader "Hidden/HDRP/OpaqueAtmosphericScattering" HLSLINCLUDE #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma multi_compile_fragment _ DEBUG_DISPLAY diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/ScreenSpaceMultipleScattering.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/ScreenSpaceMultipleScattering.compute index c57d8d304e5..e634797c60c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/ScreenSpaceMultipleScattering.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/ScreenSpaceMultipleScattering.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel ScreenSpaceMultipleScattering diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/ClearLightLists.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/ClearLightLists.compute index e897a278473..2f76292140f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/ClearLightLists.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/ClearLightLists.compute @@ -1,5 +1,5 @@ #pragma kernel ClearList -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 RWStructuredBuffer _LightListToClear; int2 _LightListEntriesAndOffset; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/Deferred.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/Deferred.compute index 6e9de4b2563..86f9ea46d3c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/Deferred.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/Deferred.compute @@ -92,7 +92,7 @@ CBUFFER_END #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStencilUsage.cs.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //------------------------------------------------------------------------------------- // variable declaration diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadowLoop.hlsl b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadowLoop.hlsl index 4b7e5312445..74017540e24 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadowLoop.hlsl +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadowLoop.hlsl @@ -229,6 +229,7 @@ void ShadowLoopMin(HDShadowContext shadowContext, PositionInputs posInput, float } else #endif + if ( lightData.shadowIndex >= 0 ) { float3 L; float4 distances; // {d, d^2, 1/d, d_proj} 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 d820562ae64..76b3f212261 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 @@ -300,7 +300,7 @@ public partial class HDRenderPipeline internal const int k_MaxLightsPerClusterCell = ShaderConfig.LightClusterMaxCellElementCount; internal static readonly Vector3 k_BoxCullingExtentThreshold = Vector3.one * 0.01f; -#if !UNITY_EDITOR && UNITY_SWITCH +#if !UNITY_EDITOR && (UNITY_SWITCH || UNITY_SWITCH2) const int k_ThreadGroupOptimalSize = 32; #else const int k_ThreadGroupOptimalSize = 64; @@ -394,6 +394,7 @@ class TileAndClusterData public GraphicsBuffer convexBoundsBuffer { get; private set; } public bool listsAreClear = false; + public bool listsAreInitialized = false; public bool clusterNeedsDepth { get; private set; } public bool hasTileBuffers { get; private set; } @@ -558,7 +559,7 @@ enum ClusterDepthSource : int const bool k_UseDepthBuffer = true; // only has an impact when EnableClustered is true (requires a depth-prepass) -#if !UNITY_EDITOR && UNITY_SWITCH +#if !UNITY_EDITOR && (UNITY_SWITCH || UNITY_SWITCH2) const int k_Log2NumClusters = 5; // accepted range is from 0 to 5 (NR_THREADS is set to 32). NumClusters is 1< g_DispatchIndirectBuffer : register( u0 ); // Indirect arguments have to be in a _buffer_, not a structured buffer diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-bigtile.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-bigtile.compute index 3b0c7cdb9f8..dc3d9f0a982 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-bigtile.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-bigtile.compute @@ -8,7 +8,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightingConvexHullUtils.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/SortingComputeUtils.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightCullUtils.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ GENERATE_VOLUMETRIC_BIGTILE @@ -159,7 +159,11 @@ void BigTileLightListGen(uint threadID : SV_GroupIndex, uint3 u3GroupID : SV_Gro } } -#if NR_THREADS > PLATFORM_LANE_COUNT || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GAMECORE) || defined(SHADER_API_SWITCH) // not sure why XB1 and Switch need the barrier (it will not be correct without) + // For some platforms we always need GroupMemoryBarrierWithGroupSync() otherwise results are incorrect. + // Reason is under investigation, related discussions: + // https://unity.slack.com/archives/C02C8FWPNHE/p1704321597295329 + // https://unity.slack.com/archives/G3JUQKYV8/p1705081617447289 +#if NR_THREADS > PLATFORM_LANE_COUNT || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GAMECORE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) GroupMemoryBarrierWithGroupSync(); #endif @@ -189,19 +193,17 @@ void BigTileLightListGen(uint threadID : SV_GroupIndex, uint3 u3GroupID : SV_Gro for(i = t; i * 2 < iNrCoarseLights + 1; i += NR_THREADS / 2) { uint id = i * 2; - uint lightIndexOrCount0 = iNrCoarseLights; // Count if (id > 0) // cannot use ternary operator here (it would evaluate both sides and fetch invalid indices, causing crash on some GPUs) { lightIndexOrCount0 = lightsListLDS[id - 1]; // Index0 } - + uint lightIndex1 = 0; // Index1 if (id < iNrCoarseLights) // cannot use ternary operator here (it would evaluate both sides and fetch invalid indices, causing crash on some GPUs) { lightIndex1 = lightsListLDS[id]; } - // Pack 2 light indices into a single bigtile value g_vLightList[MAX_NR_BIG_TILE_LIGHTS_PLUS_ONE * offs / 2 + i] = (lightIndexOrCount0 & 0xFFFF) | (lightIndex1 << 16); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clearatomic.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clearatomic.compute index 7b52e1acea1..4894091b422 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clearatomic.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clearatomic.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 RWStructuredBuffer g_LayeredSingleIdxBuffer : register(u2); // don't support RWBuffer yet in unity diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute index aca9d4f1cbf..c40fb059194 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute @@ -23,11 +23,11 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightingConvexHullUtils.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightCullUtils.hlsl" -#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_GAMECORE) +#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_GAMECORE) && !defined(SHADER_API_SWITCH2) #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/SortingComputeUtils.hlsl" #endif -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#define EXACT_EDGE_TESTS #define PERFORM_SPHERICAL_INTERSECTION_TESTS diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute index c11ba80ebd1..95c728c7593 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute @@ -18,11 +18,11 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightingConvexHullUtils.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightCullUtils.hlsl" -#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_GAMECORE) +#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_GAMECORE) && !defined(SHADER_API_SWITCH2) #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/SortingComputeUtils.hlsl" #endif -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define FINE_PRUNING_ENABLED #define PERFORM_SPHERICAL_INTERSECTION_TESTS @@ -204,7 +204,11 @@ void TileLightListGen(uint3 dispatchThreadId : SV_DispatchThreadID, uint threadI InterlockedMax(ldsZMax, asuint(dpt_ma)); InterlockedMin(ldsZMin, asuint(dpt_mi)); -#if NR_THREADS > PLATFORM_LANE_COUNT || defined(SHADER_API_SWITCH) // not sure why Switch needs the barrier (it will not be correct without) + // For some platforms we always need GroupMemoryBarrierWithGroupSync() otherwise results are incorrect. + // Reason is under investigation, related discussions: + // https://unity.slack.com/archives/C02C8FWPNHE/p1704321597295329 + // https://unity.slack.com/archives/G3JUQKYV8/p1705081617447289 +#if NR_THREADS > PLATFORM_LANE_COUNT || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) GroupMemoryBarrierWithGroupSync(); #endif } @@ -260,6 +264,7 @@ void TileLightListGen(uint3 dispatchThreadId : SV_DispatchThreadID, uint threadI #ifndef FINE_PRUNING_ENABLED { + UNITY_UNROLL for(i=t; i PLATFORM_LANE_COUNT || defined(SHADER_API_SWITCH) // not sure why Switch needs the barrier (it will not be correct without) + // For some platforms we always need GroupMemoryBarrierWithGroupSync() otherwise results are incorrect. + // Reason is under investigation, related discussions: + // https://unity.slack.com/archives/C02C8FWPNHE/p1704321597295329 + // https://unity.slack.com/archives/G3JUQKYV8/p1705081617447289 +#if NR_THREADS > PLATFORM_LANE_COUNT || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) GroupMemoryBarrierWithGroupSync(); #endif diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/materialflags.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/materialflags.compute index 32b644060d9..6b5e42cea22 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/materialflags.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/materialflags.compute @@ -14,7 +14,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define USE_MATERIAL_FEATURE_FLAGS diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/scrbound.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/scrbound.compute index 708826c9ceb..cd15f9858bd 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/scrbound.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/scrbound.compute @@ -1,5 +1,5 @@ // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel main diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute index 64d4e37a547..9fa9877be8e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute @@ -2,7 +2,7 @@ #pragma kernel DownScale #pragma kernel DepthConversion -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols // The process is done in 3 steps. We start by converting the depth from oblique to regular frustum depth. diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/BilateralUpsample.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/BilateralUpsample.compute index f869782e3a9..56928b2272a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/BilateralUpsample.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/BilateralUpsample.compute @@ -3,7 +3,7 @@ //#pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define BILATERAL_UPSAMPLE_TILE_SIZE 8 @@ -139,7 +139,7 @@ void BilateralUpSampleColor(uint3 currentCoord : SV_DispatchThreadID) float closestDepth = max(depthNeighborhood.x, max(depthNeighborhood.y, max(depthNeighborhood.z, depthNeighborhood.w))); float2 uvAtLowRes = min((currentCoord.xy) * _RayMarchingLowResPercentage + 0.5, _HalfScreenSize.xy - 1) * _ScreenSize.zw; - float2 sampleUV = ClampAndScaleUVForBilinear(uvAtLowRes); + float2 sampleUV = ClampAndScaleUVForBilinear(uvAtLowRes); float2 samplePixel = sampleUV * _ScreenSize.xy; float2 bottomRight = frac(samplePixel + 0.5); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAO.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAO.compute index 0f85c896e8a..4b5cddca7c8 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAO.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAO.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma kernel GTAOMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOBlurAndUpsample.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOBlurAndUpsample.compute index f4371200c85..6410a3a2803 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOBlurAndUpsample.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOBlurAndUpsample.compute @@ -21,7 +21,7 @@ #pragma kernel Blur BLUR_KERNEL_NAME=Blur BLUR #pragma kernel Blur_FullRes BLUR_KERNEL_NAME=Blur_FullRes BLUR FULL_RES -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 TEXTURE2D_X(_AOPackedData); RW_TEXTURE2D_X(float, _OcclusionTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute index 0fc542a21c2..758b60dc135 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute @@ -1,6 +1,6 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel GTAODenoise_CopyHistory diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOSpatialDenoise.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOSpatialDenoise.compute index 7d0914373a6..721ade2a869 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOSpatialDenoise.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOSpatialDenoise.compute @@ -3,7 +3,7 @@ // TODO: This pass really could really use some quality improvement. -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel SpatialDenoise diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOTemporalDenoise.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOTemporalDenoise.compute index f909b9725c1..9a2f82bae19 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOTemporalDenoise.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOTemporalDenoise.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel TemporalDenoise #pragma multi_compile HALF_RES FULL_RES diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute index 112073015d6..8ccedb53198 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute @@ -21,7 +21,7 @@ // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel TraceGlobalIllumination TRACE_GLOBAL_ILLUMINATION=TraceGlobalIllumination GI_TRACE #pragma kernel TraceGlobalIlluminationHalf TRACE_GLOBAL_ILLUMINATION=TraceGlobalIlluminationHalf GI_TRACE HALF_RES diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute index fa55b512155..df4b697466d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute @@ -3,7 +3,7 @@ //-------------------------------------------------------------------------------------------------- // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel ScreenSpaceReflectionsTracing SSR_TRACE #pragma kernel ScreenSpaceReflectionsReprojection SSR_REPROJECT diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute index 57cb489b39f..87722e13043 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute @@ -10,7 +10,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #ifdef SHADER_API_PSSL #include SHADER_COMPILER_GLOBAL_OPTIMIZE_REGISTER_USAGE diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/DebugDisplayHDShadowMap.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/DebugDisplayHDShadowMap.shader index fbdef7797e9..875b39e5bf7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/DebugDisplayHDShadowMap.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/DebugDisplayHDShadowMap.shader @@ -2,7 +2,7 @@ Shader "Hidden/ScriptableRenderPipeline/DebugDisplayHDShadowMap" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/EVSMBlur.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/EVSMBlur.compute index c5fb2ef6aa6..5ec4d3ef12c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/EVSMBlur.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/EVSMBlur.compute @@ -10,7 +10,7 @@ #pragma kernel CopyMoments -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 Texture2D _DepthTexture; RW_TEXTURE2D(float2, _InputTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs index 0034a8ba3e4..9188e49f521 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs @@ -367,7 +367,7 @@ internal static HDShadowAtlasInitParams GetDefault() return new HDShadowAtlasInitParams() { shadowAtlasResolution = k_DefaultShadowAtlasResolution, - shadowAtlasDepthBits = k_DefaultShadowMapDepthBits, + shadowAtlasDepthBits = CoreUtils.GetDefaultDepthBufferBits(), useDynamicViewportRescale = true }; } @@ -376,7 +376,7 @@ internal static HDShadowAtlasInitParams GetDefault() internal static HDShadowInitParameters NewDefault() => new HDShadowInitParameters() { maxShadowRequests = k_DefaultMaxShadowRequests, - directionalShadowsDepthBits = k_DefaultShadowMapDepthBits, + directionalShadowsDepthBits = CoreUtils.GetDefaultDepthBufferBits(), punctualLightShadowAtlas = HDShadowAtlasInitParams.GetDefault(), areaLightShadowAtlas = HDShadowAtlasInitParams.GetDefault(), cachedPunctualLightShadowAtlas = 2048, @@ -398,7 +398,6 @@ internal static HDShadowAtlasInitParams GetDefault() internal const int k_DefaultShadowAtlasResolution = 4096; internal const int k_DefaultMaxShadowRequests = 128; - internal const DepthBits k_DefaultShadowMapDepthBits = DepthBits.Depth32; /// Maximum number of shadow requests at the same time. public int maxShadowRequests; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/MomentShadows.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/MomentShadows.compute index 1a4339bd28a..38839a802e9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/MomentShadows.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/MomentShadows.compute @@ -11,7 +11,7 @@ //#pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader index 3b9d8598bda..2864ea0e19c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader @@ -3,7 +3,7 @@ Shader "Hidden/HDRP/ScreenSpaceShadows" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment PUNCTUAL_SHADOW_LOW PUNCTUAL_SHADOW_MEDIUM PUNCTUAL_SHADOW_HIGH #pragma multi_compile_fragment DIRECTIONAL_SHADOW_LOW DIRECTIONAL_SHADOW_MEDIUM DIRECTIONAL_SHADOW_HIGH diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowBlit.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowBlit.shader index 109fa303b7a..1491360b3be 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowBlit.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowBlit.shader @@ -2,7 +2,7 @@ Shader "Hidden/ScriptableRenderPipeline/ShadowBlit" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DynamicScaling.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowClear.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowClear.shader index 4bde629c733..18a1be96dac 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowClear.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ShadowClear.shader @@ -2,7 +2,7 @@ Shader "Hidden/ScriptableRenderPipeline/ShadowClear" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" ENDHLSL diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute index 5fb00d2a89f..80b8c9e3e49 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Trace to intermediate #pragma kernel ReprojectClouds REPROJECT_CLOUDS=ReprojectClouds diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsCombine.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsCombine.shader index 0fcdc0ec9ff..32954c82e6b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsCombine.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsCombine.shader @@ -6,7 +6,7 @@ Shader "Hidden/HDRP/VolumetricCloudsCombine" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma vertex Vert diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsShadowFilter.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsShadowFilter.compute index 2ecfd009339..ace80ef864c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsShadowFilter.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsShadowFilter.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel FilterVolumetricCloudsShadow diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTrace.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTrace.compute index f82c83cf341..9f748c72bf1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTrace.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTrace.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Render clouds #pragma kernel RenderClouds diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTraceShadows.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTraceShadows.compute index 009135f2e3b..785115fdf20 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTraceShadows.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricCloudsTraceShadows.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Shadows #pragma kernel TraceVolumetricCloudsShadows diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DebugLocalVolumetricFogAtlas.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DebugLocalVolumetricFogAtlas.shader index 653dcf364c2..e8785dad79c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DebugLocalVolumetricFogAtlas.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DebugLocalVolumetricFogAtlas.shader @@ -6,7 +6,7 @@ Shader "Hidden/HDRP/DebugLocalVolumetricFogAtlas" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute index aa8a5aa0169..1dd388140c1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute @@ -3,7 +3,7 @@ //-------------------------------------------------------------------------------------------------- // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel VolumeVoxelization diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.compute index 39c7edc9b89..52275248e84 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.compute @@ -3,7 +3,7 @@ //-------------------------------------------------------------------------------------------------- // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel VolumetricLighting diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLightingFiltering.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLightingFiltering.compute index 9d805deabab..468e2e781a3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLightingFiltering.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLightingFiltering.compute @@ -3,7 +3,7 @@ //-------------------------------------------------------------------------------------------------- // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel FilterVolumetricLighting diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.shader index ca5e56cbe30..fc9a63d55ca 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.shader @@ -244,7 +244,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Note: Require _SelectionID variable @@ -275,7 +275,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing @@ -314,7 +314,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -359,7 +359,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -400,7 +400,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -446,7 +446,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -502,7 +502,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -577,7 +577,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // enable dithering LOD crossfade #pragma multi_compile _ LOD_FADE_CROSSFADE @@ -606,7 +606,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -638,7 +638,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -687,7 +687,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -733,7 +733,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -773,7 +773,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY @@ -802,7 +802,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_DEBUG @@ -826,7 +826,7 @@ Shader "HDRP/AxF" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_CookTorrance.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_CookTorrance.shader index 2f7eb877508..7fdcc682eb9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_CookTorrance.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_CookTorrance.shader @@ -14,7 +14,7 @@ Shader "Hidden/HDRP/PreIntegratedFGD_CookTorrance" #pragma vertex Vert #pragma fragment Frag #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define PREFER_HALF 0 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_Ward.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_Ward.shader index ccca50fccef..b33efdd458a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_Ward.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/PreIntegratedFGD_Ward.shader @@ -14,7 +14,7 @@ Shader "Hidden/HDRP/PreIntegratedFGD_Ward" #pragma vertex Vert #pragma fragment Frag #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define PREFER_HALF 0 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/Decal.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/Decal.shader index 9b82c7f04dc..1987b545629 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/Decal.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/Decal.shader @@ -65,7 +65,7 @@ Shader "HDRP/Decal" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols //------------------------------------------------------------------------------------- @@ -282,7 +282,7 @@ Shader "HDRP/Decal" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma instancing_options renderinglayer diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalNormalBuffer.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalNormalBuffer.shader index 90a7db8a473..98d34a539d0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalNormalBuffer.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalNormalBuffer.shader @@ -11,7 +11,7 @@ Shader "Hidden/HDRP/Material/Decal/DecalNormalBuffer" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs index 60665d6eee5..000bb5516d5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs @@ -284,7 +284,7 @@ public Camera CurrentCamera // to work on Vulkan Mobile? // Core\CoreRP\ShaderLibrary\UnityInstancing.hlsl - // #if (defined(SHADER_API_VULKAN) && defined(SHADER_API_MOBILE)) || defined(SHADER_API_SWITCH) + // #if (defined(SHADER_API_VULKAN) && defined(SHADER_API_MOBILE)) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) // #define UNITY_INSTANCED_ARRAY_SIZE 250 private const int kDrawIndexedBatchSize = 250; @@ -318,10 +318,10 @@ public enum DecalCullingMode static public Vector4[] m_BaseColor = new Vector4[kDecalBlockSize]; // Clustered decal world space info -- useful when m_CullingMode is set to WorldspaceBasedCulling - // This data is cached and can be queried for algorithms doing their own clustering (e.g. path tracing). + // This data is cached and can be queried for algorithms doing their own clustering (e.g. path tracing). static public Vector3[] m_DecalDatasWSPositions = new Vector3[kDecalBlockSize]; static public Vector3[] m_DecalDatasWSRanges = new Vector3[kDecalBlockSize]; - + static public int m_DecalDatasCount = 0; static public float[] m_BoundingDistances = new float[1]; @@ -638,7 +638,7 @@ public void InitializeMaterialValues() float normalBlendSrc = 0.0f; float maskBlendSrc = 1.0f; m_BlendParams = new Vector3(normalBlendSrc, maskBlendSrc, (float)affectFlags); - + m_SampleNormalAlpha = 1.0f; // Metallic, AO and Smoothness remapping can be done directly in the shader graph // By hard coding those values we do an additional lerp within EvalDecalMask which could be avoided @@ -648,7 +648,7 @@ public void InitializeMaterialValues() m_ScalingBlueMaskMap = 1.0f; m_RemappingMetallic = new Vector2(remapMin, remapMax); m_RemappingAOS = new Vector4(remapMin, remapMax, remapMin, remapMax); - + // With ShaderGraph it is possible that the pass isn't generated. But if it is, it can be disabled. m_cachedProjectorPassValue = m_Material.FindPass(s_MaterialDecalPassNames[(int)MaterialDecalPass.DBufferProjector]); if (m_cachedProjectorPassValue != -1 && m_Material.GetShaderPassEnabled(s_MaterialDecalPassNames[(int)MaterialDecalPass.DBufferProjector]) == false) @@ -938,7 +938,7 @@ public void CreateDrawData(IntScalableSetting transparentTextureResolution) var camera = instance.CurrentCamera; Matrix4x4 worldToView = HDRenderPipeline.WorldToCamera(camera); - /* Prepare data for the DBuffer drawing */ + /* Prepare data for the DBuffer drawing */ if ((DecalSystem.m_CullingMode & DecalCullingMode.ViewspaceBasedCulling) != 0) { int cullingMask = camera.cullingMask; @@ -960,7 +960,7 @@ public void CreateDrawData(IntScalableSetting transparentTextureResolution) int decalMask = 1 << m_CachedLayerMask[decalIndex]; ulong decalSceneCullingMask = m_CachedSceneLayerMask[decalIndex]; bool sceneViewCullingMaskTest = true; -#if UNITY_EDITOR +#if UNITY_EDITOR // In the player, both masks will be zero. Besides we don't want to pay the cost in this case. sceneViewCullingMaskTest = (sceneCullingMask & decalSceneCullingMask) != 0; #endif @@ -1609,7 +1609,7 @@ public void UpdateTextureAtlas(CommandBuffer cmd) public void CreateDrawData() { - // Reset number of clustered decals + // Reset number of clustered decals m_DecalDatasCount = 0; // Count the current maximum number of decals to cluster, to allow reallocation if needed int maxDecalsToCluster = m_DecalsVisibleThisFrame; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeCausticLUTGen.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeCausticLUTGen.compute index 0bbda47c8a8..db6459fe330 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeCausticLUTGen.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeCausticLUTGen.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel SampleCaustic #pragma kernel CopyToLUT diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/CharlieConvolve.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/CharlieConvolve.shader index 2abe11988b7..e38d6d340f2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/CharlieConvolve.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/CharlieConvolve.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/CharlieConvolve" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/FallbackError.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/FallbackError.shader index 57481aab0fa..614be368887 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/FallbackError.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/FallbackError.shader @@ -8,7 +8,7 @@ Shader "Hidden/HDRP/FallbackError" { HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex vert #pragma fragment frag diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/BuildProbabilityTables.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/BuildProbabilityTables.compute index 14b989165d3..a328d3710df 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/BuildProbabilityTables.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/BuildProbabilityTables.compute @@ -8,7 +8,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 /* --- Input --- */ diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/ComputeGgxIblSampleData.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/ComputeGgxIblSampleData.compute index c065c16b398..6d08815b90b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/ComputeGgxIblSampleData.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/ComputeGgxIblSampleData.compute @@ -3,9 +3,9 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 -#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) +#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) #define MAX_IBL_SAMPLE_CNT 34 #else #define MAX_IBL_SAMPLE_CNT 89 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/GGXConvolve.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/GGXConvolve.shader index 440a45fd72b..ab1f14b8ffe 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/GGXConvolve.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/GGXConvolution/GGXConvolve.shader @@ -13,7 +13,7 @@ Shader "Hidden/HDRP/GGXConvolve" HLSLPROGRAM #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_local_fragment _ USE_MIS diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/MultipleScattering/HairMultipleScatteringPreIntegration.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/MultipleScattering/HairMultipleScatteringPreIntegration.compute index ffe89bafa46..f30d4c97a44 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/MultipleScattering/HairMultipleScatteringPreIntegration.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/MultipleScattering/HairMultipleScatteringPreIntegration.compute @@ -3,7 +3,7 @@ #pragma kernel ComputeAzimuthalScattering #pragma kernel ComputeLongitudinalScattering -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // This define is required for invoking BSDF. #define HAS_LIGHTLOOP diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LTCAreaLight/FilterAreaLightCookies.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LTCAreaLight/FilterAreaLightCookies.shader index 6dd280039d3..403b7bdaa21 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LTCAreaLight/FilterAreaLightCookies.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LTCAreaLight/FilterAreaLightCookies.shader @@ -2,7 +2,7 @@ Shader "Hidden/CoreResources/FilterAreaLightCookies" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma editor_sync_compilation #pragma vertex Vert diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader index 775c6aeba94..0ebe2556b34 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader @@ -586,7 +586,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -624,7 +624,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -671,7 +671,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -768,7 +768,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -865,7 +865,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -933,7 +933,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -976,7 +976,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -1054,7 +1054,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -1184,7 +1184,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define SHADERPASS SHADERPASS_CONSTANT #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" @@ -1211,7 +1211,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1243,7 +1243,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1297,7 +1297,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1348,7 +1348,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1393,7 +1393,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY @@ -1424,7 +1424,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1464,7 +1464,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma shader_feature_local_raytracing _DISABLE_DECALS @@ -1493,7 +1493,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader index ba8e5a93637..82ee8571774 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader @@ -619,7 +619,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -663,7 +663,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -712,7 +712,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -812,7 +812,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -911,7 +911,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -982,7 +982,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -1027,7 +1027,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -1107,7 +1107,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -1240,7 +1240,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define SHADERPASS SHADERPASS_CONSTANT #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" @@ -1269,7 +1269,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing @@ -1302,7 +1302,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader @@ -1359,7 +1359,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader @@ -1413,7 +1413,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader @@ -1461,7 +1461,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader @@ -1495,7 +1495,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader @@ -1537,7 +1537,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_DEBUG @@ -1566,7 +1566,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader index 34df512d3c9..1c3b9868ff7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader @@ -358,7 +358,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing @@ -398,7 +398,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing @@ -448,7 +448,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -534,7 +534,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -611,7 +611,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -655,7 +655,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -720,7 +720,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -788,7 +788,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -850,7 +850,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -977,7 +977,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1094,7 +1094,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1131,7 +1131,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // enable dithering LOD crossfade #pragma multi_compile _ LOD_FADE_CROSSFADE @@ -1160,7 +1160,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1192,7 +1192,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1254,7 +1254,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1312,7 +1312,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1360,7 +1360,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY @@ -1395,7 +1395,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1435,7 +1435,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma shader_feature_local_raytracing _DISABLE_DECALS @@ -1465,7 +1465,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader index 7b91d86ddbe..4491e26cced 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader @@ -235,7 +235,7 @@ Shader "HDRP/LitTessellation" HLSLINCLUDE #pragma target 5.0 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //------------------------------------------------------------------------------------- // Variant @@ -376,7 +376,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing @@ -418,7 +418,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing @@ -470,7 +470,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -553,7 +553,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -631,7 +631,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -677,7 +677,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -744,7 +744,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -815,7 +815,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -878,7 +878,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1005,7 +1005,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1120,7 +1120,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1158,7 +1158,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // enable dithering LOD crossfade #pragma multi_compile _ LOD_FADE_CROSSFADE @@ -1189,7 +1189,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer @@ -1223,7 +1223,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1282,7 +1282,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1337,7 +1337,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1387,7 +1387,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1424,7 +1424,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1466,7 +1466,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma shader_feature_local_raytracing _DISABLE_DECALS @@ -1496,7 +1496,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #undef TESSELLATION_ON diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD_Marschner.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD_Marschner.shader index 1b9c823b8d2..2b0b30f412f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD_Marschner.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD_Marschner.shader @@ -14,7 +14,7 @@ Shader "Hidden/HDRP/PreIntegratedFGD_Marschner" #pragma vertex Vert #pragma fragment Frag #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define PREFER_HALF 0 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_CharlieFabricLambert.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_CharlieFabricLambert.shader index 7007bac0a86..68f6c9018ed 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_CharlieFabricLambert.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_CharlieFabricLambert.shader @@ -14,7 +14,7 @@ Shader "Hidden/HDRP/preIntegratedFGD_CharlieFabricLambert" #pragma vertex Vert #pragma fragment Frag #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define PREFER_HALF 0 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_GGXDisneyDiffuse.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_GGXDisneyDiffuse.shader index 433970d02f9..db0dda96b1b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_GGXDisneyDiffuse.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/preIntegratedFGD_GGXDisneyDiffuse.shader @@ -14,7 +14,7 @@ Shader "Hidden/HDRP/preIntegratedFGD_GGXDisneyDiffuse" #pragma vertex Vert #pragma fragment Frag #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define PREFER_HALF 0 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/CombineLighting.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/CombineLighting.shader index 795922a763e..a3fe07bc300 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/CombineLighting.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/CombineLighting.shader @@ -10,7 +10,7 @@ Shader "Hidden/HDRP/CombineLighting" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols #pragma vertex Vert diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/RandomDownsample.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/RandomDownsample.compute index 787228ea0e5..2e4ebce9f1c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/RandomDownsample.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/RandomDownsample.compute @@ -3,7 +3,7 @@ //-------------------------------------------------------------------------------------------------- // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel Downsample diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScattering.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScattering.compute index 54c7aaf7439..54479050165 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScattering.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScattering.compute @@ -5,7 +5,7 @@ //-------------------------------------------------------------------------------------------------- // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel SubsurfaceScattering @@ -35,7 +35,7 @@ // Check for support of typed UAV loads from FORMAT_R16G16B16A16_FLOAT. // TODO: query the format support more precisely. -#if !(defined(SHADER_API_PSSL) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GAMECORE)) || defined(ENABLE_MSAA) +#if !(defined(SHADER_API_PSSL) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GAMECORE) || defined(SHADER_API_SWITCH2)) || defined(ENABLE_MSAA) #define USE_INTERMEDIATE_BUFFER #endif diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit.shader index 57566098888..3cbd80a9718 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit.shader @@ -122,7 +122,7 @@ Shader "HDRP/TerrainLit" } HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // All our shaders use same name for entry point #pragma vertex Vert #pragma fragment Frag @@ -159,7 +159,7 @@ Shader "HDRP/TerrainLit" Cull Off HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // All our shaders use same name for entry point #pragma vertex Vert #pragma fragment Frag @@ -194,7 +194,7 @@ Shader "HDRP/TerrainLit" ColorMask 0 HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // All our shaders use same name for entry point #pragma vertex Vert #pragma fragment Frag @@ -229,7 +229,7 @@ Shader "HDRP/TerrainLit" ZWrite On HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // All our shaders use same name for entry point #pragma vertex Vert #pragma fragment Frag @@ -277,7 +277,7 @@ Shader "HDRP/TerrainLit" Cull [_CullMode] HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // All our shaders use same name for entry point #pragma vertex Vert #pragma fragment Frag @@ -319,7 +319,7 @@ Shader "HDRP/TerrainLit" Cull Off HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // All our shaders use same name for entry point #pragma vertex Vert #pragma fragment Frag @@ -364,7 +364,7 @@ Shader "HDRP/TerrainLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -398,7 +398,7 @@ Shader "HDRP/TerrainLit" Tags{ "LightMode" = "ForwardDXR" } HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -433,7 +433,7 @@ Shader "HDRP/TerrainLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -465,7 +465,7 @@ Shader "HDRP/TerrainLit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" @@ -486,7 +486,7 @@ Shader "HDRP/TerrainLit" Tags{ "LightMode" = "DebugDXR" } HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" @@ -512,7 +512,7 @@ Shader "HDRP/TerrainLit" Tags{ "LightMode" = "PathTracingDXR" } HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_Basemap.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_Basemap.shader index 221da9f4378..f82c361f746 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_Basemap.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_Basemap.shader @@ -42,7 +42,7 @@ Shader "Hidden/HDRP/TerrainLit_Basemap" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma shader_feature_local _DISABLE_DECALS #pragma shader_feature_local _TERRAIN_INSTANCED_PERPIXEL_NORMAL @@ -264,7 +264,7 @@ Shader "Hidden/HDRP/TerrainLit_Basemap" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -298,7 +298,7 @@ Shader "Hidden/HDRP/TerrainLit_Basemap" Tags{ "LightMode" = "ForwardDXR" } HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -333,7 +333,7 @@ Shader "Hidden/HDRP/TerrainLit_Basemap" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -365,7 +365,7 @@ Shader "Hidden/HDRP/TerrainLit_Basemap" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" @@ -386,7 +386,7 @@ Shader "Hidden/HDRP/TerrainLit_Basemap" Tags{ "LightMode" = "DebugDXR" } HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" @@ -412,7 +412,7 @@ Shader "Hidden/HDRP/TerrainLit_Basemap" Tags{ "LightMode" = "PathTracingDXR" } HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_BasemapGen.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_BasemapGen.shader index b4c3d0f6014..19d4050295c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_BasemapGen.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/TerrainLit/TerrainLit_BasemapGen.shader @@ -12,7 +12,7 @@ Shader "Hidden/HDRP/TerrainLit_BasemapGen" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define SURFACE_GRADIENT // Must use Surface Gradient as the normal map texture format is now RG floating point #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader index ae8e7970867..59fcfa7761e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader @@ -96,7 +96,7 @@ Shader "HDRP/Unlit" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //------------------------------------------------------------------------------------- // Variant @@ -149,7 +149,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -193,7 +193,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -239,7 +239,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -288,7 +288,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -328,7 +328,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -375,7 +375,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -414,7 +414,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -449,7 +449,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing #pragma multi_compile _ DOTS_INSTANCING_ON @@ -484,7 +484,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -519,7 +519,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -553,7 +553,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader // Keyword for transparent @@ -588,7 +588,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #define SHADOW_LOW @@ -624,7 +624,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader // Keyword for transparent @@ -652,7 +652,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma raytracing surface_shader #pragma multi_compile _ SENSORSDK_OVERRIDE_REFLECTANCE diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/VolumetricMaterial/VolumetricMaterial.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/VolumetricMaterial/VolumetricMaterial.compute index c7e59a0e8c8..c72bfc60746 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/VolumetricMaterial/VolumetricMaterial.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/VolumetricMaterial/VolumetricMaterial.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel ComputeVolumetricMaterialRenderingParameters diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/AlphaCopy.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/AlphaCopy.compute index 58115afca88..940a970539a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/AlphaCopy.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/AlphaCopy.compute @@ -1,6 +1,6 @@ #pragma kernel KMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ApplyExposure.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ApplyExposure.compute index 28d11250d68..528ab4d55ac 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ApplyExposure.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ApplyExposure.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain #pragma multi_compile _ ENABLE_ALPHA diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomBlur.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomBlur.compute index 19e8bac5db7..e2ef0ab3aac 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomBlur.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomBlur.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DynamicScalingClamping.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain MAIN=KMain #pragma kernel KDownsample MAIN=KDownsample DOWNSAMPLE diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomPrefilter.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomPrefilter.compute index 9681b96b00e..4bd25f60f64 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomPrefilter.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomPrefilter.compute @@ -5,7 +5,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomUpsample.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomUpsample.compute index 5c55ec25e34..e7785787142 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomUpsample.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomUpsample.compute @@ -3,7 +3,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DynamicScalingClamping.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ClearBlack.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ClearBlack.shader index 7393964fa13..083269a5f2f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ClearBlack.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ClearBlack.shader @@ -3,7 +3,7 @@ Shader "Hidden/HDRP/ClearBlack" HLSLINCLUDE #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/CompositeWithUIAndOETF.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/CompositeWithUIAndOETF.shader index 8dee2fc4a26..697d0fd71a2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/CompositeWithUIAndOETF.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/CompositeWithUIAndOETF.shader @@ -3,7 +3,7 @@ Shader "Hidden/HDRP/CompositeUI" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma editor_sync_compilation #pragma multi_compile_local_fragment _ APPLY_AFTER_POST #pragma multi_compile_local _ DISABLE_TEXTURE2D_X_ARRAY diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ContrastAdaptiveSharpen.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ContrastAdaptiveSharpen.compute index 68b4a216083..a5c24818fbf 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ContrastAdaptiveSharpen.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ContrastAdaptiveSharpen.compute @@ -2,7 +2,7 @@ #pragma kernel KInitialize #pragma multi_compile _ HDR_INPUT -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DLSSBiasColorMask.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DLSSBiasColorMask.shader index ad816c57649..33d2e99267b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DLSSBiasColorMask.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DLSSBiasColorMask.shader @@ -8,7 +8,7 @@ Shader "Hidden/HDRP/DLSSBiasColorMask" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHDRxyMapping.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHDRxyMapping.compute index fd9c3cb7c10..b60de61bfdb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHDRxyMapping.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHDRxyMapping.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/HDROutput.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KCIExyGen #define GROUP_SIZE_X 8 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHistogramImage.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHistogramImage.compute index 5ba9618bb2c..eabd1c9b60c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHistogramImage.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DebugHistogramImage.compute @@ -3,7 +3,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/PhysicalCamera.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KHistogramGen #define GROUP_SIZE_X 16 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldClearIndirectArgs.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldClearIndirectArgs.compute index 3e330cf3267..68a94fc8928 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldClearIndirectArgs.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldClearIndirectArgs.compute @@ -1,6 +1,6 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KClear diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoC.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoC.compute index cb9cb8fcb64..2bffa97cf12 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoC.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoC.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ USE_MIN_DEPTH // Active when using MSAA #pragma multi_compile _ FIX_NEAR_BLEND diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCDilate.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCDilate.compute index 80a4d33f648..51cf76c35ad 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCDilate.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCDilate.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCReproject.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCReproject.compute index bbc5aa95134..7c01a99eb70 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCReproject.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCoCReproject.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Builtin/BuiltinData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ ENABLE_MAX_BLENDING diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCombine.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCombine.compute index fdae7afe892..97537010fea 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCombine.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCombine.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldGather.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldGather.compute index 6e83bd8fd69..b831418ba14 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldGather.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldGather.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMainNear MAIN=KMainNear NEAR #pragma kernel KMainFar MAIN=KMainFar FAR diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldKernel.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldKernel.compute index 3420365d746..9ea3c7a5f0a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldKernel.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldKernel.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KParametricBlurKernel MAIN=KParametricBlurKernel GROUP_SIZE=64 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMip.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMip.compute index 7bd488c2f63..7c714608179 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMip.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMip.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMainColor MAIN=KMainColor CTYPE=float3 #pragma kernel KMainColorAlpha MAIN=KMainColorAlpha CTYPE=float4 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMipSafe.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMipSafe.compute index 722eff37a67..b186aa0436b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMipSafe.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldMipSafe.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPreCombineFar.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPreCombineFar.compute index e9ddd43bb69..1a2f77d9eaa 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPreCombineFar.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPreCombineFar.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMainPreCombineFar diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPrefilter.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPrefilter.compute index f2d33556541..ecff97fa3af 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPrefilter.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldPrefilter.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ NEAR diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldTileMax.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldTileMax.compute index 9261be7594d..ea75e9d68ba 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldTileMax.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldTileMax.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain #pragma multi_compile _ NEAR diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFApertureShape.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFApertureShape.compute index 76df386427d..b69f13b711b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFApertureShape.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFApertureShape.compute @@ -3,7 +3,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel ComputeShapeBuffer diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCircleOfConfusion.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCircleOfConfusion.compute index 5c08e05c297..53fc250cb05 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCircleOfConfusion.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCircleOfConfusion.compute @@ -3,7 +3,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ USE_MIN_DEPTH // Active when using MSAA diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCoCMinMax.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCoCMinMax.compute index 730835d6b66..f107bf3f480 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCoCMinMax.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCoCMinMax.compute @@ -3,7 +3,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMainCoCMinMax TEXTURE2D_X(_InputTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCombine.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCombine.compute index 9b2552ec649..4738f7df8cf 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCombine.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFCombine.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingSampling.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel UpsampleFastTiles diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFComputeSlowTiles.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFComputeSlowTiles.compute index 99d826e780e..6e9900c3e9c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFComputeSlowTiles.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFComputeSlowTiles.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingSampling.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel ComputeSlowTiles diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFGather.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFGather.compute index 508ea385b73..2d42dcc683d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFGather.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFGather.compute @@ -4,7 +4,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingSampling.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFMinMaxDilate.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFMinMaxDilate.compute index edc10ead1ad..9d0a83487f6 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFMinMaxDilate.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFMinMaxDilate.compute @@ -3,7 +3,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain TEXTURE2D_X(_InputTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/EdgeAdaptiveSpatialUpsampling.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/EdgeAdaptiveSpatialUpsampling.compute index 6d372ddd86a..8e1aeb4dc67 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/EdgeAdaptiveSpatialUpsampling.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/EdgeAdaptiveSpatialUpsampling.compute @@ -2,7 +2,7 @@ #pragma multi_compile _ ENABLE_ALPHA #pragma multi_compile _ HDR_INPUT -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/Exposure.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/Exposure.compute index bb3837ddc6e..4d68a417dd3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/Exposure.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/Exposure.compute @@ -1,6 +1,6 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/ExposureCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KFixedExposure #pragma kernel KManualCameraExposure diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.compute index 4f167835eb0..f1eebe72fa2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.compute @@ -3,7 +3,7 @@ #pragma multi_compile _ ENABLE_ALPHA #pragma multi_compile _ HDR_INPUT -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader index d8d118481db..bfa71b43af9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader @@ -4,7 +4,7 @@ Shader "Hidden/HDRP/FinalPass" #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment _ SCREEN_COORD_OVERRIDE #pragma multi_compile_local_fragment _ FXAA diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/HistogramExposure.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/HistogramExposure.compute index dd37def8d17..35e3b2777cb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/HistogramExposure.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/HistogramExposure.compute @@ -14,7 +14,7 @@ #pragma multi_compile _ OUTPUT_DEBUG_DATA -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #ifdef GEN_PASS // Because atomics are only on uint and we need a weighted value, we need to convert. diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareDataDriven.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareDataDriven.shader index fe8b18e0db1..2095f98fdc2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareDataDriven.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareDataDriven.shader @@ -17,7 +17,7 @@ Shader "Hidden/HDRP/LensFlareDataDriven" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -49,7 +49,7 @@ Shader "Hidden/HDRP/LensFlareDataDriven" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -81,7 +81,7 @@ Shader "Hidden/HDRP/LensFlareDataDriven" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -113,7 +113,7 @@ Shader "Hidden/HDRP/LensFlareDataDriven" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -143,7 +143,7 @@ Shader "Hidden/HDRP/LensFlareDataDriven" HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vertOcclusion diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareMergeOcclusionDataDriven.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareMergeOcclusionDataDriven.compute index 746cf5e4ffa..5b9fbdba16a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareMergeOcclusionDataDriven.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareMergeOcclusionDataDriven.compute @@ -2,7 +2,7 @@ //-------------------------------------------------------------------------------------------------- // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel MainCS diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareScreenSpace.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareScreenSpace.shader index 25b6832d172..47afa59591b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareScreenSpace.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareScreenSpace.shader @@ -14,7 +14,7 @@ Shader "Hidden/HDRP/LensFlareScreenSpace" ZTest Always HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -39,7 +39,7 @@ Shader "Hidden/HDRP/LensFlareScreenSpace" ZTest Always HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -64,7 +64,7 @@ Shader "Hidden/HDRP/LensFlareScreenSpace" ZTest Always HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -89,7 +89,7 @@ Shader "Hidden/HDRP/LensFlareScreenSpace" ZTest Always HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert @@ -116,7 +116,7 @@ Shader "Hidden/HDRP/LensFlareScreenSpace" ZTest Always HLSLPROGRAM - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma target 5.0 #pragma vertex vert diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LutBuilder3D.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LutBuilder3D.compute index 984540ebd15..3c239ad63fa 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LutBuilder3D.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LutBuilder3D.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile TONEMAPPING_NONE TONEMAPPING_NEUTRAL TONEMAPPING_ACES_APPROX TONEMAPPING_ACES_FULL TONEMAPPING_CUSTOM TONEMAPPING_EXTERNAL #pragma multi_compile_local _ HDR_COLORSPACE_CONVERSION diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute index f8c2a1d2962..bd1f2a9b954 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute @@ -1,7 +1,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel MotionBlurCS @@ -182,7 +182,7 @@ float3 BlendMotionBlurLayers(float3 centralColor, float4 accumulation, float sca // accumulation - rgb hold the unormalized weighted sum of the blur kernel. So Sum(c * w[i]). The w component holds the sum of all the weights Sum(w[i]) // scatterNeighborhoodIntensity - Within the tile (neighborhood) how blurry this pixel will look like. High value means this pixels motion vector has a high intensity relative to neighborhood, and viceversa // invSampleCount - reciprocal of number of samples added in accumulation (1.0 / N) - // + // // Explanation of blur algorithm: // We split this blend into a top layer, and a back layer. // Top layer - @@ -192,7 +192,7 @@ float3 BlendMotionBlurLayers(float3 centralColor, float4 accumulation, float sca // is the unormalized / low intensity color bleeding into background pixels. This looks good when a foreground object is moving fast, and the background is static. It however adds a ringing artifact when the background is fast moving and the foreground is static. // To get the best of both results, we blend them depending on how much the current pixel has to scatter. If the current pixel scatters a lot (high motion vector intensity relative to tile) we opt for a top layer. // on the other hand, if the current pixel doesn't scatter as much (has a low intensity motion vector) we are ok showing more of the bottom layer. - + float3 topLayerColor = accumulation.w < 1e-4 ? centralColor.rgb : accumulation.rgb/accumulation.w; float topLayerAlpha = accumulation.w * invSampleCount; float3 backLayerColor = lerp(centralColor.rgb, topLayerColor, topLayerAlpha); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurGenTilePass.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurGenTilePass.compute index 51c072f7736..4e608d9d170 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurGenTilePass.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurGenTilePass.compute @@ -1,6 +1,6 @@ #pragma kernel TileGenPass GEN_PASS -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ SCATTERING #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurTileCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMergeTilePass.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMergeTilePass.compute index 71fe92bf79f..598c039c185 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMergeTilePass.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMergeTilePass.compute @@ -1,5 +1,5 @@ #pragma kernel TileMerge MERGE_PASS SCATTERING -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurTileCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMotionVecPrep.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMotionVecPrep.compute index 5323ccad0b1..1b9ba8bf071 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMotionVecPrep.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurMotionVecPrep.compute @@ -2,7 +2,7 @@ #pragma kernel MotionVecPreppingCS MOTION_VEC_PREPPING -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define SKIP_PREPPING_IF_NOT_NEEDED defined(PLATFORM_SUPPORTS_WAVE_INTRINSICS) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurNeighborhoodTilePass.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurNeighborhoodTilePass.compute index c718e275c73..c8589974b9e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurNeighborhoodTilePass.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurNeighborhoodTilePass.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel TileNeighbourhood NEIGHBOURHOOD_PASS #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurTileCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/NaNKiller.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/NaNKiller.compute index d1a35847d0a..3fdc0088933 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/NaNKiller.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/NaNKiller.compute @@ -1,6 +1,6 @@ #pragma kernel KMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PaniniProjection.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PaniniProjection.compute index 99d6c27797a..0a7da205660 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PaniniProjection.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PaniniProjection.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KMain diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostSharpenPass.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostSharpenPass.compute index 5838f12e9dd..65fed312b99 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostSharpenPass.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostSharpenPass.compute @@ -6,7 +6,7 @@ #pragma kernel SharpenCS -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 TEXTURE2D_X(_InputTexture); RW_TEXTURE2D_X(CTYPE, _OutputTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/SubpixelMorphologicalAntialiasing.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/SubpixelMorphologicalAntialiasing.shader index 2a337f6ba69..1d34f6f6415 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/SubpixelMorphologicalAntialiasing.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/SubpixelMorphologicalAntialiasing.shader @@ -8,7 +8,7 @@ Shader "Hidden/PostProcessing/SubpixelMorphologicalAntialiasing" HLSLINCLUDE - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment SMAA_PRESET_LOW SMAA_PRESET_MEDIUM SMAA_PRESET_HIGH #pragma editor_sync_compilation diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntiAliasing.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntiAliasing.shader index 15a2ecd6c65..ee7ba4e814f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntiAliasing.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntiAliasing.shader @@ -20,7 +20,7 @@ Shader "Hidden/HDRP/TemporalAA" #pragma editor_sync_compilation // #pragma enable_d3d11_debug_symbols - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Builtin/BuiltinData.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/UberPost.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/UberPost.compute index 03d051a8794..8ada7553cd7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/UberPost.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/UberPost.compute @@ -7,7 +7,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ScreenCoordOverride.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/UberPostFeatures.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/BloomCommon.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel Uber diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/Accumulation.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/Accumulation.compute index fab2c80d88a..2e44dfd5042 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/Accumulation.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/Accumulation.compute @@ -4,7 +4,7 @@ #pragma kernel KMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ INPUT_FROM_FRAME_TEXTURE #pragma multi_compile _ WRITE_TO_OUTPUT_TEXTURE diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/BlitAndExpose.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/BlitAndExpose.compute index 4a3f524854d..a1ea3d73b33 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/BlitAndExpose.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/Shaders/BlitAndExpose.compute @@ -6,7 +6,7 @@ #pragma kernel KAddMain #pragma kernel KAccumMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Input TEXTURE2D_X(_InputTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs index 9ec8fb4f9dc..c905caf5f24 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs @@ -468,6 +468,15 @@ unsafe void PrepareBuildGPULightListPassData( // In practice though, when resolution stays the same, buffers will be the same reused from one frame to another // because for now buffers are pooled based on their passData. When we do proper aliasing though, we might end up with any random chunk of memory. + if (!tileAndClusterData.listsAreInitialized) + { + // On some platforms initial values in buffer might not be zero but random data. + // In the case of buffer "PerVoxelOffset" this can cause GPU to access incorrect memory locations and crash. + // To avoid that we make sure that the buffers are cleared at least once before they start being used. + passData.clearLightLists = true; + tileAndClusterData.listsAreInitialized = true; + } + // Always build the light list in XR mode to avoid issues with multi-pass if (hdCamera.xr.enabled) { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index 149f974ab35..e177110ca1a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -215,6 +215,8 @@ void InitializePostProcess() m_MotionBlurSupportsScattering = SystemInfo.IsFormatSupported(GraphicsFormat.R32_UInt, GraphicsFormatUsage.LoadStore) && SystemInfo.IsFormatSupported(GraphicsFormat.R16_UInt, GraphicsFormatUsage.LoadStore); // TODO: Remove this line when atomic bug in HLSLcc is fixed. m_MotionBlurSupportsScattering = m_MotionBlurSupportsScattering && (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan); + // TODO: Remove this line when atomic bug in HLSLcc is fixed. + m_MotionBlurSupportsScattering = m_MotionBlurSupportsScattering && (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Switch2); // TODO: Write a version that uses structured buffer instead of texture to do atomic as Metal doesn't support atomics on textures. m_MotionBlurSupportsScattering = m_MotionBlurSupportsScattering && (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Metal); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs index 08822da2021..60089645522 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs @@ -130,7 +130,7 @@ TextureHandle CreateDepthBuffer(RenderGraph renderGraph, bool clear, MSAASamples TextureDesc depthDesc = new TextureDesc(Vector2.one, true, true) { - format = GraphicsFormat.D32_SFloat_S8_UInt, + format = CoreUtils.GetDefaultDepthStencilFormat(), bindTextureMS = msaa, msaaSamples = msaaSamples, clearBuffer = clear, @@ -1338,7 +1338,8 @@ void RenderDBuffer(RenderGraph renderGraph, HDCamera hdCamera, ref PrepassOutput SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne || SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOneD3D12 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.GameCoreXboxOne || - SystemInfo.graphicsDeviceType == GraphicsDeviceType.GameCoreXboxSeries; + SystemInfo.graphicsDeviceType == GraphicsDeviceType.GameCoreXboxSeries || + SystemInfo.graphicsDeviceType == GraphicsDeviceType.Switch2; if (!canReadBoundDepthBuffer) { @@ -1511,7 +1512,7 @@ void DownsampleDepthForLowResTransparency(RenderGraph renderGraph, HDCamera hdCa passData.depthTexture = builder.ReadTexture(output.depthPyramidTexture); passData.downsampledDepthBuffer = builder.UseDepthBuffer(renderGraph.CreateTexture( - new TextureDesc(Vector2.one * hdCamera.lowResScale, true, true) { format = GraphicsFormat.D32_SFloat_S8_UInt, name = "LowResDepthBuffer" }), DepthAccess.Write); + new TextureDesc(Vector2.one * hdCamera.lowResScale, true, true) { format = CoreUtils.GetDefaultDepthStencilFormat(), name = "LowResDepthBuffer" }), DepthAccess.Write); builder.SetRenderFunc( (DownsampleDepthForLowResPassData data, RenderGraphContext context) => 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 2ac4ee41143..60ef90d321a 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 @@ -1004,7 +1004,7 @@ TextureHandle CreateOffscreenUIBuffer(RenderGraph renderGraph, MSAASamples msaaS TextureHandle CreateOffscreenUIDepthBuffer(RenderGraph renderGraph, MSAASamples msaaSamples, Rect viewport) { return renderGraph.CreateTexture(new TextureDesc((int)viewport.width, (int)viewport.height, false, true) - { format = GraphicsFormat.D32_SFloat_S8_UInt, clearBuffer = true, msaaSamples = msaaSamples, name = "UI Depth Buffer" }); + { format = CoreUtils.GetDefaultDepthStencilFormat(), clearBuffer = true, msaaSamples = msaaSamples, name = "UI Depth Buffer" }); } @@ -1167,7 +1167,7 @@ void RenderForwardTransparent(RenderGraph renderGraph, { // if refraction is disabled, we did not create a copy of the depth buffer, so we need to create a dummy one here. passData.depthAndStencil = builder.CreateTransientTexture(new TextureDesc(Vector2.one, true, true) - { format = GraphicsFormat.D32_SFloat_S8_UInt, bindTextureMS = hdCamera.msaaSamples != MSAASamples.None, msaaSamples = hdCamera.msaaSamples, clearBuffer = false, name = "Dummy Depth", disableFallBackToImportedTexture = true, fallBackToBlackTexture = false}); + { format = CoreUtils.GetDefaultDepthStencilFormat(), bindTextureMS = hdCamera.msaaSamples != MSAASamples.None, msaaSamples = hdCamera.msaaSamples, clearBuffer = false, name = "Dummy Depth", disableFallBackToImportedTexture = true, fallBackToBlackTexture = false}); } else { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs index c23c8b10c20..b884a65cc03 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs @@ -159,7 +159,8 @@ static bool NeedTemporarySubsurfaceBuffer() SystemInfo.graphicsDeviceType != GraphicsDeviceType.XboxOne && SystemInfo.graphicsDeviceType != GraphicsDeviceType.XboxOneD3D12 && SystemInfo.graphicsDeviceType != GraphicsDeviceType.GameCoreXboxOne && - SystemInfo.graphicsDeviceType != GraphicsDeviceType.GameCoreXboxSeries); + SystemInfo.graphicsDeviceType != GraphicsDeviceType.GameCoreXboxSeries && + SystemInfo.graphicsDeviceType != GraphicsDeviceType.Switch2); } // Albedo + SSS Profile and mask / Specular occlusion (when no SSS) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 522078379ee..c21dd3f057b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -95,7 +95,7 @@ internal static HDRenderPipeline currentPipeline bool m_FrameSettingsHistoryEnabled = false; -#if UNITY_SWITCH +#if UNITY_SWITCH //|| UNITY_SWITCH2 ? internal static bool k_PreferFragment = true; #else internal static bool k_PreferFragment = false; @@ -355,8 +355,10 @@ void SetHDRState(HDCamera camera) #else bool hdrInPlayerSettings = true; #endif + bool supportsSwitchingHDR = SystemInfo.hdrDisplaySupportFlags.HasFlag(HDRDisplaySupportFlags.RuntimeSwitchable); + bool hdrOutputActive = HDROutputSettings.main.available && HDROutputSettings.main.active; - if (hdrInPlayerSettings && HDROutputSettings.main.available) + if (hdrInPlayerSettings && supportsSwitchingHDR && hdrOutputActive) { if (camera.camera.cameraType != CameraType.Game) { @@ -684,7 +686,7 @@ public HDRenderPipeline(HDRenderPipelineAsset asset) m_DepthPyramidMipLevelOffsetsBuffer = new ComputeBuffer(15, sizeof(int) * 2); m_CustomPassColorBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer")); - m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.None, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: DepthBits.Depth32)); + m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.None, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: CoreUtils.GetDefaultDepthBufferBits())); // For debugging MousePositionDebug.instance.Build(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/CompositeLines.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/CompositeLines.shader index 70a85057f86..a450b2f8ea3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/CompositeLines.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/CompositeLines.shader @@ -3,7 +3,7 @@ Shader "Hidden/HDRP/CompositeLines" HLSLINCLUDE #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StagePrepare.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StagePrepare.compute index 80b55b35e4a..67c0270ec7f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StagePrepare.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StagePrepare.compute @@ -49,7 +49,7 @@ void ClearClusters(uint3 dispatchThreadID : SV_DispatchThreadID) _ClusterCountersBuffer.Store(dispatchThreadID.x << 2, 0); } -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 groupshared float2 gs_ViewSpaceDepthRanges; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterBin.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterBin.compute index e25cb635245..9820af44684 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterBin.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterBin.compute @@ -1,7 +1,7 @@ #pragma kernel Main #pragma kernel MainArgs -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRenderingCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterFine.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterFine.compute index cd80333beb3..6ef4c11e1eb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterFine.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageRasterFine.compute @@ -5,7 +5,7 @@ #pragma kernel Main SEGMENTS_PER_CLUSTER=2048 LDS_STRIDE=5 DEBUG #pragma kernel Main SEGMENTS_PER_CLUSTER=256 LDS_STRIDE=2 COMPILING_SHADER -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 int _HairDebugMode; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageSetupSegment.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageSetupSegment.compute index 613037d8b1c..80451d7d9cc 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageSetupSegment.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageSetupSegment.compute @@ -2,7 +2,7 @@ #pragma multi_compile INDEX_FORMAT_UINT_16 INDEX_FORMAT_UINT_32 -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRenderingCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageShadingSetup.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageShadingSetup.compute index 30714a7dead..6847d89c1d0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageShadingSetup.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageShadingSetup.compute @@ -9,7 +9,7 @@ #pragma kernel CalculateHighestVisibleHistogramID #pragma kernel DiscardSamplesBasedOnHistogram -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRenderingCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageWorkQueue.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageWorkQueue.compute index 5110a4f105e..c87b5c025c5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageWorkQueue.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Kernels/StageWorkQueue.compute @@ -4,7 +4,7 @@ #pragma kernel WorkQueueActiveClusters #pragma kernel BuildFineRasterArgs -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRenderingCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingSkySamplingData.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingSkySamplingData.compute index 66004b6695d..03cf3297775 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingSkySamplingData.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingSkySamplingData.compute @@ -2,7 +2,7 @@ #define COMPUTE_PATH_TRACING_SKY_SAMPLING_DATA -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Common/RayBinning.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Common/RayBinning.compute index f4e55b16a78..d47d8ae518e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Common/RayBinning.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Common/RayBinning.compute @@ -1,7 +1,7 @@ #pragma kernel RayBinning RAY_BINNING=RayBinning #pragma kernel RayBinningHalf RAY_BINNING=RayBinningHalf HALF_RESOLUTION -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute index 102707e040e..958bd7d1728 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute @@ -3,7 +3,7 @@ #pragma kernel BufferReduction -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute index bec68dc2812..e361403f215 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute @@ -1,6 +1,6 @@ #pragma kernel DebugLightCluster -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #define DEBUG_LIGHT_CLUSTER_TILE_SIZE 8 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader index 099c9d345a5..5fda7761058 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader @@ -6,7 +6,7 @@ Shader "Hidden/HDRP/DebugLightCluster" HLSLINCLUDE - #pragma only_renderers d3d11 xboxseries ps5 + #pragma only_renderers d3d11 xboxseries ps5 switch2 static const float3 cubeVertices[24] = { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute index e84a01555fc..2b07f9f8bdd 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute @@ -17,7 +17,7 @@ // In addition to that, we intentionally disabled dithering for the ray tracing case as it requires the screen space position. #define SHADOW_LOW -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // Needed for the ray miss and the last bounce indirect diffuse lighting #pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute index 8c74f6d5a5c..b248aad9e27 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute @@ -6,7 +6,7 @@ #pragma kernel GatherSingle GATHER_FILTER=GatherSingle SINGLE_CHANNEL #pragma kernel GatherColor GATHER_FILTER=GatherColor -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // We need the stencil flag of this. #define BILATERLAL_UNLIT diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute index 1f10ab6fd9e..3ce7be3ea28 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #pragma kernel BilateralFilterHSingleDirectional BILATERAL_FILTER=BilateralFilterHSingleDirectional SINGLE_CHANNEL DIRECTIONAL_LIGHT #pragma kernel BilateralFilterVSingleDirectional BILATERAL_FILTER=BilateralFilterVSingleDirectional FINAL_PASS SINGLE_CHANNEL DIRECTIONAL_LIGHT @@ -31,7 +31,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/BilateralFilter.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RayTracingShadowUtilities.hlsl" -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_Blur.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_Blur.compute index efa633002a0..7a253a04daa 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_Blur.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_Blur.compute @@ -1,6 +1,6 @@ #pragma kernel Blur -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_CopyHistory.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_CopyHistory.compute index 5ec5367946c..f43946c400f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_CopyHistory.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_CopyHistory.compute @@ -1,7 +1,7 @@ #pragma kernel CopyHistoryAccumulation COPY_HISTORY=CopyHistoryAccumulation ACCUMULATION #pragma kernel CopyHistory COPY_HISTORY=CopyHistory -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_HistoryFix.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_HistoryFix.compute index d622ad8a8c1..e122d0bfeb3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_HistoryFix.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_HistoryFix.compute @@ -1,6 +1,6 @@ #pragma kernel HistoryFix -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_MipGeneration.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_MipGeneration.compute index daffe389200..b9024137ed5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_MipGeneration.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_MipGeneration.compute @@ -1,7 +1,7 @@ #pragma kernel MipGeneration #pragma kernel CopyMip -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PostBlur.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PostBlur.compute index 1f9d8b9c7e2..865168550ab 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PostBlur.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PostBlur.compute @@ -1,6 +1,6 @@ #pragma kernel PostBlur -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PreBlur.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PreBlur.compute index 2a048be6c3a..22f6dfe6a91 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PreBlur.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_PreBlur.compute @@ -1,6 +1,6 @@ #pragma kernel PreBlur -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalAccumulation.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalAccumulation.compute index fb0f675de37..2c60b7234e7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalAccumulation.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalAccumulation.compute @@ -1,6 +1,6 @@ #pragma kernel TemporalAccumulation -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Builtin/BuiltinData.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalStabilization.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalStabilization.compute index bbc29ab66ab..376840c4e0d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalStabilization.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReBlur/ReBlur_TemporalStabilization.compute @@ -1,6 +1,6 @@ #pragma kernel TemporalStabilization -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute index b9808f2686e..cc3bd289287 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute @@ -6,7 +6,7 @@ #pragma kernel BilateralFilterH_HR BILATERAL_FILTER=BilateralFilterH_HR HALF_RESOLUTION #pragma kernel BilateralFilterV_HR BILATERAL_FILTER=BilateralFilterV_HR FINAL_PASS HALF_RESOLUTION -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute index 5edde8cacc4..a0e0bd7f8aa 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute @@ -1,5 +1,5 @@ -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // Temporal Filtering kernels #pragma kernel BilateralFilterHSingle BILATERAL_FILTER=BilateralFilterHSingle SINGLE_CHANNEL @@ -9,7 +9,7 @@ #pragma kernel BilateralFilterVColor BILATERAL_FILTER=BilateralFilterVColor FINAL_PASS -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute index cf2a10403f5..d38e4df443c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute @@ -13,7 +13,7 @@ #pragma kernel OutputHistoryArray OUTPUT_IS_ARRAY -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Common includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute index bdd0d815db6..284dffc4045 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute @@ -3,7 +3,7 @@ #pragma kernel IndirectDiffuseIntegrationUpscaleHalfRes #pragma kernel IndirectDiffuseIntegrationUpscaleFullRes -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // Include and define the shader pass #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayMarching.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayMarching.compute index f873e1722f2..f56ba9ae6e4 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayMarching.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayMarching.compute @@ -1,7 +1,7 @@ #pragma kernel RayMarchKernel RAY_MARCH_KERNEL=RayMarchKernel #pragma kernel RayMarchHalfKernel RAY_MARCH_KERNEL=RayMarchHalfKernel HALF_RESOLUTION -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // Include and define the shader pass #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute index 76ddadd9857..0c9b33b4333 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute @@ -1,13 +1,13 @@ #pragma kernel RTAOApplyIntensity -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // HDRP generic includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols // Tile size of this compute diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute index ba545fc783b..9bc57f224e0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute @@ -1,7 +1,7 @@ #pragma kernel RaytracingLightCluster #pragma kernel RaytracingLightCull -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // SRP & HDRP includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute index f9930d22e54..5920a35ab48 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute @@ -1,7 +1,7 @@ #pragma kernel ReflectionAdjustWeight #pragma kernel ReflectionUpscale -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute index 5d326fbc5d6..043b3da0f19 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute @@ -8,7 +8,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #define SHADERPASS SHADERPASS_RAYTRACING -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute index bcac8513126..bf8558606f3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute @@ -46,7 +46,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingMIS.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RayTracingShadowUtilities.hlsl" -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadowFilter.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadowFilter.compute index 3e0d45f7535..64c8d151067 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadowFilter.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadowFilter.compute @@ -19,7 +19,7 @@ // Debug #pragma kernel WriteShadowTextureDebug -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/SubSurface/RayTracingSubSurface.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/SubSurface/RayTracingSubSurface.compute index b638fa1a57f..ccc16e04c34 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/SubSurface/RayTracingSubSurface.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/SubSurface/RayTracingSubSurface.compute @@ -2,7 +2,7 @@ #pragma kernel BlendSubSurfaceData #pragma kernel BlendSubSurfaceDataWithGI -#pragma only_renderers d3d11 xboxseries ps5 +#pragma only_renderers d3d11 xboxseries ps5 switch2 // Given that this pass does not use the shadow algorithm multi-compile, we need to define SHADOW_LOW to quite the shadow algorithm error #define SHADOW_LOW diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramid.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramid.compute index a0a7083cf6f..9101956b46c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramid.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramid.compute @@ -19,7 +19,7 @@ // Author: Bob Brown // -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel KColorGaussian KERNEL_SIZE=8 MAIN_GAUSSIAN=KColorGaussian #pragma kernel KColorDownsample KERNEL_SIZE=8 MAIN_DOWNSAMPLE=KColorDownsample diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramidPS.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramidPS.shader index d568a012215..9f4ed8d25a1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramidPS.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramidPS.shader @@ -13,7 +13,7 @@ Shader "Hidden/ColorPyramidPS" HLSLPROGRAM #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag #define DISABLE_TEXTURE2D_X_ARRAY 1 @@ -30,7 +30,7 @@ Shader "Hidden/ColorPyramidPS" HLSLPROGRAM #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma vertex Vert #pragma fragment Frag #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/ColorPyramidPS.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs index 9af8cc68e10..dffccc9aca1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs @@ -255,7 +255,9 @@ virtual internal void ExecuteInternal(RenderGraph renderGraph, HDCamera hdCamera ctx.cmd.SetGlobalFloat(HDShaderIDs._CustomPassInjectionPoint, (float)customPass.injectionPoint); if (customPass.currentRenderTarget.colorBufferRG.IsValid() && customPass.injectionPoint == CustomPassInjectionPoint.AfterPostProcess) + { ctx.cmd.SetGlobalTexture(HDShaderIDs._AfterPostProcessColorBuffer, customPass.currentRenderTarget.colorBufferRG); + } if (customPass.currentRenderTarget.motionVectorBufferRG.IsValid() && (customPass.injectionPoint != CustomPassInjectionPoint.BeforeRendering)) ctx.cmd.SetGlobalTexture(HDShaderIDs._CameraMotionVectorsTexture, customPass.currentRenderTarget.motionVectorBufferRG); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassRenderersUtils.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassRenderersUtils.shader index 290f5e6735e..22b83db62bc 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassRenderersUtils.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassRenderersUtils.shader @@ -7,7 +7,7 @@ Shader "Hidden/HDRP/CustomPassRenderersUtils" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader index 207a0214dea..046e335b826 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader @@ -5,7 +5,7 @@ Shader "Hidden/HDRP/CustomPassUtils" #pragma vertex Vert #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassCommon.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DepthPyramid.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DepthPyramid.compute index 57e79ae6baf..f0ed38f0482 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DepthPyramid.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DepthPyramid.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureXR.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DepthPyramidConstants.cs.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_local _ ENABLE_CHECKERBOARD diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Distortion/ApplyDistortion.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Distortion/ApplyDistortion.shader index e9826d586b1..dddcfa68550 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Distortion/ApplyDistortion.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Distortion/ApplyDistortion.shader @@ -9,7 +9,7 @@ Shader "Hidden/HDRP/ApplyDistortion" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma editor_sync_compilation #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/GenerateMaxZ.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/GenerateMaxZ.compute index 2875aeac759..bfca96d7ed0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/GenerateMaxZ.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/GenerateMaxZ.compute @@ -2,7 +2,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureXR.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel ComputeMaxZ MAX_Z_DOWNSAMPLE=1 #pragma kernel ComputeFinalMask FINAL_MASK=1 @@ -120,7 +120,7 @@ void ComputeMaxZ(uint3 dispatchThreadId : SV_DispatchThreadID, uint gid : SV_Gro #elif FINAL_MASK -TEXTURE2D_X(_InputTexture); +TEXTURE2D_X_FLOAT(_InputTexture); RW_TEXTURE2D_X(OUT_MASK_FORMAT, _OutputTexture); void DownsampleDepth(float s0, float s1, float s2, float s3, out float maxDepth) @@ -171,7 +171,7 @@ void ComputeFinalMask(uint3 dispatchThreadId : SV_DispatchThreadID, uint gid : S #elif DILATE_MASK -TEXTURE2D_X(_InputTexture); +TEXTURE2D_X_FLOAT(_InputTexture); RW_TEXTURE2D_X(OUT_MASK_FORMAT, _OutputTexture); OUT_MASK_FORMAT DilateValue(OUT_MASK_FORMAT currMax, OUT_MASK_FORMAT currSample) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/AmbientOcclusionResolve.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/AmbientOcclusionResolve.shader index cd9465280ff..ea6218b3e2f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/AmbientOcclusionResolve.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/AmbientOcclusionResolve.shader @@ -2,7 +2,7 @@ Shader "Hidden/HDRP/AOResolve" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" //#pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/ColorResolve.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/ColorResolve.shader index 7a923ac38dc..f7cf351414b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/ColorResolve.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/ColorResolve.shader @@ -2,7 +2,7 @@ Shader "Hidden/HDRP/ColorResolve" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/DepthValues.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/DepthValues.shader index e35257553a0..34239d2a2c4 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/DepthValues.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/DepthValues.shader @@ -2,7 +2,7 @@ Shader "Hidden/HDRP/DepthValues" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment _ _HAS_MOTION_VECTORS _DEPTH_ONLY #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/MotionVecResolve.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/MotionVecResolve.shader index 079cd75ecf3..3a20ae10dc7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/MotionVecResolve.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MSAA/MotionVecResolve.shader @@ -2,7 +2,7 @@ Shader "Hidden/HDRP/MotionVecResolve" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader index 3cbedae2d56..80066d232ed 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader @@ -10,7 +10,7 @@ Shader "Hidden/HDRP/CameraMotionVectors" #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ComputeThickness.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ComputeThickness.shader index c86878e4efd..9289dbfd9c6 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ComputeThickness.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ComputeThickness.shader @@ -3,7 +3,7 @@ Shader "Renderers/Thickness" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //enable GPU instancing support #pragma multi_compile_instancing diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs index c2f262a1840..0394ab81b17 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs @@ -810,6 +810,9 @@ internal static bool IsSupportedGraphicDevice(GraphicsDeviceType graphicDevice) if (graphicDevice == GraphicsDeviceType.Switch) // Switch support only enabled when forced by env variable for CI return Environment.GetEnvironmentVariable("ENABLE_HDRP_SWITCH_SUPPORT") != null || Application.platform == RuntimePlatform.Switch; + if (graphicDevice == GraphicsDeviceType.Switch2) // Switch2 support only enabled when forced by env variable for CI + return Environment.GetEnvironmentVariable("ENABLE_HDRP_SWITCH2_SUPPORT") != null || Application.platform == RuntimePlatform.Switch2; + return (graphicDevice == GraphicsDeviceType.Direct3D11 || graphicDevice == GraphicsDeviceType.Direct3D12 || graphicDevice == GraphicsDeviceType.PlayStation4 || @@ -820,7 +823,9 @@ internal static bool IsSupportedGraphicDevice(GraphicsDeviceType graphicDevice) graphicDevice == GraphicsDeviceType.GameCoreXboxOne || graphicDevice == GraphicsDeviceType.GameCoreXboxSeries || graphicDevice == GraphicsDeviceType.Metal || - graphicDevice == GraphicsDeviceType.Vulkan); + graphicDevice == GraphicsDeviceType.Vulkan + // || graphicDevice == GraphicsDeviceType.Switch2 + ); } internal static bool IsHardwareDynamicResolutionSupportedByDevice(GraphicsDeviceType deviceType) @@ -838,6 +843,8 @@ internal static bool IsSupportedBuildTarget(UnityEditor.BuildTarget buildTarget) { if (buildTarget == UnityEditor.BuildTarget.Switch) // Switch support only enabled when forced by env variable for CI return Environment.GetEnvironmentVariable("ENABLE_HDRP_SWITCH_SUPPORT") != null; + if (buildTarget == UnityEditor.BuildTarget.Switch2) // Switch2 support only enabled when forced by env variable for CI + return Environment.GetEnvironmentVariable("ENABLE_HDRP_SWITCH2_SUPPORT") != null; return (buildTarget == UnityEditor.BuildTarget.StandaloneWindows || buildTarget == UnityEditor.BuildTarget.StandaloneWindows64 || buildTarget == UnityEditor.BuildTarget.StandaloneLinux64 || @@ -846,6 +853,7 @@ internal static bool IsSupportedBuildTarget(UnityEditor.BuildTarget buildTarget) buildTarget == UnityEditor.BuildTarget.XboxOne || buildTarget == UnityEditor.BuildTarget.GameCoreXboxOne || buildTarget == UnityEditor.BuildTarget.GameCoreXboxSeries || + buildTarget == UnityEditor.BuildTarget.Switch2 || buildTarget == UnityEditor.BuildTarget.PS4 || buildTarget == UnityEditor.BuildTarget.PS5 || // buildTarget == UnityEditor.BuildTarget.iOS || // IOS isn't supported @@ -1271,8 +1279,22 @@ internal static string GetUnsupportedAPIMessage(string graphicAPI) if (isSupportedBuildTarget) msg = "Platform " + currentPlatform + " with graphics API " + graphicAPI + " is not supported with HDRP"; else + { msg = "Platform " + currentPlatform + " is not supported with HDRP"; +#if UNITY_EDITOR + if (buildTarget == UnityEditor.BuildTarget.Switch2) + { + msg += ". (For testing purpose only, un-hide by defining environment variable ENABLE_HDRP_SWITCH2_SUPPORT)"; + } +#else + if (currentPlatform == "Switch2 OS") + { + msg += ". (For testing purpose only, un-hide by defining environment variable ENABLE_HDRP_SWITCH2_SUPPORT)"; + } +#endif + } + // Display more information to the users when it should have use Metal instead of OpenGL if (graphicAPI.StartsWith("OpenGL")) { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.compute index b0ce842cf82..c6592812ee6 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.compute @@ -1,6 +1,6 @@ #pragma kernel Copy #pragma kernel GenerateMipMap -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/Material/DefaultHDParticleMaterial.mat b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/Material/DefaultHDParticleMaterial.mat index de77d009830..e19100c0793 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/Material/DefaultHDParticleMaterial.mat +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/Material/DefaultHDParticleMaterial.mat @@ -11,13 +11,16 @@ Material: m_Shader: {fileID: 4800000, guid: c4edd00ff2db5b24391a4fcb1762e459, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] + m_ValidKeywords: + - _ENABLE_FOG_ON_TRANSPARENT + - _SURFACE_TYPE_TRANSPARENT m_InvalidKeywords: [] m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: 2000 - stringTagMap: {} + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent disabledShaderPasses: - DistortionVectors - MOTIONVECTORS @@ -70,7 +73,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 0} + m_Texture: {fileID: 10300, guid: 0000000000000000f000000000000000, type: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MaskMap: @@ -110,7 +113,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _UnlitColorMap: - m_Texture: {fileID: 0} + m_Texture: {fileID: 10300, guid: 0000000000000000f000000000000000, type: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} m_Ints: [] @@ -125,7 +128,7 @@ Material: - _AlphaCutoffPostpass: 0.5 - _AlphaCutoffPrepass: 0.5 - _AlphaCutoffShadow: 0.5 - - _AlphaDstBlend: 0 + - _AlphaDstBlend: 10 - _AlphaRemapMax: 1 - _AlphaRemapMin: 0 - _AlphaSrcBlend: 1 @@ -164,7 +167,7 @@ Material: - _DoubleSidedEnable: 0 - _DoubleSidedGIMode: 0 - _DoubleSidedNormalMode: 1 - - _DstBlend: 0 + - _DstBlend: 10 - _EmissiveColorMode: 1 - _EmissiveExposureWeight: 1 - _EmissiveIntensity: 1 @@ -220,7 +223,7 @@ Material: - _StencilWriteMaskGBuffer: 3 - _StencilWriteMaskMV: 43 - _SubsurfaceMask: 1 - - _SurfaceType: 0 + - _SurfaceType: 1 - _TexWorldScale: 1 - _TexWorldScaleEmissive: 1 - _Thickness: 1 @@ -237,11 +240,11 @@ Material: - _UVEmissive: 0 - _UseEmissiveIntensity: 0 - _UseShadowThreshold: 0 - - _ZTestDepthEqualForOpaque: 3 + - _ZTestDepthEqualForOpaque: 4 - _ZTestGBuffer: 4 - _ZTestModeDistortion: 4 - _ZTestTransparent: 4 - - _ZWrite: 1 + - _ZWrite: 0 m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0} @@ -262,6 +265,7 @@ Material: - _UnlitColor: {r: 1, g: 1, b: 1, a: 1} - _UnlitColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0} m_BuildTextureStacks: [] + m_AllowLocking: 1 --- !u!114 &6200975693885156646 MonoBehaviour: m_ObjectHideFlags: 11 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/Blit.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/Blit.shader index 63fcc2ead04..364073bf243 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/Blit.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/Blit.shader @@ -4,7 +4,7 @@ Shader "Hidden/HDRP/Blit" #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ DISABLE_TEXTURE2D_X_ARRAY #pragma multi_compile _ BLIT_SINGLE_SLICE #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/BlitColorAndDepth.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/BlitColorAndDepth.shader index 8d7351af6e9..e1dc642096f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/BlitColorAndDepth.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/BlitColorAndDepth.shader @@ -4,7 +4,7 @@ Shader "Hidden/HDRP/BlitColorAndDepth" #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ DISABLE_TEXTURE2D_X_ARRAY #pragma multi_compile _ BLIT_SINGLE_SLICE #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ClearStencilBuffer.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ClearStencilBuffer.shader index b56481778b1..edf57c301ff 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ClearStencilBuffer.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ClearStencilBuffer.shader @@ -8,7 +8,7 @@ Shader "Hidden/HDRP/ClearStencilBuffer" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader index 69e24c42df4..6450e147eeb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader @@ -27,7 +27,7 @@ Shader "Hidden/HDRP/CopyDepthBuffer" HLSLPROGRAM #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma fragment Frag #pragma vertex Vert //#pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyStencilBuffer.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyStencilBuffer.shader index 22d9c8535c6..38e4322f74c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyStencilBuffer.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyStencilBuffer.shader @@ -9,7 +9,7 @@ Shader "Hidden/HDRP/CopyStencilBuffer" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader index 1a7c500bb24..1f1acff1716 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader @@ -5,7 +5,7 @@ Shader "Hidden/HDRP/DownsampleDepth" #pragma target 4.5 #pragma editor_sync_compilation #pragma multi_compile_local_fragment _ GATHER_DOWNSAMPLE - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ResolveStencilBuffer.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ResolveStencilBuffer.compute index 142c5d0302d..4169d795762 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ResolveStencilBuffer.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ResolveStencilBuffer.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel Main diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader index 18726abbc46..9b3118599ec 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader @@ -4,7 +4,7 @@ Shader "Hidden/HDRP/UpsampleTransparent" #pragma target 4.5 #pragma editor_sync_compilation - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XRMirrorView.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XRMirrorView.shader index 57b413d3769..93f0e0b2d09 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XRMirrorView.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XRMirrorView.shader @@ -6,7 +6,7 @@ Shader "Hidden/HDRP/XRMirrorView" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_local_fragment _ HDR_COLORSPACE_CONVERSION_AND_ENCODING #pragma multi_compile_fragment _ DISABLE_TEXTURE2D_X_ARRAY ENDHLSL diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XROcclusionMesh.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XROcclusionMesh.shader index 38bdad7bc2b..86dff9b829d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XROcclusionMesh.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/XROcclusionMesh.shader @@ -2,7 +2,7 @@ Shader "Hidden/HDRP/XROcclusionMesh" { HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ XR_OCCLUSION_MESH_COMBINED diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/AmbientProbeConvolution.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/AmbientProbeConvolution.compute index adad297c575..7cc158819c4 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/AmbientProbeConvolution.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/AmbientProbeConvolution.compute @@ -7,7 +7,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Hammersley.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Regular ambient probe convolution // Always use mips and output separate diffuse buffer. diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/BlitCubemap.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/BlitCubemap.shader index f4248c78e77..36c24f1a875 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/BlitCubemap.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/BlitCubemap.shader @@ -12,7 +12,7 @@ Shader "Hidden/BlitCubemap" { #pragma vertex vert #pragma fragment frag #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudShadows.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudShadows.compute index 35bdbbfd014..fb1bb1ee1e5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudShadows.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudShadows.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma multi_compile_local LAYER1_OFF LAYER1_STATIC LAYER1_PROCEDURAL LAYER1_FLOWMAP diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudTexture.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudTexture.compute index 2d74e82c7d6..0d7177a3494 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudTexture.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/BakeCloudTexture.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_local _ USE_SECOND_CLOUD_LAYER diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.shader index 9134ff4fa96..4e98777c971 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.shader @@ -6,7 +6,7 @@ Shader "Hidden/HDRP/Sky/CloudLayer" #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma multi_compile_local LAYER1_STATIC LAYER1_PROCEDURAL LAYER1_FLOWMAP diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader index ffa0d53747d..e2f3ade6604 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader @@ -6,7 +6,7 @@ Shader "Hidden/HDRP/Sky/GradientSky" #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 6685de59727..3b44e190e15 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -6,7 +6,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/IntegrateHDRISky.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/IntegrateHDRISky.shader index f9760c745c8..973ac31a118 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/IntegrateHDRISky.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/IntegrateHDRISky.shader @@ -18,7 +18,7 @@ Shader "Hidden/HDRP/IntegrateHDRI" #pragma vertex Vert #pragma fragment Frag #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/GroundIrradiancePrecomputation.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/GroundIrradiancePrecomputation.compute index cc54b81ca45..7c415274cd6 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/GroundIrradiancePrecomputation.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/GroundIrradiancePrecomputation.compute @@ -1,5 +1,5 @@ // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel main diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/InScatteredRadiancePrecomputation.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/InScatteredRadiancePrecomputation.compute index 069b802ba19..3b8e6dc2623 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/InScatteredRadiancePrecomputation.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/InScatteredRadiancePrecomputation.compute @@ -1,5 +1,5 @@ // #pragma enable_d3d11_debug_symbols -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma kernel main diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader index 463ccd430af..7d2d9d756aa 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader @@ -7,7 +7,7 @@ Shader "Hidden/HDRP/Sky/PbrSky" // #pragma enable_d3d11_debug_symbols #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile_fragment _ LOCAL_SKY diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/SkyLUTGenerator.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/SkyLUTGenerator.compute index b50f8dba4c6..7c8f925fccb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/SkyLUTGenerator.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/SkyLUTGenerator.compute @@ -1,7 +1,7 @@ // Ref: A Scalable and Production Ready Sky and Atmosphere Rendering Technique - Hillaire, ESGR 2020 // https://sebh.github.io/publications/egsr2020.pdf -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma kernel MultiScatteringLUT OUTPUT_MULTISCATTERING diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUPrefixSum/GPUPrefixSum.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUPrefixSum/GPUPrefixSum.compute index d80989f603c..042c8e9dae2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUPrefixSum/GPUPrefixSum.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUPrefixSum/GPUPrefixSum.compute @@ -9,7 +9,7 @@ #include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/GPUPrefixSum/GPUPrefixSum.Data.cs.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols @@ -139,7 +139,11 @@ void MainPrefixSumOnGroupCommon(int3 dispatchThreadID, int groupThreadIndex, boo //Hillis Steele Scan for (int i = 1; i < GROUP_SIZE; i <<= 1) { - uint val = groupThreadIndex >= i ? gs_prefixCache[groupThreadIndex - i] : 0u; + //Avoiding ternary operator (it would evaluate both sides and fetch invalid indices, causing crash on some GPUs) + uint val = 0u; + if (groupThreadIndex >= i) + val = gs_prefixCache[groupThreadIndex - i]; + GroupMemoryBarrierWithGroupSync(); gs_prefixCache[groupThreadIndex] += val; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUSort/GPUSort.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUSort/GPUSort.compute index 886b288be37..f8cdd1a4600 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUSort/GPUSort.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/GPUSort/GPUSort.compute @@ -4,7 +4,7 @@ // Ref: https://poniesandlight.co.uk/reflect/bitonic_merge_sort/ #pragma multi_compile _ STAGE_BMS STAGE_LOCAL_DISPERSE STAGE_BIG_FLIP STAGE_BIG_DISPERSE -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // Disable warning for auto unrolling of single iteration loop. #pragma warning(disable : 3557) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/VirtualTexturing/Shaders/DownsampleVTFeedback.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/VirtualTexturing/Shaders/DownsampleVTFeedback.compute index 1cdff7dc6ee..1b88c3bd314 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/VirtualTexturing/Shaders/DownsampleVTFeedback.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/VirtualTexturing/Shaders/DownsampleVTFeedback.compute @@ -2,7 +2,7 @@ #pragma kernel KMain #pragma kernel KMainMSAA -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs index b5344370014..bbfb4bbb78b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs @@ -46,7 +46,7 @@ partial class WaterSystem internal const string k_TessellationPass = "Tessellation"; readonly static string[] k_PassesGBuffer = new string[] { k_WaterGBufferPass, k_LowResGBufferPass }; readonly static string[] k_PassesGBufferTessellation = new string[] { k_WaterGBufferPass + k_TessellationPass, k_LowResGBufferPass }; - readonly static string[] k_PassesWaterDebug = new string[] { k_WaterDebugPass + k_TessellationPass, k_WaterDebugPass + k_LowResGBufferPass }; + readonly static string[] k_PassesWaterDebug = new string[] { k_WaterDebugPass, k_WaterDebugPass + k_LowResGBufferPass }; // Other internal rendering data MaterialPropertyBlock m_WaterMaterialPropertyBlock; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/FourierTransform.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/FourierTransform.compute index 55e1a2f3c60..8c385b89c0e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/FourierTransform.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/FourierTransform.compute @@ -18,7 +18,7 @@ // Generic Graphics includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // The set of possible kernels #pragma kernel RowPassTi_256 FFT_PASS_TI=RowPassTi_256 FFT_RESOLUTION=256 BUTTERFLY_COUNT=8 COMPENSATION_FACTOR=1.0 diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/UnderWaterUtilities.hlsl b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/UnderWaterUtilities.hlsl index b197d5c0140..54b8849fd40 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/UnderWaterUtilities.hlsl +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/UnderWaterUtilities.hlsl @@ -62,7 +62,7 @@ bool IsUnderWater(uint2 coord) TEXTURE2D_X(_WaterGBufferTexture0); TEXTURE2D_X(_WaterGBufferTexture1); TEXTURE2D_X(_WaterGBufferTexture2); -TEXTURE2D_X(_WaterGBufferTexture3); +TEXTURE2D_X_FLOAT(_WaterGBufferTexture3); // force high-precision else UnpackSurfaceIndex gives incorrect values on builds defaulting to mediump StructuredBuffer _WaterSurfaceProfiles; uint UnpackSurfaceIndex(uint2 positionSS) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterCaustics.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterCaustics.shader index 73f28a2ac84..68178cc1c35 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterCaustics.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterCaustics.shader @@ -4,7 +4,7 @@ Shader "Hidden/HDRP/WaterCaustics" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDecal.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDecal.shader index 2a004f962c6..7bae3ac0856 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDecal.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDecal.shader @@ -4,7 +4,7 @@ Shader "Hidden/HDRP/WaterDecal" HLSLINCLUDE #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDeformation.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDeformation.compute index a5ce48f8703..f0cf94cc5da 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDeformation.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterDeformation.compute @@ -1,7 +1,7 @@ #pragma kernel FilterDeformation #pragma kernel EvaluateDeformationSurfaceGradient -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterEvaluation.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterEvaluation.compute index 5c82455b59c..ec60888304c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterEvaluation.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterEvaluation.compute @@ -1,6 +1,6 @@ #pragma kernel FindVerticalDisplacements -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterExclusion.shader b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterExclusion.shader index 1e72406e005..15a1952199e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterExclusion.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterExclusion.shader @@ -25,7 +25,7 @@ Shader "Hidden/HDRP/WaterExclusion" HLSLPROGRAM #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ DOTS_INSTANCING_ON // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterFoam.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterFoam.compute index 5b7ec0a1fc4..920bdc29330 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterFoam.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterFoam.compute @@ -1,7 +1,7 @@ #pragma kernel ReprojectFoam #pragma kernel AttenuateFoam -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLighting.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLighting.compute index 733d772c722..372738e7b81 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLighting.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLighting.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma kernel WaterClearIndirect diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLine.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLine.compute index 3c595270ffe..cc40a9a34cf 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLine.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterLine.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 //#pragma enable_d3d11_debug_symbols #pragma kernel ClearWaterLine diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterSimulation.compute b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterSimulation.compute index 369876914b0..b019e9ba502 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterSimulation.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/WaterSimulation.compute @@ -6,7 +6,7 @@ #pragma kernel EvaluateInstanceData EVALUATE_INSTANCE_DATA=EvaluateInstanceData #pragma kernel EvaluateInstanceDataInfinite EVALUATE_INSTANCE_DATA=EvaluateInstanceDataInfinite INFINITE_WATER -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.high-definition/Samples~/ProceduralSky/Runtime/ProceduralSky/Resources/ProceduralSky.shader b/Packages/com.unity.render-pipelines.high-definition/Samples~/ProceduralSky/Runtime/ProceduralSky/Resources/ProceduralSky.shader index c3716367065..4079c363deb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Samples~/ProceduralSky/Runtime/ProceduralSky/Resources/ProceduralSky.shader +++ b/Packages/com.unity.render-pipelines.high-definition/Samples~/ProceduralSky/Runtime/ProceduralSky/Resources/ProceduralSky.shader @@ -11,7 +11,7 @@ Shader "Hidden/HDRP/Sky/ProceduralSky" #pragma editor_sync_compilation #pragma target 4.5 - #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 #pragma multi_compile _ _ENABLE_SUN_DISK diff --git a/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/FurnaceTests.compute b/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/FurnaceTests.compute index d8b47cad886..ef81fffa009 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/FurnaceTests.compute +++ b/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/FurnaceTests.compute @@ -1,7 +1,7 @@ #pragma kernel FurnaceTest #pragma kernel FurnaceTestSampled -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 // #pragma enable_d3d11_debug_symbols diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs index f98c64c2e4a..660a9f08a15 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs @@ -162,7 +162,7 @@ private void ViewBatch(int index) foreach (var obj in batch1.Lights) { - if(obj != null) + if (obj != null) lightBubble1.Add(MakePill(obj)); } @@ -241,7 +241,7 @@ private void CompareBatch(int index1, int index2) lightBubble1.Clear(); foreach (var obj in lightSet1) { - if(obj != null) + if (obj != null) lightBubble1.Add(MakePill(obj)); } @@ -255,7 +255,7 @@ private void CompareBatch(int index1, int index2) lightBubble2.Clear(); foreach (var obj in lightSet2) { - if(obj != null) + if (obj != null) lightBubble2.Add(MakePill(obj)); } @@ -391,7 +391,7 @@ private void OnSelectionChanged() var firstIndex = batchListView.selectedIndices.First(); var secondIndex = batchListView.selectedIndices.Last(); - if(secondIndex > firstIndex + 1 || secondIndex < firstIndex - 1) + if (secondIndex > firstIndex + 1 || secondIndex < firstIndex - 1) { // Clamp since we do adjacent batch comparisons secondIndex = Mathf.Clamp(secondIndex, firstIndex - 1, firstIndex + 1); @@ -408,7 +408,7 @@ private void OnSelectionChanged() default: // Account for multiple select either with shift or ctrl keys - if(batchListView.selectedIndices.Count() > 2) + if (batchListView.selectedIndices.Count() > 2) { if (selectedIndices.Count == 1) { @@ -466,8 +466,12 @@ private bool IsDirty() isDirty |= Light2DManager.GetCachedSortingLayer().Count() != batchList.Sum(x => x.LayerNames.Count()); isDirty |= cachedSceneHandle != SceneManager.GetActiveScene().handle; isDirty |= cachedCamPos != Camera.main?.transform.position; - isDirty |= totalLightCount != lightCullResult.visibleLights.Count(); - isDirty |= totalShadowCount != lightCullResult.visibleShadows.Count(); + + if (lightCullResult.IsGameView()) + { + isDirty |= totalLightCount != lightCullResult.visibleLights.Count(); + isDirty |= totalShadowCount != lightCullResult.visibleShadows.Count(); + } return isDirty; } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs index 55f6d1d92ed..d3c440aabb9 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs @@ -101,7 +101,8 @@ internal static void Place(GameObject go, GameObject parent) static Light2D CreateLight(MenuCommand menuCommand, Light2D.LightType type, Vector3[] shapePath = null) { - GameObject go = ObjectFactory.CreateGameObject("Light 2D", typeof(Light2D)); + var lightName = type != Light2D.LightType.Point ? type.ToString() : "Spot"; + GameObject go = ObjectFactory.CreateGameObject(lightName + " Light 2D", typeof(Light2D)); Light2D light2D = go.GetComponent(); light2D.batchSlotIndex = LightBatch.batchSlotIndex; light2D.lightType = type; diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteLitPass.hlsl b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteLitPass.hlsl index 43bc2140bae..14784130821 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteLitPass.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteLitPass.hlsl @@ -31,6 +31,9 @@ PackedVaryings vert(Attributes input) input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy); output = BuildVaryings(input); output.color *= _RendererColor * unity_SpriteColor; // vertex color has to applied here +#if defined(DEBUG_DISPLAY) + output.normalWS = TransformObjectToWorldNormal(input.normalOS); +#endif PackedVaryings packedOutput = PackVaryings(output); return packedOutput; } @@ -59,10 +62,13 @@ half4 frag(PackedVaryings packedInput) : SV_TARGET #endif SurfaceData2D surfaceData; - InitializeSurfaceData(color.rgb, color.a, surfaceDescription.SpriteMask, surfaceData); + InitializeSurfaceData(color.rgb, color.a, surfaceDescription.SpriteMask, surfaceDescription.NormalTS, surfaceData); InputData2D inputData; InitializeInputData(unpacked.texCoord0.xy, half2(unpacked.screenPosition.xy / unpacked.screenPosition.w), inputData); +#if defined(DEBUG_DISPLAY) SETUP_DEBUG_DATA_2D(inputData, unpacked.positionWS, unpacked.positionCS); + surfaceData.normalWS = unpacked.normalWS; +#endif return CombinedShapeLightShared(surfaceData, inputData); } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteUnlitPass.hlsl b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteUnlitPass.hlsl index 61a7f121823..f97aa179688 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteUnlitPass.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteUnlitPass.hlsl @@ -13,6 +13,9 @@ PackedVaryings vert(Attributes input) input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy); output = BuildVaryings(input); output.color *= _RendererColor * unity_SpriteColor; // vertex color has to applied here +#if defined(DEBUG_DISPLAY) + output.normalWS = TransformObjectToWorldNormal(input.normalOS); +#endif PackedVaryings packedOutput = PackVaryings(output); return packedOutput; } @@ -38,9 +41,13 @@ half4 frag(PackedVaryings packedInput) : SV_TARGET clip(color.a - surfaceDescription.AlphaClipThreshold); #endif - #if defined(DEBUG_DISPLAY) +#if defined(DEBUG_DISPLAY) SurfaceData2D surfaceData; InitializeSurfaceData(color.rgb, color.a, surfaceData); + surfaceData.normalWS = unpacked.normalWS; +#if (SHADERPASS == SHADERPASS_SPRITELIT) + surfaceData.normalTS = surfaceDescription.NormalTS; +#endif InputData2D inputData; InitializeInputData(unpacked.positionWS.xy, half2(unpacked.texCoord0.xy), inputData); half4 debugColor = 0; @@ -51,7 +58,7 @@ half4 frag(PackedVaryings packedInput) : SV_TARGET { return debugColor; } - #endif +#endif // Disable vertex color multiplication. Users can get the color from VertexColor node #if !defined(HAVE_VFX_MODIFICATION) && !defined(_DISABLE_COLOR_TINT) diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs index aae2a514149..eb1794fffeb 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs @@ -210,15 +210,16 @@ static class SpriteLitBlockMasks { BlockFields.SurfaceDescription.BaseColor, BlockFields.SurfaceDescriptionLegacy.SpriteColor, - BlockFields.SurfaceDescription.Alpha, UniversalBlockFields.SurfaceDescription.SpriteMask, + BlockFields.SurfaceDescription.NormalTS, + BlockFields.SurfaceDescription.Alpha, BlockFields.SurfaceDescription.AlphaClipThreshold, }; public static BlockFieldDescriptor[] FragmentNormal = new BlockFieldDescriptor[] { - BlockFields.SurfaceDescription.Alpha, BlockFields.SurfaceDescription.NormalTS, + BlockFields.SurfaceDescription.Alpha, BlockFields.SurfaceDescription.AlphaClipThreshold, }; @@ -241,6 +242,7 @@ static class SpriteLitRequiredFields StructFields.Varyings.positionWS, StructFields.Varyings.texCoord0, StructFields.Varyings.screenPosition, + StructFields.Varyings.normalWS, }; public static FieldCollection Normal = new FieldCollection() diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs index d80389a6914..d6d3425cba4 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs @@ -238,8 +238,9 @@ static class SpriteLitBlockMasks { BlockFields.SurfaceDescription.BaseColor, BlockFields.SurfaceDescriptionLegacy.SpriteColor, - BlockFields.SurfaceDescription.Alpha, UniversalBlockFields.SurfaceDescription.SpriteMask, + BlockFields.SurfaceDescription.NormalTS, + BlockFields.SurfaceDescription.Alpha, BlockFields.SurfaceDescription.AlphaClipThreshold, }; @@ -247,8 +248,8 @@ static class SpriteLitBlockMasks { BlockFields.SurfaceDescription.BaseColor, BlockFields.SurfaceDescriptionLegacy.SpriteColor, - BlockFields.SurfaceDescription.Alpha, BlockFields.SurfaceDescription.NormalTS, + BlockFields.SurfaceDescription.Alpha, BlockFields.SurfaceDescription.AlphaClipThreshold, }; } @@ -263,6 +264,7 @@ static class SpriteLitRequiredFields StructFields.Varyings.positionWS, StructFields.Varyings.texCoord0, StructFields.Varyings.screenPosition, + StructFields.Varyings.normalWS, }; public static FieldCollection Normal = new FieldCollection() diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteUnlitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteUnlitSubTarget.cs index d0007ced61a..04af108cc61 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteUnlitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteUnlitSubTarget.cs @@ -208,6 +208,7 @@ static class SpriteUnlitRequiredFields StructFields.Varyings.positionWS, StructFields.Varyings.color, StructFields.Varyings.texCoord0, + StructFields.Varyings.normalWS, }; } #endregion diff --git a/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/DecalRendererFeatureEditor.cs b/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/DecalRendererFeatureEditor.cs index 620f5be2d3a..ba16ae93864 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/DecalRendererFeatureEditor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/DecalRendererFeatureEditor.cs @@ -45,12 +45,20 @@ public override void OnInspectorGUI() { Init(); + var isGLDevice = SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLCore; + EditorGUILayout.PropertyField(m_Technique, Styles.Technique); DecalTechniqueOption technique = (DecalTechniqueOption)m_Technique.intValue; if (technique == DecalTechniqueOption.DBuffer) { + if (isGLDevice) + { + EditorGUILayout.HelpBox("DBuffer technique is not supported on OpenGL. Decals will not be rendered.", MessageType.Error); + EditorGUILayout.Space(); + } + EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_DBufferSurfaceData, Styles.SurfaceData); EditorGUI.indentLevel--; @@ -64,7 +72,25 @@ public override void OnInspectorGUI() } EditorGUILayout.PropertyField(m_MaxDrawDistance, Styles.MaxDrawDistance); + + if (isGLDevice) + { + if (m_DecalLayers.boolValue) + { + m_DecalLayers.boolValue = false; + serializedObject.ApplyModifiedProperties(); + } + + GUI.enabled = false; + } + EditorGUILayout.PropertyField(m_DecalLayers, Styles.UseRenderingLayers); + + if (isGLDevice) + { + GUI.enabled = true; + EditorGUILayout.HelpBox("Rendering Layers are not supported on OpenGL.", MessageType.Warning); + } } } } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs index 7a485892f31..858934da750 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderBuildPreprocessor.cs @@ -165,11 +165,13 @@ internal sealed class PlatformBuildTimeDetect internal bool isHololens { get; private set; } internal bool isQuest { get; private set; } internal bool isSwitch { get; private set; } + internal bool isSwitch2 { get; private set; } private PlatformBuildTimeDetect() { BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget); isSwitch = buildTargetGroup == BuildTargetGroup.Switch; + isSwitch2 = buildTargetGroup == BuildTargetGroup.Switch2; #if XR_MANAGEMENT_4_0_1_OR_NEWER var buildTargetSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTargetGroup); @@ -279,7 +281,7 @@ private static void GetGlobalAndPlatformSettings(bool isDevelopmentBuild) PlatformBuildTimeDetect platformBuildTimeDetect = PlatformBuildTimeDetect.GetInstance(); bool isShaderAPIMobileDefined = GraphicsSettings.HasShaderDefine(BuiltinShaderDefine.SHADER_API_MOBILE); - if (platformBuildTimeDetect.isSwitch || isShaderAPIMobileDefined) + if (platformBuildTimeDetect.isSwitch || platformBuildTimeDetect.isSwitch2 || isShaderAPIMobileDefined) s_UseSHPerVertexForSHAuto = true; // XR Stripping 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 08ee092892b..b3460eebf15 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 @@ -180,6 +180,8 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera collector.AddFloatProperty(Property.BlendModePreserveSpecular, blendModePreserveSpecular ? 1.0f : 0.0f); collector.AddFloatProperty(Property.SrcBlend, 1.0f); // always set by material inspector, ok to have incorrect values here collector.AddFloatProperty(Property.DstBlend, 0.0f); // always set by material inspector, ok to have incorrect values here + collector.AddFloatProperty(Property.SrcBlendAlpha, 1.0f); // always set by material inspector, ok to have incorrect values here + collector.AddFloatProperty(Property.DstBlendAlpha, 0.0f); // always set by material inspector, ok to have incorrect values here collector.AddToggleProperty(Property.ZWrite, (target.surfaceType == SurfaceType.Opaque)); collector.AddFloatProperty(Property.ZWriteControl, (float)target.zWriteControl); collector.AddFloatProperty(Property.ZTest, (float)target.zTestMode); // ztest mode is designed to directly pass as ztest diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSixWaySubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSixWaySubTarget.cs index b5e982b02b1..b9acdc4ae5d 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSixWaySubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSixWaySubTarget.cs @@ -1,4 +1,4 @@ -using System; +using System; using UnityEngine; using UnityEditor.ShaderGraph; using UnityEngine.UIElements; @@ -151,6 +151,8 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera collector.AddFloatProperty(Property.AlphaClip, target.alphaClip ? 1.0f : 0.0f); collector.AddFloatProperty(Property.SrcBlend, 1.0f); // always set by material inspector, ok to have incorrect values here collector.AddFloatProperty(Property.DstBlend, 0.0f); // always set by material inspector, ok to have incorrect values here + collector.AddFloatProperty(Property.SrcBlendAlpha, 1.0f); // always set by material inspector, ok to have incorrect values here + collector.AddFloatProperty(Property.DstBlendAlpha, 0.0f); // always set by material inspector, ok to have incorrect values here collector.AddToggleProperty(Property.ZWrite, (target.surfaceType == SurfaceType.Opaque)); collector.AddFloatProperty(Property.ZWriteControl, (float)target.zWriteControl); collector.AddFloatProperty(Property.ZTest, (float)target.zTestMode); // ztest mode is designed to directly pass as ztest diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSubTarget.cs index 3511f5a7c97..423e1f828be 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalSubTarget.cs @@ -76,7 +76,7 @@ public virtual ScriptableObject GetMetadataObject(GraphDataReadOnly graphData) urpMetadata.hasVertexModificationInMotionVector = false; } - urpMetadata.isVFXCompatible = graphData.IsVFXCompatible(); + urpMetadata.isVFXCompatible = target.SupportsVFX(); return urpMetadata; } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs index a621a53c578..26ac3ed4a64 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs @@ -1426,6 +1426,8 @@ public static class Uniforms { public static readonly string srcBlend = "[" + Property.SrcBlend + "]"; public static readonly string dstBlend = "[" + Property.DstBlend + "]"; + public static readonly string srcBlendAlpha = "[" + Property.SrcBlendAlpha + "]"; + public static readonly string dstBlendAlpha = "[" + Property.DstBlendAlpha + "]"; public static readonly string cullMode = "[" + Property.CullMode + "]"; public static readonly string zWrite = "[" + Property.ZWrite + "]"; public static readonly string zTest = "[" + Property.ZTest + "]"; @@ -1467,7 +1469,7 @@ public static RenderStateCollection UberSwitchedRenderState(UniversalTarget targ RenderState.ZTest(Uniforms.zTest), RenderState.ZWrite(Uniforms.zWrite), RenderState.Cull(Uniforms.cullMode), - RenderState.Blend(Uniforms.srcBlend, Uniforms.dstBlend), + RenderState.Blend(Uniforms.srcBlend, Uniforms.dstBlend, Uniforms.srcBlendAlpha, Uniforms.dstBlendAlpha), }; } else diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUnlitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUnlitSubTarget.cs index 5a5c5120713..b4997c4c8a6 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUnlitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUnlitSubTarget.cs @@ -93,6 +93,8 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera collector.AddFloatProperty(Property.AlphaClip, target.alphaClip ? 1.0f : 0.0f); collector.AddFloatProperty(Property.SrcBlend, 1.0f); // always set by material inspector collector.AddFloatProperty(Property.DstBlend, 0.0f); // always set by material inspector + collector.AddFloatProperty(Property.SrcBlendAlpha, 1.0f); // always set by material inspector, ok to have incorrect values here + collector.AddFloatProperty(Property.DstBlendAlpha, 0.0f); // always set by material inspector, ok to have incorrect values here collector.AddToggleProperty(Property.ZWrite, (target.surfaceType == SurfaceType.Opaque)); collector.AddFloatProperty(Property.ZWriteControl, (float)target.zWriteControl); collector.AddFloatProperty(Property.ZTest, (float)target.zTestMode); // ztest mode is designed to directly pass as ztest diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Renderer2D.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Renderer2D.cs index ad8d8fcdb99..633d79d2fe7 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Renderer2D.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Renderer2D.cs @@ -6,11 +6,6 @@ namespace UnityEngine.Rendering.Universal { internal sealed partial class Renderer2D : ScriptableRenderer { - #if UNITY_SWITCH || UNITY_EMBEDDED_LINUX || UNITY_QNX || UNITY_ANDROID - const GraphicsFormat k_DepthStencilFormat = GraphicsFormat.D24_UNorm_S8_UInt; - #else - const GraphicsFormat k_DepthStencilFormat = GraphicsFormat.D32_SFloat_S8_UInt; - #endif const int k_FinalBlitPassQueueOffset = 1; const int k_AfterFinalBlitPassQueueOffset = k_FinalBlitPassQueueOffset + 1; @@ -244,7 +239,7 @@ void CreateRenderTextures( { var depthDescriptor = cameraTargetDescriptor; depthDescriptor.colorFormat = RenderTextureFormat.Depth; - depthDescriptor.depthStencilFormat = k_DepthStencilFormat; + depthDescriptor.depthStencilFormat = CoreUtils.GetDefaultDepthStencilFormat(); if (!cameraData.resolveFinalTarget && m_UseDepthStencilBuffer) depthDescriptor.bindMS = depthDescriptor.msaaSamples > 1 && !SystemInfo.supportsMultisampleAutoResolve && (SystemInfo.supportsMultisampledTextures != 0); RenderingUtils.ReAllocateHandleIfNeeded(ref m_DepthTextureHandle, depthDescriptor, FilterMode.Point, wrapMode: TextureWrapMode.Clamp, name: "_CameraDepthAttachment"); @@ -315,7 +310,7 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re RenderingUtils.ReAllocateHandleIfNeeded(ref DebugHandler.DebugScreenColorHandle, descriptor, name: "_DebugScreenColor"); RenderTextureDescriptor depthDesc = cameraData.cameraTargetDescriptor; - DebugHandler.ConfigureDepthDescriptorForDebugScreen(ref depthDesc, k_DepthStencilFormat, cameraData.pixelWidth, cameraData.pixelHeight); + DebugHandler.ConfigureDepthDescriptorForDebugScreen(ref depthDesc, CoreUtils.GetDefaultDepthStencilFormat(), cameraData.pixelWidth, cameraData.pixelHeight); RenderingUtils.ReAllocateHandleIfNeeded(ref DebugHandler.DebugScreenDepthHandle, depthDesc, name: "_DebugScreenDepth"); } @@ -396,7 +391,7 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re bool outputToHDR = cameraData.isHDROutputActive; if (shouldRenderUI && outputToHDR) { - m_DrawOffscreenUIPass.Setup(cameraData, k_DepthStencilFormat); + m_DrawOffscreenUIPass.Setup(cameraData, CoreUtils.GetDefaultDepthStencilFormat()); EnqueuePass(m_DrawOffscreenUIPass); } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs index 0f45be3b704..48a3a84a14e 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs @@ -225,9 +225,22 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData { Universal2DResourceData universal2DResourceData = frameData.Get(); CommonResourceData commonResourceData = frameData.Get(); + UniversalCameraData cameraData = frameData.Get(); + + DebugHandler debugHandler = ScriptableRenderPass.GetActiveDebugHandler(cameraData); + var isDebugLightingActive = debugHandler?.IsLightingActive ?? true; + +#if UNITY_EDITOR + if (cameraData.isSceneViewCamera && UnityEditor.SceneView.currentDrawingSceneView != null) + isDebugLightingActive &= UnityEditor.SceneView.currentDrawingSceneView.sceneLighting; + + if (cameraData.camera.cameraType == CameraType.Preview) + isDebugLightingActive = false; +#endif if (!layerBatch.lightStats.useLights || - isVolumetric && !layerBatch.lightStats.useVolumetricLights) + isVolumetric && !layerBatch.lightStats.useVolumetricLights || + !isDebugLightingActive) return; // OpenGL has a bug with MRTs - support single RTs by using low level pass diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs index 6c92f097b81..b9005f923c4 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs @@ -54,8 +54,15 @@ private static void Execute(RasterGraphContext context, PassData passData) } } - // Draw all renderers in layer batch - cmd.DrawRendererList(passData.rendererList); + if (passData.activeDebugHandler) + { + passData.debugRendererLists.DrawWithRendererList(cmd); + } + else + { + // Draw all renderers in layer batch + cmd.DrawRendererList(passData.rendererList); + } RendererLighting.DisableAllKeywords(cmd); } @@ -74,6 +81,8 @@ class PassData internal bool layerUseLights; internal TextureHandle[] lightTextures; internal RendererListHandle rendererList; + internal DebugRendererLists debugRendererLists; + internal bool activeDebugHandler; #if UNITY_EDITOR internal bool isLitView; // Required for prefab view and preview camera @@ -141,9 +150,22 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData RendererLighting.GetTransparencySortingMode(rendererData, cameraData.camera, ref sortSettings); drawSettings.sortingSettings = sortSettings; - var param = new RendererListParams(renderingData.cullResults, drawSettings, filterSettings); - passData.rendererList = graph.CreateRendererList(param); - builder.UseRendererList(passData.rendererList); + var activeDebugHandler = GetActiveDebugHandler(cameraData); + passData.activeDebugHandler = activeDebugHandler != null; + + if (activeDebugHandler != null) + { + var renderStateBlock = new RenderStateBlock(RenderStateMask.Nothing); + passData.debugRendererLists = activeDebugHandler.CreateRendererListsWithDebugRenderState(graph, + ref renderingData.cullResults, ref drawSettings, ref filterSettings, ref renderStateBlock); + passData.debugRendererLists.PrepareRendererListForRasterPass(builder); + } + else + { + var param = new RendererListParams(renderingData.cullResults, drawSettings, filterSettings); + passData.rendererList = graph.CreateRendererList(param); + builder.UseRendererList(passData.rendererList); + } if (passData.layerUseLights) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/Renderer2DRendergraph.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/Renderer2DRendergraph.cs index 69af2a14b9f..45474504221 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/Renderer2DRendergraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/Renderer2DRendergraph.cs @@ -99,6 +99,7 @@ ImportResourceSummary GetImportResourceSummary(RenderGraph renderGraph, Universa { clearColor = true; clearDepth = true; + debugHandler.TryGetScreenClearColor(ref cameraBackgroundColor); } output.cameraColorParams.clearOnFirstUse = clearColor; @@ -325,7 +326,7 @@ void CreateResources(RenderGraph renderGraph) m_CopyDepthPass.m_CopyResolvedDepth = !depthDescriptor.bindMS; depthDescriptor.graphicsFormat = GraphicsFormat.None; - depthDescriptor.depthStencilFormat = k_DepthStencilFormat; + depthDescriptor.depthStencilFormat = CoreUtils.GetDefaultDepthStencilFormat(); RenderingUtils.ReAllocateHandleIfNeeded(ref m_RenderGraphCameraDepthHandle, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepthAttachment"); commonResourceData.activeDepthID = ActiveID.Camera; @@ -423,7 +424,7 @@ void CreateCameraNormalsTextures(RenderGraph renderGraph, RenderTextureDescripto normalsDepthDesc.graphicsFormat = GraphicsFormat.None; normalsDepthDesc.autoGenerateMips = false; normalsDepthDesc.msaaSamples = descriptor.msaaSamples; - normalsDepthDesc.depthStencilFormat = k_DepthStencilFormat; + normalsDepthDesc.depthStencilFormat = CoreUtils.GetDefaultDepthStencilFormat(); resourceData.normalsDepth = UniversalRenderer.CreateRenderGraphTexture(renderGraph, normalsDepthDesc, "_NormalDepth", false, FilterMode.Bilinear); } @@ -470,7 +471,7 @@ void CreateShadowTextures(RenderGraph renderGraph, int width, int height) var shadowDepthDesc = new RenderTextureDescriptor(width, height); shadowDepthDesc.graphicsFormat = GraphicsFormat.None; shadowDepthDesc.autoGenerateMips = false; - shadowDepthDesc.depthStencilFormat = k_DepthStencilFormat; + shadowDepthDesc.depthStencilFormat = CoreUtils.GetDefaultDepthStencilFormat(); resourceData.shadowDepth = UniversalRenderer.CreateRenderGraphTexture(renderGraph, shadowDepthDesc, "_ShadowDepth", false, FilterMode.Bilinear); } @@ -668,7 +669,7 @@ private void OnMainRendering(RenderGraph renderGraph) if (shouldRenderUI && outputToHDR) { TextureHandle overlayUI; - m_DrawOffscreenUIPass.RenderOffscreen(renderGraph, frameData, k_DepthStencilFormat, out overlayUI); + m_DrawOffscreenUIPass.RenderOffscreen(renderGraph, frameData, CoreUtils.GetDefaultDepthStencilFormat(), out overlayUI); commonResourceData.overlayUITexture = overlayUI; } } @@ -696,7 +697,7 @@ private void OnAfterRendering(RenderGraph renderGraph) commonResourceData.debugScreenColor = UniversalRenderer.CreateRenderGraphTexture(renderGraph, colorDesc, "_DebugScreenColor", false); RenderTextureDescriptor depthDesc = cameraData.cameraTargetDescriptor; - DebugHandler.ConfigureDepthDescriptorForDebugScreen(ref depthDesc, k_DepthStencilFormat, cameraData.pixelWidth, cameraData.pixelHeight); + DebugHandler.ConfigureDepthDescriptorForDebugScreen(ref depthDesc, CoreUtils.GetDefaultDepthStencilFormat(), cameraData.pixelWidth, cameraData.pixelHeight); commonResourceData.debugScreenDepth = UniversalRenderer.CreateRenderGraphTexture(renderGraph, depthDesc, "_DebugScreenDepth", false); } @@ -817,11 +818,14 @@ private void OnAfterRendering(RenderGraph renderGraph) // If HDR debug views are enabled, DebugHandler will perform the blit from debugScreenColor (== finalColorHandle) to backBufferColor. DebugHandler?.Render(renderGraph, cameraData, finalColorHandle, commonResourceData.overlayUITexture, commonResourceData.backBufferColor); - if (cameraData.isSceneViewCamera) - DrawRenderGraphWireOverlay(renderGraph, frameData, commonResourceData.backBufferColor); + if (cameraData.resolveFinalTarget) + { + if (cameraData.isSceneViewCamera) + DrawRenderGraphWireOverlay(renderGraph, frameData, commonResourceData.backBufferColor); - if (drawGizmos) - DrawRenderGraphGizmos(renderGraph, frameData, commonResourceData.activeColorTexture, commonResourceData.activeDepthTexture, GizmoSubset.PostImageEffects); + if (drawGizmos) + DrawRenderGraphGizmos(renderGraph, frameData, commonResourceData.activeColorTexture, commonResourceData.activeDepthTexture, GizmoSubset.PostImageEffects); + } } private void CleanupRenderGraphResources() diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs index f739bec90be..a02994c9427 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs @@ -235,6 +235,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer TextureHandle depthTarget = resourceData.dBufferDepth.IsValid() ? resourceData.dBufferDepth : resourceData.activeDepthTexture; + TextureHandle renderingLayersTexture = resourceData.renderingLayersTexture; + using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { InitPassData(ref passData); @@ -278,8 +280,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.UseTexture(cameraDepthTexture, AccessFlags.Read); if (cameraNormalsTexture.IsValid()) builder.UseTexture(cameraNormalsTexture, AccessFlags.Read); - if (passData.decalLayers) - builder.UseTexture(resourceData.renderingLayersTexture, AccessFlags.Read); + if (passData.decalLayers && renderingLayersTexture.IsValid()) + builder.UseTexture(renderingLayersTexture, AccessFlags.Read); if (resourceData.ssaoTexture.IsValid()) builder.UseGlobalTexture(s_SSAOTextureID); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs index 857185bb531..9f292956923 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs @@ -163,6 +163,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer { UniversalResourceData resourceData = frameData.Get(); TextureHandle cameraDepthTexture = resourceData.cameraDepthTexture; + TextureHandle renderingLayersTexture = resourceData.renderingLayersTexture; using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { @@ -189,8 +190,13 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer if (m_DecalLayers && resourceData.gBuffer[5].IsValid()) builder.SetInputAttachment(resourceData.gBuffer[5], 1, AccessFlags.Read); } - else if (cameraDepthTexture.IsValid()) - builder.UseTexture(cameraDepthTexture, AccessFlags.Read); + else + { + if (cameraDepthTexture.IsValid()) + builder.UseTexture(cameraDepthTexture, AccessFlags.Read); + if(m_DecalLayers && renderingLayersTexture.IsValid()) + builder.UseTexture(renderingLayersTexture, AccessFlags.Read); + } SortingCriteria sortingCriteria = passData.cameraData.defaultOpaqueSortFlags; DrawingSettings drawingSettings = RenderingUtils.CreateDrawingSettings(m_ShaderTagIdList, renderingData, diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs index 02b55483404..ae1c1856558 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs @@ -109,6 +109,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer UniversalResourceData resourceData = frameData.Get(); TextureHandle cameraDepthTexture = resourceData.cameraDepthTexture; + TextureHandle renderingLayersTexture = resourceData.renderingLayersTexture; using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { @@ -129,6 +130,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer if (cameraDepthTexture.IsValid()) builder.UseTexture(cameraDepthTexture, AccessFlags.Read); + if (passData.decalLayers && renderingLayersTexture.IsValid()) + builder.UseTexture(renderingLayersTexture, AccessFlags.Read); + builder.AllowGlobalStateModification(true); builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalCameraData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalCameraData.cs index 30266a552fa..724fba94e0b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalCameraData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalCameraData.cs @@ -158,7 +158,7 @@ public Matrix4x4 GetGPUProjectionMatrixNoJitter(int viewIndex = 0) internal Matrix4x4 GetGPUProjectionMatrix(bool renderIntoTexture, int viewIndex = 0) { - return m_JitterMatrix * GL.GetGPUProjectionMatrix(GetProjectionMatrix(viewIndex), renderIntoTexture); + return GL.GetGPUProjectionMatrix(GetProjectionMatrix(viewIndex), renderIntoTexture); } /// diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs index a323002cbd1..94b62b49ac8 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs @@ -292,7 +292,9 @@ internal DecalTechnique GetTechnique(bool isDeferred, bool needsGBufferAccurateN switch (m_Settings.technique) { case DecalTechniqueOption.Automatic: - if (IsAutomaticDBuffer() || isDeferred && needsGBufferAccurateNormals) + if (isGLDevice) + technique = isDeferred ? DecalTechnique.GBuffer : DecalTechnique.ScreenSpace; + else if (IsAutomaticDBuffer() || isDeferred && needsGBufferAccurateNormals) technique = DecalTechnique.DBuffer; else if (isDeferred) technique = DecalTechnique.GBuffer; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs index 66964f25a3f..e825bef9ff8 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs @@ -1550,6 +1550,7 @@ internal static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera cam { desc = new RenderTextureDescriptor(cameraData.scaledWidth, cameraData.scaledHeight); desc.graphicsFormat = MakeRenderTextureGraphicsFormat(isHdrEnabled, requestHDRColorBufferPrecision, needsAlpha); + desc.depthBufferBits = (int)CoreUtils.GetDefaultDepthBufferBits(); desc.depthStencilFormat = SystemInfo.GetGraphicsFormat(DefaultFormat.DepthStencil); desc.msaaSamples = msaaSamples; desc.sRGB = (QualitySettings.activeColorSpace == ColorSpace.Linear); @@ -1967,6 +1968,7 @@ internal static void Initialize() isXRMobile = isRunningMobile; isShaderAPIMobileDefined = GraphicsSettings.HasShaderDefine(BuiltinShaderDefine.SHADER_API_MOBILE); isSwitch = Application.platform == RuntimePlatform.Switch; + isSwitch2 = Application.platform == RuntimePlatform.Switch2; } #if ENABLE_VR && ENABLE_VR_MODULE @@ -2007,6 +2009,8 @@ private static bool IsRunningXRMobile() /// internal static bool isSwitch { get; private set; } = false; + internal static bool isSwitch2 { get; private set; } = false; + /// /// Gives the SH evaluation mode when set to automatically detect. /// @@ -2016,7 +2020,7 @@ internal static ShEvalMode ShAutoDetect(ShEvalMode mode) { if (mode == ShEvalMode.Auto) { - if (isXRMobile || isShaderAPIMobileDefined || isSwitch) + if (isXRMobile || isShaderAPIMobileDefined || isSwitch || isSwitch2) return ShEvalMode.PerVertex; else return ShEvalMode.PerPixel; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index 47123aa8366..0da0636a2b6 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -39,11 +39,6 @@ public enum DepthPrimingMode /// public sealed partial class UniversalRenderer : ScriptableRenderer { -#if UNITY_SWITCH || UNITY_ANDROID || UNITY_EMBEDDED_LINUX || UNITY_QNX - const GraphicsFormat k_DepthStencilFormatDefault = GraphicsFormat.D24_UNorm_S8_UInt; -#else - const GraphicsFormat k_DepthStencilFormatDefault = GraphicsFormat.D32_SFloat_S8_UInt; - #endif const int k_FinalBlitPassQueueOffset = 1; const int k_AfterFinalBlitPassQueueOffset = k_FinalBlitPassQueueOffset + 1; @@ -188,8 +183,8 @@ protected internal override bool SupportsCameraNormals() internal LayerMask transparentLayerMask { get; set; } internal bool shadowTransparentReceive { get; set; } - internal GraphicsFormat cameraDepthTextureFormat { get => (m_CameraDepthTextureFormat != DepthFormat.Default) ? (GraphicsFormat)m_CameraDepthTextureFormat : k_DepthStencilFormatDefault; } - internal GraphicsFormat cameraDepthAttachmentFormat { get => (m_CameraDepthAttachmentFormat != DepthFormat.Default) ? (GraphicsFormat)m_CameraDepthAttachmentFormat : k_DepthStencilFormatDefault; } + internal GraphicsFormat cameraDepthTextureFormat { get => (m_CameraDepthTextureFormat != DepthFormat.Default) ? (GraphicsFormat)m_CameraDepthTextureFormat : CoreUtils.GetDefaultDepthStencilFormat(); } + internal GraphicsFormat cameraDepthAttachmentFormat { get => (m_CameraDepthAttachmentFormat != DepthFormat.Default) ? (GraphicsFormat)m_CameraDepthAttachmentFormat : CoreUtils.GetDefaultDepthStencilFormat(); } /// /// Constructor for the Universal Renderer. diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl index 761386188bf..65a7d29289e 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl @@ -21,7 +21,7 @@ #if UNITY_REVERSED_Z // TODO: workaround. There's a bug where SHADER_API_GL_CORE gets erroneously defined on switch. - #if (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_GLES3) + #if (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2)) || defined(SHADER_API_GLES3) //GL with reversed z => z clip range is [near, -far] -> remapping to [0, far] #define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) max((coord - _ProjectionParams.y)/(-_ProjectionParams.z-_ProjectionParams.y)*_ProjectionParams.z, 0) #else diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl index e3d6621f069..7150bfe4032 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl @@ -39,7 +39,7 @@ bool CalculateDebugColorMaterialSettings(in SurfaceData2D surfaceData, in InputD case DEBUGMATERIALMODE_ALBEDO: { - debugColor = half4(surfaceData.albedo, 1); + debugColor = half4(surfaceData.albedo, surfaceData.alpha); return true; } @@ -55,10 +55,15 @@ bool CalculateDebugColorMaterialSettings(in SurfaceData2D surfaceData, in InputD return true; } - case DEBUGMATERIALMODE_NORMAL_TANGENT_SPACE: case DEBUGMATERIALMODE_NORMAL_WORLD_SPACE: { - debugColor = half4(surfaceData.normalTS, 1); + debugColor = half4(surfaceData.normalWS * 0.5 + 0.5, surfaceData.alpha); + return true; + } + + case DEBUGMATERIALMODE_NORMAL_TANGENT_SPACE: + { + debugColor = half4(surfaceData.normalTS * 0.5 + 0.5, surfaceData.alpha); return true; } diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl index 51980f231c1..c33b4ecf25f 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl @@ -18,7 +18,7 @@ #if defined(SHADER_API_MOBILE) && defined(SHADER_API_GLES30) #define MAX_VISIBLE_LIGHTS MAX_VISIBLE_LIGHT_COUNT_LOW_END_MOBILE // WebGPU's minimal limits are based on mobile rather than desktop, so it will need to assume mobile. -#elif defined(SHADER_API_MOBILE) || (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_GLES3) || defined(SHADER_API_WEBGPU) // Workaround because SHADER_API_GLCORE is also defined when SHADER_API_SWITCH is +#elif defined(SHADER_API_MOBILE) || (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2)) || defined(SHADER_API_GLES3) || defined(SHADER_API_WEBGPU) // Workaround because SHADER_API_GLCORE is also defined when SHADER_API_SWITCH is #define MAX_VISIBLE_LIGHTS MAX_VISIBLE_LIGHT_COUNT_MOBILE #else #define MAX_VISIBLE_LIGHTS MAX_VISIBLE_LIGHT_COUNT_DESKTOP @@ -163,7 +163,7 @@ StructuredBuffer _AdditionalLightsBuffer; StructuredBuffer _AdditionalLightsIndices; #else // GLES3 causes a performance regression in some devices when using CBUFFER. -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_START(AdditionalLights) #endif float4 _AdditionalLightsPosition[MAX_VISIBLE_LIGHTS]; @@ -173,7 +173,7 @@ half4 _AdditionalLightsAttenuation[MAX_VISIBLE_LIGHTS]; half4 _AdditionalLightsSpotDir[MAX_VISIBLE_LIGHTS]; half4 _AdditionalLightsOcclusionProbes[MAX_VISIBLE_LIGHTS]; float _AdditionalLightsLayerMasks[MAX_VISIBLE_LIGHTS]; // we want uint[] but Unity api does not support it. -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_END #endif #endif @@ -193,14 +193,14 @@ float urp_ReflProbes_Count; // 2023.3 Deprecated. This is for backwards compatibility. Remove in the future. #define samplerurp_ReflProbes_Atlas sampler_LinearClamp -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_START(urp_ReflectionProbeBuffer) #endif float4 urp_ReflProbes_BoxMax[MAX_REFLECTION_PROBES]; // w contains the blend distance float4 urp_ReflProbes_BoxMin[MAX_REFLECTION_PROBES]; // w contains the importance float4 urp_ReflProbes_ProbePosition[MAX_REFLECTION_PROBES]; // w is positive for box projection, |w| is max mip level float4 urp_ReflProbes_MipScaleOffset[MAX_REFLECTION_PROBES * 7]; -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_END #endif diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/LightCookie/LightCookieInput.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/LightCookie/LightCookieInput.hlsl index 3d29e8b73a4..7f79825ddc5 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/LightCookie/LightCookieInput.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/LightCookie/LightCookieInput.hlsl @@ -13,7 +13,7 @@ SAMPLER(sampler_MainLightCookieTexture); // Buffers // GLES3 causes a performance regression in some devices when using CBUFFER. -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_START(LightCookies) #endif float4x4 _MainLightWorldToLight; @@ -25,7 +25,7 @@ CBUFFER_START(LightCookies) float4 _AdditionalLightsCookieAtlasUVRects[MAX_VISIBLE_LIGHTS]; // (xy: uv size, zw: uv offset) float _AdditionalLightsLightTypes[MAX_VISIBLE_LIGHTS]; #endif -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_END #endif diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl index 98f61aaae2e..85d27e6db12 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl @@ -38,7 +38,7 @@ half3 ReconstructNormalDerivative(float2 positionSS) float3 viewSpacePos = ViewSpacePosAtPixelPosition(positionSS); float3 hDeriv = ddy(viewSpacePos); float3 vDeriv = ddx(viewSpacePos); - return half3(normalize(cross(hDeriv, vDeriv))); + return half3(SafeNormalize(cross(hDeriv, vDeriv))); } // Taken from https://gist.github.com/bgolus/a07ed65602c009d5e2f753826e8078a0 diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl index a5b9c495baf..585feef6f5c 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl @@ -5,6 +5,7 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Shadow/ShadowSamplingTent.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GlobalSamplers.hlsl" #include "Core.hlsl" +#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl" #include "Shadows.deprecated.hlsl" #define MAX_SHADOW_CASCADES 4 @@ -60,7 +61,7 @@ TEXTURE2D_SHADOW(_AdditionalLightsShadowmapTexture); SAMPLER_CMP(sampler_LinearClampCompare); // GLES3 causes a performance regression in some devices when using CBUFFER. -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_START(LightShadows) #endif @@ -95,7 +96,7 @@ float4x4 _AdditionalLightsWorldToShadow[MAX_VISIBLE_LIGHTS]; // Per-shadow-s #endif #endif -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_END #endif diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl index 72c29f3b976..dadf1329d45 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl @@ -9,7 +9,7 @@ #define UNITY_STEREO_INSTANCING_ENABLED #endif -#if defined(STEREO_MULTIVIEW_ON) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_VULKAN)) && !(defined(SHADER_API_SWITCH)) +#if defined(STEREO_MULTIVIEW_ON) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_VULKAN)) && !(defined(SHADER_API_SWITCH)) && !(defined(SHADER_API_SWITCH2)) #define UNITY_STEREO_MULTIVIEW_ENABLED #endif diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl index a2c951b3d7b..281c14cd649 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl @@ -13,6 +13,4 @@ half4 NormalsRenderingShared(half4 color, half3 normalTS, half3 tangent, half3 b return normalColor; } - - #endif diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl index 1dc12b7c649..8d7e8095851 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl @@ -8,6 +8,9 @@ struct SurfaceData2D half alpha; half4 mask; half3 normalTS; +#if defined(DEBUG_DISPLAY) + half3 normalWS; +#endif }; void InitializeSurfaceData(half3 albedo, half alpha, half4 mask, half3 normalTS, out SurfaceData2D surfaceData) diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Shadow2D-Unshadow-Geometry.shader b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Shadow2D-Unshadow-Geometry.shader index 746f6e11c37..955027c74fb 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Shadow2D-Unshadow-Geometry.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Shadow2D-Unshadow-Geometry.shader @@ -18,8 +18,6 @@ Shader "Hidden/Shadow2DUnshadowGeometry" } Cull Off - Blend SrcColor Zero - BlendOp Add ZWrite Off ZTest Always diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader index c131a618303..a655580f63a 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader @@ -44,6 +44,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" float3 positionOS : POSITION; float4 color : COLOR; float2 uv : TEXCOORD0; + float3 normal : NORMAL; UNITY_SKINNED_VERTEX_INPUTS UNITY_VERTEX_INPUT_INSTANCE_ID }; @@ -56,6 +57,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" half2 lightingUV : TEXCOORD1; #if defined(DEBUG_DISPLAY) float3 positionWS : TEXCOORD2; + half3 normalWS : TEXCOORD3; #endif UNITY_VERTEX_OUTPUT_STEREO }; @@ -70,6 +72,9 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" TEXTURE2D(_MaskTex); SAMPLER(sampler_MaskTex); + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + // NOTE: Do not ifdef the properties here as SRP batcher can not handle different layouts. CBUFFER_START(UnityPerMaterial) half4 _Color; @@ -103,6 +108,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" o.positionCS = TransformObjectToHClip(v.positionOS); #if defined(DEBUG_DISPLAY) o.positionWS = TransformObjectToWorld(v.positionOS); + o.normalWS = TransformObjectToWorldDir(v.normal); #endif o.uv = v.uv; o.lightingUV = half2(ComputeScreenPos(o.positionCS / o.positionCS.w).xy); @@ -117,13 +123,18 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" { const half4 main = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); const half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv); + const half3 normalTS = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, i.uv)); + SurfaceData2D surfaceData; InputData2D inputData; - InitializeSurfaceData(main.rgb, main.a, mask, surfaceData); + InitializeSurfaceData(main.rgb, main.a, mask, normalTS, surfaceData); InitializeInputData(i.uv, i.lightingUV, inputData); +#if defined(DEBUG_DISPLAY) SETUP_DEBUG_TEXTURE_DATA_2D_NO_TS(inputData, i.positionWS, i.positionCS, _MainTex); + surfaceData.normalWS = i.normalWS; +#endif return CombinedShapeLightShared(surfaceData, inputData); } @@ -169,6 +180,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex); + TEXTURE2D(_NormalMap); SAMPLER(sampler_NormalMap); diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Unlit-Default.shader b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Unlit-Default.shader index 3ead730de7f..b332b4f1177 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Unlit-Default.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Unlit-Default.shader @@ -46,6 +46,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Unlit-Default" float3 positionOS : POSITION; float4 color : COLOR; float2 uv : TEXCOORD0; + float3 normal : NORMAL; UNITY_SKINNED_VERTEX_INPUTS UNITY_VERTEX_INPUT_INSTANCE_ID }; @@ -57,6 +58,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Unlit-Default" float2 uv : TEXCOORD0; #if defined(DEBUG_DISPLAY) float3 positionWS : TEXCOORD2; + half3 normalWS : TEXCOORD3; #endif UNITY_VERTEX_OUTPUT_STEREO }; @@ -82,6 +84,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Unlit-Default" o.positionCS = TransformObjectToHClip(v.positionOS); #if defined(DEBUG_DISPLAY) o.positionWS = TransformObjectToWorld(v.positionOS); + o.normalWS = TransformObjectToWorldDir(v.normal); #endif o.uv = v.uv; o.color = v.color * _Color * unity_SpriteColor; @@ -100,6 +103,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Unlit-Default" InitializeSurfaceData(mainTex.rgb, mainTex.a, surfaceData); InitializeInputData(i.uv, inputData); SETUP_DEBUG_TEXTURE_DATA_2D_NO_TS(inputData, i.positionWS, i.positionCS, _MainTex); + surfaceData.normalWS = i.normalWS; if(CanDebugOverrideOutputColor(surfaceData, inputData, debugColor)) { diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader index 9bf48568ed6..c2eedb0360d 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader @@ -282,6 +282,7 @@ Shader "Universal Render Pipeline/Complex Lit" #pragma multi_compile_fragment _ _SHADOWS_SOFT #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" // ------------------------------------- diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader index 9428527cbce..50beea499b1 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader @@ -279,6 +279,7 @@ Shader "Universal Render Pipeline/Lit" #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" // ------------------------------------- diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader index d58791e6cec..7906f65e908 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader @@ -153,6 +153,7 @@ Shader "Universal Render Pipeline/Nature/SpeedTree7" #pragma multi_compile LOD_FADE_PERCENTAGE #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader index 64cbed64bcc..8997d7141ae 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader @@ -144,6 +144,7 @@ Shader "Universal Render Pipeline/Nature/SpeedTree8" #pragma multi_compile LOD_FADE_PERCENTAGE #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader index fcd049e3edd..f79948e5f2d 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader @@ -219,6 +219,7 @@ Shader "Universal Render Pipeline/Particles/Lit" #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX // ------------------------------------- // Unity defined keywords diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader index 9ff45ff4a30..9da8c89cea6 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader @@ -223,6 +223,7 @@ Shader "Universal Render Pipeline/Particles/Simple Lit" #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" // ------------------------------------- diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl b/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl index 8417e334182..961c86d2721 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl @@ -19,7 +19,7 @@ // On all other platforms we could basically get away with preset 15 which has slightly better edge quality. // Tweakable params (can be changed to get different performance and quality tradeoffs) -#if SHADER_API_PS5 && defined(HDR_INPUT) +#if (SHADER_API_PS5 || SHADER_API_SWITCH2) && defined(HDR_INPUT) // The console implementation does not generate artefacts when the input pixels are in nits (monitor HDR range). #define FXAA_PC 0 #else diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/SubpixelMorphologicalAntialiasing.hlsl b/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/SubpixelMorphologicalAntialiasing.hlsl index fa4786e22fe..1e8ae0af1bf 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/SubpixelMorphologicalAntialiasing.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/SubpixelMorphologicalAntialiasing.hlsl @@ -747,7 +747,9 @@ float2 SMAALumaEdgeDetectionPS(float2 texcoord, float finalDelta = max(maxDelta.x, maxDelta.y); // Local contrast adaptation: -#if !defined(SHADER_API_GLCORE) || defined(SHADER_API_SWITCH) // TODO: Bug workaround, switch defines GLCORE when it shouldn't + // + // Preprocessor condition is a work-around required because Unity might define SHADER_API_GLCORE when target platform is Switch +#if !defined(SHADER_API_GLCORE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) edges.xy *= step(finalDelta, SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR * delta.xy); #endif @@ -819,7 +821,9 @@ float2 SMAAColorEdgeDetectionPS(float2 texcoord, float finalDelta = max(maxDelta.x, maxDelta.y); // Local contrast adaptation: -#if !defined(SHADER_API_GLCORE) || defined(SHADER_API_SWITCH) // TODO: Bug workaround, switch defines GLCORE when it shouldn't + // + // Preprocessor condition is a work-around required because Unity might define SHADER_API_GLCORE when target platform is Switch +#if !defined(SHADER_API_GLCORE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) edges.xy *= step(finalDelta, SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR * delta.xy); #endif diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/SimpleLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/SimpleLit.shader index adb6de31607..daa686491b0 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/SimpleLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/SimpleLit.shader @@ -234,6 +234,7 @@ Shader "Universal Render Pipeline/Simple Lit" #pragma multi_compile_fragment _ _SHADOWS_SOFT #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader index 3ade9ef54d9..d7d154aee26 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader @@ -158,6 +158,7 @@ Shader "Universal Render Pipeline/Terrain/Lit" #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" // ------------------------------------- diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader index 50f7972a31a..3b0f25df115 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader @@ -86,6 +86,7 @@ Shader "Hidden/TerrainEngine/Details/UniversalPipeline/WavingDoublePass" #pragma multi_compile_fragment _ _LIGHT_COOKIES #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrassPasses.hlsl b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrassPasses.hlsl index 2cd6f125f9e..280d3a41468 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrassPasses.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrassPasses.hlsl @@ -200,7 +200,7 @@ inline void InitializeSimpleLitSurfaceData(GrassVertexOutput input, out SurfaceD outSurfaceData.alpha = alpha; outSurfaceData.albedo = diffuse; outSurfaceData.metallic = 0.0; // unused - outSurfaceData.specular = 0.1;// SampleSpecularSmoothness(uv, diffuseAlpha.a, _SpecColor, TEXTURE2D_ARGS(_SpecGlossMap, sampler_SpecGlossMap)); + outSurfaceData.specular = 0.0; // To match forward pass (UUM-113119) outSurfaceData.smoothness = input.posWSShininess.w; outSurfaceData.normalTS = 0.0; // unused outSurfaceData.occlusion = 1.0; diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/ScreenSpaceShadows.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/ScreenSpaceShadows.shader index 9bf64a835ae..2b84a80d86f 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/ScreenSpaceShadows.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/ScreenSpaceShadows.shader @@ -20,10 +20,8 @@ Shader "Hidden/Universal Render Pipeline/ScreenSpaceShadows" { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); -#if UNITY_REVERSED_Z - float deviceDepth = SAMPLE_TEXTURE2D_X(_CameraDepthTexture, sampler_PointClamp, input.texcoord.xy).r; -#else - float deviceDepth = SAMPLE_TEXTURE2D_X(_CameraDepthTexture, sampler_PointClamp, input.texcoord.xy).r; + float deviceDepth = LoadSceneDepth(input.positionCS.xy); +#if !UNITY_REVERSED_Z deviceDepth = deviceDepth * 2.0 - 1.0; #endif diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl index 19f3d75fb12..edca3ab14ae 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl @@ -334,7 +334,7 @@ half4 DeferredShading(Varyings input) : SV_Target InputData inputData = InputDataFromGbufferAndWorldPosition(gbuffer2, posWS.xyz); #if defined(_LIT) - #if SHADER_API_MOBILE || SHADER_API_SWITCH + #if SHADER_API_MOBILE || SHADER_API_SWITCH || SHADER_API_SWITCH2 // Specular highlights are still silenced by setting specular to 0.0 during gbuffer pass and GPU timing is still reduced. bool materialSpecularHighlightsOff = false; #else 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 4118a6e89b7..4378ffc43fe 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.shader @@ -462,7 +462,8 @@ Shader "Hidden/Universal Render Pipeline/StencilDeferred" // ------------------------------------- // Universal Pipeline keywords #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION - + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + // ------------------------------------- // Includes #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDeferred.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/RuntimeTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/RuntimeTests.cs index 42a0eddeaf3..1bca05b7aa3 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/RuntimeTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/RuntimeTests.cs @@ -37,7 +37,8 @@ public IEnumerator PipelineHasCorrectColorSpace() AssetCheck(); var rr = new UnityEngine.Rendering.RenderPipeline.StandardRequest(); - rr.destination = new RenderTexture(128, 128, UnityEngine.Experimental.Rendering.GraphicsFormat.R8G8B8A8_SRGB, UnityEngine.Experimental.Rendering.GraphicsFormat.D32_SFloat); + rr.destination = new RenderTexture(128, 128, UnityEngine.Experimental.Rendering.GraphicsFormat.R8G8B8A8_SRGB, + CoreUtils.GetDefaultDepthOnlyFormat()); rr.mipLevel = 0; rr.slice = 0; rr.face = CubemapFace.Unknown; @@ -57,7 +58,7 @@ public IEnumerator PipelineSetsAndRestoreGlobalShaderTagCorrectly() AssetCheck(); var rr = new UnityEngine.Rendering.RenderPipeline.StandardRequest(); - rr.destination = new RenderTexture(128, 128, UnityEngine.Experimental.Rendering.GraphicsFormat.R8G8B8A8_SRGB, UnityEngine.Experimental.Rendering.GraphicsFormat.D32_SFloat); + rr.destination = new RenderTexture(128, 128, UnityEngine.Experimental.Rendering.GraphicsFormat.R8G8B8A8_SRGB, CoreUtils.GetDefaultDepthOnlyFormat()); rr.mipLevel = 0; rr.slice = 0; rr.face = CubemapFace.Unknown; diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef index cde11bc6285..13cdbdae9cf 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef @@ -6,7 +6,8 @@ "GUID:27619889b8ba8c24980f49ee34dbb44a", "GUID:0acc523941302664db1f4e527237feb3", "GUID:516a5277b8c3b4f4c8cc86b77b1591ff", - "GUID:d8b63aba1907145bea998dd612889d6b" + "GUID:d8b63aba1907145bea998dd612889d6b", + "GUID:df380645f10b7bc4b97d4f5eb6303d95" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Packages/com.unity.shadergraph/Documentation~/Color-Modes.md b/Packages/com.unity.shadergraph/Documentation~/Color-Modes.md index 56648ca32cd..c082f606967 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Color-Modes.md +++ b/Packages/com.unity.shadergraph/Documentation~/Color-Modes.md @@ -8,13 +8,13 @@ Shader Graph can display colors on nodes in your graph to improve readability. T | Name | Description | |:-------------|:------------| -| None | Does not display colors on the nodes. All nodes use the default gray. | -| Category | Displays colors on the nodes based on their assigned category. See **Category Colors** below. | -| Heatmap | Displays colors on the nodes based on the nodes relative performance cost. By default, dark colored nodes contribute very little to the overall GPU performance cost of the shader and brighter colored nodes require more GPU computation to run. | -| Precision | Displays colors on the nodes based on the current [Precision Mode](Precision-Modes.md) in use. | -| User Defined | Lets you set the display colors on a per-node basis. These are custom colors for your graph. See **User Defined Colors** below. | +| **None** | Does not display colors on the nodes. All nodes use the default gray. | +| **Category** | Displays colors on the nodes based on their assigned category. Refer to [Category colors](#category-colors). | +| **Heatmap** | Displays colors on the nodes based on the nodes relative performance cost. By default, dark colored nodes contribute very little to the overall GPU performance cost of the shader and brighter colored nodes require more GPU computation to run. Refer to [Heatmap colors](#heatmap-colors). | +| **Precision** | Displays colors on the nodes based on the current [Precision Mode](Precision-Modes.md) in use. Refer to [Precision colors](#precision-colors). | +| **User Defined** | Lets you set the display colors on a per-node basis. These are custom colors for your graph. Refer to [User Defined colors](#user-defined-colors). | -### Category Colors +### Category colors This mode displays colors on the nodes based on their category. See the [Node Library](Node-Library.md) to learn about the different categories available. @@ -32,13 +32,49 @@ The table below lists current categories and their corresponding colors. | Utility | #AEAEAE | | UV | #08D78B | -**Note:** [Sub Graph](Sub-Graph.md) nodes in a main [Shader Graph](index.md) fall in the Utility category. If you select **Category** mode, all Sub Graphs use the Utility color. +[Sub Graph](Sub-Graph.md) nodes in a main [Shader Graph](index.md) fall in the Utility category. If you select **Category** mode, all Sub Graphs use the Utility color. -### Precision Colors +**Note:** You can [override the Category colors](#override-category-and-precision-default-colors) according to your needs. -This mode displays colors on the nodes based on their current precision. If you set a node to **Inherit Precision**, the display color reflects the currently active precision. See [Precision Modes](Precision-Modes.md) for more information about inheritance. +### Heatmap colors -### User Defined Colors +This mode displays colors on the nodes based on their relative performance cost: +* Darker colored nodes (black to purple-red) have a lower impact on the overall GPU performance of the shader. +* Brighter colored nodes (red to yellow) require more GPU computation to run. +* Nodes colored in light blue have an unknown impact on the GPU performance. + +You can use this color mode to identify and adjust the most expensive parts of the shader graph if your shader's overall performance is low. + +**Note:** Platforms and hardware profiles may introduce variations in the costs of specific nodes and operations. You should consider the Heatmap color mode as an indication to help start the shader optimization process rather than a precise and exact measurement of final results. The best way to measure shader performance is still to run the shader on the target platform in the context of your project. + +#### The default Heatmap colors + +The default Heatmap color set includes 10 colors. + +![The 10 default colors of the Heatmap mode, in a gradient from the left to the right: from black through purple, red, and orange, to yellow.](images/HeatMapGradient.png) + +Each color corresponds to a range of GPU cycle numbers that would be required to run the node's code once compiled, and the scale is exponential. For example, black corresponds to 0-3 GPU cycles, red corresponds to 64-127 cycles, and yellow corresponds to 1024 cycles and more. + +An additional color, light blue by default, is reserved for the unknown impact. + +A few considerations to better understand the default node color assignment in the Heatmap color mode: + +* Many nodes have no performance cost. This includes nodes that bring in data from outside the shader without performing any math, or straightforward math nodes such as Absolute and Saturate. + +* The node color assignments are broad estimates, as some nodes produce a variable number of cycles depending on the input data type or the various parameters you've set up. + +* The unknown impact color is for nodes that do texture samples or whose results can vary widely. Texture samples take a long time and some factors such as filtering settings and texture resolution can also change their performance cost a lot. + + +### Precision colors + +This mode displays colors on the nodes based on their current precision. + +If you set a node to **Inherit Precision**, the display color reflects the currently active precision. See [Precision Modes](Precision-Modes.md) for more information about inheritance. + +**Note:** You can [override the Precision colors](#override-category-and-precision-default-colors) according to your needs. + +### User-defined colors This mode displays colors on the nodes based on user preferences. In this mode, the user defines colors for each node. If a custom color is not set, the node displays in the default gray. @@ -50,8 +86,38 @@ To set a custom color for a node, right-click on the target node to bring up the | Reset | Removes the currently selected color and sets it to the default gray. | -## Overriding Default Colors +## Customize the predefined color modes + +For each project, you can customize the predefined color modes according to your needs. -For each project, you can override preset colors in the **Category** and **Precision** modes. Unity uses a `.uss` style sheet and Hex color codes to set colors. The default style sheet in your project is `Packages/com.unity.shadergraph/Editor/Resources/Styles/ColorMode.uss`. +### Override the Category and Precision default colors + +You can override preset colors in the **Category** and **Precision** modes. Unity uses a `.uss` style sheet and Hex color codes to set colors. The default style sheet in your project is `Packages/com.unity.shadergraph/Editor/Resources/Styles/ColorMode.uss`. The best practice is to create a copy of this file to override the presets. Under your project's **Assets** folder, create a new `Editor/Resources/Styles` folder structure, and place a copy of `ColorMode.uss` in the `Styles` folder. Change the Hex color codes in this `.uss` file to override the presets and use your own custom colors for the **Category** and **Precision** modes. + +### Customize the Heatmap color mode + +You can customize the whole Heatmap color mode, which includes the number of available colors, the color assignment for all available nodes and sub graphs, and the colors themselves. For this, you have to create a custom Shader Graph Heatmap Values asset and then reference it in the [Project Settings](Shader-Graph-Project-Settings.md#heatmap-color-mode-settings). + +To create and apply a custom Shader Graph Heatmap Values asset in your project, follow these steps: + +1. In the Project window, right-click in any folder, select **Create** > **Shader Graph** > **Custom Heatmap Values**. +1. Choose between **Heatmap with Default Values** or **Empty Heatmap** depending on your needs. +1. Give your new asset a name and select it. +1. In the inspector: + * In the **Categories** section, define the colors and the number of colors you need in your custom color set. Use **+** (plus) or **-** (minus) at the bottom of the list to add or remove colors. + * In the **Subgraphs** and **Nodes** sections, assign each listed sub graph and node a color based on the category indexes listed in the **Categories** section. + * In the **Subgraphs** section, you can add sub graphs of your project that aren't listed and also assign them a color. +1. From the Editor's main menu, select **Edit** > **Project Settings**, and select **Shader Graph**. +1. Under **Heatmap Color Mode Settings**, in **Custom Values**, select the Shader Graph Heatmap Values asset you just configured. + +**Note**: When you assign color category values to **Nodes** and **Subgraphs** in the Shader Graph Heatmap Values asset, make sure to only use values that correspond to category indexes that exist in the **Category** list. + +#### Beyond the configuration + +If you need to roll back to the default Heatmap color mode setup, in the **Project Settings**, under **Heatmap Color Mode Settings**, in **Custom Values**, select **None**. + +You can create multiple custom Shader Graph Heatmap Values assets and alternatively use them based on the current needs of the project. You can only select one Custom Heatmap Values asset at a time in the [Project Settings](Shader-Graph-Project-Settings.md#heatmap-color-mode-settings). + +When you set up a custom Shader Graph Heatmap Values asset, you can completely change the purpose of the Heatmap color mode and define a color set that represents a totally different kind of information. For example, a technical director could decide to use only two colors, green and red, and inform the team that green nodes are available to use while red nodes are off limits. diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Function-Node.md b/Packages/com.unity.shadergraph/Documentation~/Custom-Function-Node.md index eaf8ff0b83c..81fc37ded71 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Custom-Function-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Custom-Function-Node.md @@ -1,31 +1,41 @@ # Custom Function Node -![01](images/Custom-Function-Node.png) +Use the Custom Function Node to inject your own custom HLSL code in Shader Graphs to do some fine-grained optimization, for example. -## Description +You can either write small functions directly into graphs by using the string mode, or reference external HLSL files. Use the [Custom Port Menu](Custom-Port-Menu.md) to define your own input and output ports on the node itself. -The Custom Function Node enables you to inject your own custom HLSL code in Shader Graphs. This provides you with an extra level of control when you need it (for example, to do some fine-grained optimization). You can either write small functions directly into graphs by using the string mode, or reference external HLSL include files. Use the [Custom Port Menu](Custom-Port-Menu.md) to define your own input and output ports on the node itself. +![The Custom Function node properties](images/Custom-Function-Node-File.png) -## How to Use +| Property | Description | +|:----------|:------------| +| **Inputs** | Define the node's input ports. The names you enter here define the names for the input values you use in the code. | +| **Outputs** | Define the node's output ports. The names you enter here define the names for the output values you use in the code. | +| **Type** | Select the way to reference the custom function in the node. The options are:
  • **File**: Reference an external file that contains the functions.
  • **String**: Directly write functions in the node.
| +| **Name** | The name of the custom function in the code, **without** the function precision suffix `_half ` or `_float `. | +| **Source** | When you set **Type** to **File**, the reference to the HLSL file that includes the custom functions. The file can be anywhere in your Unity project and must have the `.hlsl` extension. For more details, refer to [file content syntax](#file-content-syntax-details-and-examples). | +| **Body** | When you set **Type** to **String**, the HLSL code that defines the contents of the custom functions. Unity handles the arguments, braces, and indent scope automatically. | -Use the [Create Node Menu](Create-Node-Menu.md) to create Custom Function nodes. By default, new Custom Function nodes don't have any input or output ports. -In the [Graph Inspector](Internal-Inspector.md), open the **Node Settings** to access the Custom Function and [Custom Port Menu](Custom-Port-Menu.md) menus. -![02](images/Custom-Function-Node-File.png) ![03](images/Custom-Function-Node-String.png) +## Set up a Custom Function node -### Custom Function menu +To set up a Custom Function node: -| Menu Item | Description | -|:----------|:------------| -| Inputs | A [Custom Port Menu](Custom-Port-Menu.md) that defines the node's input ports. | -| Outputs | A [Custom Port Menu](Custom-Port-Menu.md) that defines the node's output ports. | -| Type | A function type selector. Choose File to reference an external file or string to directly input functions to the node. | -| Name | Part of the name this custom function has in the final generated code. Suffixed by the function type ` _half ` or ` _float `. | -| Source | An asset field to reference the external HLSL include file with the `.hlsl` extension. **Available only in `File` mode**. | -| Body | A text box where you enter HLSL code. **Available only in `String` mode**. | +1. [Create a new node](Create-Node-Menu.md) of **Custom Function** type (from the **Utility** category). +1. In the [Graph Inspector](Internal-Inspector.md), select **Node Settings**. +1. [Define custom **Inputs** and **Outputs**](Custom-Port-Menu.md) to set the node's ports and the corresponding variables to use in the custom function. +1. Define the custom function according to your needs, either with a [file](#define-the-custom-function-with-a-file) or a [string](#define-the-custom-function-with-a-string). + +### Define the custom function with a string + +In **String** mode, the graph generates the shader function. + +To define the function with a string: + +1. In the Graph Inspector, in the Node Settings, Set **Type** to **String**. +1. In the **Name** field, specify a name for the function. +1. In the **Body** field, write the contents of the function. Unity handles the arguments, braces, and indent scope automatically. -### Defining the Function via string -If you select `String` mode, the graph generates the shader function. The `Name` field defines the name of the generated function, and the `Body` field defines the contents of the generated function. Unity handles the arguments, braces, and indent scope automatically. In `String` mode you may use the token `$precision` instead of `half` or `float` in the `Body` field. Unity replaces this with the correct type, based on that node's precision, when the node is processed. +In **String** mode, you may use the token `$precision` instead of `half` or `float` in the **Body** field. Unity replaces this with the correct type when the node is processed, based on that node's precision. ![04](images/Custom-Function-Node-String-wFunction.png) @@ -38,13 +48,36 @@ void MyFunction_float(float3 A, float B, out float3 Out) } ``` -### Defining the Function via file +### Define the custom function with a file -If you select `File` mode, the graph does not automatically generate the shader function. This mode injects an include reference in the final generated shader, and uses a function from within the referenced file. The `Name` field must match the name of the function you wish to call. The `Source` field contains a reference to the HLSL file that includes the function. +In **File** mode, the graph does not automatically generate the shader function. This mode injects an include reference in the final generated shader, and uses a function from within the referenced file. + +To create an HLSL file to use from a Custom Function node: + +1. Use your file system to create an empty text file with the `.hlsl` extension in any folder of your Unity project. +1. Write your custom function according to the [file content syntax](#file-content-syntax-details-and-examples). + +To use a function from the HLSL file in the node: + +1. In the Graph Inspector, in the Node Settings, set **Type** to **File**. +1. In the **Source** field, reference the HLSL file that contains the function. +1. In the **Name** field, specify the name of the function to call in the file, **without** the function precision suffix `_half ` or `_float `. ![06](images/Custom-Function-Node-File-wFunction.png) -When you use `File` mode for the Custom Function node, you must manually format the functions properly. One thing to note when creating custom functions for [Shader Graph](index.md) is the precision suffixes. The generated code appends a precision suffix to function names. Your include file function must also append your desired precision suffix (shown below with `_float`), or contain multiple functions with both `_float` and `_half` suffixes, but your `Name` field **must not include the precision suffix**. +#### File content syntax, details, and examples + +HLSL files you reference in Custom Function nodes can contain one or multiple functions. In all cases, you have to match the following expectations: + +* The file should include a `#ifndef` condition along with a `#define` statement with an identifier to make sure Unity doesn't load the same functions twice, which would result in a compile error. + * You must use the same id string for the `#ifndef` condition and the `#define` statement. + * If you create multiple HLSL files for Custom Function nodes in the same project, you must use a different id string for each file. +* Each function name must have a precision suffix: + * Use `_float` to run the function in full precision mode. + * Use `_half` if you need to save resources, which might only apply to certain platforms. +* The function arguments must correspond to the Inputs you defined in the Node Settings. + +For example: ``` //UNITY_SHADER_NO_UPGRADE @@ -58,7 +91,7 @@ void MyFunction_float(float3 A, float B, out float3 Out) #endif //MYHLSLINCLUDE_INCLUDED ``` -`File` mode allows for more flexibility with custom functions in a graph. You can define uniform variables outside the function scope, as shown here with a matrix. +**File** mode allows for more flexibility with custom functions in a graph. You can define uniform variables outside the function scope, as shown here with a matrix. ``` //UNITY_SHADER_NO_UPGRADE @@ -68,7 +101,7 @@ float4x4 _MyMatrix; void MyFunction_float(float3 A, float B, out float3 Out) { A = mul(float4(A, 0.0), _MyMatrix).rgb; -Out = A + B; + Out = A + B; } #endif //MYHLSLINCLUDE_INCLUDED ``` @@ -107,17 +140,54 @@ void MyFunction_float(float3 A, float B, out float3 Out) #endif //MYHLSLINCLUDE_INCLUDED ``` -### Reusing Custom Function Nodes +## Call Unity shader code functions + +You can call from your custom function any shader code functions that are part of existing Unity's Render Pipeline libraries. + +However, be aware of the following: + +* Your project must include the library that contains the shader code functions you need to call. To prevent errors, you should always isolate the code with an `#if defined()` condition according to the library you're using, and define fallback values for the variables. The usual keywords that identify Unity shader code libraries are the following: + * For the [Built-In Render Pipeline (BiRP)](https://docs.unity3d.com/Manual/use-built-in-shader-methods-birp.html) library, use `#if defined(BUILTIN_PIPELINE_CORE_INCLUDED)`. + * For the [Universal Render Pipeline (URP)](https://docs.unity3d.com/Manual/urp/use-built-in-shader-methods.html) library, use `#if defined(UNIVERSAL_PIPELINE_CORE_INCLUDED)`. + * For the [High-Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Manual/high-definition-render-pipeline.html) library, use `#if defined(UNITY_HEADER_HD_INCLUDED)`. +* The Shader Graph node and main previews can't access Unity's Render Pipeline libraries in the Editor. This generates compile errors in the Editor even though the shader works correctly in your project. To prevent this issue, you have to isolate the code with an `#ifdef SHADERGRAPH_PREVIEW` condition and also define default values for the variables in the Shader Graph preview context. +* The code in libraries might change over time from one Unity version to another. You need to make sure to regularly test and update your custom functions in your projects. + +Here is an example with URP library function calls and the above-mentioned conditional protections set up: + +``` +#ifdef SHADERGRAPH_PREVIEW + half3 color = half3(0,0,0); + half atten = 1; + half3 dir = half3 (0.707, 0, 0.707); + +#else + #if defined(UNIVERSAL_PIPELINE_CORE_INCLUDED) + half4 shadowCoord = TransformWorldToShadowCoord(WorldPosition); + Light mainLight = GetMainLight(shadowCoord); + half3 color = mainLight.color; + half atten = mainLight.shadowAttenuation; + half3 dir = mainLight.direction; + #else + half3 color = half3(0, 0, 0); + half atten = 1; + half3 dir = half3 (0.707, 0, 0.707); + #endif + +#endif +``` + +## Reuse Custom Function Nodes -The Custom Function node, on its own, is a single node instance. If you wish to re-use the same custom functions without re-creating the inputs, outputs, and function referencing, use [Sub Graphs](Sub-graph.md). Sub Graphs appear in the [Create Node Menu](Create-Node-Menu.md), and they enable you to share or re-use your custom functions. +The Custom Function node, on its own, is a single node instance. If you wish to reuse the same custom function without re-creating the inputs, outputs, and function referencing, include the Custom Function node in a [Sub Graph](Sub-graph.md). Once created, the Sub Graph appears in the [Create Node Menu](Create-Node-Menu.md), along with the nodes. ![11](images/Custom-Function-Node-Subgraph.png) -Create your custom function either directly in a Sub Graph, or right-click the existing Custom Function node and select `Convert to Sub Graph`. To add the appropriate input and output ports, use the [Graph Inspector](Internal-Inspector.md) and [Custom Port Menu](Custom-Port-Menu.md). After this, you can reuse your custom function as many times as needed, even within other Sub Graphs. +You can create a Sub Graph and add a Custom Function node to it, or right-click an existing Custom Function node and select `Convert to Sub Graph`. To add the appropriate input and output ports, use the [Graph Inspector](Internal-Inspector.md) and [Custom Port Menu](Custom-Port-Menu.md). -### Working with texture wires +## Work with texture wires -From version 10.3, Shader Graph has five new data structures to ensure that Custom Function Nodes (CFNs) and SubGraphs input and output data from texture wires in a consistent way. The new structures also make it possible for SamplerState to compile on [GLES2](https://en.wikipedia.org/wiki/OpenGL_ES#OpenGL_ES_2.0) platforms and access data associated with textures via `myInputTex.samplerstate` and `myInputTex.texelSize`. +From version 10.3, Shader Graph has five new data structures to ensure that Custom Function nodes and Sub Graphs input and output data from texture wire in a consistent way. The new structures also make it possible for SamplerState to compile on [GLES2](https://en.wikipedia.org/wiki/OpenGL_ES#OpenGL_ES_2.0) platforms and access data associated with textures via `myInputTex.samplerstate` and `myInputTex.texelSize`. Four structures are for the texture types, and one is for the sampler state: @@ -127,9 +197,9 @@ Four structures are for the texture types, and one is for the sampler state: * UnityTextureCube * UnitySamplerState -CFNs you create with earlier versions of Shader Graph continue to work after this change. As part of the automatic update, Unity transitions them to the new **Bare** node type. This type replicates the old input and output behavior. All other types pass the new structs. +Custom Function nodes you create with earlier versions of Shader Graph continue to work after this change. As part of the automatic update, Unity transitions them to the new **Bare** node type. This type replicates the old input and output behavior. All other types pass the new structs. -However, you should manually upgrade CFNs that produce texture or samplerstate types as output to ensure that they behave consistently—and to gain the benefits of the new design. Unity flags this type of outdated Custom Function Nodes with a warning when you open your Shader Graph in 10.3 or later. +However, you should manually upgrade Custom Function nodes that produce texture or samplerstate types as output to ensure that they behave consistently—and to gain the benefits of the new design. Unity flags this type of outdated Custom Function Nodes with a warning when you open your Shader Graph in 10.3 or later. #### How to upgrade diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Project-Settings.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Project-Settings.md index bc1055356c4..3780da6fa18 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Project-Settings.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Project-Settings.md @@ -22,11 +22,11 @@ It's impossible to limit the number of channels users can create in a Shader Gra ## Heatmap Color Mode Settings -You can create multiple customized heatmap values assets and swap them in and out based on the current needs of your project. Use **Heatmap Color Mode Settings** to specify which custom heatmap values asset to use for your project. +You can customize the [Heatmap color mode](Color-Modes.md#heatmap-colors) and use different sets of colors with different node assignments according to your project needs. For this, you first have to [create a custom Shader Graph Heatmap Values asset](Color-Modes.md#customize-the-heatmap-color-mode). | Property | Description | |:------------------|:-------------------------------------------| -| **Custom Values** | Specify which set of customized heatmap values to use for your project. | +| **Custom Values** | Specify the Shader Graph Heatmap Values asset to use for your project, or **None** if you want to use the default values. | ## Additional resources diff --git a/Packages/com.unity.shadergraph/Documentation~/images/Custom-Function-Node-String.png b/Packages/com.unity.shadergraph/Documentation~/images/Custom-Function-Node-String.png deleted file mode 100644 index 1893d3354a6..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/Custom-Function-Node-String.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/HeatMapGradient.png b/Packages/com.unity.shadergraph/Documentation~/images/HeatMapGradient.png new file mode 100644 index 00000000000..e9b4150a0ce Binary files /dev/null and b/Packages/com.unity.shadergraph/Documentation~/images/HeatMapGradient.png differ diff --git a/Packages/com.unity.shadergraph/Editor/Data/Attributes/SRPFilterAttribute.cs b/Packages/com.unity.shadergraph/Editor/Data/Attributes/SRPFilterAttribute.cs index 0abb4594701..f46ca6c33b5 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Attributes/SRPFilterAttribute.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Attributes/SRPFilterAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace UnityEditor.ShaderGraph { @@ -12,4 +13,30 @@ public SRPFilterAttribute(params Type[] WorksWithSRP) srpTypes = WorksWithSRP; } } + + internal static class SRPFilterUtil + { + internal static bool IsCompatibleWithSRPs(this AbstractMaterialNode node, HashSet srpTypes, out HashSet incompatibleSet) + { + var srpFilter = NodeClassCache.GetAttributeOnNodeType(node.GetType()); + incompatibleSet = null; + + if (srpFilter == null || srpTypes.IsSubsetOf(srpFilter.srpTypes)) + return true; + + incompatibleSet = new(srpTypes); + incompatibleSet.ExceptWith(srpFilter.srpTypes); + return false; + } + + internal static void GatherSRPCompatibility(this AbstractMaterialNode node, ref HashSet srpTypes) + { + var srpFilter = NodeClassCache.GetAttributeOnNodeType(node.GetType()); + if (srpFilter == null) + return; + + HashSet supportedTypes = new HashSet(srpFilter.srpTypes); + srpTypes.UnionWith(supportedTypes); + } + } } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Attributes/SubTargetFilterAttribute.cs b/Packages/com.unity.shadergraph/Editor/Data/Attributes/SubTargetFilterAttribute.cs index 4d0cc0a9c12..669d90e05bc 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Attributes/SubTargetFilterAttribute.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Attributes/SubTargetFilterAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace UnityEditor.ShaderGraph { @@ -12,4 +13,48 @@ public SubTargetFilterAttribute(params Type[] WorksWithSubTargets) subTargetTypes = WorksWithSubTargets; } } + + + internal static class SubTargetFilterUtil + { + // This is to check actual compatibility with a subtarget. + internal static bool IsSubTargetCompatible(this AbstractMaterialNode node, Type subTarget) + { + var subTargetFilter = NodeClassCache.GetAttributeOnNodeType(node.GetType()); + if (subTargetFilter == null) + return true; + + foreach (var type in subTargetFilter.subTargetTypes) + if (type.IsAssignableFrom(subTarget)) + return true; + + return false; + } + + // This does not check for inheritance, it's mainly for comparing between filters of two or more nodes. + internal static bool IsCompatibleWithSubTargetFilters(this AbstractMaterialNode node, HashSet subTargetTypes, out HashSet incompatibleSet) + { + var subTargetFilter = NodeClassCache.GetAttributeOnNodeType(node.GetType()); + incompatibleSet = null; + + if (subTargetFilter == null || subTargetTypes.IsSubsetOf(subTargetFilter.subTargetTypes)) + return true; + + incompatibleSet = new(subTargetTypes); + incompatibleSet.ExceptWith(subTargetFilter.subTargetTypes); + return false; + } + + // This does not gather inherited types, it's for populating the declared subtarget filters. + // There is not currently a case where inherited types would need to be dealt with here, but this won't work + // correctly if that's needed. + internal static void GatherSubTargetCompatibility(this AbstractMaterialNode node, ref HashSet subTargetTypes) + { + var subTargetFilter = NodeClassCache.GetAttributeOnNodeType(node.GetType()); + if (subTargetFilter == null) + return; + HashSet supportedTypes = new HashSet(subTargetFilter.subTargetTypes); + subTargetTypes.UnionWith(supportedTypes); + } + } } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs index 8b64acbf2c7..b9a63e4a0ed 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs @@ -2854,6 +2854,11 @@ public void OnEnable() node.OnEnable(); } + foreach (var node in GetNodes()) + { + node.SetupSlots(); + } + ShaderGraphPreferences.onVariantLimitChanged += OnKeywordChanged; } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphValidation.cs b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphValidation.cs index 4af27fab20a..452b9dfaa02 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphValidation.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphValidation.cs @@ -46,14 +46,18 @@ public static void ValidateNode(AbstractMaterialNode node) bool disallowedByAllTargets = true; bool disallowedByAnySubTarget = false; IEnumerable targets = node.owner.activeTargets; - if (node.owner.isSubGraph) - { - targets = node.owner.allPotentialTargets; - } + foreach (var target in targets) { + var subtarget = GetActiveSubTarget(target); + if (subtarget != null && (!subtarget.IsNodeAllowedBySubTarget(t) || !node.IsSubTargetCompatible(subtarget.GetType()))) + { + disallowedByAnySubTarget = true; + node.isValid = false; + node.owner.AddValidationError(node.objectId, $"{node.name} Node is not allowed by {subtarget.displayName} implementation", Rendering.ShaderCompilerMessageSeverity.Error); + } //if at least one target doesn't allow a node, it is considered invalid - if (!target.IsNodeAllowedByTarget(t)) + else if (!target.IsNodeAllowedByTarget(t)) { disallowedByAnyTargets = true; node.isValid = false; @@ -65,15 +69,40 @@ public static void ValidateNode(AbstractMaterialNode node) { disallowedByAllTargets = false; } - - var subtarget = GetActiveSubTarget(target); - if (subtarget != null && !subtarget.IsNodeAllowedBySubTarget(t)) + } + // Subgraphs have no allegiance to a Target/SubTarget workflow, + // but we can infer incompatibilities when SRPFilter and SubTargetFilter are + // similarly incompatible across nodes in a subgraph. + // Unfortunately, there isn't a good way to promote these compatibilities to + // the main graph without quite a bit more work. + if (node.owner.isSubGraph) + { + disallowedByAllTargets = false; + System.Text.StringBuilder sb = new(); + if (!node.IsCompatibleWithSRPs(srpSet, out var badSrps)) + { + disallowedByAnyTargets = true; + sb.Append("Nodes in subgraph have conflicting SRP restrictions; "); + foreach (var srp in badSrps) + sb.Append($"{srp.Name}, "); + sb.Remove(sb.Length - 2, 2); + sb.AppendLine(); + } + if (!node.IsCompatibleWithSubTargetFilters(subTargetSet, out var badSubTargets)) { disallowedByAnySubTarget = true; + sb.Append("Nodes in subgraph have conflicting Material restrictions; "); + foreach (var subTarget in badSubTargets) + sb.Append($"{subTarget.Name}, "); + sb.Remove(sb.Length - 2, 2); + } + if (disallowedByAnySubTarget || disallowedByAnyTargets) + { node.isValid = false; - node.owner.AddValidationError(node.objectId, $"{node.name} Node is not allowed by {subtarget.displayName} implementation", Rendering.ShaderCompilerMessageSeverity.Error); + node.owner.AddValidationError(node.objectId, sb.ToString(), Rendering.ShaderCompilerMessageSeverity.Warning); } } + if (!disallowedByAnyTargets && !disallowedByAnySubTarget) { node.isValid = true; @@ -92,9 +121,24 @@ public static void ValidateNode(AbstractMaterialNode node) } } + static HashSet srpSet; + static HashSet subTargetSet; public static void ValidateGraph(GraphData graph) { graph.m_UnsupportedTargets.Clear(); + + srpSet = new(); + subTargetSet = new(); + + if (graph.isSubGraph) + { + foreach(var node in graph.GetNodes()) + { + node.GatherSRPCompatibility(ref srpSet); + node.GatherSubTargetCompatibility(ref subTargetSet); + } + } + GraphDataUtils.ApplyActionLeafFirst(graph, ValidateNode); } } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UV/ParallaxOcclusionMappingNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UV/ParallaxOcclusionMappingNode.cs index 4c5385e662e..d9a49c56168 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UV/ParallaxOcclusionMappingNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UV/ParallaxOcclusionMappingNode.cs @@ -10,7 +10,7 @@ namespace UnityEditor.ShaderGraph [Title("UV", "Parallax Occlusion Mapping")] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.ParallaxOcclusionMappingNode")] [FormerName("UnityEditor.Rendering.HighDefinition.ParallaxOcclusionMappingNode")] - class ParallaxOcclusionMappingNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireViewDirection, IMayRequireMeshUV + class ParallaxOcclusionMappingNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireViewDirection, IMayRequireMeshUV, IMayRequireTransform { public ParallaxOcclusionMappingNode() { @@ -220,6 +220,8 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo "); } + public NeededTransform[] RequiresTransform(ShaderStageCapability stageCapability = ShaderStageCapability.All) => new[] { NeededTransform.WorldToObject }; + public NeededCoordinateSpace RequiresViewDirection(ShaderStageCapability stageCapability = ShaderStageCapability.All) { return NeededCoordinateSpace.Tangent; diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs index 3c4a3ba3ca8..67336b7c2f3 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs @@ -150,7 +150,7 @@ void LoadSubGraph() m_SubGraph.LoadGraphData(); m_SubGraph.LoadDependencyData(); - name = m_SubGraph.name; + name = ObjectNames.NicifyVariableName(m_SubGraph.name); } } diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/MaterialGraphEditWindow.cs b/Packages/com.unity.shadergraph/Editor/Drawing/MaterialGraphEditWindow.cs index d53e1cff365..4804a090b7d 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/MaterialGraphEditWindow.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/MaterialGraphEditWindow.cs @@ -298,13 +298,14 @@ void Update() string assetPath = AssetDatabase.GUIDToAssetPath(selectedGuid); string graphName = Path.GetFileNameWithoutExtension(assetPath); + graphObject.Validate(); + graphEditorView = new GraphEditorView(this, materialGraph, messageManager, graphName) { viewDataKey = selectedGuid, }; m_ColorSpace = PlayerSettings.colorSpace; m_RenderPipelineAsset = GraphicsSettings.currentRenderPipeline; - graphObject.Validate(); // update blackboard title for the new graphEditorView updateTitle = true; diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/SearchWindowProvider.cs b/Packages/com.unity.shadergraph/Editor/Drawing/SearchWindowProvider.cs index b4d99cf1f24..91edeaed698 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/SearchWindowProvider.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/SearchWindowProvider.cs @@ -198,7 +198,8 @@ public void GenerateNodeEntries() } else if (title[0] != k_HiddenFolderName) { - title.Add(asset.name); + var name = ObjectNames.NicifyVariableName(asset.name); + title.Add(name); AddEntries(node, title.ToArray(), nodeEntries); } } diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs index 69d5eb788a5..c1848a12847 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs @@ -535,7 +535,7 @@ void UpdatePreviewExpandedState(bool expanded) void UpdateTitle() { if (node is SubGraphNode subGraphNode && subGraphNode.asset != null) - title = subGraphNode.asset.name; + title = subGraphNode.name; else { if (node.sgVersion < node.latestVersion) diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs b/Packages/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs index 9636bfc1b21..cfb3db4d1e8 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs @@ -17,6 +17,7 @@ internal enum Platform Playstation, Switch, PS5, + Switch2, } [GenerationAPI] @@ -48,6 +49,8 @@ public static string ToShaderString(this Platform platform) return "playstation"; case Platform.Switch: return "switch"; + case Platform.Switch2: + return "switch2"; case Platform.PS5: return "ps5"; default: @@ -61,7 +64,7 @@ internal static class PragmaRenderers // Return high end platform list for the only renderer directive (The list use by HDRP) internal static Platform[] GetHighEndPlatformArray() { - return new Platform[] { Platform.D3D11, Platform.Playstation, Platform.XboxOne, Platform.GameCoreXboxSeries, Platform.Vulkan, Platform.Metal, Platform.Switch }; + return new Platform[] { Platform.D3D11, Platform.Playstation, Platform.XboxOne, Platform.GameCoreXboxSeries, Platform.Vulkan, Platform.Metal, Platform.Switch, Platform.Switch2 }; } // Return platform list not compatible with DXC (The list use by HDRP) diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl index 15ebffb4c76..b51ba593f14 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl @@ -11,7 +11,7 @@ #include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Input.hlsl" #if !defined(SHADER_HINT_NICE_QUALITY) - #if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) + #if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH)|| defined(SHADER_API_SWITCH2) #define SHADER_HINT_NICE_QUALITY 0 #else #define SHADER_HINT_NICE_QUALITY 1 @@ -37,7 +37,7 @@ #if UNITY_REVERSED_Z // TODO: workaround. There's a bug where SHADER_API_GL_CORE gets erroneously defined on switch. - #if (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_GLES3) + #if (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH) &&!defined(SHADER_API_SWITCH2)) || defined(SHADER_API_GLES3) //GL with reversed z => z clip range is [near, -far] -> should remap in theory but dont do it in practice to save some perf (range is close enough) #define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) max(-(coord), 0) #else diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Input.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Input.hlsl index 403b06e6d1f..e14279d7768 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Input.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Input.hlsl @@ -10,9 +10,12 @@ #include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/ShaderTypes.cs.hlsl" #include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Deprecated.hlsl" +// MAX_VISIBLE_LIGHTS +// #if defined(SHADER_API_MOBILE) && defined(SHADER_API_GLES30) #define MAX_VISIBLE_LIGHTS 16 -#elif defined(SHADER_API_MOBILE) || (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_GLES3) || defined(SHADER_API_WEBGPU) // Workaround because SHADER_API_GLCORE is also defined when SHADER_API_SWITCH is +// Part of preprocessor condition below is a work-around required because Unity might define SHADER_API_GLCORE when target platform is Switch +#elif defined(SHADER_API_MOBILE) || (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2)) || defined(SHADER_API_GLES3) || defined(SHADER_API_WEBGPU) #define MAX_VISIBLE_LIGHTS 32 #else #define MAX_VISIBLE_LIGHTS 256 @@ -56,7 +59,7 @@ StructuredBuffer _AdditionalLightsBuffer; StructuredBuffer _AdditionalLightsIndices; #else // GLES3 causes a performance regression in some devices when using CBUFFER. -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_START(AdditionalLights) #endif float4 _AdditionalLightsPosition[MAX_VISIBLE_LIGHTS]; @@ -64,7 +67,7 @@ half4 _AdditionalLightsColor[MAX_VISIBLE_LIGHTS]; half4 _AdditionalLightsAttenuation[MAX_VISIBLE_LIGHTS]; half4 _AdditionalLightsSpotDir[MAX_VISIBLE_LIGHTS]; half4 _AdditionalLightsOcclusionProbes[MAX_VISIBLE_LIGHTS]; -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_END #endif #endif diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl index 22e923b74c5..67926ca331f 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl @@ -457,7 +457,7 @@ half DirectBRDFSpecular(BRDFData brdfData, half3 normalWS, half3 lightDirectionW // On platforms where half actually means something, the denominator has a risk of overflow // clamp below was added specifically to "fix" that, but dx compiler (we convert bytecode to metal/gles) // sees that specularTerm have only non-negative terms, so it skips max(0,..) in clamp (leaving only min(100,...)) -#if defined (SHADER_API_MOBILE) || defined (SHADER_API_SWITCH) +#if defined (SHADER_API_MOBILE) || defined (SHADER_API_SWITCH) || defined (SHADER_API_SWITCH2) specularTerm = specularTerm - HALF_MIN; specularTerm = clamp(specularTerm, 0.0, 100.0); // Prevent FP16 overflow on mobiles #endif diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shadows.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shadows.hlsl index 6e59ab21bd4..7ed9e206705 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shadows.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shadows.hlsl @@ -49,7 +49,7 @@ TEXTURE2D_SHADOW(_AdditionalLightsShadowmapTexture); SAMPLER_CMP(sampler_AdditionalLightsShadowmapTexture); // GLES3 causes a performance regression in some devices when using CBUFFER. -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_START(MainLightShadows) #endif // Last cascade is initialized with a no-op matrix. It always transforms @@ -67,7 +67,7 @@ half4 _MainLightShadowOffset2; half4 _MainLightShadowOffset3; half4 _MainLightShadowParams; // (x: shadowStrength, y: 1.0 if soft shadows, 0.0 otherwise, z: main light fade scale, w: main light fade bias) float4 _MainLightShadowmapSize; // (xy: 1/width and 1/height, zw: width and height) -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_END #endif @@ -85,8 +85,10 @@ float4 _AdditionalShadowmapSize; // (xy: 1/width and 1/height, zw: width an #else - -#if defined(SHADER_API_MOBILE) || (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_GLES3) || defined(SHADER_API_WEBGPU) // Workaround because SHADER_API_GLCORE is also defined when SHADER_API_SWITCH is +// MAX_PUNCTUAL_LIGHT_SHADOW_SLICES_IN_UBO +// +// Part of preprocessor condition below is a work-around required because Unity might define SHADER_API_GLCORE when target platform is Switch +#if defined(SHADER_API_MOBILE) || (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2)) || defined(SHADER_API_GLES3) || defined(SHADER_API_WEBGPU) // Point lights can use 6 shadow slices, but on some mobile GPUs performance decrease drastically with uniform blocks bigger than 8kb. This number ensures size of buffer AdditionalLightShadows stays reasonable. // It also avoids shader compilation errors on SHADER_API_GLES30 devices where max number of uniforms per shader GL_MAX_FRAGMENT_UNIFORM_VECTORS is low (224) // Keep in sync with MAX_PUNCTUAL_LIGHT_SHADOW_SLICES_IN_UBO in AdditionalLightsShadowCasterPass.cs @@ -98,7 +100,7 @@ float4 _AdditionalShadowmapSize; // (xy: 1/width and 1/height, zw: width an #endif // GLES3 causes a performance regression in some devices when using CBUFFER. -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_START(AdditionalLightShadows) #endif @@ -112,7 +114,7 @@ half4 _AdditionalShadowOffset3; half4 _AdditionalShadowFadeParams; // x: additional light fade scale, y: additional light fade bias, z: 0.0, w: 0.0) float4 _AdditionalShadowmapSize; // (xy: 1/width and 1/height, zw: width and height) -#ifndef SHADER_API_GLES3 +#ifndef LIGHT_SHADOWS_NO_CBUFFER CBUFFER_END #endif @@ -136,7 +138,7 @@ ShadowSamplingData GetMainLightShadowSamplingData() { ShadowSamplingData shadowSamplingData; - // shadowOffsets are used in SampleShadowmapFiltered #if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) + // shadowOffsets are used in SampleShadowmapFiltered #if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) shadowSamplingData.shadowOffset0 = _MainLightShadowOffset0; shadowSamplingData.shadowOffset1 = _MainLightShadowOffset1; shadowSamplingData.shadowOffset2 = _MainLightShadowOffset2; @@ -152,7 +154,7 @@ ShadowSamplingData GetAdditionalLightShadowSamplingData() { ShadowSamplingData shadowSamplingData; - // shadowOffsets are used in SampleShadowmapFiltered #if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) + // shadowOffsets are used in SampleShadowmapFiltered #if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) shadowSamplingData.shadowOffset0 = _AdditionalShadowOffset0; shadowSamplingData.shadowOffset1 = _AdditionalShadowOffset1; shadowSamplingData.shadowOffset2 = _AdditionalShadowOffset2; @@ -207,7 +209,7 @@ real SampleShadowmapFiltered(TEXTURE2D_SHADOW_PARAM(ShadowMap, sampler_ShadowMap { real attenuation; -#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) +#if defined(SHADER_API_MOBILE) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) // 4-tap hardware comparison real4 attenuation4; attenuation4.x = SAMPLE_TEXTURE2D_SHADOW(ShadowMap, sampler_ShadowMap, shadowCoord.xyz + samplingData.shadowOffset0.xyz); diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl index b4cc37343f6..27b5d3eba3a 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl @@ -110,7 +110,7 @@ #define UNITY_SAMPLE_SHADOW(tex,coord) SAMPLE_TEXTURE2D_SHADOW(tex, sampler##tex, coord) #define UNITY_SAMPLE_SHADOW_PROJ(tex,coord) SAMPLE_TEXTURE2D_SHADOW(tex, sampler##tex, (coord.xyz / coord.w)) -#if defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN) || defined(SHADER_API_SWITCH) || defined(SHADER_API_WEBGPU) +#if defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN) || defined(SHADER_API_SWITCH) || defined(SHADER_API_SWITCH2) || defined(SHADER_API_WEBGPU) // GLSL does not have textureLod(samplerCubeShadow, ...) support. #define UNITY_SAMPLE_TEXCUBE_SHADOW(tex,coord) tex.SampleCmp (sampler##tex,(coord).xyz,(coord).w) #else @@ -163,7 +163,7 @@ #define DXC_SAMPLER_COMPATIBILITY 1 // On DXC platforms which don't care about explicit sampler precison we want the emulated types to work directly e.g without needing to redefine 'sampler2D' to 'sampler2D_f' -#if !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !defined(SHADER_API_METAL) && !defined(SHADER_API_SWITCH) +#if !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !defined(SHADER_API_METAL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2) #define sampler1D_f sampler1D #define sampler2D_f sampler2D #define sampler3D_f sampler3D @@ -248,7 +248,7 @@ min16float4 texCUBEproj(samplerCUBE_h s, in float4 t) { return texCUBE(s, t.xy // Define "fixed" precision to be half on non-GLSL platforms, // and sampler*_prec to be just simple samplers. -#if !defined(SHADER_API_PSSL) && !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !defined(SHADER_API_METAL) && !defined(SHADER_API_SWITCH) +#if !defined(SHADER_API_PSSL) && !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !defined(SHADER_API_METAL) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2) #define UNITY_FIXED_IS_HALF 1 #define sampler1D_half sampler1D #define sampler1D_float sampler1D diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/UnityInput.hlsl b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/UnityInput.hlsl index 4f007edc6b6..05a1ac8d802 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/UnityInput.hlsl +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/UnityInput.hlsl @@ -7,7 +7,7 @@ #define UNITY_STEREO_INSTANCING_ENABLED #endif -#if defined(STEREO_MULTIVIEW_ON) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_VULKAN)) && !(defined(SHADER_API_SWITCH)) +#if defined(STEREO_MULTIVIEW_ON) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_VULKAN)) && !(defined(SHADER_API_SWITCH)) && !(defined(SHADER_API_SWITCH2)) #define UNITY_STEREO_MULTIVIEW_ENABLED #endif diff --git a/Packages/com.unity.shadergraph/Editor/ShaderGraphProjectSettings.cs b/Packages/com.unity.shadergraph/Editor/ShaderGraphProjectSettings.cs index 6393a71b607..4ccca63f409 100644 --- a/Packages/com.unity.shadergraph/Editor/ShaderGraphProjectSettings.cs +++ b/Packages/com.unity.shadergraph/Editor/ShaderGraphProjectSettings.cs @@ -105,19 +105,14 @@ void OnGUIHandler(string searchContext) EditorGUILayout.LabelField(Styles.CustomInterpLabel, EditorStyles.boldLabel); EditorGUI.indentLevel++; - int newError = EditorGUILayout.IntField(Styles.CustomInterpErrorThresholdLabel, m_customInterpError.intValue); - m_customInterpError.intValue = Mathf.Clamp(newError, kMinChannelThreshold, kMaxChannelThreshold); - + int oldError = m_customInterpError.intValue; int oldWarn = m_customInterpWarn.intValue; - int newWarn = EditorGUILayout.IntField(Styles.CustomInterpWarnThresholdLabel, m_customInterpWarn.intValue); - // If the user did not modify the warning field, restore their previous input and reclamp against the new error threshold. - if (oldWarn == newWarn) - newWarn = oldWarningThreshold; - else - oldWarningThreshold = newWarn; + int newError = EditorGUILayout.DelayedIntField(Styles.CustomInterpErrorThresholdLabel, oldError); + int newWarn = EditorGUILayout.DelayedIntField(Styles.CustomInterpWarnThresholdLabel, oldWarn); - m_customInterpWarn.intValue = Mathf.Clamp(newWarn, kMinChannelThreshold, m_customInterpError.intValue); + m_customInterpError.intValue = Mathf.Clamp(newError, oldWarn, kMaxChannelThreshold); + m_customInterpWarn.intValue = Mathf.Clamp(newWarn, kMinChannelThreshold, oldError); GUILayout.BeginHorizontal(EditorStyles.helpBox); GUILayout.Label(EditorGUIUtility.IconContent("console.infoicon"), GUILayout.ExpandWidth(true)); diff --git a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomButton.cs b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomButton.cs index 25a94e1b60e..07d21e2efee 100644 --- a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomButton.cs +++ b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomButton.cs @@ -94,7 +94,7 @@ public void OnSubmit(BaseEventData eventData) public virtual Material GetModifiedMaterial(Material baseMaterial) { - _material = new Material(baseMaterial); + _material ??= new Material(baseMaterial); _material.SetFloat(StatePropertyId, (int)currentSelectionState); diff --git a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomSlider.cs b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomSlider.cs index 5212c9c59df..dcbc72fa860 100644 --- a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomSlider.cs +++ b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomSlider.cs @@ -136,7 +136,7 @@ protected override void DoStateTransition(SelectionState state, bool instant) public virtual Material GetModifiedMaterial(Material baseMaterial) { - _material = new Material(baseMaterial); + _material ??= new Material(baseMaterial); _material.SetFloat(StatePropertyId, (int)currentSelectionState); _material.SetVector(SliderValuePropertyId, Vector); diff --git a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs index ed9fe06e9d5..29f4a1c224c 100644 --- a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs +++ b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs @@ -121,7 +121,7 @@ protected override void DoStateTransition(SelectionState state, bool instant) public virtual Material GetModifiedMaterial(Material baseMaterial) { - _material = new Material(baseMaterial); + _material ??= new Material(baseMaterial); _material.SetFloat(StatePropertyId, (int)currentSelectionState); diff --git a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/Meter.cs b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/Meter.cs index ec334d4102e..765eac076b9 100644 --- a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/Meter.cs +++ b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/Meter.cs @@ -97,7 +97,7 @@ protected override void OnDidApplyAnimationProperties() public virtual Material GetModifiedMaterial(Material baseMaterial) { - _material = new Material(baseMaterial); + _material ??= new Material(baseMaterial); if (_material.HasFloat(MeterValuePropertyId)) _material.SetFloat(MeterValuePropertyId, Value); diff --git a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RangeBar.cs b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RangeBar.cs index d2ecac51407..e9cb297177b 100644 --- a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RangeBar.cs +++ b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RangeBar.cs @@ -126,7 +126,7 @@ protected override void OnDidApplyAnimationProperties() public virtual Material GetModifiedMaterial(Material baseMaterial) { - _material = new Material(baseMaterial); + _material ??= new Material(baseMaterial); if (_material.HasVector(RangeBarValuePropertyId)) _material.SetVector(RangeBarValuePropertyId, Vector); diff --git a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RectTransformSize.cs b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RectTransformSize.cs index cca2b012bd1..0a7c92f5a6f 100644 --- a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RectTransformSize.cs +++ b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/RectTransformSize.cs @@ -113,7 +113,7 @@ public void UpdateMaterial() public Material GetModifiedMaterial(Material baseMaterial) { - _material = new Material(baseMaterial); + _material ??= new Material(baseMaterial); if (_material.HasVector(PropertyId)) _material.SetVector(PropertyId, RectTransformInfo); diff --git a/Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl b/Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl index c2aecdcad9b..f5169b16365 100644 --- a/Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl +++ b/Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl @@ -73,7 +73,7 @@ void GetLeftHandedViewSpaceMatrices(out float4x4 viewMatrix, out float4x4 projMa } #if UNITY_REVERSED_Z - #if (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH)) || defined(SHADER_API_GLES3) + #if (defined(SHADER_API_GLCORE) && !defined(SHADER_API_SWITCH) && !defined(SHADER_API_SWITCH2)) || defined(SHADER_API_GLES3) //GL with reversed z => z clip range is [near, -far] -> should remap in theory but dont do it in practice to save some perf (range is close enough) #define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) max(-(coord), 0) #else diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputParticleMesh.md b/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputParticleMesh.md index a9494cb4af6..acc4222386a 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputParticleMesh.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputParticleMesh.md @@ -22,7 +22,7 @@ Below is a list of settings and properties specific to the Output Particle Mesh | **Mesh [N]** | Mesh | The mesh(es) to use to render particles. The number of mesh input fields depends on the **Mesh Count** setting. | | **Sub Mesh Mask [N]** | uint (mask) | The sub mesh mask(s) to use for each mesh. The number of sub mesh mask fields depends on the **Mesh Count** setting. | | **Lod Values** | Vector4 | The threshold values the Context uses to choose between LOD levels. The values represent a percentage of the viewport along one dimension (For instance, a Value of 10.0 means 10% of the screen). The Context tests values from left to right (0 to n) and selects the LOD level only if the percentage of the particle on screen is above the threshold. This means you have to specify LOD values in decreasing order. Note that you can also use LOD with a mesh count of 1 to cull small particles on screen. This property only appears if you enable the **LOD** setting. | -| **Radius Scale** | float | The scale to apply when selecting the LOD level per particle. By default, the LOD system assumes meshes bounding boxes are unit boxes. If your mesh bounding boxes is smaller/bigger than the unit box, you can use this property to apply a scale so that lod thresholds are consistent with apparent size. This property only appears if you enable the **LOD** setting. | +| **Radius Scale** | float | The scale to apply when selecting the LOD level per particle. By default, the LOD system assumes meshes bounding boxes are unit boxes. If your mesh bounding boxes is smaller/bigger than the unit box, you can use this property to apply a scale so that lod thresholds are consistent with apparent size. Frustum culling also uses this scale to compute the mesh size, when enabled. This property only appears if you enable the **LOD** or **Frustum Culling** settings. | ## Limitations diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputShaderGraphMesh.md b/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputShaderGraphMesh.md index f5c37286b1c..d17c193fa7e 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputShaderGraphMesh.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputShaderGraphMesh.md @@ -21,7 +21,7 @@ This output is similar to [Output Particle Mesh](Context-OutputParticleMesh.md). | **Mesh [N]** | Mesh | The meshes to use to render particles. The number of mesh input fields depends on the **Mesh Count** setting. | | **Sub Mesh Mask [N]** | uint (mask) | The sub mesh masks to use for each mesh. The number of sub mesh mask fields depends on the **Mesh Count** setting. | | **Lod Values** | Vector4 | The threshold values the Context uses to choose between LOD levels. The values represent a percentage of the viewport along one dimension (For instance, a Value of 10.0 means 10% of the screen). The Context tests values from left to right (0 to n) and selects the LOD level only if the percentage of the particle on screen is above the threshold. This means you have to specify LOD values in decreasing order. Note that you can also use LOD with a mesh count of 1 to cull small particles on screen. This property only appears if you enable the **LOD** setting. | -| **Radius Scale** | float | The scale to apply when selecting the LOD level per particle. By default, the LOD system assumes mesh bounding boxes are unit boxes. If your mesh bounding box is smaller/bigger than the unit box, you can use this property to apply a scale so that LOD thresholds are consistent with apparent size. This property only appears if you enable the **LOD** setting. | +| **Radius Scale** | float | The scale to apply when selecting the LOD level per particle. By default, the LOD system assumes mesh bounding boxes are unit boxes. If your mesh bounding box is smaller/bigger than the unit box, you can use this property to apply a scale so that LOD thresholds are consistent with apparent size. Frustum culling also uses this scale to compute the mesh size, when enabled. This property only appears if you enable the **LOD** or **Frustum Culling** settings. | [!include[](Snippets/Context-OutputShaderGraph-InlineNotes.md)] diff --git a/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs b/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs index 3301eac790f..7d746a3b6e9 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs @@ -879,6 +879,7 @@ static private StringBuilder Build( GraphicsDeviceType.GameCoreXboxSeries => "xboxseries", GraphicsDeviceType.PlayStation4 => "playstation", GraphicsDeviceType.Switch => "switch", + GraphicsDeviceType.Switch2 => "switch2", GraphicsDeviceType.PlayStation5 => "ps5", GraphicsDeviceType.WebGPU => "webgpu", _ => throw new Exception($"Graphics Device Type '{deviceType}' not supported in shader string."), diff --git a/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs b/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs index 153835ba588..6363f3a6756 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs @@ -7,7 +7,7 @@ namespace UnityEditor.VFX.UI { class VFXEnumValuePopup : VisualElement, INotifyValueChanged { - DropdownField m_DropDownButton; + readonly DropdownField m_DropDownButton; long m_Value; public IEnumerable choices => m_DropDownButton.choices; @@ -32,26 +32,20 @@ public long value set => SetValueAndNotify(value); } - public void SetValueAndNotify(long newValue) + private void SetValueAndNotify(long newValue) { if (!EqualityComparer.Default.Equals(value, newValue)) { - using (ChangeEvent evt = ChangeEvent.GetPooled(value, newValue)) - { - evt.target = this; - SetValueWithoutNotify(newValue); - SendEvent(evt); - } + using var evt = ChangeEvent.GetPooled(value, newValue); + evt.target = this; + SetValueWithoutNotify(newValue); + m_DropDownButton.value = m_DropDownButton.choices[(int)m_Value]; + SendEvent(evt); } } public void SetValueWithoutNotify(long newValue) { - if (newValue >= 0 && newValue < m_DropDownButton.choices.Count) - { - m_Value = newValue; - } - m_Value = Math.Clamp(newValue, 0, m_DropDownButton.choices.Count - 1); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Core/VFXSRPBinder.cs b/Packages/com.unity.visualeffectgraph/Editor/Core/VFXSRPBinder.cs index f906561b028..673d6ced16d 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Core/VFXSRPBinder.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Core/VFXSRPBinder.cs @@ -29,6 +29,15 @@ public struct ShaderGraphBinder abstract public string SRPAssetTypeStr { get; } abstract public Type SRPOutputDataType { get; } + public bool IsShaderVFXCompatible(ShaderGraphVfxAsset shaderGraph) + { + var path = AssetDatabase.GetAssetPath(shaderGraph); + var shader = AssetDatabase.LoadAssetAtPath(path); + if (shader != null) + return IsShaderVFXCompatible(shader); + return false; + } + public abstract bool IsShaderVFXCompatible(Shader shader); public virtual void SetupMaterial(Material mat, bool hasMotionVector = false, bool hasShadowCasting = false, ShaderGraphVfxAsset shaderGraph = null) { } @@ -112,6 +121,7 @@ public virtual IEnumerable GetSupportedGraphicDevices() yield return GraphicsDeviceType.PlayStation4; yield return GraphicsDeviceType.PlayStation5; yield return GraphicsDeviceType.Switch; + yield return GraphicsDeviceType.Switch2; yield return GraphicsDeviceType.WebGPU; } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs index bb1b84d4cf2..a4f6213c725 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs @@ -576,6 +576,7 @@ private void UnbindItem(VisualElement element, int index) parent.RemoveFromClassList("treeleaf"); parent.RemoveFromClassList("separator"); parent.UnregisterCallback(OnToggleCategory); + parent.UnregisterCallback(OnAddNode); parent.visible = true; } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs index f51cb0f8521..7103b67098f 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs @@ -84,7 +84,8 @@ public PropertyItem(VFXParameterController controller, int id) : base(null, id, class OutputCategory : PropertyCategory { public const string Label = "Output"; - public OutputCategory(bool isExpanded, int id) : base(Label, id, false, isExpanded) { } + public OutputCategory(bool isExpanded, int id) : base(Label, id, false, isExpanded) {} + public override bool canRename => false; } class AttributeItem : ParameterItem diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardCategory.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardCategory.cs index 0edae40baea..41ed45214b1 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardCategory.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardCategory.cs @@ -31,6 +31,10 @@ public VFXBlackboardCategory(IParameterItem category) : base($"cat:{category.tit m_TextField.RegisterCallback(OnEditTextSucceed, TrickleDown.TrickleDown); RegisterCallback(OnMouseDown, TrickleDown.TrickleDown); } + else + { + capabilities &= ~(Capabilities.Deletable | Capabilities.Renamable | Capabilities.Copiable); + } this.AddManipulator(new ContextualMenuManipulator(BuildContextualMenu)); } @@ -57,6 +61,7 @@ private DropdownMenuAction.Status IsMenuVisible(DropdownMenuAction action) { switch (m_Category) { + case OutputCategory: return DropdownMenuAction.Status.Disabled; case PropertyCategory { isRoot: false }: return DropdownMenuAction.Status.Normal; default: return DropdownMenuAction.Status.Disabled; } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Profiling/VFXProfilingBoard.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Profiling/VFXProfilingBoard.cs index e580deb044e..d90751aafee 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Profiling/VFXProfilingBoard.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Profiling/VFXProfilingBoard.cs @@ -513,9 +513,11 @@ void SetupHeatMapSettings() m_HeatmapSettingsContainer.Add(m_TopExecutionTimeField); m_TopExecutionTimeField.RegisterValueChangedCallback(evt => { + var value = Mathf.Max(0, evt.newValue); + m_TopExecutionTimeField.SetValueWithoutNotify(value); foreach (var anchoredPanel in m_AnchoredProfilerPanels) { - anchoredPanel.SetHeatmapRefValue(evt.newValue); + anchoredPanel.SetHeatmapRefValue(value); } }); } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs index 5ad19cbe615..6ed0767b61c 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs @@ -419,17 +419,6 @@ void EffectRestart() m_DebugUI.Notify(VFXUIDebug.Events.VFXReset); } - public void OnVisualEffectComponentChanged(IEnumerable visualEffects) - { - if (m_AttachedComponent != null - && visualEffects.Contains(m_AttachedComponent) - && m_AttachedComponent.visualEffectAsset != controller.graph.visualEffectResource.asset) - { - //The Visual Effect Asset has been changed and is no longer valid, we don't want to modify capacity on the wrong graph. We have to detach. - m_View.attachedComponent = null; - } - } - VisualEffect m_AttachedComponent; public VisualEffect GetAttachedComponent() diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs index f5aac661162..3888669e86b 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs @@ -164,7 +164,6 @@ public override object FilterValue(object value) class UintPropertyRM : NumericPropertyRM { private VFXEnumValuePopup m_EnumPopup; - private VFX32BitField m_BitField; public UintPropertyRM(IPropertyRMProvider controller, float labelWidth) : base(controller, labelWidth) { @@ -212,6 +211,7 @@ protected override VisualElement CreateSimpleField(string label) { var nameLabel = new Label(label); nameLabel.AddToClassList("label"); + nameLabel.AddToClassList("bitfield-label"); Insert(0, nameLabel); return new VFX32BitField(); } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs index 5564ff69ccb..3ed93216154 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs @@ -624,7 +624,7 @@ public override void UpdateGUI(bool force) if (m_Field is IVFXNotifyValueChanged vfxNotifyValueChanged) vfxNotifyValueChanged.SetValueWithoutNotify(value, force); else - m_Field.SetValueWithoutNotify(value); + m_Field.value = value; } catch (System.Exception ex) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index d62810bf75a..dc158602505 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -1134,7 +1134,14 @@ void ToggleProfilingBoard(ChangeEvent e) public void OnVisualEffectComponentChanged(IEnumerable visualEffects) { - m_ComponentBoard.OnVisualEffectComponentChanged(visualEffects); + if (attachedComponent == null || attachedComponent.visualEffectAsset != controller.graph.visualEffectResource.asset) + { + Detach(); + foreach (VisualEffect visualEffect in visualEffects) + { + TryAttachTo(visualEffect, true); + } + } } public void Delete() diff --git a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs index 22b5aeb74b0..8ebee7aef4a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs @@ -539,15 +539,16 @@ public static void DisplayPrewarmInspectorGUI(SerializedObject resourceObject, S if (!prewarmDeltaTime.hasMultipleDifferentValues && !prewarmStepCount.hasMultipleDifferentValues) { var currentDeltaTime = prewarmDeltaTime.floatValue; - var currentStepCount = prewarmStepCount.uintValue; + int currentStepCount = (int)prewarmStepCount.uintValue; var currentTotalTime = currentDeltaTime * currentStepCount; EditorGUI.BeginChangeCheck(); currentTotalTime = EditorGUILayout.FloatField(EditorGUIUtility.TrTextContent("PreWarm Total Time", "Sets the time in seconds to advance the current effect to when it is initially played. "), currentTotalTime); if (EditorGUI.EndChangeCheck()) { - if (currentStepCount <= 0) + if (currentStepCount <= 0 && currentTotalTime != 0.0f) { - prewarmStepCount.uintValue = currentStepCount = 1u; + currentStepCount = 1; + prewarmStepCount.uintValue = (uint)currentStepCount; } currentDeltaTime = currentTotalTime / currentStepCount; @@ -556,17 +557,18 @@ public static void DisplayPrewarmInspectorGUI(SerializedObject resourceObject, S } EditorGUI.BeginChangeCheck(); - currentStepCount = (uint)EditorGUILayout.IntField(EditorGUIUtility.TrTextContent("PreWarm Step Count", "Sets the number of simulation steps the prewarm should be broken down to. "), (int)currentStepCount); + currentStepCount = EditorGUILayout.IntField(EditorGUIUtility.TrTextContent("PreWarm Step Count", "Sets the number of simulation steps the prewarm should be broken down to. "), (int)currentStepCount); if (EditorGUI.EndChangeCheck()) { - if (currentStepCount <= 0 && currentTotalTime != 0.0f) + bool hasPrewarm = currentTotalTime != 0.0f; + if (currentStepCount <= 0) { - prewarmStepCount.uintValue = currentStepCount = 1; + currentStepCount = hasPrewarm ? 1 : 0; } - currentDeltaTime = currentTotalTime == 0.0f ? 0.0f : currentTotalTime / currentStepCount; + currentDeltaTime = hasPrewarm ? currentTotalTime / currentStepCount : 0.0f; prewarmDeltaTime.floatValue = currentDeltaTime; - prewarmStepCount.uintValue = currentStepCount; + prewarmStepCount.uintValue = (uint)currentStepCount; resourceObject.ApplyModifiedProperties(); } @@ -576,18 +578,18 @@ public static void DisplayPrewarmInspectorGUI(SerializedObject resourceObject, S { if (currentDeltaTime < k_MinimalCommonDeltaTime) { - prewarmDeltaTime.floatValue = currentDeltaTime = k_MinimalCommonDeltaTime; + currentDeltaTime = k_MinimalCommonDeltaTime; } - if (currentDeltaTime > currentTotalTime) + float totalTime = currentDeltaTime * currentStepCount; + if (totalTime > currentTotalTime) { - currentTotalTime = currentDeltaTime; + currentTotalTime = totalTime; } - - if (currentTotalTime != 0.0f) + else { - var candidateStepCount_A = (uint)Mathf.FloorToInt(currentTotalTime / currentDeltaTime); - var candidateStepCount_B = (uint)Mathf.RoundToInt(currentTotalTime / currentDeltaTime); + var candidateStepCount_A = Mathf.FloorToInt(currentTotalTime / currentDeltaTime); + var candidateStepCount_B = Mathf.RoundToInt(currentTotalTime / currentDeltaTime); var totalTime_A = currentDeltaTime * candidateStepCount_A; var totalTime_B = currentDeltaTime * candidateStepCount_B; @@ -601,7 +603,7 @@ public static void DisplayPrewarmInspectorGUI(SerializedObject resourceObject, S currentStepCount = candidateStepCount_B; } - prewarmStepCount.uintValue = currentStepCount; + prewarmStepCount.uintValue = (uint)currentStepCount; } prewarmDeltaTime.floatValue = currentDeltaTime; resourceObject.ApplyModifiedProperties(); diff --git a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs index a71a2c23888..6e6319ce44d 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs @@ -851,9 +851,10 @@ public override void OnInspectorGUI() EditorGUI.indentLevel = 0; if (serializedObject.ApplyModifiedProperties()) { - var window = WindowLayout.FindEditorWindowOfType(typeof(VFXViewWindow)) as VFXViewWindow; - if (window != null) + foreach (var window in VFXViewWindow.GetAllWindows()) + { window.OnVisualEffectComponentChanged(targets.Cast()); + } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs index 5d62e387dec..a4c6efef614 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs @@ -44,12 +44,22 @@ ShaderGraphVfxAsset GetOrRefreshShaderGraphObject(List<(string error, VFXErrorTy } } - if (currentShaderGraph != null && !currentShaderGraph.generatesWithShaderGraph) + if (currentShaderGraph != null) { - if (errors != null) - errors.Add(("DeprecatedOldShaderGraph", VFXErrorType.Error, ParticleShadingShaderGraph.kErrorOldSG)); + if (!currentShaderGraph.generatesWithShaderGraph) + { + if (errors != null) + errors.Add(("DeprecatedOldShaderGraph", VFXErrorType.Error, ParticleShadingShaderGraph.kErrorOldSG)); - currentShaderGraph = VFXResources.errorFallbackShaderGraph; + currentShaderGraph = VFXResources.errorFallbackShaderGraph; + } + else if (VFXLibrary.currentSRPBinder != null && !VFXLibrary.currentSRPBinder.IsShaderVFXCompatible(currentShaderGraph)) + { + if (errors != null) + errors.Add(("NoSRPCompatibleSG", VFXErrorType.Error, "The current Shader Graph doesn't support the current SRP or VFX Support is not enabled.")); + + currentShaderGraph = VFXResources.errorFallbackShaderGraph; + } } if (currentShaderGraph == null) @@ -111,7 +121,8 @@ public override TraitDescription GetDescription(VFXAbstractComposedParticleOutpu } desc.hasAlphaClipping = actualShaderGraph.alphaClipping; - var shaderGraphProperties = VFXShaderGraphHelpers.GetProperties(actualShaderGraph); + //Retrieve properties from shaderGraph (and not actualShaderGraph) to prevent slot removal when listing is available for another SRP + var shaderGraphProperties = VFXShaderGraphHelpers.GetProperties(shaderGraph); foreach (var sgProperty in shaderGraphProperties) { desc.properties.Add(sgProperty.property); diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedTopology.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedTopology.cs index 7294e01d6df..6cf9787be53 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedTopology.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedTopology.cs @@ -66,6 +66,8 @@ public override TraitDescription GetDescription(VFXAbstractComposedParticleOutpu desc.features |= VFXOutputUpdate.Features.MultiMesh; if (lod) desc.features |= VFXOutputUpdate.Features.LOD; + if (parent.HasFrustumCulling()) + desc.features |= VFXOutputUpdate.Features.FrustumCulling; desc.properties.AddRange(VFXMultiMeshHelper.GetInputProperties(MeshCount, desc.features)); foreach (var cpuExpression in VFXMultiMeshHelper.GetCPUExpressionNames(MeshCount)) diff --git a/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphHelpers.cs b/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphHelpers.cs index 762819e0498..fcc19902940 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphHelpers.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphHelpers.cs @@ -107,6 +107,9 @@ public static bool HasAnyKeywordProperty(ShaderGraphVfxAsset shaderGraph) public static IEnumerable GetProperties(ShaderGraphVfxAsset shaderGraph) { + if (shaderGraph == null) + yield break; + foreach (var property in shaderGraph.properties) { if (property is AbstractShaderProperty shaderProperty) diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXContext.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXContext.uss index 3e03d5a570b..859eb2710ca 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXContext.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXContext.uss @@ -319,7 +319,6 @@ TextField#user-title-textfield #unity-text-input #user-label { overflow: hidden; - max-height: 120px; } VFXContextUI.inputTypespawnevent #user-label diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXControls.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXControls.uss index 408276ae413..e040741e7bb 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXControls.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXControls.uss @@ -120,6 +120,10 @@ VFXStringFieldPushButton > Label { -unity-slice-right: 12; } +.propertyrm > Label.bitfield-label { + margin-left: 0; +} + VFX32BitField { margin-left: 2px; } diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uxml/VFXCompileDropdownPanel.uxml b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uxml/VFXCompileDropdownPanel.uxml index e33892797c7..e699be856f1 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uxml/VFXCompileDropdownPanel.uxml +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uxml/VFXCompileDropdownPanel.uxml @@ -8,7 +8,7 @@ - + diff --git a/Packages/com.unity.visualeffectgraph/Shaders/Sort.compute b/Packages/com.unity.visualeffectgraph/Shaders/Sort.compute index 708121cbb79..e4fe54c210a 100644 --- a/Packages/com.unity.visualeffectgraph/Shaders/Sort.compute +++ b/Packages/com.unity.visualeffectgraph/Shaders/Sort.compute @@ -16,7 +16,7 @@ #pragma kernel MergePass MERGE_PASS=MergePass FINAL_PASS=0 #pragma kernel MergeFinalPass MERGE_PASS=MergeFinalPass FINAL_PASS=1 -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch glcore gles3 webgpu +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 glcore gles3 webgpu #include "HLSLSupport.cginc" diff --git a/Packages/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute b/Packages/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute index 6545a7957b8..f0545a0b1c4 100644 --- a/Packages/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute +++ b/Packages/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute @@ -1,6 +1,6 @@ #pragma kernel UpdateParticleStrip -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch glcore gles3 webgpu +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 glcore gles3 webgpu #include "HLSLSupport.cginc" diff --git a/Packages/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute b/Packages/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute index 243ea66e2fb..1a01b8e0016 100644 --- a/Packages/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute +++ b/Packages/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute @@ -7,7 +7,7 @@ #pragma kernel CSVFXInitBoundsBuffer #pragma kernel CSVFXCopyStructBufferSelf -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch glcore gles3 webgpu +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 glcore gles3 webgpu #include "HLSLSupport.cginc" diff --git a/Packages/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute b/Packages/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute index fe419ab4294..373fbb6b5ca 100644 --- a/Packages/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute +++ b/Packages/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute @@ -1,6 +1,6 @@ #pragma kernel CSVFXIndirectArgs -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch glcore gles3 webgpu +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2 glcore gles3 webgpu #include "HLSLSupport.cginc" diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_115004.unitypackage b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_115004.unitypackage new file mode 100644 index 00000000000..1e187446355 --- /dev/null +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_115004.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5bf67909680f24609ee37c09e683cdc0f5332dc793e45be774fc67e4d6abeac0 +size 11306 diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_115004.unitypackage.meta b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_115004.unitypackage.meta new file mode 100644 index 00000000000..4348af19210 --- /dev/null +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_115004.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: acf24afc6dd780b4d8f73b98d997af91 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXMaterialVariantTest.cs b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXMaterialVariantTest.cs index 354598c5e26..da9e9452543 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXMaterialVariantTest.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXMaterialVariantTest.cs @@ -130,6 +130,70 @@ public void Migration_Material_Settings() } } + [UnityTest, Description("Covers UUM-115004, N.B.: This coverage can't be full without cross SRP project")] + public IEnumerator Failing_SG_Target_With_Current_Pipeline() + { + var packagePath = "Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_115004.unitypackage"; + AssetDatabase.ImportPackageImmediately(packagePath); + yield return null; + + var vfxPath = VFXTestCommon.tempBasePath + "Repro_UUM_115004.vfx"; + var vfxAsset = AssetDatabase.LoadAssetAtPath(vfxPath); + Assert.IsNotNull(vfxAsset); + + var vfxResource = vfxAsset.GetResource(); + Assert.IsNotNull(vfxResource); + + var vfxGraph = vfxResource.GetOrCreateGraph(); + Assert.IsNotNull(vfxGraph); + + var window = VFXViewWindow.GetWindow(vfxGraph, true, true); + window.LoadAsset(vfxAsset, null); + window.Focus(); + yield return null; //No error preventing to open the graph + + var particleOutputs = vfxGraph.children.OfType().ToArray(); + Assert.AreEqual(4, particleOutputs.Length); + foreach (var particleOutput in particleOutputs) + { + Assert.IsNotNull(particleOutput.inputFlowSlot[0].link[0].context); + + var serializedShaderGraph = particleOutput.GetSettingValue("shaderGraph") as ShaderGraphVfxAsset; + var actualShaderGraph = particleOutput.GetShaderGraph(); + Assert.IsNotNull(actualShaderGraph); + + bool isCompatibleWithCurrentSRP = false; +#if VFX_TESTS_HAS_HDRP && VFX_TESTS_HAS_URP + Assert.Fail("This suite doesn't support both pipeline yet."); +#elif VFX_TESTS_HAS_HDRP + if (particleOutput.label.Contains("HDRP")) + { + isCompatibleWithCurrentSRP = true; + } +#elif VFX_TESTS_HAS_URP + if (particleOutput.label.Contains("URP")) + { + isCompatibleWithCurrentSRP = true; + } +#endif + if (isCompatibleWithCurrentSRP) + { + Assert.AreEqual(1, particleOutput.inputSlots.Count); + Assert.IsTrue((bool)particleOutput.inputSlots[0].HasLink()); + Assert.IsNotNull(serializedShaderGraph); + } + else + { + //N.B.: This asset won't be null if both SRP are available, checking reference to missing data here (but known guid) + Assert.IsFalse(object.ReferenceEquals(serializedShaderGraph, null)); + Assert.IsTrue(serializedShaderGraph == null); + } + } + + window.Close(); + yield return null; + } + public struct Check_Material_Override_Behavior_Test_Case { internal string name; diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Runtime/VFXRuntimeTests.cs b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Runtime/VFXRuntimeTests.cs index d2cdaf01946..cb1bcdb612f 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Runtime/VFXRuntimeTests.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Runtime/VFXRuntimeTests.cs @@ -167,10 +167,8 @@ public IEnumerator Cross_Material_Variant_Check_Content() Assert.IsFalse(hasBlendMode); Assert.AreEqual(0.0f, actualMaterial.GetFloat("_Blend")); - //URP doesn't use alpha independent blending mode with SG integration - Assert.IsFalse(actualMaterial.HasFloat("_SrcBlendAlpha")); - Assert.IsFalse(actualMaterial.HasFloat("_DstBlendAlpha")); - //Only rely on Blend [_SrcBlend] [_DstBlend] + Assert.AreEqual((float)Rendering.BlendMode.One, actualMaterial.GetFloat("_SrcBlendAlpha")); + Assert.AreEqual((float)Rendering.BlendMode.OneMinusSrcAlpha, actualMaterial.GetFloat("_DstBlendAlpha")); Assert.AreEqual((float)Rendering.BlendMode.SrcAlpha, actualMaterial.GetFloat("_SrcBlend")); //N.B.: Conflict with HDRP Assert.AreEqual((float)Rendering.BlendMode.OneMinusSrcAlpha, actualMaterial.GetFloat("_DstBlend")); #endif diff --git a/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Packages/manifest.json b/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Packages/manifest.json index 1d408131f94..e5f20b4b12c 100644 --- a/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Packages/manifest.json +++ b/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Packages/manifest.json @@ -18,7 +18,7 @@ "com.unity.render-pipelines.high-definition-config": "file:../../../../../Packages/com.unity.render-pipelines.high-definition-config", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.brg": "file:../../../Packages/com.unity.testing.brg", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", diff --git a/Tests/SRPTests/Projects/BatchRendererGroup_URP/Packages/manifest.json b/Tests/SRPTests/Projects/BatchRendererGroup_URP/Packages/manifest.json index 507378382d7..f7579eb74d8 100644 --- a/Tests/SRPTests/Projects/BatchRendererGroup_URP/Packages/manifest.json +++ b/Tests/SRPTests/Projects/BatchRendererGroup_URP/Packages/manifest.json @@ -18,7 +18,7 @@ "com.unity.render-pipelines.universal-config": "file:../../../../../Packages/com.unity.render-pipelines.universal-config", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.brg": "file:../../../Packages/com.unity.testing.brg", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json index 4ca64cb006e..d415c5973cc 100644 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json +++ b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Foundation/Packages/manifest.json @@ -14,7 +14,7 @@ "com.unity.render-pipelines.universal-config": "file:../../../../../Packages/com.unity.render-pipelines.universal-config", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", "com.unity.modules.ai": "1.0.0", diff --git a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json index 4ca64cb006e..d415c5973cc 100644 --- a/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json +++ b/Tests/SRPTests/Projects/BuiltInGraphicsTest_Lighting/Packages/manifest.json @@ -14,7 +14,7 @@ "com.unity.render-pipelines.universal-config": "file:../../../../../Packages/com.unity.render-pipelines.universal-config", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", "com.unity.modules.ai": "1.0.0", diff --git a/Tests/SRPTests/Projects/HDRP_DXR_Tests/Packages/manifest.json b/Tests/SRPTests/Projects/HDRP_DXR_Tests/Packages/manifest.json index de0d68f14ac..9eb354ed2cf 100644 --- a/Tests/SRPTests/Projects/HDRP_DXR_Tests/Packages/manifest.json +++ b/Tests/SRPTests/Projects/HDRP_DXR_Tests/Packages/manifest.json @@ -10,7 +10,7 @@ "com.unity.rendering.denoising": "1.0.5", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.hdrp": "file:../../../Packages/com.unity.testing.hdrp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", diff --git a/Tests/SRPTests/Projects/HDRP_PerformanceTests/Packages/manifest.json b/Tests/SRPTests/Projects/HDRP_PerformanceTests/Packages/manifest.json index b28f4fef9cd..9424ca756f0 100644 --- a/Tests/SRPTests/Projects/HDRP_PerformanceTests/Packages/manifest.json +++ b/Tests/SRPTests/Projects/HDRP_PerformanceTests/Packages/manifest.json @@ -10,7 +10,7 @@ "com.unity.shaderanalysis": "file:../../../../../Packages/com.unity.shaderanalysis", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.test-framework.graphics.performance": "file:../../../Packages/com.unity.test-framework.graphics.performance", "com.unity.ugui": "2.0.0", "com.unity.visualeffectgraph": "file:../../../../../Packages/com.unity.visualeffectgraph", diff --git a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Packages/manifest.json b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Packages/manifest.json index 23b138c9a23..f1a794435aa 100644 --- a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Packages/manifest.json +++ b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Packages/manifest.json @@ -8,7 +8,7 @@ "com.unity.render-pipelines.high-definition-config": "file:../../../../../Packages/com.unity.render-pipelines.high-definition-config", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.hdrp": "file:../../../Packages/com.unity.testing.hdrp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", diff --git a/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json b/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json index d4cdadf6c72..afced47110f 100644 --- a/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json +++ b/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json @@ -11,7 +11,7 @@ "com.unity.render-pipelines.high-definition-config": "file:../../../../../Packages/com.unity.render-pipelines.high-definition-config", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.hdrp": "file:../../../Packages/com.unity.testing.hdrp", "com.unity.testing.common-graphics": "file:../../../Packages/com.unity.testing.common-graphics", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", diff --git a/Tests/SRPTests/Projects/MultipleSRP_Tests/Packages/manifest.json b/Tests/SRPTests/Projects/MultipleSRP_Tests/Packages/manifest.json index 1dec8d66a76..3a6d4ffb3a6 100644 --- a/Tests/SRPTests/Projects/MultipleSRP_Tests/Packages/manifest.json +++ b/Tests/SRPTests/Projects/MultipleSRP_Tests/Packages/manifest.json @@ -11,7 +11,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.timeline": "1.8.0", "com.unity.ugui": "2.0.0", "com.unity.visualeffectgraph": "file:../../../../../Packages/com.unity.visualeffectgraph", diff --git a/Tests/SRPTests/Projects/SRP_SmokeTest/Assets/Tests/Editor/Volumes/VolumeComponentCopyPasteTests.cs b/Tests/SRPTests/Projects/SRP_SmokeTest/Assets/Tests/Editor/Volumes/VolumeComponentCopyPasteTests.cs index cbdb338f3a9..bcdf6cabd97 100644 --- a/Tests/SRPTests/Projects/SRP_SmokeTest/Assets/Tests/Editor/Volumes/VolumeComponentCopyPasteTests.cs +++ b/Tests/SRPTests/Projects/SRP_SmokeTest/Assets/Tests/Editor/Volumes/VolumeComponentCopyPasteTests.cs @@ -42,7 +42,7 @@ public void CopyPasteSingle() { VolumeComponentCopyPaste.CopySettings(m_Src1); m_Src1.AssertEquality(m_Dst1, Assert.AreNotEqual); - VolumeComponentCopyPaste.PasteSettings(m_Dst1); + VolumeComponentCopyPaste.PasteSettings(m_Dst1, null); m_Src1.AssertEquality(m_Dst1, Assert.AreEqual); } @@ -50,7 +50,7 @@ public void CopyPasteSingle() public void CopyPasteSingleUndoRedo() { VolumeComponentCopyPaste.CopySettings(m_Src1); - VolumeComponentCopyPaste.PasteSettings(m_Dst1); + VolumeComponentCopyPaste.PasteSettings(m_Dst1, null); Undo.PerformUndo(); m_Dst1.AssertEquality(m_Default1, Assert.AreEqual); // paste target is unchanged Undo.PerformRedo(); @@ -65,7 +65,7 @@ public void CopyPasteMultiple() m_Src2.AssertEquality(m_Dst2, Assert.AreNotEqual); m_Src3.AssertEquality(m_Dst3, Assert.AreNotEqual); - VolumeComponentCopyPaste.PasteSettings(new List { m_Dst1, m_Dst2, m_Dst3 }); + VolumeComponentCopyPaste.PasteSettings(new List { m_Dst1, m_Dst2, m_Dst3 }, null); m_Src1.AssertEquality(m_Dst1, Assert.AreEqual); m_Src2.AssertEquality(m_Dst2, Assert.AreEqual); m_Src3.AssertEquality(m_Dst3, Assert.AreEqual); @@ -79,7 +79,7 @@ public void CopyPasteMultipleInDifferentOrder() m_Src2.AssertEquality(m_Dst2, Assert.AreNotEqual); m_Src3.AssertEquality(m_Dst3, Assert.AreNotEqual); - VolumeComponentCopyPaste.PasteSettings(new List { m_Dst3, m_Dst1, m_Dst2 }); + VolumeComponentCopyPaste.PasteSettings(new List { m_Dst3, m_Dst1, m_Dst2 }, null); m_Src1.AssertEquality(m_Dst1, Assert.AreEqual); m_Src2.AssertEquality(m_Dst2, Assert.AreEqual); m_Src3.AssertEquality(m_Dst3, Assert.AreEqual); @@ -89,9 +89,9 @@ public void CopyPasteMultipleInDifferentOrder() public void CopyPasteMultipleToSingleComponent() { VolumeComponentCopyPaste.CopySettings(new List { m_Src1, m_Src2, m_Src3 }); - VolumeComponentCopyPaste.PasteSettings(new List { m_Dst3 }); - VolumeComponentCopyPaste.PasteSettings(new List { m_Dst2 }); - VolumeComponentCopyPaste.PasteSettings(new List { m_Dst1 }); + VolumeComponentCopyPaste.PasteSettings(new List { m_Dst3 }, null); + VolumeComponentCopyPaste.PasteSettings(new List { m_Dst2 }, null); + VolumeComponentCopyPaste.PasteSettings(new List { m_Dst1 }, null); m_Src1.AssertEquality(m_Dst1, Assert.AreEqual); m_Src2.AssertEquality(m_Dst2, Assert.AreEqual); m_Src3.AssertEquality(m_Dst3, Assert.AreEqual); @@ -101,7 +101,7 @@ public void CopyPasteMultipleToSingleComponent() public void CopyPasteSingleToMultipleComponent() { VolumeComponentCopyPaste.CopySettings(new List { m_Src1 }); - VolumeComponentCopyPaste.PasteSettings(new List { m_Dst3, m_Dst1, m_Dst2 }); + VolumeComponentCopyPaste.PasteSettings(new List { m_Dst3, m_Dst1, m_Dst2 }, null); m_Src1.AssertEquality(m_Dst1, Assert.AreEqual); } @@ -109,7 +109,7 @@ public void CopyPasteSingleToMultipleComponent() public void CopyPasteMultipleUndoRedo() { VolumeComponentCopyPaste.CopySettings(new List { m_Src1, m_Src2, m_Src3 }); - VolumeComponentCopyPaste.PasteSettings(new List { m_Dst1, m_Dst2, m_Dst3 }); + VolumeComponentCopyPaste.PasteSettings(new List { m_Dst1, m_Dst2, m_Dst3 }, null); Undo.PerformUndo(); @@ -166,5 +166,44 @@ public void CanPasteIfMultipleMatchingTypes() VolumeComponentCopyPaste.CopySettings(new List { m_Src1, m_Src2, m_Src3 }); Assert.True(VolumeComponentCopyPaste.CanPaste(new List { m_Dst1, m_Dst3, m_Dst2 })); } + + [Test] + public void AfterPasteSettings_VolumeProfileAssetIsDirty() + { + const string kAssetPath = "Assets/AfterPasteSettings_VolumeProfileAssetIsDirty.asset"; + var sourceProfile = ScriptableObject.CreateInstance(); + sourceProfile.Add(); + var volumeProfileAsset = VolumeProfileFactory.CreateVolumeProfileAtPath(kAssetPath, sourceProfile); + + VolumeComponentCopyPaste.CopySettings(m_Src1); + Assume.That(volumeProfileAsset.TryGet(out var dst)); + + int dirtyCountBeforePaste = EditorUtility.GetDirtyCount(volumeProfileAsset); + VolumeComponentCopyPaste.PasteSettings(dst, volumeProfileAsset); + Assert.AreEqual(EditorUtility.GetDirtyCount(volumeProfileAsset), dirtyCountBeforePaste + 1); + + dirtyCountBeforePaste = EditorUtility.GetDirtyCount(volumeProfileAsset); + VolumeComponentCopyPaste.PasteSettings(new List{ dst } , volumeProfileAsset); + Assert.AreEqual(EditorUtility.GetDirtyCount(volumeProfileAsset), dirtyCountBeforePaste + 1); + + AssetDatabase.DeleteAsset(kAssetPath); + } + + [Test] + public void AfterPasteSettings_VolumeProfileInstanceIsNotDirty() + { + var volumeProfileInstance = ScriptableObject.CreateInstance(); + CopyPasteTestComponent1 dst = volumeProfileInstance.Add(); + + VolumeComponentCopyPaste.CopySettings(m_Src1); + + int dirtyCountBeforePaste = EditorUtility.GetDirtyCount(volumeProfileInstance); + VolumeComponentCopyPaste.PasteSettings(dst, volumeProfileInstance); + Assert.AreEqual(EditorUtility.GetDirtyCount(volumeProfileInstance), dirtyCountBeforePaste); + + dirtyCountBeforePaste = EditorUtility.GetDirtyCount(volumeProfileInstance); + VolumeComponentCopyPaste.PasteSettings(new List{ dst }, volumeProfileInstance); + Assert.AreEqual(EditorUtility.GetDirtyCount(volumeProfileInstance), dirtyCountBeforePaste); + } } } diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/ShaderStageCapabilityTests.cs b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/ShaderStageCapabilityTests.cs index 6fc7b98e55b..137e3165843 100644 --- a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/ShaderStageCapabilityTests.cs +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/ShaderStageCapabilityTests.cs @@ -57,7 +57,7 @@ public void SubGraphDescendentsTests() graphData.OnEnable(); graphData.ValidateGraph(); - var subGraphnodeName = "ShaderStageCapability_SubGraph"; + var subGraphnodeName = "Shader Stage Capability_Sub Graph"; var subGraphNode = FindFirstNodeOfType(graphData, subGraphnodeName); if (subGraphNode == null) { @@ -142,7 +142,7 @@ void ValidateSlotError(MaterialSlot slotA, MaterialSlot slotB, AbstractMaterialN graphData.RemoveEdge(edge); } - var subGraphNode = FindFirstNodeOfType(graphData, "SubShaderInvalidCapabilities_SubGraph"); + var subGraphNode = FindFirstNodeOfType(graphData, "Sub Shader Invalid Capabilities_Sub Graph"); var vertexIdNode = FindFirstNodeOfType(graphData); var sampleTextureNode = FindFirstNodeOfType(graphData); var baseColorNode = FindFirstNodeOfType(graphData, $"{BlockFields.SurfaceDescription.BaseColor.tag}.{BlockFields.SurfaceDescription.BaseColor.name}"); diff --git a/Tests/SRPTests/Projects/ShaderGraph/Packages/manifest.json b/Tests/SRPTests/Projects/ShaderGraph/Packages/manifest.json index 2fb0c77facf..cab2d14ea73 100644 --- a/Tests/SRPTests/Projects/ShaderGraph/Packages/manifest.json +++ b/Tests/SRPTests/Projects/ShaderGraph/Packages/manifest.json @@ -7,7 +7,7 @@ "com.unity.render-pipelines.universal-config": "file:../../../../../Packages/com.unity.render-pipelines.universal-config", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testtools.codecoverage": "1.1.0", "com.unity.ugui": "2.0.0", "com.unity.visualeffectgraph": "file:../../../../../Packages/com.unity.visualeffectgraph", diff --git a/Tests/SRPTests/Projects/ShaderGraphUniversalStereo/Packages/manifest.json b/Tests/SRPTests/Projects/ShaderGraphUniversalStereo/Packages/manifest.json index 3b522775672..12a55531d74 100644 --- a/Tests/SRPTests/Projects/ShaderGraphUniversalStereo/Packages/manifest.json +++ b/Tests/SRPTests/Projects/ShaderGraphUniversalStereo/Packages/manifest.json @@ -9,7 +9,7 @@ "com.unity.render-pipelines.universal-config": "file:../../../../../Packages/com.unity.render-pipelines.universal-config", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.ugui": "2.0.0", "com.unity.xr.mock-hmd": "1.1.1-preview.1", "local.utf.references": "file:../../../Packages/local.utf.references", diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json index 4bcd92e9433..60c3ebd78aa 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json @@ -17,7 +17,7 @@ "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.visualeffectgraph": "file:../../../../../Packages/com.unity.visualeffectgraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", "com.unity.modules.ai": "1.0.0", diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json index cd34f0ef378..b5fd395ebbd 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json @@ -15,7 +15,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.common-graphics": "file:../../../Packages/com.unity.testing.common-graphics", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json index fe6b4407ea8..a847c0f2f0d 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json @@ -14,7 +14,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json index 97e3618e6c8..d62ad97bc29 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json @@ -15,7 +15,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json index 69c61ce3ba1..fd1656e562a 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json @@ -14,7 +14,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Packages/manifest.json b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Packages/manifest.json index c96082eb9df..a5f7c4fb0c2 100644 --- a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Packages/manifest.json +++ b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Packages/manifest.json @@ -18,7 +18,7 @@ "com.unity.timeline": "1.8.4", "com.unity.ugui": "2.0.0", "com.unity.visualeffectgraph": "file:../../../../../Packages/com.unity.visualeffectgraph", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "local.utf.references": "file:../../../Packages/local.utf.references", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/40_InstancingSplitCompute.unity b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/40_InstancingSplitCompute.unity index 766ea6cde70..79f4d838b22 100644 --- a/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/40_InstancingSplitCompute.unity +++ b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/40_InstancingSplitCompute.unity @@ -42,7 +42,8 @@ RenderSettings: --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 12 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 m_GISettings: serializedVersion: 2 m_BounceScale: 1 @@ -238,6 +239,59 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &327876044 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 327876046} + - component: {fileID: 327876045} + m_Layer: 0 + m_Name: SplitGroupStressTest + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &327876045 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 327876044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9b2fe12112e8e294499e4be00cf2c1a1, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::SplitGroupStressTest + Textures: + - {fileID: 2800000, guid: 276d9e395ae18fe40a9b4988549f2349, type: 3} + - {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0} + Meshes: + - {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} + - {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} + - {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} + MaxInstanceCount: 1000 + InstancePerFrame: 100 +--- !u!4 &327876046 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 327876044} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.00746, y: 2.04013, z: 0.93717} + 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!1 &348579748 GameObject: m_ObjectHideFlags: 0 @@ -1180,126 +1234,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3} m_Name: m_EditorClassIdentifier: - clearColorMode: 0 - backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0} - clearDepth: 1 - volumeLayerMask: - serializedVersion: 2 - m_Bits: 1 - volumeAnchorOverride: {fileID: 0} - antialiasing: 0 - SMAAQuality: 2 - dithering: 0 - stopNaNs: 0 - taaSharpenStrength: 0.5 - TAAQuality: 1 - taaSharpenMode: 0 - taaRingingReduction: 0 - taaHistorySharpening: 0.35 - taaAntiFlicker: 0.5 - taaMotionVectorRejection: 0 - taaAntiHistoryRinging: 0 - taaBaseBlendFactor: 0.875 - taaJitterScale: 1 - physicalParameters: - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - flipYMode: 0 - xrRendering: 1 - fullscreenPassthrough: 0 - allowDynamicResolution: 0 - customRenderingSettings: 0 - invertFaceCulling: 0 - probeLayerMask: - serializedVersion: 2 - m_Bits: 4294967295 - hasPersistentHistory: 0 - screenSizeOverride: {x: 0, y: 0, z: 0, w: 0} - screenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} - allowDeepLearningSuperSampling: 1 - deepLearningSuperSamplingUseCustomQualitySettings: 0 - deepLearningSuperSamplingQuality: 0 - deepLearningSuperSamplingUseCustomAttributes: 0 - deepLearningSuperSamplingUseOptimalSettings: 1 - deepLearningSuperSamplingSharpening: 0 - fsrOverrideSharpness: 0 - fsrSharpness: 0.92 - exposureTarget: {fileID: 0} - materialMipBias: 0 - m_RenderingPathCustomFrameSettings: - bitDatas: - data1: 1266566494682957 - data2: 13799030890350739480 - lodBias: 1 - lodBiasMode: 0 - lodBiasQualityLevel: 0 - maximumLODLevel: 0 - maximumLODLevelMode: 0 - maximumLODLevelQualityLevel: 0 - sssQualityMode: 0 - sssQualityLevel: 0 - sssCustomSampleBudget: 20 - sssCustomDownsampleSteps: 0 - msaaMode: 1 - materialQuality: 0 - renderingPathCustomFrameSettingsOverrideMask: - mask: - data1: 0 - data2: 0 - defaultFrameSettings: 0 - m_Version: 9 - m_ObsoleteRenderingPath: 0 - m_ObsoleteFrameSettings: - overrides: 0 - enableShadow: 0 - enableContactShadows: 0 - enableShadowMask: 0 - enableSSR: 0 - enableSSAO: 0 - enableSubsurfaceScattering: 0 - enableTransmission: 0 - enableAtmosphericScattering: 0 - enableVolumetrics: 0 - enableReprojectionForVolumetrics: 0 - enableLightLayers: 0 - enableExposureControl: 1 - diffuseGlobalDimmer: 0 - specularGlobalDimmer: 0 - shaderLitMode: 0 - enableDepthPrepassWithDeferredRendering: 0 - enableTransparentPrepass: 0 - enableMotionVectors: 0 - enableObjectMotionVectors: 0 - enableDecals: 0 - enableRoughRefraction: 0 - enableTransparentPostpass: 0 - enableDistortion: 0 - enablePostprocess: 0 - enableOpaqueObjects: 0 - enableTransparentObjects: 0 - enableRealtimePlanarReflection: 0 - enableMSAA: 0 - enableAsyncCompute: 0 - runLightListAsync: 0 - runSSRAsync: 0 - runSSAOAsync: 0 - runContactShadowsAsync: 0 - runVolumeVoxelizationAsync: 0 - lightLoopSettings: - overrides: 0 - enableDeferredTileAndCluster: 0 - enableComputeLightEvaluation: 0 - enableComputeLightVariants: 0 - enableComputeMaterialVariants: 0 - enableFptlForForwardOpaque: 0 - enableBigTilePrepass: 0 - isFptlEnabled: 0 --- !u!1 &1248642482 GameObject: m_ObjectHideFlags: 0 @@ -1907,7 +1841,7 @@ LightingSettings: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: Settings.lighting - serializedVersion: 8 + serializedVersion: 9 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 m_RealtimeEnvironmentLighting: 1 @@ -2206,6 +2140,7 @@ SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 1247116095} + - {fileID: 327876046} - {fileID: 2105409545} - {fileID: 176540214} - {fileID: 869646327} diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/SplitGroupStressTest.cs b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/SplitGroupStressTest.cs new file mode 100644 index 00000000000..d8ba1a15e58 --- /dev/null +++ b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/SplitGroupStressTest.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Serialization; +using UnityEngine.VFX; + +public class SplitGroupStressTest : MonoBehaviour +{ + + public List Textures; + public List Meshes; + public int MaxInstanceCount = 100; + public int InstancePerFrame = 30; + + // Start is called once before the first execution of Update after the MonoBehaviour is created + private List m_OriginalVisualEffects; + private List m_VisualEffects; + private int m_Index; + + int kTextureId = Shader.PropertyToID("Texture"); + int kMeshId = Shader.PropertyToID("Mesh"); + + private bool m_DeletionMode = false; + + void Start() + { + m_OriginalVisualEffects = new List(FindObjectsByType(FindObjectsSortMode.None)); + m_VisualEffects = new List(MaxInstanceCount); + } + + // Update is called once per frame + void Update() + { + if (!m_DeletionMode) + { + if (m_VisualEffects.Count < MaxInstanceCount) + { + for (int i = 0; i < InstancePerFrame; i++) + { + var refVfx = m_OriginalVisualEffects[m_Index % m_OriginalVisualEffects.Count]; + var newPos = refVfx.gameObject.transform.localPosition + Vector3.left; + var vfx = Instantiate(refVfx, newPos, Quaternion.identity); + vfx.SetTexture(kTextureId, Textures[m_Index % Textures.Count]); + vfx.SetMesh(kMeshId, Meshes[m_Index % Meshes.Count]); + m_VisualEffects.Add(vfx); + m_Index++; + } + } + else + { + m_DeletionMode = true; + } + } + else + { + for (int i = 0; i < InstancePerFrame; i++) + { + if (m_VisualEffects.Count > 0) + { + Destroy(m_VisualEffects[m_VisualEffects.Count - 1].gameObject); + m_VisualEffects.RemoveAt(m_VisualEffects.Count - 1); + } + } + } + + } +} diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/SplitGroupStressTest.cs.meta b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/SplitGroupStressTest.cs.meta new file mode 100644 index 00000000000..b3bf4f70238 --- /dev/null +++ b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Assets/GraphicsTests/Instancing/SplitGroupStressTest.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9b2fe12112e8e294499e4be00cf2c1a1 \ No newline at end of file diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_URP/Packages/manifest.json b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Packages/manifest.json index 953e175010e..10c680a0c26 100644 --- a/Tests/SRPTests/Projects/VisualEffectGraph_URP/Packages/manifest.json +++ b/Tests/SRPTests/Projects/VisualEffectGraph_URP/Packages/manifest.json @@ -17,7 +17,7 @@ "com.unity.ugui": "2.0.0", "com.unity.visualeffectgraph": "file:../../../../../Packages/com.unity.visualeffectgraph", "com.unity.xr.legacyinputhelpers": "2.1.2", - "com.unity.testframework.graphics": "8.11.0-exp.1", + "com.unity.testframework.graphics": "8.12.0-exp.2", "local.utf.references": "file:../../../Packages/local.utf.references", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0",