diff --git a/TestProjects/HDRP_DXR_Tests/ProjectSettings/ProjectSettings.asset b/TestProjects/HDRP_DXR_Tests/ProjectSettings/ProjectSettings.asset index 104d47fd624..af843add623 100644 --- a/TestProjects/HDRP_DXR_Tests/ProjectSettings/ProjectSettings.asset +++ b/TestProjects/HDRP_DXR_Tests/ProjectSettings/ProjectSettings.asset @@ -275,6 +275,9 @@ PlayerSettings: - m_BuildTarget: WebGL m_StaticBatching: 0 m_DynamicBatching: 0 + - m_BuildTarget: PS5 + m_StaticBatching: 0 + m_DynamicBatching: 0 m_BuildTargetGraphicsJobs: - m_BuildTarget: MacStandaloneSupport m_GraphicsJobs: 0 @@ -600,6 +603,7 @@ PlayerSettings: webGLDecompressionFallback: 0 scriptingDefineSymbols: 1: UNITY_HDRP_DXR_TESTS_DEFINE;ENABLE_RAYTRACING + 33: UNITY_HDRP_DXR_TESTS_DEFINE;ENABLE_RAYTRACING;NO_RAY_RECURSION additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: {} diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs index 9f82f0998b7..f1ae4cfd00e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs @@ -33,7 +33,7 @@ class AmbientOcclusionEditor : VolumeComponentWithQualityEditor SerializedDataParameter m_Denoise; SerializedDataParameter m_DenoiserRadius; - public override bool hasAdvancedMode => (m_RayTracing == null || !(HDRenderPipeline.pipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue)); + public override bool hasAdvancedMode => (m_RayTracing == null || !(HDRenderPipeline.buildPipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue)); public override void OnEnable() { @@ -72,7 +72,7 @@ public override void OnInspectorGUI() return; } - if (HDRenderPipeline.pipelineSupportsRayTracing) + if (HDRenderPipeline.buildPipelineSupportsRayTracing) PropertyField(m_RayTracing, EditorGUIUtility.TrTextContent("Ray Tracing (Preview)", "Enable ray traced ambient occlusion.")); // Shared attributes @@ -80,7 +80,7 @@ public override void OnInspectorGUI() PropertyField(m_DirectLightingStrength, EditorGUIUtility.TrTextContent("Direct Lighting Strength", "Controls how much the ambient light affects occlusion.")); // If ray tracing is supported and it is enabled on this volume, display the ray tracing options. - if (HDRenderPipeline.pipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue) + if (HDRenderPipeline.buildPipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue) { PropertyField(m_LayerMask, EditorGUIUtility.TrTextContent("Layer Mask", "Layer mask used to include the objects for ambient occlusion.")); base.OnInspectorGUI(); // Quality Setting diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs index e4f718745d6..da198aa52f8 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs @@ -1102,7 +1102,7 @@ static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner) EditorGUILayout.Slider(serialized.areaLightShadowCone, HDAdditionalLightData.k_MinAreaLightShadowCone, HDAdditionalLightData.k_MaxAreaLightShadowCone, s_Styles.areaLightShadowCone); } - if (HDRenderPipeline.pipelineSupportsRayTracing && HDRenderPipeline.pipelineSupportsScreenSpaceShadows) + if (HDRenderPipeline.buildPipelineSupportsRayTracing && HDRenderPipeline.pipelineSupportsScreenSpaceShadows) { bool isPunctual = lightType == HDLightType.Point || (lightType == HDLightType.Spot && serialized.spotLightShape.GetEnumValue() == SpotLightShape.Cone); if (isPunctual || (lightType == HDLightType.Area && serialized.areaLightShape == AreaLightShape.Rectangle)) @@ -1137,7 +1137,7 @@ static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner) if (lightType == HDLightType.Directional && HDRenderPipeline.pipelineSupportsScreenSpaceShadows) { EditorGUILayout.PropertyField(serialized.useScreenSpaceShadows, s_Styles.useScreenSpaceShadows); - if (HDRenderPipeline.pipelineSupportsRayTracing) + if (HDRenderPipeline.buildPipelineSupportsRayTracing) { using (new EditorGUI.DisabledScope(!serialized.useScreenSpaceShadows.boolValue)) { @@ -1248,7 +1248,7 @@ static void DrawContactShadowsContent(SerializedHDLight serialized, Editor owner HDAdditionalLightData.ScalableSettings.UseContactShadow(hdrp), hdrp.name ); - if (HDRenderPipeline.pipelineSupportsRayTracing + if (HDRenderPipeline.buildPipelineSupportsRayTracing && serialized.contactShadows.@override.boolValue) { EditorGUI.indentLevel++; diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs index 3c5973418a1..7efd8b2ced6 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs @@ -188,7 +188,7 @@ public override void OnInspectorGUI() PropertyField(m_Enable, EditorGUIUtility.TrTextContent("Enable")); // The ray tracing enabling checkbox is only displayed if the asset supports ray tracing - bool rayTracingSupported = HDRenderPipeline.pipelineSupportsRayTracing; + bool rayTracingSupported = HDRenderPipeline.buildPipelineSupportsRayTracing; if (rayTracingSupported) PropertyField(m_RayTracing, k_RayTracingText); @@ -231,7 +231,7 @@ public override QualitySettingsBlob SaveCustomQualitySettingsAsObject(QualitySet settings = new QualitySettingsBlob(); // RTR - if (HDRenderPipeline.pipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && + if (HDRenderPipeline.buildPipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue) { settings.Save(m_MinSmoothness); @@ -253,7 +253,7 @@ public override QualitySettingsBlob SaveCustomQualitySettingsAsObject(QualitySet public override void LoadSettingsFromObject(QualitySettingsBlob settings) { // RTR - if (HDRenderPipeline.pipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && + if (HDRenderPipeline.buildPipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue) { settings.TryLoad(ref m_MinSmoothness); @@ -273,7 +273,7 @@ public override void LoadSettingsFromObject(QualitySettingsBlob settings) public override void LoadSettingsFromQualityPreset(RenderPipelineSettings settings, int level) { // RTR - if (HDRenderPipeline.pipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && + if (HDRenderPipeline.buildPipelineSupportsRayTracing && m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue) { CopySetting(ref m_MinSmoothness, settings.lightingQualitySettings.RTRMinSmoothness[level]); @@ -293,7 +293,7 @@ public override void LoadSettingsFromQualityPreset(RenderPipelineSettings settin public override bool QualityEnabled() { // Quality always used for SSR - if (!HDRenderPipeline.rayTracingSupportedBySystem || !m_RayTracing.value.boolValue) + if (!HDRenderPipeline.buildTargetSupportsRayTracing || !m_RayTracing.value.boolValue) return true; // Handle the quality usage for RTGI diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDTarget.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDTarget.cs index 453c67fe165..2c9050b022d 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDTarget.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDTarget.cs @@ -781,7 +781,7 @@ static class CorePragmas { { Pragma.Target(ShaderModel.Target50) }, { Pragma.Raytracing("surface_shader") }, - { Pragma.OnlyRenderers(new Platform[] {Platform.D3D11}) }, + { Pragma.OnlyRenderers(new Platform[] {Platform.D3D11, Platform.PS5}) }, }; } #endregion diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index 86e23243b0c..8cd178676b8 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -132,7 +132,7 @@ public class GeneralSection public static readonly GUIContent supportRaytracing = EditorGUIUtility.TrTextContent("Realtime Raytracing (Preview)"); public static readonly GUIContent supportedRayTracingMode = EditorGUIUtility.TrTextContent("Supported Ray Tracing Mode (Preview)"); public static readonly GUIContent rayTracingUnsupportedWarning = EditorGUIUtility.TrTextContent("Ray tracing is not supported on your device. Please refer to the documentation."); - public static readonly GUIContent rayTracingDX12OnlyWarning = EditorGUIUtility.TrTextContent("Ray tracing is currently only supported on DX12."); + public static readonly GUIContent rayTracingRestrictionOnlyWarning = EditorGUIUtility.TrTextContent("Ray tracing is currently only supported on DX12 and Playstation 5."); public static readonly GUIContent rayTracingMSAAUnsupported = EditorGUIUtility.TrTextContent("When Ray tracing is enabled in asset, MSAA is not supported. Please refer to the documentation."); public static readonly GUIContent maximumLODLevel = EditorGUIUtility.TrTextContent("Maximum LOD Level"); public static readonly GUIContent LODBias = EditorGUIUtility.TrTextContent("LOD Bias"); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs index f51d296c162..6a83f1f4800 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs @@ -963,16 +963,14 @@ static void Drawer_SectionRenderingUnsorted(SerializedHDRenderPipelineAsset seri { ++EditorGUI.indentLevel; EditorGUILayout.PropertyField(serialized.renderPipelineSettings.supportedRayTracingMode, Styles.supportedRayTracingMode); - if (serialized.renderPipelineSettings.supportRayTracing.boolValue && !UnityEngine.SystemInfo.supportsRayTracing) + + // If ray tracing is enabled by the asset but the current system does not support it display a warning + if (!HDRenderPipeline.currentSystemSupportsRayTracing) { - if (PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget)[0] != GraphicsDeviceType.Direct3D12) - { - EditorGUILayout.HelpBox(Styles.rayTracingDX12OnlyWarning.text, MessageType.Warning, wide: true); - } + if (serialized.renderPipelineSettings.supportRayTracing.boolValue) + EditorGUILayout.HelpBox(Styles.rayTracingRestrictionOnlyWarning.text, MessageType.Warning, wide: true); else - { EditorGUILayout.HelpBox(Styles.rayTracingUnsupportedWarning.text, MessageType.Warning, wide: true); - } } --EditorGUI.indentLevel; } diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs index 714dd9d27e9..2c773e52b8b 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs @@ -41,7 +41,7 @@ public override void OnInspectorGUI() } // If ray tracing is supported display the content of the volume component - if (HDRenderPipeline.pipelineSupportsRayTracing) + if (HDRenderPipeline.buildPipelineSupportsRayTracing) { PropertyField(m_Enable); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs index 5c049e94be1..30e5360ea3a 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs @@ -104,7 +104,7 @@ public override void OnInspectorGUI() PropertyField(m_Enable); // If ray tracing is supported display the content of the volume component - if (HDRenderPipeline.pipelineSupportsRayTracing) + if (HDRenderPipeline.buildPipelineSupportsRayTracing ) { PropertyField(m_RayTracing, EditorGUIUtility.TrTextContent("Ray Tracing (Preview)", "Enable ray traced global illumination.")); } @@ -114,7 +114,7 @@ public override void OnInspectorGUI() using (new HDEditorUtils.IndentScope()) { - if (HDRenderPipeline.pipelineSupportsRayTracing) + if (HDRenderPipeline.buildPipelineSupportsRayTracing ) { if (m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue) { @@ -269,7 +269,7 @@ public override void LoadSettingsFromQualityPreset(RenderPipelineSettings settin public override bool QualityEnabled() { // Quality always used for SSGI - if (!HDRenderPipeline.rayTracingSupportedBySystem || !m_RayTracing.value.boolValue) + if (!HDRenderPipeline.buildTargetSupportsRayTracing || !m_RayTracing.value.boolValue) return true; // Handle the quality usage for RTGI diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RecursiveRenderingEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RecursiveRenderingEditor.cs index 96783615007..eaf18782439 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RecursiveRenderingEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RecursiveRenderingEditor.cs @@ -37,7 +37,7 @@ public override void OnInspectorGUI() } // If ray tracing is supported display the content of the volume component - if (HDRenderPipeline.pipelineSupportsRayTracing) + if (HDRenderPipeline.buildPipelineSupportsRayTracing) { PropertyField(m_Enable); diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs index ece315f7b98..d859767a86c 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs @@ -145,55 +145,110 @@ public Entry(QualityScope scope, InclusiveMode mode, Style.ConfigStyle configSty } } + + [InitializeOnLoadMethod] + static void InitializeEntryListOnLoad() + { + EditorApplication.delayCall += () => + InitializeEntryList(); + } + + static void InitializeEntryList() + { + if (EditorWindow.HasOpenInstances()) + { + HDWizard window = (HDWizard)EditorWindow.GetWindow(typeof(HDWizard)); + window.ReBuildEntryList(); + } + } + + Entry[] BuildEntryList() + { + List entryList = new List(); + + // Add the general and XR entries + entryList.AddRange(new[] + { + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpColorSpace, IsColorSpaceCorrect, FixColorSpace), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpLightmapEncoding, IsLightmapCorrect, FixLightmap), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpShadow, IsShadowCorrect, FixShadow), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpShadowmask, IsShadowmaskCorrect, FixShadowmask), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetGraphicsAssigned, IsHdrpAssetGraphicsUsedCorrect, FixHdrpAssetGraphicsUsed), + new Entry(QualityScope.CurrentQuality, InclusiveMode.HDRP, Style.hdrpAssetQualityAssigned, IsHdrpAssetQualityUsedCorrect, FixHdrpAssetQualityUsed), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetRuntimeResources, IsHdrpAssetRuntimeResourcesCorrect, FixHdrpAssetRuntimeResources), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetEditorResources, IsHdrpAssetEditorResourcesCorrect, FixHdrpAssetEditorResources), + new Entry(QualityScope.CurrentQuality, InclusiveMode.HDRP, Style.hdrpBatcher, IsSRPBatcherCorrect, FixSRPBatcher), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetDiffusionProfile, IsHdrpAssetDiffusionProfileCorrect, FixHdrpAssetDiffusionProfile), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpVolumeProfile, IsDefaultVolumeProfileAssigned, FixDefaultVolumeProfileAssigned), + new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpLookDevVolumeProfile, IsDefaultLookDevVolumeProfileAssigned, FixDefaultLookDevVolumeProfileAssigned), + + new Entry(QualityScope.Global, InclusiveMode.VR, Style.vrLegacyVRSystem, IsOldVRSystemForCurrentBuildTargetGroupCorrect, FixOldVRSystemForCurrentBuildTargetGroup), + new Entry(QualityScope.Global, InclusiveMode.VR, Style.vrXRManagementPackage, IsVRXRManagementPackageInstalledCorrect, FixVRXRManagementPackageInstalled), + new Entry(QualityScope.Global, InclusiveMode.XRManagement, Style.vrOculusPlugin, () => false, null), + new Entry(QualityScope.Global, InclusiveMode.XRManagement, Style.vrSinglePassInstancing, () => false, null), + new Entry(QualityScope.Global, InclusiveMode.VR, Style.vrLegacyHelpersPackage, IsVRLegacyHelpersCorrect, FixVRLegacyHelpers), + }); + + if (CalculateSelectedBuildTarget() == BuildTarget.PS5) + { + entryList.AddRange(new[] + { + new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrAutoGraphicsAPIWarning_WindowsOnly, IsDXRAutoGraphicsAPICorrect_WindowsOnly, FixDXRAutoGraphicsAPI_WindowsOnly), + new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrD3D12Warning_WindowsOnly, IsDXRDirect3D12Correct_WindowsOnly, FixDXRDirect3D12_WindowsOnly), + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrStaticBatching, IsDXRStaticBatchingCorrect, FixDXRStaticBatching), + new Entry(QualityScope.CurrentQuality, InclusiveMode.DXR, Style.dxrActivated, IsDXRActivationCorrect, FixDXRActivation), + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrBuildTarget, IsValidBuildTarget, FixBuildTarget), + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrResources, IsDXRAssetCorrect, FixDXRAsset), + }); + } + else + { + entryList.AddRange(new[] + { + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrAutoGraphicsAPI, IsDXRAutoGraphicsAPICorrect, FixDXRAutoGraphicsAPI), + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrD3D12, IsDXRDirect3D12Correct, FixDXRDirect3D12), + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrStaticBatching, IsDXRStaticBatchingCorrect, FixDXRStaticBatching), + new Entry(QualityScope.CurrentQuality, InclusiveMode.DXR, Style.dxrActivated, IsDXRActivationCorrect, FixDXRActivation), + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrBuildTarget, IsValidBuildTarget, FixBuildTarget), + new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrResources, IsDXRAssetCorrect, FixDXRAsset), + }); + } + + + // Add the Optional checks + entryList.AddRange(new[] + { + new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrScreenSpaceShadow, IsDXRScreenSpaceShadowCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), + new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrScreenSpaceShadowFS, IsDXRScreenSpaceShadowFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), + new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrReflections, IsDXRReflectionsCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), + new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrReflectionsFS, IsDXRReflectionsFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), + new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrTransparentReflections, IsDXRTransparentReflectionsCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), + new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrTransparentReflectionsFS, IsDXRTransparentReflectionsFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), + new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrGI, IsDXRGICorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), + new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrGIFS, IsDXRGIFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), + }); + + return entryList.ToArray(); + } + + internal void ReBuildEntryList() + { + m_Entries = BuildEntryList(); + } + + Entry[] m_Entries; //To add elements in the Wizard configuration checker, //add your new checks in this array at the right position. //Both "Fix All" button and UI drawing will use it. //Indentation is computed in Entry if you use certain subscope. - Entry[] m_Entries; + Entry[] entries { get { // due to functor, cannot static link directly in an array and need lazy init if (m_Entries == null) - m_Entries = new[] - { - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpColorSpace, IsColorSpaceCorrect, FixColorSpace), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpLightmapEncoding, IsLightmapCorrect, FixLightmap), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpShadow, IsShadowCorrect, FixShadow), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpShadowmask, IsShadowmaskCorrect, FixShadowmask), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetGraphicsAssigned, IsHdrpAssetGraphicsUsedCorrect, FixHdrpAssetGraphicsUsed), - new Entry(QualityScope.CurrentQuality, InclusiveMode.HDRP, Style.hdrpAssetQualityAssigned, IsHdrpAssetQualityUsedCorrect, FixHdrpAssetQualityUsed), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetRuntimeResources, IsHdrpAssetRuntimeResourcesCorrect, FixHdrpAssetRuntimeResources), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetEditorResources, IsHdrpAssetEditorResourcesCorrect, FixHdrpAssetEditorResources), - new Entry(QualityScope.CurrentQuality, InclusiveMode.HDRP, Style.hdrpBatcher, IsSRPBatcherCorrect, FixSRPBatcher), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpAssetDiffusionProfile, IsHdrpAssetDiffusionProfileCorrect, FixHdrpAssetDiffusionProfile), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpVolumeProfile, IsDefaultVolumeProfileAssigned, FixDefaultVolumeProfileAssigned), - new Entry(QualityScope.Global, InclusiveMode.HDRP, Style.hdrpLookDevVolumeProfile, IsDefaultLookDevVolumeProfileAssigned, FixDefaultLookDevVolumeProfileAssigned), - - new Entry(QualityScope.Global, InclusiveMode.VR, Style.vrLegacyVRSystem, IsOldVRSystemForCurrentBuildTargetGroupCorrect, FixOldVRSystemForCurrentBuildTargetGroup), - new Entry(QualityScope.Global, InclusiveMode.VR, Style.vrXRManagementPackage, IsVRXRManagementPackageInstalledCorrect, FixVRXRManagementPackageInstalled), - new Entry(QualityScope.Global, InclusiveMode.XRManagement, Style.vrOculusPlugin, () => false, null), - new Entry(QualityScope.Global, InclusiveMode.XRManagement, Style.vrSinglePassInstancing, () => false, null), - new Entry(QualityScope.Global, InclusiveMode.VR, Style.vrLegacyHelpersPackage, IsVRLegacyHelpersCorrect, FixVRLegacyHelpers), - - new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrAutoGraphicsAPI, IsDXRAutoGraphicsAPICorrect, FixDXRAutoGraphicsAPI), - new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrD3D12, IsDXRDirect3D12Correct, FixDXRDirect3D12), - new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrStaticBatching, IsDXRStaticBatchingCorrect, FixDXRStaticBatching), - new Entry(QualityScope.CurrentQuality, InclusiveMode.DXR, Style.dxrActivated, IsDXRActivationCorrect, FixDXRActivation), - new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxr64bits, IsArchitecture64Bits, FixArchitecture64Bits), - new Entry(QualityScope.Global, InclusiveMode.DXR, Style.dxrResources, IsDXRAssetCorrect, FixDXRAsset), - - // Optional checks - new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrScreenSpaceShadow, IsDXRScreenSpaceShadowCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), - new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrScreenSpaceShadowFS, IsDXRScreenSpaceShadowFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), - new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrReflections, IsDXRReflectionsCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), - new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrReflectionsFS, IsDXRReflectionsFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), - new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrTransparentReflections, IsDXRTransparentReflectionsCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), - new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrTransparentReflectionsFS, IsDXRTransparentReflectionsFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), - new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrGI, IsDXRGICorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), - new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrGIFS, IsDXRGIFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), - }; + m_Entries = BuildEntryList(); return m_Entries; } } @@ -617,14 +672,25 @@ bool IsDXRAllCorrect() void FixDXRAll() => FixAllEntryInScope(InclusiveMode.DXR); + bool IsDXRAutoGraphicsAPICorrect_WindowsOnly() + => !PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.StandaloneWindows64) && !PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.StandaloneWindows); + + void FixDXRAutoGraphicsAPI_WindowsOnly(bool fromAsyncUnused) + { + PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.StandaloneWindows64, false); + PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.StandaloneWindows, false); + } + bool IsDXRAutoGraphicsAPICorrect() - => !PlayerSettings.GetUseDefaultGraphicsAPIs(CalculateSelectedBuildTarget()); + => (!PlayerSettings.GetUseDefaultGraphicsAPIs(CalculateSelectedBuildTarget())); void FixDXRAutoGraphicsAPI(bool fromAsyncUnused) => PlayerSettings.SetUseDefaultGraphicsAPIs(CalculateSelectedBuildTarget(), false); bool IsDXRDirect3D12Correct() - => (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12) && !HDProjectSettings.wizardNeedRestartAfterChangingToDX12; + { + return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 && !HDProjectSettings.wizardNeedRestartAfterChangingToDX12; + } void FixDXRDirect3D12(bool fromAsyncUnused) { @@ -654,6 +720,35 @@ void FixDXRDirect3D12(bool fromAsyncUnused) } } + bool IsDXRDirect3D12Correct_WindowsOnly() + { + return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 && !HDProjectSettings.wizardNeedRestartAfterChangingToDX12; + } + + void FixDXRDirect3D12_WindowsOnly(bool fromAsyncUnused) + { + if (PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows64).Contains(GraphicsDeviceType.Direct3D12)) + { + PlayerSettings.SetGraphicsAPIs( + BuildTarget.StandaloneWindows64, + new[] { GraphicsDeviceType.Direct3D12 } + .Concat( + PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows64) + .Where(x => x != GraphicsDeviceType.Direct3D12)) + .ToArray()); + } + else + { + PlayerSettings.SetGraphicsAPIs( + BuildTarget.StandaloneWindows64, + new[] { GraphicsDeviceType.Direct3D12 } + .Concat(PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows64)) + .ToArray()); + } + HDProjectSettings.wizardNeedRestartAfterChangingToDX12 = true; + m_Fixer.Add(() => ChangedFirstGraphicAPI(BuildTarget.StandaloneWindows64)); //register reboot at end of operations + } + void ChangedFirstGraphicAPI(BuildTarget target) { //It seams that the 64 version is not check for restart for a strange reason @@ -682,10 +777,13 @@ void CheckPersistantNeedReboot() } bool IsDXRAssetCorrect() - => HDRenderPipeline.defaultAsset != null - && HDRenderPipeline.defaultAsset.renderPipelineRayTracingResources != null - && SystemInfo.supportsRayTracing; - + { + var selectedBuildTarget = CalculateSelectedBuildTarget(); + return HDRenderPipeline.defaultAsset != null + && HDRenderPipeline.defaultAsset.renderPipelineRayTracingResources != null + && (SystemInfo.supportsRayTracing || selectedBuildTarget == BuildTarget.PS5); + } + void FixDXRAsset(bool fromAsyncUnused) { if (!IsHdrpAssetGraphicsUsedCorrect()) @@ -767,14 +865,17 @@ bool IsDXRGIFSCorrect() return false; } - bool IsArchitecture64Bits() - => EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64; - + bool IsValidBuildTarget() + { + return (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64) + || (EditorUserBuildSettings.activeBuildTarget == BuildTarget.PS5); + } - void FixArchitecture64Bits(bool fromAsyncUnused) - { - EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); - } + void FixBuildTarget(bool fromAsyncUnused) + { + if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.PS5) + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); + } bool IsDXRStaticBatchingCorrect() => !GetStaticBatching(CalculateSelectedBuildTarget()); diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs index b19492fe5e5..265273abd7b 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs @@ -128,9 +128,21 @@ public ConfigStyle(string label, string error, string button = resolve, MessageT public static readonly ConfigStyle dxrAutoGraphicsAPI = new ConfigStyle( label: "Auto graphics API", error: "Auto Graphics API is not supported!"); + + public static readonly ConfigStyle dxrAutoGraphicsAPIWarning_WindowsOnly = new ConfigStyle( + label: L10n.Tr("Auto graphics API"), + error: L10n.Tr("Auto Graphics API is not supported on Windows!"), + messageType: MessageType.Warning); + public static readonly ConfigStyle dxrD3D12 = new ConfigStyle( label: "Direct3D 12", error: "Direct3D 12 needs to be the active device! (Editor restart is required). If an API different than D3D12 is forced via command line argument, clicking Fix won't change it, so please consider removing it if wanting to run DXR."); + + public static readonly ConfigStyle dxrD3D12Warning_WindowsOnly = new ConfigStyle( + label: L10n.Tr("Direct3D 12"), + error: L10n.Tr("Direct3D 12 needs to be the active device on windows! (Editor restart is required). If an API different than D3D12 is forced via command line argument, clicking Fix won't change it, so please consider removing it if wanting to run DXR."), + messageType: MessageType.Warning); + public static readonly ConfigStyle dxrScreenSpaceShadow = new ConfigStyle( label: "Screen Space Shadows (Asset)", error: "Screen Space Shadows are disabled in the current HDRP Asset which means you cannot enable ray-traced shadows for lights in your scene. To enable this feature, open your HDRP Asset, go to Lighting > Shadows, and enable Screen Space Shadows.", messageType: MessageType.Warning); @@ -155,10 +167,10 @@ public ConfigStyle(string label, string error, string button = resolve, MessageT public static readonly ConfigStyle dxrGIFS = new ConfigStyle( label: "Screen Space Global Illumination (HDRP Default Settings)", error: $"Screen Space Global Illumination is disabled in the default Camera Frame Settings. This means Cameras that use these Frame Settings do not render ray-traced global illumination. To enable this feature, go to Project Settings > HDRP Default Settings > Frame Settings > Default Frame Settings For Camera > Lighting and enable Screen Space Global Illumination. This configuration depends on {dxrGI.label}. This means, before you fix this, you must fix {dxrGI.label} first.", messageType: MessageType.Info); - public static readonly ConfigStyle dxr64bits = new ConfigStyle( - label: "Architecture 64 bits", - error: "To build your Project to a Unity Player, ray tracing requires that the build uses 64 bit architecture."); - public static readonly ConfigStyle dxrStaticBatching = new ConfigStyle( + public static readonly ConfigStyle dxrBuildTarget = new ConfigStyle( + label: L10n.Tr("Build Target"), + error: L10n.Tr("To build your Project as a Unity Player your build target must be StandaloneWindows64 or Playstation5.")); + public static readonly ConfigStyle dxrStaticBatching = new ConfigStyle( label: "Static Batching", error: "Static Batching is not supported!"); public static readonly ConfigStyle dxrActivated = new ConfigStyle( @@ -225,6 +237,11 @@ static HDWizard() static void WizardBehaviourDelayed() { + + // We can pass here if HDProjectSettings.wizardIsStartPopup is false. See WizardBehaviour() + if (!HDProjectSettings.wizardIsStartPopup) + return; + if (frameToWait > 0) --frameToWait; else @@ -257,6 +274,11 @@ static void CheckPersistencyPopupAlreadyOpened() [Callbacks.DidReloadScripts] static void WizardBehaviour() { + // We should call HDProjectSettings.wizardIsStartPopup to check here. + // But if the Wizard is opened while a domain reload occurs, we end up calling + // LoadSerializedFileAndForget at a time Unity associate with Constructor. This is not allowed. + // As we should wait some frame for everything to be correctly loaded anyway, we do that in WizardBehaviourDelayed. + //We need to wait at least one frame or the popup will not show up frameToWait = 10; EditorApplication.update += WizardBehaviourDelayed; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs index 1ec110d5dcb..ce2be14c9b9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs @@ -282,7 +282,7 @@ internal void InitializeNonRenderGraphResources() float scaleFactor = m_RunningFullRes ? 1.0f : 0.5f; AllocRT(scaleFactor); - if (HDRenderPipeline.GatherRayTracingSupport(m_Settings)) + if (HDRenderPipeline.PipelineSupportsRayTracing(m_Settings)) { m_RaytracingAmbientOcclusion.InitializeNonRenderGraphResources(); } @@ -292,7 +292,7 @@ internal void CleanupNonRenderGraphResources() { ReleaseRT(); - if (HDRenderPipeline.GatherRayTracingSupport(m_Settings)) + if (HDRenderPipeline.PipelineSupportsRayTracing(m_Settings)) { m_RaytracingAmbientOcclusion.CleanupNonRenderGraphResources(); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader index d29e27051c9..c7632714be5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader @@ -978,7 +978,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1022,7 +1022,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1063,7 +1063,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1098,7 +1098,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1125,7 +1125,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1158,7 +1158,7 @@ Shader "HDRP/LayeredLit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader index d98b1aad6bc..f02baf03261 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader @@ -1017,7 +1017,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1063,7 +1063,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1106,7 +1106,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1143,7 +1143,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1172,7 +1172,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader @@ -1207,7 +1207,7 @@ Shader "HDRP/LayeredLitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader index 4820fe557d7..c0fc8c76f68 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader @@ -942,7 +942,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -986,7 +986,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1027,7 +1027,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1063,7 +1063,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY @@ -1092,7 +1092,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -1124,7 +1124,7 @@ Shader "HDRP/Lit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader index 613601c7ec0..0f1315a7b88 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader @@ -988,7 +988,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1034,7 +1034,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1077,7 +1077,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1115,7 +1115,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1146,7 +1146,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #undef TESSELLATION_ON @@ -1180,7 +1180,7 @@ Shader "HDRP/LitTessellation" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #undef TESSELLATION_ON diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader index e0eb3c46d3d..a28dbb32f73 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader @@ -466,7 +466,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -496,7 +496,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY @@ -525,7 +525,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_GBUFFER @@ -556,7 +556,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #define SHADOW_LOW @@ -587,7 +587,7 @@ Shader "HDRP/Unlit" HLSLPROGRAM - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_PATH_TRACING diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 1a7dc920606..7f60a7bf454 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -35,6 +35,10 @@ internal static HDRenderPipeline currentPipeline internal static bool pipelineSupportsRayTracing => HDRenderPipeline.currentPipeline != null && HDRenderPipeline.currentPipeline.rayTracingSupported; +#if UNITY_EDITOR + internal static bool buildPipelineSupportsRayTracing => HDRenderPipeline.currentPipeline != null && (HDRenderPipeline.currentPipeline.m_AssetSupportsRayTracing && HDRenderPipeline.buildTargetSupportsRayTracing); +#endif + internal static bool pipelineSupportsScreenSpaceShadows => GraphicsSettings.currentRenderPipeline is HDRenderPipelineAsset hdrpAsset ? hdrpAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.supportScreenSpaceShadows : false; @@ -353,6 +357,9 @@ internal bool showCascade Material m_ColorResolveMaterial = null; Material m_MotionVectorResolve = null; + // Flag that defines if ray tracing is supporte d by the current asset + bool m_AssetSupportsRayTracing = false; + // Flag that defines if ray tracing is supported by the current asset and platform bool m_RayTracingSupported = false; /// @@ -390,7 +397,8 @@ public HDRenderPipeline(HDRenderPipelineAsset asset, HDRenderPipelineAsset defau QualitySettings.maximumLODLevel = m_Asset.GetDefaultFrameSettings(FrameSettingsRenderType.Camera).GetResolvedMaximumLODLevel(m_Asset); // The first thing we need to do is to set the defines that depend on the render pipeline settings - m_RayTracingSupported = GatherRayTracingSupport(m_Asset.currentPlatformRenderPipelineSettings); + m_RayTracingSupported = PipelineSupportsRayTracing(m_Asset.currentPlatformRenderPipelineSettings); + m_AssetSupportsRayTracing = m_Asset.currentPlatformRenderPipelineSettings.supportRayTracing; #if UNITY_EDITOR // If defaultAsset is not ready (can happen due to loading order issue), then we should return @@ -665,8 +673,6 @@ void UpgradeResourcesInAssetIfNeeded(HDRenderPipelineAsset asset) void UpgradeResourcesIfNeeded() { - // The first thing we need to do is to set the defines that depend on the render pipeline settings - m_Asset.EvaluateSettings(); // Check and fix both the default and current HDRP asset UpgradeResourcesInAssetIfNeeded(HDRenderPipeline.defaultAsset); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs index db6d91562e1..79eb8a4b48e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs @@ -401,25 +401,6 @@ bool UpdateDefineList(bool flagValue, string defineMacroValue) return false; } - // This function allows us to raise or remove some preprocessing defines based on the render pipeline settings - internal void EvaluateSettings() - { - // Grab the current set of defines and split them - string currentDefineList = UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(UnityEditor.BuildTargetGroup.Standalone); - defineArray.Clear(); - defineArray.AddRange(currentDefineList.Split(';')); - - // Update all the individual defines - bool needUpdate = false; - needUpdate |= UpdateDefineList(HDRenderPipeline.GatherRayTracingSupport(currentPlatformRenderPipelineSettings), "ENABLE_RAYTRACING"); - - // Only set if it changed - if (needUpdate) - { - UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(UnityEditor.BuildTargetGroup.Standalone, string.Join(";", defineArray.ToArray())); - } - } - internal bool AddDiffusionProfile(DiffusionProfileSettings profile) { if (diffusionProfileSettingsList.Length < 15) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index 0e904bd1021..690445fa36d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -266,7 +266,11 @@ PathTracingParameters PreparePathTracingParameters(HDCamera hdCamera) parameters.shaderVariablesRaytracingCB = m_ShaderVariablesRayTracingCB; parameters.shaderVariablesRaytracingCB._RaytracingNumSamples = (int)m_SubFrameManager.subFrameCount; parameters.shaderVariablesRaytracingCB._RaytracingMinRecursion = m_PathTracingSettings.minimumDepth.value; +#if NO_RAY_RECURSION + parameters.shaderVariablesRaytracingCB._RaytracingMaxRecursion = 1; +#else parameters.shaderVariablesRaytracingCB._RaytracingMaxRecursion = m_PathTracingSettings.maximumDepth.value; +#endif parameters.shaderVariablesRaytracingCB._RaytracingIntensityClamp = m_PathTracingSettings.maximumIntensity.value; parameters.shaderVariablesRaytracingCB._RaytracingSampleIndex = (int)parameters.cameraData.currentIteration; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs index ae9d524fefc..0960867bdd5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs @@ -527,7 +527,11 @@ static void RenderQualityRayTracedIndirectDiffuse(CommandBuffer cmd, QualityRTIn qrtidParameters.shaderVariablesRayTracingCB._RaytracingIncludeSky = 1; qrtidParameters.shaderVariablesRayTracingCB._RaytracingRayMaxLength = qrtidParameters.rayLength; qrtidParameters.shaderVariablesRayTracingCB._RaytracingNumSamples = qrtidParameters.sampleCount; +#if NO_RAY_RECURSION + qrtidParameters.shaderVariablesRayTracingCB._RaytracingMaxRecursion = 1; +#else qrtidParameters.shaderVariablesRayTracingCB._RaytracingMaxRecursion = qrtidParameters.bounceCount; +#endif qrtidParameters.shaderVariablesRayTracingCB._RayTracingDiffuseLightingOnly = 1; ConstantBuffer.PushGlobal(cmd, qrtidParameters.shaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs index bf66a33a7d8..c7b6ca71922 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs @@ -722,16 +722,17 @@ internal HDRaytracingLightCluster RequestLightCluster() } // Ray Tracing is supported if the asset setting supports it and the platform supports it - static internal bool GatherRayTracingSupport(RenderPipelineSettings rpSetting) - => rpSetting.supportRayTracing && rayTracingSupportedBySystem; + static internal bool PipelineSupportsRayTracing(RenderPipelineSettings rpSetting) + => rpSetting.supportRayTracing && currentSystemSupportsRayTracing; + + static internal bool currentSystemSupportsRayTracing + => SystemInfo.supportsRayTracing; - static internal bool rayTracingSupportedBySystem - => UnityEngine.SystemInfo.supportsRayTracing #if UNITY_EDITOR - && (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.StandaloneWindows64 - || UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.StandaloneWindows) + static internal bool buildTargetSupportsRayTracing + => (UnityEditor.PlayerSettings.GetGraphicsAPIs(UnityEditor.EditorUserBuildSettings.activeBuildTarget)[0] == GraphicsDeviceType.Direct3D12) + || (UnityEditor.PlayerSettings.GetGraphicsAPIs(UnityEditor.EditorUserBuildSettings.activeBuildTarget)[0] == GraphicsDeviceType.PlayStation5); #endif - ; internal BlueNoise GetBlueNoiseManager() { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs index d0eacafeefd..77c9793122b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs @@ -224,7 +224,11 @@ static void ExecuteRecursiveRendering(CommandBuffer cmd, RecursiveRendererParame // Update Global Constant Buffer. rrParams.shaderVariablesRayTracingCB._RaytracingRayMaxLength = rrParams.rayLength; +#if NO_RAY_RECURSION + rrParams.shaderVariablesRayTracingCB._RaytracingMaxRecursion = 1; +#else rrParams.shaderVariablesRayTracingCB._RaytracingMaxRecursion = rrParams.maxDepth; +#endif rrParams.shaderVariablesRayTracingCB._RaytracingReflectionMinSmoothness = rrParams.minSmoothness; ConstantBuffer.PushGlobal(cmd, rrParams.shaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs index c37987e17f9..653702462b0 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs @@ -484,7 +484,11 @@ static void RenderQualityRayTracedReflections(CommandBuffer cmd, RTRQualityRende rtrQRenderingParameters.shaderVariablesRayTracingCB._RaytracingRayMaxLength = rtrQRenderingParameters.rayLength; rtrQRenderingParameters.shaderVariablesRayTracingCB._RaytracingNumSamples = rtrQRenderingParameters.sampleCount; // Set the number of bounces for reflections +#if NO_RAY_RECURSION + rtrQRenderingParameters.shaderVariablesRayTracingCB._RaytracingMaxRecursion = 1; +#else rtrQRenderingParameters.shaderVariablesRayTracingCB._RaytracingMaxRecursion = rtrQRenderingParameters.bounceCount; +#endif rtrQRenderingParameters.shaderVariablesRayTracingCB._RayTracingDiffuseLightingOnly = 0; ConstantBuffer.PushGlobal(cmd, rtrQRenderingParameters.shaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Common/RayBinning.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Common/RayBinning.compute index 6f159867ac4..29ded368a00 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Common/RayBinning.compute +++ b/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 +#pragma only_renderers d3d11 ps5 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute index 1bddd140200..db2827d6941 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/CountTracedRays.compute @@ -2,7 +2,7 @@ #pragma kernel TextureReduction #pragma kernel BufferReduction -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 #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/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute index c4e69f6f2ef..d0fb9d786ec 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.compute @@ -1,6 +1,6 @@ #pragma kernel DebugLightCluster -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 #define DEBUG_LIGHT_CLUSTER_TILE_SIZE 8 diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader index 76cd54511e7..c21728b0cac 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/DebugLightCluster.shader @@ -5,7 +5,7 @@ Shader "Hidden/HDRP/DebugLightCluster" Tags { "Queue"="Transparent+0" "IgnoreProjector"="True" "RenderType"="Transparent" } HLSLINCLUDE - #pragma only_renderers d3d11 + #pragma only_renderers d3d11 ps5 static const float3 cubeVertices[24] = { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute index f717b2801f8..339e936ceb5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingDeferred.compute @@ -8,7 +8,7 @@ // 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 -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // Include and define the shader pass #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute index 36aec2088f9..eb58513fb4a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseDenoiser.compute @@ -4,7 +4,7 @@ #pragma kernel GatherSingle GATHER_FILTER=GatherSingle SINGLE_CHANNEL #pragma kernel GatherColor GATHER_FILTER=GatherColor -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // Common includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute index d71541b6866..e87ea74be92 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DiffuseShadowDenoiser.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 #pragma kernel BilateralFilterHSingleDirectional BILATERAL_FILTER=BilateralFilterHSingleDirectional SINGLE_CHANNEL DIRECTIONAL_LIGHT #pragma kernel BilateralFilterVSingleDirectional BILATERAL_FILTER=BilateralFilterVSingleDirectional FINAL_PASS SINGLE_CHANNEL DIRECTIONAL_LIGHT @@ -18,7 +18,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/BilateralFilter.hlsl" -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // #pragma enable_d3d11_debug_symbols // Tile size of this compute diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute index 194fdacf68f..3394dfc6bf3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute @@ -1,11 +1,11 @@ -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 #pragma kernel TemporalAccumulation #pragma kernel CopyHistory #pragma kernel BilateralFilterH BILATERAL_FILTER=BilateralFilterH #pragma kernel BilateralFilterV BILATERAL_FILTER=BilateralFilterV FINAL_PASS -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 #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/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute index 508dd18f391..54608b221f6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/SimpleDenoiser.compute @@ -1,4 +1,4 @@ -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // Temporal Filtering kernels #pragma kernel BilateralFilterHSingle BILATERAL_FILTER=BilateralFilterHSingle SINGLE_CHANNEL @@ -7,7 +7,7 @@ #pragma kernel BilateralFilterHColor BILATERAL_FILTER=BilateralFilterHColor #pragma kernel BilateralFilterVColor BILATERAL_FILTER=BilateralFilterVColor FINAL_PASS -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 #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/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute index b4a9e9a3fee..1bea34fd2c7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute @@ -25,7 +25,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DenoisingUtils.hlsl" -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // #pragma enable_d3d11_debug_symbols // Tile size of this compute shaders diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute index 93bca209e7a..e59bc1b386b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute @@ -4,7 +4,7 @@ #pragma kernel IndirectDiffuseIntegrationUpscaleFullRes INDIRECT_DIFFUSE_INTEGRATION_UPSCALE=IndirectDiffuseIntegrationUpscaleFullRes #pragma kernel AdjustIndirectDiffuseWeight -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // Include and define the shader pass #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute index 26718630c09..770cc7abb0b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingAmbientOcclusion.compute @@ -1,13 +1,13 @@ #pragma kernel RTAOApplyIntensity -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // 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 +#pragma only_renderers d3d11 ps5 // #pragma enable_d3d11_debug_symbols // Tile size of this compute diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute index 869edc03308..30825d5822b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute +++ b/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 +#pragma only_renderers d3d11 ps5 // SRP & HDRP includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute index 79641f2185d..07053bfef73 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingReflectionFilter.compute @@ -1,7 +1,7 @@ #pragma kernel ReflectionIntegrationUpscaleHalfRes REFLECTION_INTEGRATION_UPSCALE=ReflectionIntegrationUpscaleHalfRes HALF_RESOLUTION #pragma kernel ReflectionIntegrationUpscaleFullRes REFLECTION_INTEGRATION_UPSCALE=ReflectionIntegrationUpscaleFullRes -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" @@ -132,8 +132,8 @@ void REFLECTION_INTEGRATION_UPSCALE(uint3 dispatchThreadId : SV_DispatchThreadID if(sampleDepth == 0.0f) continue; // Compute the target pixel that it will impact - float sample = _BlueNoiseTexture[int3(relativeHRShift, 0)].x; - int index = clamp(floor(sample * 4.0f), 0, 3); + float texSample = _BlueNoiseTexture[int3(relativeHRShift, 0)].x; + int index = clamp(floor(texSample * 4.0f), 0, 3); if (index != localIndex) continue; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute index 367c45f652f..6fad5a3a94d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute +++ b/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 +#pragma only_renderers d3d11 ps5 // HDRP generic includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute index 6b389b2952c..66e7765dd54 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.compute @@ -21,7 +21,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #define SHADERPASS SHADERPASS_RAYTRACING -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // HDRP generic includes #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" @@ -41,7 +41,7 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/SphericalCone.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingMIS.hlsl" -#pragma only_renderers d3d11 +#pragma only_renderers d3d11 ps5 // #pragma enable_d3d11_debug_symbols // Tile size of this compute diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadowFilter.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadowFilter.compute index 383f0b09d89..cb94589a241 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadowFilter.compute +++ b/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 +#pragma only_renderers d3d11 ps5 #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/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/SubSurface/RayTracingSubSurface.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/SubSurface/RayTracingSubSurface.compute index bd05dac8f37..0afb54d3e2d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/SubSurface/RayTracingSubSurface.compute +++ b/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 +#pragma only_renderers d3d11 ps5 // 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/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs index 4a9e2721154..bdeb4f1589b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs @@ -753,7 +753,7 @@ internal static void Sanitize(ref FrameSettings sanitizedFrameSettings, Camera c sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.ShadowMaps] &= !preview; sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.Shadowmask] &= renderPipelineSettings.supportShadowMask && !preview; sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.ContactShadows] &= !preview; - bool pipelineSupportsRayTracing = HDRenderPipeline.GatherRayTracingSupport(renderPipelineSettings); + bool pipelineSupportsRayTracing = HDRenderPipeline.PipelineSupportsRayTracing(renderPipelineSettings); // Ray tracing effects are not allowed on reflection probes due to the accumulation process. bool rayTracingActive = sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.RayTracing] &= pipelineSupportsRayTracing && !preview && temporalAccumulationAllowed; diff --git a/com.unity.render-pipelines.high-definition/ValidationConfig.json b/com.unity.render-pipelines.high-definition/ValidationConfig.json index 8d69d6f82c6..27fad4e590a 100644 --- a/com.unity.render-pipelines.high-definition/ValidationConfig.json +++ b/com.unity.render-pipelines.high-definition/ValidationConfig.json @@ -25,6 +25,17 @@ "com\\.unity\\.render-pipelines\\.ps5" ] }, + { + "Targets": "+PS5", + "Files": + [ + "Editor/Material/ShaderGraph/HDTarget.cs" + ], + "Patterns": + [ + "Pragma\\.OnlyRenderers.*Platform\\.PS5" + ] + }, { "Targets": "+XboxOne", "Files": diff --git a/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs b/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs index 1164ef234bb..84fd3d9ca3c 100644 --- a/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs +++ b/com.unity.shadergraph/Editor/Generation/Enumerations/Platform.cs @@ -17,6 +17,7 @@ internal enum Platform GameCoreXboxSeries, Playstation, Switch, + PS5, } [GenerationAPI] @@ -50,6 +51,8 @@ public static string ToShaderString(this Platform platform) return "playstation"; case Platform.Switch: return "switch"; + case Platform.PS5: + return "ps5"; default: throw new ArgumentOutOfRangeException(); }