diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index fa03fa7fb84..dad4210a8a2 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +### Added +- Exposed the API to access HDRP shader pass names. + ### Fixed - Fixed a null reference exception when creating a diffusion profile asset. - Fixed the diffusion profile not being registered as a dependency of the ShaderGraph. diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs index 84da7ca4a0a..42b8e46b14f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs @@ -1,60 +1,101 @@ namespace UnityEngine.Rendering.HighDefinition { - static class HDShaderPassNames + /// Pass names and shader ids used in HDRP. these names can be used as filters when rendering objects in a custom pass or a DrawRenderers() call. + public static class HDShaderPassNames { // ShaderPass string - use to have consistent name through the code + /// Empty pass name. public static readonly string s_EmptyStr = ""; + /// Forward pass name. public static readonly string s_ForwardStr = "Forward"; + /// Depth Only pass name. public static readonly string s_DepthOnlyStr = "DepthOnly"; + /// Depth Forward Only pass name. public static readonly string s_DepthForwardOnlyStr = "DepthForwardOnly"; + /// Forward Only pass name. public static readonly string s_ForwardOnlyStr = "ForwardOnly"; + /// GBuffer pass name. public static readonly string s_GBufferStr = "GBuffer"; + /// GBuffer With Prepass pass name. public static readonly string s_GBufferWithPrepassStr = "GBufferWithPrepass"; + /// Legacy Unlit cross pipeline pass name. public static readonly string s_SRPDefaultUnlitStr = "SRPDefaultUnlit"; + /// Motion Vectors pass name. public static readonly string s_MotionVectorsStr = "MotionVectors"; + /// Distortion Vectors pass name. public static readonly string s_DistortionVectorsStr = "DistortionVectors"; + /// Transparent Depth Prepass pass name. public static readonly string s_TransparentDepthPrepassStr = "TransparentDepthPrepass"; + /// Transparent Backface pass name. public static readonly string s_TransparentBackfaceStr = "TransparentBackface"; + /// Transparent Depth Postpass pass name. public static readonly string s_TransparentDepthPostpassStr = "TransparentDepthPostpass"; + /// RayTracing Prepass pass name. public static readonly string s_RayTracingPrepassStr = "RayTracingPrepass"; + /// Visibility DXR pass name. public static readonly string s_RayTracingVisibilityStr = "VisibilityDXR"; + /// PathTracing DXR pass name. public static readonly string s_PathTracingDXRStr = "PathTracingDXR"; + /// META pass name. public static readonly string s_MetaStr = "META"; + /// Shadow Caster pass name. public static readonly string s_ShadowCasterStr = "ShadowCaster"; + /// FullScreen Debug pass name. public static readonly string s_FullScreenDebugStr = "FullScreenDebug"; + /// DBuffer Projector pass name. public static readonly string s_DBufferProjectorStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DBufferProjector]; + /// Decal Projector Forward Emissive pass name. public static readonly string s_DecalProjectorForwardEmissiveStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DecalProjectorForwardEmissive]; + /// DBuffer Mesh pass name. public static readonly string s_DBufferMeshStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DBufferMesh]; + /// Decal Mesh Forward Emissive pass name. public static readonly string s_DecalMeshForwardEmissiveStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DecalMeshForwardEmissive]; // ShaderPass name + /// Empty shader tag id. public static readonly ShaderTagId s_EmptyName = new ShaderTagId(s_EmptyStr); + /// Forward shader tag id. public static readonly ShaderTagId s_ForwardName = new ShaderTagId(s_ForwardStr); + /// Depth Only shader tag id. public static readonly ShaderTagId s_DepthOnlyName = new ShaderTagId(s_DepthOnlyStr); + /// Depth Forward Only shader tag id. public static readonly ShaderTagId s_DepthForwardOnlyName = new ShaderTagId(s_DepthForwardOnlyStr); + /// Forward Only shader tag id. public static readonly ShaderTagId s_ForwardOnlyName = new ShaderTagId(s_ForwardOnlyStr); + /// GBuffer shader tag id. public static readonly ShaderTagId s_GBufferName = new ShaderTagId(s_GBufferStr); + /// GBufferWithPrepass shader tag id. public static readonly ShaderTagId s_GBufferWithPrepassName = new ShaderTagId(s_GBufferWithPrepassStr); + /// Legacy Unlit cross pipeline shader tag id. public static readonly ShaderTagId s_SRPDefaultUnlitName = new ShaderTagId(s_SRPDefaultUnlitStr); + /// Motion Vectors shader tag id. public static readonly ShaderTagId s_MotionVectorsName = new ShaderTagId(s_MotionVectorsStr); + /// Distortion Vectors shader tag id. public static readonly ShaderTagId s_DistortionVectorsName = new ShaderTagId(s_DistortionVectorsStr); + /// Transparent Depth Prepass shader tag id. public static readonly ShaderTagId s_TransparentDepthPrepassName = new ShaderTagId(s_TransparentDepthPrepassStr); + /// Transparent Backface shader tag id. public static readonly ShaderTagId s_TransparentBackfaceName = new ShaderTagId(s_TransparentBackfaceStr); + /// Transparent Depth Postpass shader tag id. public static readonly ShaderTagId s_TransparentDepthPostpassName = new ShaderTagId(s_TransparentDepthPostpassStr); + /// RayTracing Prepass shader tag id. public static readonly ShaderTagId s_RayTracingPrepassName = new ShaderTagId(s_RayTracingPrepassStr); + /// FullScreen Debug shader tag id. public static readonly ShaderTagId s_FullScreenDebugName = new ShaderTagId(s_FullScreenDebugStr); + /// DBuffer Mesh shader tag id. public static readonly ShaderTagId s_DBufferMeshName = new ShaderTagId(s_DBufferMeshStr); + /// Decal Mesh Forward Emissive shader tag id. public static readonly ShaderTagId s_DecalMeshForwardEmissiveName = new ShaderTagId(s_DecalMeshForwardEmissiveStr); // Legacy name - public static readonly ShaderTagId s_AlwaysName = new ShaderTagId("Always"); - public static readonly ShaderTagId s_ForwardBaseName = new ShaderTagId("ForwardBase"); - public static readonly ShaderTagId s_DeferredName = new ShaderTagId("Deferred"); - public static readonly ShaderTagId s_PrepassBaseName = new ShaderTagId("PrepassBase"); - public static readonly ShaderTagId s_VertexName = new ShaderTagId("Vertex"); - public static readonly ShaderTagId s_VertexLMRGBMName = new ShaderTagId("VertexLMRGBM"); - public static readonly ShaderTagId s_VertexLMName = new ShaderTagId("VertexLM"); + internal static readonly ShaderTagId s_AlwaysName = new ShaderTagId("Always"); + internal static readonly ShaderTagId s_ForwardBaseName = new ShaderTagId("ForwardBase"); + internal static readonly ShaderTagId s_DeferredName = new ShaderTagId("Deferred"); + internal static readonly ShaderTagId s_PrepassBaseName = new ShaderTagId("PrepassBase"); + internal static readonly ShaderTagId s_VertexName = new ShaderTagId("Vertex"); + internal static readonly ShaderTagId s_VertexLMRGBMName = new ShaderTagId("VertexLMRGBM"); + internal static readonly ShaderTagId s_VertexLMName = new ShaderTagId("VertexLM"); } // Pre-hashed shader ids - naming conventions are a bit off in this file as we use the same diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs index 34ce91f8008..8aff33e8dd5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs @@ -154,7 +154,7 @@ protected override void Execute(CustomPassContext ctx) stencilState = new StencilState(false), }; - PerObjectData renderConfig = ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask) ? HDUtils.k_RendererConfigurationBakedLightingWithShadowMask : HDUtils.k_RendererConfigurationBakedLighting; + PerObjectData renderConfig = ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask) ? HDUtils.GetBakedLightingWithShadowMaskRenderConfig() : HDUtils.GetBakedLightingRenderConfig(); var result = new RendererListDesc(shaderPasses, ctx.cullingResults, ctx.hdCamera.camera) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs index 499584b578e..f2e13fdbb4e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs @@ -18,6 +18,11 @@ public class HDUtils internal const PerObjectData k_RendererConfigurationBakedLighting = PerObjectData.LightProbe | PerObjectData.Lightmaps | PerObjectData.LightProbeProxyVolume; internal const PerObjectData k_RendererConfigurationBakedLightingWithShadowMask = k_RendererConfigurationBakedLighting | PerObjectData.OcclusionProbe | PerObjectData.OcclusionProbeProxyVolume | PerObjectData.ShadowMask; + /// Returns the render configuration for baked static lighting, this value can be used in a RendererListDesc call to render Lit objects. + public static PerObjectData GetBakedLightingRenderConfig() => k_RendererConfigurationBakedLighting; + /// Returns the render configuration for baked static lighting with shadow masks, this value can be used in a RendererListDesc call to render Lit objects when shadow masks are enabled. + public static PerObjectData GetBakedLightingWithShadowMaskRenderConfig() => k_RendererConfigurationBakedLightingWithShadowMask; + /// Default HDAdditionalReflectionData static internal HDAdditionalReflectionData s_DefaultHDAdditionalReflectionData { get { return ComponentSingleton.instance; } } /// Default HDAdditionalLightData