diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/create-ray-tracing-context.md b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/create-ray-tracing-context.md index 5c2dacbdf21..baa4d4f9d87 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/create-ray-tracing-context.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/create-ray-tracing-context.md @@ -9,7 +9,7 @@ Follow these steps: ## Load the ray tracing resources The [`RayTracingContext`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext) needs a few utility shaders that the [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) object supplies. You can load these resources in several different ways. -If your project uses SRP (Scriptable Render Pipeline), load the resources via [`RayTracingResources.LoadFromRenderPipelineResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext.LoadFromRenderPipelineResources()). This always works in the Editor. +If your project uses SRP (Scriptable Render Pipeline), load the resources via [`RayTracingResources.LoadFromRenderPipelineResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources.LoadFromRenderPipelineResources()). This always works in the Editor. ```C# var rtResources = new RayTracingResources(); bool result = rtResources.LoadFromRenderPipelineResources(); @@ -49,9 +49,12 @@ rtResources.LoadFromAssetBundle(asssetBundle); ## Create the context Once the [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) are loaded, use them to create the [`RayTracingContext`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext). ```C# -// Choose a backend -var backend = RayTracingContext.IsBackendSupported(RayTracingBackend.Hardware) ? RayTracingBackend.Hardware : RayTracingBackend.Compute; +var context = new RayTracingContext(rtResources); +``` + +By default, Unity checks if the device supports hardware ray tracing, and selects either hardware ray tracing or compute shaders. To manually select the backend, pass in a `RayTracingBackend`. For example: -// Create the context +```C# +var backend = RayTracingBackend.Compute; var context = new RayTracingContext(backend, rtResources); ``` diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/release-resources.md b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/release-resources.md new file mode 100644 index 00000000000..881045c15f9 --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/release-resources.md @@ -0,0 +1,26 @@ +# Release your ray tracing objects + +You must free up the memory your ray tracing objects use after you finish with them. + +Dispose of the following: + +- Scratch buffers. Use [`GraphicsBuffer.Dispose`](xref:UnityEngine.GraphicsBuffer.Dispose()) after you've executed the final command buffer. +- Ray tracing acceleration structures. Use [`IRayTracingAccelStruct.Dispose`](xref:UnityEngine.Rendering.UnifiedRayTracing.IRayTracingAccelStruct.Dispose()) after you've executed the final command buffer. +- Ray tracing context. Use [`RayTracingContext.Dispose`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingContext.Dispose()) after you dispose of all its acceleration structures. + +**Note**: Unity automatically disposes of [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) and [`IRayTracingShader`](xref:UnityEngine.Rendering.UnifiedRayTracing.IRayTracingShader). + +For example: + +```C# +RayTracingContext rtContext = new RayTracingContext(rtResources); +IRayTracingShader rtShader = rtContext.LoadRayTracingShader("Assets/yourShader.urtshader"); +IRayTracingAccelStruct rtAccelStruct = rtContext.CreateAccelerationStructure(new AccelerationStructureOptions()); +GraphicsBuffer rtScratchBuffer = RayTracingHelper.CreateScratchBufferForBuild(rtAccelStruct); + +// ... create and dispatch your ray tracing command buffers ... + +rtScratchBuffer.Dispose(); +rtAccelStruct.Dispose(); +rtContext.Dispose(); +``` diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/unified-ray-tracing-api.md b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/unified-ray-tracing-api.md index 97d2b49c41a..41f71c4ee88 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/unified-ray-tracing-api.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/unified-ray-tracing-api.md @@ -12,4 +12,4 @@ The `UnifiedRayTracing` API enables you to write ray tracing code that can execu |[Execute your ray tracing code](execute-shader.md)|How to execute your ray tracing shader.| |[Sample code](trace-camera-rays-full-sample.md)|Complete code example showcasing tracing rays from the scene's camera.| |[Unified ray tracing shader code reference](shader-code-reference.md)|API reference for the unified ray tracing shader code.| - +|[Release your ray tracing objects](release-resources.md)|Learn how to release your ray tracing resources.| diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/workflow.md b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/workflow.md index 2683113ba65..c6669a1147f 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/workflow.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/UnifiedRayTracing/workflow.md @@ -5,6 +5,7 @@ To use the API to trace rays in Unity, follow these steps: 3. Create a shader. 4. Build your acceleration structure. 5. Execute your shader. +6. Dispose of your objects. ## Create the ray tracing context @@ -53,3 +54,5 @@ rtShader.Dispatch(cmd, traceScratchBuffer, threadCountX, threadCountY, threadCou For more information, refer to [Execute your ray tracing code](execute-shader.md). +## Dispose of your objects +For more information, refer to [Release your ray tracing objects](release-resources.md). \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs b/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs index c52489bb120..6ae1a448d9c 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.IO; using UnityEditor; @@ -40,7 +39,6 @@ static SampleDependencyImporter() PackageInfo m_PackageInfo; SampleList m_SampleList; - List m_Samples; VisualElement injectingElement; VisualElement _panelRoot; @@ -100,6 +98,7 @@ internal void RefreshSampleButtons() var bound = Mathf.Min(sampleContainers.Count, m_SampleList.samples.Length); + // Foreach sample for (int i=0; i { ImportSampleDependencies(index); - using (var ev = NavigationSubmitEvent.GetPooled()) + // After importing the dependencies, we can call the package manager API import logic. + foreach (Sample sample in Sample.FindByPackage(m_PackageInfo.name, m_PackageInfo.version)) { - ev.target = importButton; - importButton.SendEvent(ev); + if (sample.displayName == m_SampleList.samples[index].displayName) + { + sample.Import(Sample.ImportOptions.HideImportWindow | Sample.ImportOptions.OverridePreviousImports); + } } + }; } else // We may need to update the button text after the sample import here. diff --git a/Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgrader.Utils.cs b/Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgrader.Utils.cs index 8c4ab136b62..f1ba62b0caa 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgrader.Utils.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgrader.Utils.cs @@ -12,6 +12,8 @@ namespace UnityEditor.Rendering /// public partial class MaterialUpgrader { +internal static readonly string k_DialogKey = $"{nameof(UnityEditor)}.{nameof(Rendering)}.{nameof(MaterialUpgrader)}.ConfirmMaterialConversion"; + #region Internal API /// /// Represents an entry describing material properties @@ -344,15 +346,15 @@ static void PerformUpgrade(List materialUpgrades, List s_Empty = new List(); + + public static List GetCurrentSRPUpgraders() + { + if (!GraphicsSettings.isScriptableRenderPipelineEnabled) + return s_Empty; + + return MaterialUpgrader.FetchAllUpgradersForPipeline(GraphicsSettings.currentRenderPipelineAssetType); + } + + [MenuItem("Edit/Rendering/Materials/Convert All Built-In Materials to Current SRP", true)] + internal static bool UpgradeMaterialsProjectValidate() + { + return GraphicsSettings.isScriptableRenderPipelineEnabled; + } + + [MenuItem("Edit/Rendering/Materials/Convert All Built-In Materials to Current SRP", priority = CoreUtils.Priorities.editMenuPriority + 1)] + internal static void UpgradeMaterialsProject() + { + MaterialUpgrader.UpgradeProjectFolder(GetCurrentSRPUpgraders(), "Upgrade to SRP Material"); + } + + [MenuItem("Edit/Rendering/Materials/Convert Selected Built-In Materials to Current SRP", true)] + internal static bool UpgradeMaterialsSelectionValidate() + { + if (Selection.objects.Length == 0 || !GraphicsSettings.isScriptableRenderPipelineEnabled) + return false; + + foreach (var obj in Selection.objects) + { + if (obj is not Material) + return false; + } + + return true; + } + + [MenuItem("Edit/Rendering/Materials/Convert Selected Built-In Materials to Current SRP", priority = CoreUtils.Priorities.editMenuPriority + 2)] + internal static void UpgradeMaterialsSelection() + { + MaterialUpgrader.UpgradeSelection(GetCurrentSRPUpgraders(), "Upgrade to SRP Material"); + } + } +} diff --git a/Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs.meta b/Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs.meta new file mode 100644 index 00000000000..56a170e650f --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 81cce92cea62afc46ae47b09fa3c8c6e \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index a2a052bbc3b..fcf92138254 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -875,8 +875,11 @@ protected override VisualElement Create() this.ScheduleTracked(field, () => field.schedule.Execute(() => { - if (currentIndex >= 0 && currentIndex < enumNames.Length) - field.SetValueWithoutNotify(enumNames[currentIndex].text); + // https://jira.unity3d.com/browse/UUM-138138: Clamp currentIndex to 0. This matches old IMGUI + // DebugUIDrawer behavior where a negative index is sometimes used to denote an invalid/none value. + int index = Mathf.Max(0, currentIndex); + if (index < enumNames.Length) + field.SetValueWithoutNotify(enumNames[index].text); }).Every(100)); m_AdditionalSearchText = string.Join(",", field.choices); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Panel.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Panel.cs index 928070bb71d..e1cce1f0ab8 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Panel.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Panel.cs @@ -56,6 +56,7 @@ public VisualElement Create(DebugUI.Context context) container.AddToClassList("unity-inspector-element"); var content = new VisualElement(); + foreach (var child in children) { if (context == Context.Editor && child.isRuntimeOnly) @@ -67,6 +68,7 @@ public VisualElement Create(DebugUI.Context context) if (childUIElement != null) content.Add(childUIElement); } + container.Add(content); return container; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/RuntimeDebugWindow.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/RuntimeDebugWindow.cs index cb4e0649a00..3d47460f623 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/RuntimeDebugWindow.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/RuntimeDebugWindow.cs @@ -127,7 +127,9 @@ void BuildDebugUI() else selectedPanelName = m_SelectedPanel.displayName; - SetSelectedPanel(selectedPanelName); + // Defer until after layout so all AttachToPanelEvent callbacks from ScheduleTracked + // have fired and registered their schedulers before SetHierarchyEnabled is called. + m_TabViewElement.schedule.Execute(_ => SetSelectedPanel(selectedPanelName)).StartingIn(100); } void OnDestroy() diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/Debug/DebugDisplayGPUResidentDrawer.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/Debug/DebugDisplayGPUResidentDrawer.cs index ce6cea13cdb..6f3335f7253 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/Debug/DebugDisplayGPUResidentDrawer.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/Debug/DebugDisplayGPUResidentDrawer.cs @@ -234,15 +234,11 @@ private static DebugUI.Table.Row AddOcclusionContextDataRow(int index) }; } - static bool s_GRDWasEnabled; - [DisplayInfo(name = "Rendering", order = 5)] private class SettingsPanel : DebugDisplaySettingsPanel { public SettingsPanel(DebugDisplayGPUResidentDrawer data) { - s_GRDWasEnabled = GPUResidentDrawer.IsInitialized(); - DocumentationUtils.TryGetHelpURL(typeof(DebugDisplayGPUResidentDrawer), out var documentationUrl); var foldout = new DebugUI.Foldout() { @@ -257,13 +253,6 @@ public SettingsPanel(DebugDisplayGPUResidentDrawer data) style = MessageBox.Style.Warning, messageCallback = () => { - // HACK: Reload the UI if GRD enabled state changes - if (s_GRDWasEnabled != GPUResidentDrawer.IsInitialized()) - { - s_GRDWasEnabled = GPUResidentDrawer.IsInitialized(); - DebugManager.instance.Reset(); - } - var settings = GPUResidentDrawer.GetGlobalSettingsFromRPAsset(); return GPUResidentDrawer.IsGPUResidentDrawerSupportedBySRP(settings, out var msg, out var _) ? string.Empty : msg; }, @@ -271,7 +260,9 @@ public SettingsPanel(DebugDisplayGPUResidentDrawer data) }; foldout.children.Add(helpBox); - // HACK: Avoid creating GRD debug modes when it's not enabled. + GPUResidentDrawer.initializedChanged += OnGPUResidentDrawerInitialzedChanged; + + // Avoid creating GRD debug modes when it's not enabled. // This debug UI currently creates ~650 DebugUI Widgets (over 80% of all debug widgets in URP). // To avoid the overhead, we don't create them if GRD is not enabled. If GRD gets enabled while window is open, // we refresh the window. It would probably be a good idea to rethink how the stats tables are implemented. @@ -307,6 +298,21 @@ public SettingsPanel(DebugDisplayGPUResidentDrawer data) AddInstanceCullingStatsWidget(data); } + private void OnGPUResidentDrawerInitialzedChanged(bool previousValue, bool currentValue) + { + // Reload the UI if GRD enabled state changes, from disabled to enabled only, as the UI did not have all the widgets and we need to add them + // in assembly reloads, or entering playmode we do not have this code path and the SettingsPanel will be recreated itself by the Rendering Debugger + // reconstruction. + if ( previousValue == false && currentValue == true ) + DebugManager.instance.Reset(); + } + + public override void Dispose() + { + base.Dispose(); + GPUResidentDrawer.initializedChanged -= OnGPUResidentDrawerInitialzedChanged; + } + private void AddInstanceCullingStatsWidget(DebugDisplayGPUResidentDrawer data) { var instanceCullerStats = new DebugUI.Foldout diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs index f5a2db8e6ae..be1177587f8 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs @@ -340,6 +340,8 @@ internal static void Reinitialize() #endif } + internal static Action initializedChanged; // previousValue, currentValue + private static void Cleanup() { if (s_Instance == null) @@ -352,6 +354,8 @@ private static void Cleanup() private static void Recreate(GPUResidentDrawerSettings settings) { + bool wasInitialized = IsInitialized(); + Cleanup(); if (IsGPUResidentDrawerSupportedBySRP(settings, out var message, out var severity)) @@ -363,6 +367,10 @@ private static void Recreate(GPUResidentDrawerSettings settings) { LogMessage(message, severity); } + + bool isInitialized = IsInitialized(); + if (wasInitialized != isInitialized) + initializedChanged?.Invoke(wasInitialized, isInitialized); } private IntPtr m_ContextIntPtr = IntPtr.Zero; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingContext.cs b/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingContext.cs index 0c6ff3dcf0a..01e23667eaf 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingContext.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingContext.cs @@ -332,7 +332,9 @@ static public GraphicsBuffer CreateScratchBufferForTrace(IRayTracingShader shade /// Resizes a scratch buffer if its size doesn't fit the requirement of . /// /// - /// The resize is accomplished by disposing of the GraphicsBuffer and instanciating a new one at the proper size. + /// Unity resizes the buffer by disposing of the `GraphicsBuffer` and instantiating a new one with the proper size. + /// **Important:** If you reference the current in a command buffer, you must + /// only call this method after you submit the command buffer. See or . /// /// The shader that will be passed to . /// Number of threads in the X dimension that will be passed to . @@ -362,7 +364,9 @@ static public void ResizeScratchBufferForTrace( /// Resizes a scratch buffer if its size doesn't fit the requirement of . /// /// - /// The resize is accomplished by disposing of the GraphicsBuffer and instanciating a new one at the proper size. + /// Unity resizes the buffer by disposing of the `GraphicsBuffer` and instantiating a new one with the proper size. + /// **Important:** If you reference the current in a command buffer, you must + /// only call this method after you submit the command buffer. See or . /// /// The acceleration structure that will be passed to . /// The scratch buffer. diff --git a/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingResources.cs b/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingResources.cs index ca69731e84c..ea9c7970584 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingResources.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/RayTracingResources.cs @@ -5,6 +5,12 @@ namespace UnityEngine.Rendering.UnifiedRayTracing { + /// + /// Resource class that handles the serialization of UnifiedRayTracing's utility shaders in projects using a Scriptable Render Pipeline. + /// + /// + /// This class is used internally by + /// [Scripting.APIUpdating.MovedFrom( autoUpdateAPI: true, sourceNamespace: "UnityEngine.Rendering.UnifiedRayTracing", @@ -13,10 +19,13 @@ namespace UnityEngine.Rendering.UnifiedRayTracing [Serializable] [SupportedOnRenderPipeline()] [Categorization.CategoryInfo(Name = "R: Unified Ray Tracing", Order = 1000), HideInInspector] - sealed class RayTracingRenderPipelineResources : IRenderPipelineResources + public sealed class RayTracingRenderPipelineResources : IRenderPipelineResources { [SerializeField, HideInInspector] int m_Version = 1; + /// + /// The version number of the resources container. + /// public int version { get => m_Version; @@ -49,54 +58,84 @@ public int version [SerializeField, ResourcePath("Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/scatter.compute")] ComputeShader m_Scatter; + /// + /// Compute shader for geometry pool operations. + /// public ComputeShader GeometryPoolKernels { get => m_GeometryPoolKernels; set => this.SetValueAndNotify(ref m_GeometryPoolKernels, value, nameof(m_GeometryPoolKernels)); } + /// + /// Compute shader for buffer copy operations. + /// public ComputeShader CopyBuffer { get => m_CopyBuffer; set => this.SetValueAndNotify(ref m_CopyBuffer, value, nameof(m_CopyBuffer)); } + /// + /// Compute shader for copying vertex position data. + /// public ComputeShader CopyPositions { get => m_CopyPositions; set => this.SetValueAndNotify(ref m_CopyPositions, value, nameof(m_CopyPositions)); } + /// + /// Compute shader for radix sort operations. + /// public ComputeShader BitHistogram { get => m_BitHistogram; set => this.SetValueAndNotify(ref m_BitHistogram, value, nameof(m_BitHistogram)); } + /// + /// Compute shader for prefix sum operations. + /// public ComputeShader BlockReducePart { get => m_BlockReducePart; set => this.SetValueAndNotify(ref m_BlockReducePart, value, nameof(m_BlockReducePart)); } + /// + /// Compute shader for prefix sum operations. + /// public ComputeShader BlockScan { get => m_BlockScan; set => this.SetValueAndNotify(ref m_BlockScan, value, nameof(m_BlockScan)); } + /// + /// Compute shader for building a BVH. + /// public ComputeShader BuildHlbvh { get => m_BuildHlbvh; set => this.SetValueAndNotify(ref m_BuildHlbvh, value, nameof(m_BuildHlbvh)); } + /// + /// Compute shader for BVH restructuring. + /// + /// + /// Used to optimize the BVH structure after initial construction. + /// public ComputeShader RestructureBvh { get => m_RestructureBvh; set => this.SetValueAndNotify(ref m_RestructureBvh, value, nameof(m_RestructureBvh)); } + /// + /// Compute shader for radix sort operations. + /// public ComputeShader Scatter { get => m_Scatter; @@ -107,17 +146,62 @@ public ComputeShader Scatter /// /// Utility shaders needed by a to operate. /// + /// + /// This class holds compute shaders required for unified ray tracing operations, + /// including geometry pool management and BVH construction kernels. + /// public class RayTracingResources { - internal ComputeShader geometryPoolKernels { get; set; } - internal ComputeShader copyBuffer { get; set; } - internal ComputeShader copyPositions { get; set; } - internal ComputeShader bitHistogram { get; set; } - internal ComputeShader blockReducePart { get; set; } - internal ComputeShader blockScan { get; set; } - internal ComputeShader buildHlbvh { get; set; } - internal ComputeShader restructureBvh { get; set; } - internal ComputeShader scatter { get; set; } + /// + /// Compute shader for geometry pool operations. + /// + public ComputeShader geometryPoolKernels { get; set; } + + /// + /// Compute shader for buffer copy operations. + /// + public ComputeShader copyBuffer { get; set; } + + /// + /// Compute shader for copying vertex position data. + /// + public ComputeShader copyPositions { get; set; } + + /// + /// Compute shader for radix sort operations. + /// + public ComputeShader bitHistogram { get; set; } + + /// + /// Compute shader for radix sort operations. + /// + public ComputeShader scatter { get; set; } + + /// + /// Compute shader for prefix sum operations. + /// + public ComputeShader blockReducePart { get; set; } + + /// + /// Compute shader for prefix sum operations. + /// + public ComputeShader blockScan { get; set; } + + /// + /// Compute shader for building a BVH. + /// + public ComputeShader buildHlbvh { get; set; } + + /// + /// Compute shader for BVH restructuring. + /// + /// + /// Used to optimize the BVH structure after initial construction. + /// + public ComputeShader restructureBvh { get; set; } + + + #if UNITY_EDITOR /// diff --git a/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/TraceRay.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/TraceRay.hlsl index b9bcd02df1a..efaad78efe8 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/TraceRay.hlsl +++ b/Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/TraceRay.hlsl @@ -151,6 +151,7 @@ struct HitContext namespace UnifiedRT { #pragma warning(disable : 3557) // prevent warning when the "while (rayQuery.Proceed())" loop is unrolled +#pragma warning(disable : 4000) // suppress FXC warnings about potentially uninitialized variables void TraceRay(DispatchInfo dispatchInfo, RayTracingAccelStruct accelStruct, uint instanceMask, Ray ray, uint rayFlags, inout UNIFIED_RT_PAYLOAD payload) { diff --git a/Packages/com.unity.render-pipelines.core/Runtime/XR/XRBuiltinShaderConstants.cs b/Packages/com.unity.render-pipelines.core/Runtime/XR/XRBuiltinShaderConstants.cs index cbbd2cee2dc..df9f0be4d19 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/XR/XRBuiltinShaderConstants.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/XR/XRBuiltinShaderConstants.cs @@ -52,6 +52,11 @@ public static class XRBuiltinShaderConstants /// static public readonly int unity_StereoWorldSpaceCameraPos = Shader.PropertyToID("unity_StereoWorldSpaceCameraPos"); + /// + /// Cached unique id for unity_StereoEyeIndex + /// + static public readonly int unity_StereoEyeIndex = Shader.PropertyToID("unity_StereoEyeIndex"); + // Pre-allocate arrays to avoid GC static Matrix4x4[] s_cameraProjMatrix = new Matrix4x4[2]; static Matrix4x4[] s_invCameraProjMatrix = new Matrix4x4[2]; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightingSearchColumnProviders.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightingSearchColumnProviders.cs index 15cfc3d5bfc..1d8fe4e7b39 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightingSearchColumnProviders.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightingSearchColumnProviders.cs @@ -258,7 +258,7 @@ public static void ReflectionProbeResolutionSearchColumnProvider(SearchColumn co column.drawer = args => { var go = args.item.data as GameObject ?? args.item.ToObject(); - if (go == null || !go.TryGetComponent(out var hdProbe)) + if (go == null || !go.TryGetComponent(out var hdProbe) || args.value is not HDLightingSearchDataAccessors.ReflectionProbeResolutionData) { return args.value; } @@ -357,7 +357,7 @@ public static void ContactShadowsSearchColumnProvider(SearchColumn column) column.drawer = args => { var go = args.item.data as GameObject ?? args.item.ToObject(); - if (go == null || !go.TryGetComponent(out _)) + if (go == null || !go.TryGetComponent(out _) || args.value is not HDLightingSearchDataAccessors.ContactShadowsData) { return null; } @@ -420,7 +420,7 @@ public static void ShadowResolutionSearchColumnProvider(SearchColumn column) column.drawer = args => { var go = args.item.data as GameObject ?? args.item.ToObject(); - if (go == null || !go.TryGetComponent(out _)) + if (go == null || !go.TryGetComponent(out _) || args.value is not ShadowResolutionOption) { return null; } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs deleted file mode 100644 index 3181589f0e9..00000000000 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.HighDefinition; - -namespace UnityEditor.Rendering.HighDefinition -{ - class MaterialUpgraderEditMenus - { - public static List GetHDUpgraders() - { - return MaterialUpgrader.FetchAllUpgradersForPipeline(typeof(HDRenderPipelineAsset)); - } - - [MenuItem("Edit/Rendering/Materials/Convert All Materials using HDRP upgraders", priority = CoreUtils.Priorities.editMenuPriority + 1)] - internal static void UpgradeMaterialsProject() - { - MaterialUpgrader.UpgradeProjectFolder(GetHDUpgraders(), "Upgrade to HDRP Material"); - } - - [MenuItem("Edit/Rendering/Materials/Convert Selected Materials using HDRP upgraders", true)] - static bool MaterialValidate(MenuCommand command) - { - foreach (var obj in Selection.objects) - { - if (obj is not Material) return false; - } - - return true; - } - - [MenuItem("Edit/Rendering/Materials/Convert Selected Materials using HDRP upgraders", priority = CoreUtils.Priorities.editMenuPriority + 2)] - internal static void UpgradeMaterialsSelection() - { - MaterialUpgrader.UpgradeSelection(GetHDUpgraders(), "Upgrade to HDRP Material"); - } - } -} diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs.meta b/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs.meta deleted file mode 100644 index f1574a46878..00000000000 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 989185d0be859c14a8c6c5e7e8f9f46b \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.cs index f64b026d44c..388b27da51f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.cs @@ -391,6 +391,10 @@ private void UpdateWindowTitle() }); } + public static List GetHDUpgraders() + { + return MaterialUpgrader.FetchAllUpgradersForPipeline(typeof(HDRenderPipelineAsset)); + } private void CreateGUI() { UpdateWindowTitle(); @@ -431,8 +435,7 @@ private void CreateGUI() container.Add(CreateTitle(Style.migrationTitle)); - if (MaterialUpgrader.ProjectContainsNonAutomaticUpgradePath( - MaterialUpgraderEditMenus.GetHDUpgraders())) + if (MaterialUpgrader.ProjectContainsNonAutomaticUpgradePath(GetHDUpgraders())) { var nonBuiltinMaterialHelpBox = new HelpBox(Style.nonAutomaticUpgradeMaterials, HelpBoxMessageType.Warning); nonBuiltinMaterialHelpBox.AddToClassList("NonBuiltinMaterialWarning"); 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 b11ad5c0012..5a6afcc0151 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 @@ -1076,7 +1076,7 @@ TextureHandle inputStencil io.previousPreUpscaleResolution = hdCamera.historyRTHandleProperties.previousViewportSize; io.postUpscaleResolution = new Vector2Int((int)hdCamera.finalViewport.width, (int)hdCamera.finalViewport.height); io.enableTexArray = TextureXR.useTexArray; - io.cameraInstanceID = hdCamera.camera.GetEntityId().GetRawData(); + io.cameraInstanceID = EntityId.ToULong(hdCamera.camera.GetEntityId()); io.nearClipPlane = hdCamera.camera.nearClipPlane; io.farClipPlane = hdCamera.camera.farClipPlane; io.fieldOfViewDegrees = hdCamera.camera.fieldOfView; 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 bfed4123426..3f900903382 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 @@ -331,10 +331,11 @@ void RecordRenderGraph(RenderRequest renderRequest, GenerateColorPyramid(m_RenderGraph, hdCamera, colorBuffer, distortionColorPyramid, FullScreenDebugMode.PreRefractionColorPyramid, distortionRendererList); currentColorPyramid = distortionColorPyramid; - - // The color pyramid for distortion is not an history, so it need to be sampled appropriate RT handle scale. Thus we need to update it - var newScale = new Vector4(RTHandles.rtHandleProperties.rtHandleScale.x, RTHandles.rtHandleProperties.rtHandleScale.y, 0, 0); - m_ShaderVariablesGlobalCB._ColorPyramidUvScaleAndLimitCurrentFrame = newScale; + // The color pyramid for distortion is not an history buffer, so it needs to be sampled using an appropriate RT handle scale. Thus we need to update the scale and the limit. + // It's relatively straightforward to update the scale because we store it in rtHandleScale but we miss the limit values. For now, we approximate them by setting them to the scale value. + // This is imperfect but resetting limit at (0, 0) gives worse results (UUM-130925). + var newScaleLimits = new Vector4(RTHandles.rtHandleProperties.rtHandleScale.x, RTHandles.rtHandleProperties.rtHandleScale.y, RTHandles.rtHandleProperties.rtHandleScale.x, RTHandles.rtHandleProperties.rtHandleScale.y); + m_ShaderVariablesGlobalCB._ColorPyramidUvScaleAndLimitCurrentFrame = newScaleLimits; PushGlobalCameraParams(m_RenderGraph, hdCamera); } 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 db2839f382b..d6292090c79 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 @@ -222,11 +222,8 @@ NeighborTapData GetNeighborTapDataSample_HR(uint2 groupThreadId, int2 offset) return GetNeighborTapDataSample_HR(OffsetToLDSAdress_HR(groupThreadId, offset)); } -NeighborTapData GetNeighborTapDataSample_HR_NOLDS(uint2 fulLResCoord, int2 offset) +NeighborTapData GetNeighborTapDataSample_HR_NOLDS(uint2 tapCoord) { - int2 tapCoord = (fulLResCoord / 2 + offset) * 2; - tapCoord = int2(clamp(tapCoord.x, 0, (int)_ScreenSize.x - 1), clamp(tapCoord.y, 0, (int)_ScreenSize.y - 1)); - NeighborTapData outVal; outVal.lighting = LOAD_TEXTURE2D_X(_IndirectDiffuseTexture, tapCoord / 2).xyz; outVal.linearDepth = Linear01Depth(LOAD_TEXTURE2D_X(_DepthTexture, tapCoord).x, _ZBufferParams); @@ -278,11 +275,15 @@ void IndirectDiffuseIntegrationUpscaleHalfRes(uint3 dispatchThreadId : SV_Dispat { for(int x = -HALF_RES_OUT_REGION_SIZE; x < HALF_RES_OUT_REGION_SIZE; ++x) { + int2 tapCoord = (targetCoord / 2 + int2(x,y)) * 2; + if (any(tapCoord < 0) || any(tapCoord >= _ScreenSize.xy)) + continue; + #ifndef WITHOUT_LDS // Grab the neighbor data NeighborTapData neighborData = GetNeighborTapDataSample_HR(groupThreadId, int2(x,y)); #else - NeighborTapData neighborData = GetNeighborTapDataSample_HR_NOLDS(targetCoord, int2(x,y)); + NeighborTapData neighborData = GetNeighborTapDataSample_HR_NOLDS(tapCoord); #endif // Evaluate the weight of this neighbor float weight = EvaluateNeighborWeight(neighborData, normalData.normalWS, linearDepth); @@ -416,6 +417,10 @@ void IndirectDiffuseIntegrationUpscaleFullRes(uint3 dispatchThreadId : SV_Dispat { for(int x = -FULL_RES_OUT_REGION_SIZE; x < FULL_RES_OUT_REGION_SIZE; ++x) { + int2 tapCoord = targetCoord + int2(x,y); + if (any(tapCoord < 0) || any(tapCoord >= _ScreenSize.xy)) + continue; + #ifndef WITHOUT_LDS // Grab the neighbor data NeighborTapData neighborData = GetNeighborTapDataSample_FR(groupThreadId, int2(x,y)); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/URPBuildDataValidator.cs b/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/URPBuildDataValidator.cs index 0e661c23705..20090c4de7d 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/URPBuildDataValidator.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/URPBuildDataValidator.cs @@ -25,6 +25,7 @@ private static void ValidateRenderPipelineAssetsAreAtLastVersion(List renderPipelineAssets) { +#pragma warning disable 618 bool supportsDynamicBatching = false; foreach (var urpPipelineAsset in renderPipelineAssets) { @@ -36,6 +37,7 @@ private static void ValidateDynamicBatchingSettings(List p.boolValue, Styles.gpuResidentDrawerEnableOcclusionCullingInCameras); --EditorGUI.indentLevel; @@ -256,7 +262,12 @@ private static string GetRendererNamesWithoutCorrectLightingMode(UniversalRender static void DrawRenderingAdditional(SerializedUniversalRenderPipelineAsset serialized, Editor ownerEditor) { EditorGUILayout.PropertyField(serialized.srpBatcher, Styles.srpBatcher); + EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(serialized.supportsDynamicBatching, Styles.dynamicBatching); + if (EditorGUI.EndChangeCheck() && serialized.supportsDynamicBatching.boolValue) + { + Debug.LogWarning(Styles.warningDynamicBatching); + } EditorGUILayout.PropertyField(serialized.storeActionsOptimizationProperty, Styles.storeActionsOptimizationText); } @@ -288,7 +299,13 @@ static void DrawQuality(SerializedUniversalRenderPipelineAsset serialized, Edito && !IsAndroidXRTargetted(), Styles.msaaText, MessageType.Info, Styles.msaaTileOnlyInfo); - serialized.renderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleText, serialized.renderScale.floatValue, UniversalRenderPipeline.minRenderScale, UniversalRenderPipeline.maxRenderScale); + using (new EditorGUI.MixedValueScope(serialized.renderScale.hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + float newRenderScale = EditorGUILayout.Slider(Styles.renderScaleText, serialized.renderScale.floatValue, UniversalRenderPipeline.minRenderScale, UniversalRenderPipeline.maxRenderScale); + if (EditorGUI.EndChangeCheck()) + serialized.renderScale.floatValue = newRenderScale; + } DisplayTileOnlyHelpBox( serialized.renderScale, p => @@ -388,7 +405,13 @@ static void DrawUpscalingFilterDropdownAndOptions(SerializedUniversalRenderPipel // We put the FSR sharpness override value behind an override checkbox so we can tell when the user intends to use a custom value rather than the default. if (serialized.fsrOverrideSharpness.boolValue) { - serialized.fsrSharpness.floatValue = EditorGUILayout.Slider(Styles.fsrSharpnessText, serialized.fsrSharpness.floatValue, 0.0f, 1.0f); + using (new EditorGUI.MixedValueScope(serialized.fsrSharpness.hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + float newFsrSharpness = EditorGUILayout.Slider(Styles.fsrSharpnessText, serialized.fsrSharpness.floatValue, 0.0f, 1.0f); + if (EditorGUI.EndChangeCheck()) + serialized.fsrSharpness.floatValue = newFsrSharpness; + } } --EditorGUI.indentLevel; break; @@ -469,7 +492,13 @@ static void DrawUpscalingFilterDropdownAndOptions(SerializedUniversalRenderPipel // We put the FSR sharpness override value behind an override checkbox so we can tell when the user intends to use a custom value rather than the default. if (serialized.fsrOverrideSharpness.boolValue) { - serialized.fsrSharpness.floatValue = EditorGUILayout.Slider(Styles.fsrSharpnessText, serialized.fsrSharpness.floatValue, 0.0f, 1.0f); + using (new EditorGUI.MixedValueScope(serialized.fsrSharpness.hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + float newFsrSharpness = EditorGUILayout.Slider(Styles.fsrSharpnessText, serialized.fsrSharpness.floatValue, 0.0f, 1.0f); + if (EditorGUI.EndChangeCheck()) + serialized.fsrSharpness.floatValue = newFsrSharpness; + } } --EditorGUI.indentLevel; @@ -517,13 +546,13 @@ static void DrawLighting(SerializedUniversalRenderPipelineAsset serialized, Edit EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel++; - disableGroup |= !serialized.mainLightRenderingModeProp.boolValue; + disableGroup |= serialized.mainLightRenderingModeProp.hasMultipleDifferentValues || !serialized.mainLightRenderingModeProp.boolValue; EditorGUI.BeginDisabledGroup(disableGroup); EditorGUILayout.PropertyField(serialized.mainLightShadowsSupportedProp, Styles.supportsMainLightShadowsText); EditorGUI.EndDisabledGroup(); - disableGroup |= !serialized.mainLightShadowsSupportedProp.boolValue; + disableGroup |= serialized.mainLightShadowsSupportedProp.hasMultipleDifferentValues || !serialized.mainLightShadowsSupportedProp.boolValue; EditorGUI.BeginDisabledGroup(disableGroup); EditorGUILayout.PropertyField(serialized.mainLightShadowmapResolutionProp, Styles.mainLightShadowmapResolutionText); EditorGUI.EndDisabledGroup(); @@ -541,7 +570,7 @@ static void DrawLighting(SerializedUniversalRenderPipelineAsset serialized, Edit EditorGUILayout.PropertyField(serialized.probeVolumeSHBands, Styles.probeVolumeSHBands); EditorGUILayout.PropertyField(serialized.supportProbeVolumeGPUStreaming, Styles.supportProbeVolumeGPUStreaming); - EditorGUI.BeginDisabledGroup(!serialized.supportProbeVolumeGPUStreaming.boolValue); + EditorGUI.BeginDisabledGroup(serialized.supportProbeVolumeGPUStreaming.hasMultipleDifferentValues || !serialized.supportProbeVolumeGPUStreaming.boolValue); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(serialized.supportProbeVolumeDiskStreaming, Styles.supportProbeVolumeDiskStreaming); EditorGUI.indentLevel--; @@ -579,9 +608,15 @@ static void DrawLighting(SerializedUniversalRenderPipelineAsset serialized, Edit EditorGUILayout.PropertyField(serialized.additionalLightsRenderingModeProp, Styles.addditionalLightsRenderingModeText); EditorGUI.indentLevel++; - disableGroup = serialized.additionalLightsRenderingModeProp.intValue == (int)LightRenderingMode.Disabled; + disableGroup = serialized.additionalLightsRenderingModeProp.hasMultipleDifferentValues || serialized.additionalLightsRenderingModeProp.intValue == (int)LightRenderingMode.Disabled; EditorGUI.BeginDisabledGroup(disableGroup); - serialized.additionalLightsPerObjectLimitProp.intValue = EditorGUILayout.IntSlider(Styles.perObjectLimit, serialized.additionalLightsPerObjectLimitProp.intValue, 0, UniversalRenderPipeline.maxPerObjectLights); + using (new EditorGUI.MixedValueScope(serialized.additionalLightsPerObjectLimitProp.hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + int newPerObjectLimit = EditorGUILayout.IntSlider(Styles.perObjectLimit, serialized.additionalLightsPerObjectLimitProp.intValue, 0, UniversalRenderPipeline.maxPerObjectLights); + if (EditorGUI.EndChangeCheck()) + serialized.additionalLightsPerObjectLimitProp.intValue = newPerObjectLimit; + } #if UNITY_META_QUEST if (serialized.additionalLightsPerObjectLimitProp.intValue > 1) { @@ -590,19 +625,23 @@ static void DrawLighting(SerializedUniversalRenderPipelineAsset serialized, Edit #endif EditorGUI.EndDisabledGroup(); - disableGroup |= (serialized.additionalLightsPerObjectLimitProp.intValue == 0 || serialized.additionalLightsRenderingModeProp.intValue != (int)LightRenderingMode.PerPixel); + disableGroup |= serialized.additionalLightsPerObjectLimitProp.hasMultipleDifferentValues + || serialized.additionalLightsRenderingModeProp.hasMultipleDifferentValues + || serialized.additionalLightsPerObjectLimitProp.intValue == 0 + || serialized.additionalLightsRenderingModeProp.intValue != (int)LightRenderingMode.PerPixel; EditorGUI.BeginDisabledGroup(disableGroup); EditorGUILayout.PropertyField(serialized.additionalLightShadowsSupportedProp, Styles.supportsAdditionalShadowsText); EditorGUI.EndDisabledGroup(); - disableGroup |= !serialized.additionalLightShadowsSupportedProp.boolValue; + disableGroup |= serialized.additionalLightShadowsSupportedProp.hasMultipleDifferentValues || !serialized.additionalLightShadowsSupportedProp.boolValue; EditorGUI.BeginDisabledGroup(disableGroup); EditorGUILayout.PropertyField(serialized.additionalLightShadowmapResolutionProp, Styles.additionalLightsShadowmapResolution); DrawShadowResolutionTierSettings(serialized, ownerEditor); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); - disableGroup = serialized.additionalLightsRenderingModeProp.intValue == (int)LightRenderingMode.Disabled || !serialized.supportsLightCookies.boolValue; + disableGroup = serialized.additionalLightsRenderingModeProp.hasMultipleDifferentValues || serialized.additionalLightsRenderingModeProp.intValue == (int)LightRenderingMode.Disabled + || serialized.supportsLightCookies.hasMultipleDifferentValues || !serialized.supportsLightCookies.boolValue; EditorGUI.BeginDisabledGroup(disableGroup); EditorGUILayout.PropertyField(serialized.additionalLightCookieResolutionProp, Styles.additionalLightsCookieResolution); @@ -656,11 +695,9 @@ static void DrawShadowResolutionTierSettings(SerializedUniversalRenderPipelineAs { // UI code adapted from HDRP U.I logic implemented in com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedScalableSetting.cs ) - var rect = GUILayoutUtility.GetRect(0, float.Epsilon, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight); + var rect = EditorGUILayout.GetControlRect(); var contentRect = EditorGUI.PrefixLabel(rect, Styles.additionalLightsShadowResolutionTiers); - EditorGUI.BeginChangeCheck(); - const int k_ShadowResolutionTiersCount = 3; var values = new[] { serialized.additionalLightsShadowResolutionTierLowProp, serialized.additionalLightsShadowResolutionTierMediumProp, serialized.additionalLightsShadowResolutionTierHighProp }; @@ -679,20 +716,29 @@ static void DrawShadowResolutionTierSettings(SerializedUniversalRenderPipelineAs if (spaceLeft > 2) // If at least two pixels are left to draw this field, draw it, otherwise, skip { var fieldSlot = new Rect(contentRect.x + pixelShift, contentRect.y, num - labelWidth, contentRect.height); // Define the rectangle for the field - int value = EditorGUI.DelayedIntField(fieldSlot, values[index].intValue); - values[index].intValue = Mathf.Max(UniversalAdditionalLightData.AdditionalLightsShadowMinimumResolution, Mathf.NextPowerOfTwo(value)); + using (new EditorGUI.MixedValueScope(values[index].hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + int value = EditorGUI.DelayedIntField(fieldSlot, values[index].intValue); + if (EditorGUI.EndChangeCheck()) + values[index].intValue = Mathf.Max(UniversalAdditionalLightData.AdditionalLightsShadowMinimumResolution, Mathf.NextPowerOfTwo(value)); + } } pixelShift += spaceLeft; // Shift by the slot that was left for the field } EditorGUI.indentLevel = indentLevel; - - EditorGUI.EndChangeCheck(); } static void DrawShadows(SerializedUniversalRenderPipelineAsset serialized, Editor ownerEditor) { - serialized.shadowDistanceProp.floatValue = Mathf.Max(0.0f, EditorGUILayout.FloatField(Styles.shadowDistanceText, serialized.shadowDistanceProp.floatValue)); + using (new EditorGUI.MixedValueScope(serialized.shadowDistanceProp.hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + float newShadowDistance = Mathf.Max(0.0f, EditorGUILayout.FloatField(Styles.shadowDistanceText, serialized.shadowDistanceProp.floatValue)); + if (EditorGUI.EndChangeCheck()) + serialized.shadowDistanceProp.floatValue = newShadowDistance; + } EditorUtils.Unit unit = EditorUtils.Unit.Metric; if (serialized.shadowCascadeCountProp.intValue != 0) { @@ -719,8 +765,21 @@ static void DrawShadows(SerializedUniversalRenderPipelineAsset serialized, Edito DrawCascades(serialized, cascadeCount, useMetric, baseMetric); EditorGUI.indentLevel++; - serialized.shadowDepthBiasProp.floatValue = EditorGUILayout.Slider(Styles.shadowDepthBias, serialized.shadowDepthBiasProp.floatValue, 0.0f, UniversalRenderPipeline.maxShadowBias); - serialized.shadowNormalBiasProp.floatValue = EditorGUILayout.Slider(Styles.shadowNormalBias, serialized.shadowNormalBiasProp.floatValue, 0.0f, UniversalRenderPipeline.maxShadowBias); + using (new EditorGUI.MixedValueScope(serialized.shadowDepthBiasProp.hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + float newDepthBias = EditorGUILayout.Slider(Styles.shadowDepthBias, serialized.shadowDepthBiasProp.floatValue, 0.0f, UniversalRenderPipeline.maxShadowBias); + if (EditorGUI.EndChangeCheck()) + serialized.shadowDepthBiasProp.floatValue = newDepthBias; + } + + using (new EditorGUI.MixedValueScope(serialized.shadowNormalBiasProp.hasMultipleDifferentValues)) + { + EditorGUI.BeginChangeCheck(); + float newNormalBias = EditorGUILayout.Slider(Styles.shadowNormalBias, serialized.shadowNormalBiasProp.floatValue, 0.0f, UniversalRenderPipeline.maxShadowBias); + if (EditorGUI.EndChangeCheck()) + serialized.shadowNormalBiasProp.floatValue = newNormalBias; + } EditorGUILayout.PropertyField(serialized.softShadowsSupportedProp, Styles.supportsSoftShadows); if (serialized.softShadowsSupportedProp.boolValue) { @@ -910,8 +969,10 @@ static void DrawPostProcessing(SerializedUniversalRenderPipelineAsset serialized else if (isHdrOn && PlayerSettings.allowHDRDisplaySupport && serialized.colorGradingMode.intValue == (int)ColorGradingMode.LowDynamicRange) EditorGUILayout.HelpBox(Styles.colorGradingModeWithHDROutput, MessageType.Warning); + EditorGUI.BeginChangeCheck(); EditorGUILayout.DelayedIntField(serialized.colorGradingLutSize, Styles.colorGradingLutSize); - serialized.colorGradingLutSize.intValue = Mathf.Clamp(serialized.colorGradingLutSize.intValue, UniversalRenderPipelineAsset.k_MinLutSize, UniversalRenderPipelineAsset.k_MaxLutSize); + if (EditorGUI.EndChangeCheck()) + serialized.colorGradingLutSize.intValue = Mathf.Clamp(serialized.colorGradingLutSize.intValue, UniversalRenderPipelineAsset.k_MinLutSize, UniversalRenderPipelineAsset.k_MaxLutSize); if (isHdrOn && serialized.colorGradingMode.intValue == (int)ColorGradingMode.HighDynamicRange && serialized.colorGradingLutSize.intValue < 32) EditorGUILayout.HelpBox(Styles.colorGradingLutSizeWarning, MessageType.Warning); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Skin.cs b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Skin.cs index 72d028e36e1..5953e1f98c8 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Skin.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Skin.cs @@ -28,6 +28,7 @@ internal static class Styles public static GUIContent srpBatcher = EditorGUIUtility.TrTextContent("SRP Batcher", "If enabled, the render pipeline uses the SRP batcher."); public static GUIContent storeActionsOptimizationText = EditorGUIUtility.TrTextContent("Store Actions", "Sets the store actions policy on tile based GPUs. Affects render targets memory usage and will impact performance."); public static GUIContent dynamicBatching = EditorGUIUtility.TrTextContent("Dynamic Batching", "If enabled, the render pipeline will batch drawcalls with few triangles together by copying their vertex buffers into a shared buffer on a per-frame basis."); + public static readonly string warningDynamicBatching = "Dynamic Batching is deprecated and will be removed in a future release. Use SRP Batcher or GPU Instancing instead."; // Quality public static GUIContent hdrText = EditorGUIUtility.TrTextContent("HDR", "Controls the global HDR settings."); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineBatchingWarning.cs b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineBatchingWarning.cs new file mode 100644 index 00000000000..f11aa7f236d --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineBatchingWarning.cs @@ -0,0 +1,42 @@ +using UnityEditorInternal; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +namespace UnityEditor.Rendering.Universal +{ + // TODO: Remove this class once Dynamic Batching has been fully removed. + static class UniversalRenderPipelineBatchingWarning + { + const string k_SessionKey = "URPDynamicBatchingWarningShown"; + + [InitializeOnLoadMethod] + static void Initialize() + { + if (SessionState.GetBool(k_SessionKey, false)) + return; + + RenderPipelineManager.activeRenderPipelineCreated += WarnIfDynamicBatchingEnabled; + } + + static void WarnIfDynamicBatchingEnabled() + { + RenderPipelineManager.activeRenderPipelineCreated -= WarnIfDynamicBatchingEnabled; + + if (!InternalEditorUtility.isHumanControllingUs) + return; + + if (GraphicsSettings.currentRenderPipeline is not UniversalRenderPipelineAsset urpAsset) + return; + + SessionState.SetBool(k_SessionKey, true); + +#pragma warning disable 618 + if (urpAsset.supportsDynamicBatching) + { + Debug.LogWarning("Dynamic Batching is deprecated and will be removed in a future release. Use SRP Batcher or GPU Instancing instead. Disable Dynamic Batching in the Universal Render Pipeline Asset to remove this warning."); + } +#pragma warning restore 618 + } + } +} diff --git a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineBatchingWarning.cs.meta b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineBatchingWarning.cs.meta new file mode 100644 index 00000000000..7337482c904 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineBatchingWarning.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aa9836a839ff4ee89489b215f0dd4062 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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 14adaf366f5..8a2b1de03f6 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 @@ -177,19 +177,16 @@ internal void Render(RenderGraph graph, ContextContainer frameData, int batchInd var layerBatch = frameData.Get().layerBatches[batchIndex]; DebugHandler debugHandler = GetActiveDebugHandler(cameraData); - var isDebugLightingActive = debugHandler?.IsLightingActive ?? true; + var isLightingActive = 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; + isLightingActive &= UnityEditor.SceneView.currentDrawingSceneView.sceneLighting; #endif if (!layerBatch.lightStats.useLights || isVolumetric && !layerBatch.lightStats.useVolumetricLights || - !isDebugLightingActive) + !isLightingActive) return; // Render single RTs by for apis that don't support MRTs 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 91372f3983c..ccd9def2553 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 @@ -31,7 +31,7 @@ private static void Execute(RasterGraphContext context, PassData passData) RendererLighting.SetLightShaderGlobals(cmd, passData.lightBlendStyles, passData.blendStyleIndices); #if UNITY_EDITOR - if (passData.isLitView) + if (passData.isLightingActive) #endif { if (passData.layerUseLights) @@ -79,7 +79,7 @@ class PassData internal bool activeDebugHandler; #if UNITY_EDITOR - internal bool isLitView; // Required for prefab view and preview camera + internal bool isLightingActive; // Required for prefab view and preview camera #endif } @@ -93,20 +93,13 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex Renderer2DData rendererData = frameData.Get().renderingData; var layerBatch = frameData.Get().layerBatches[batchIndex]; - bool isLitView = true; + DebugHandler debugHandler = GetActiveDebugHandler(cameraData); + var isLightingActive = debugHandler?.IsLightingActive ?? true; #if UNITY_EDITOR // Early out for prefabs if (cameraData.isSceneViewCamera && UnityEditor.SceneView.currentDrawingSceneView != null) - isLitView = UnityEditor.SceneView.currentDrawingSceneView.sceneLighting; - - // Early out for preview camera - if (cameraData.cameraType == CameraType.Preview) - isLitView = false; - - DebugHandler debugHandler = GetActiveDebugHandler(cameraData); - if (debugHandler != null) - isLitView = debugHandler.IsLightingActive; + isLightingActive = UnityEditor.SceneView.currentDrawingSceneView.sceneLighting; #endif // Preset global light textures for first batch @@ -114,14 +107,14 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex { using (var builder = graph.AddRasterRenderPass(k_SetLightBlendTexture, out var passData, m_SetLightBlendTextureProfilingSampler)) { - if (layerBatch.lightStats.useLights && isLitView) + if (layerBatch.lightStats.useLights && isLightingActive) { passData.lightTextures = universal2DResourceData.lightTextures[batchIndex]; for (var i = 0; i < passData.lightTextures.Length; i++) builder.UseTexture(passData.lightTextures[i]); } - SetGlobalLightTextures(graph, builder, frameData, batchIndex, isLitView); + SetGlobalLightTextures(graph, builder, frameData, batchIndex, isLightingActive); builder.AllowGlobalStateModification(true); @@ -143,7 +136,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex passData.isSceneLit = rendererData.lightCullResult.IsSceneLit(); passData.layerUseLights = layerBatch.lightStats.useLights; #if UNITY_EDITOR - passData.isLitView = isLitView; + passData.isLightingActive = isLightingActive; #endif var drawSettings = CreateDrawingSettings(k_ShaderTags, renderingData, cameraData, lightData, SortingCriteria.CommonTransparent); @@ -168,7 +161,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex builder.UseRendererList(passData.rendererList); } - if (passData.layerUseLights && isLitView) + if (passData.layerUseLights && isLightingActive) { passData.lightTextures = universal2DResourceData.lightTextures[batchIndex]; for (var i = 0; i < passData.lightTextures.Length; i++) @@ -189,7 +182,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex // Post set global light textures for next renderer pass var nextBatch = batchIndex + 1; if (nextBatch < universal2DResourceData.lightTextures.Length) - SetGlobalLightTextures(graph, builder, frameData, nextBatch, isLitView); + SetGlobalLightTextures(graph, builder, frameData, nextBatch, isLightingActive); builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { @@ -198,13 +191,13 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex } } - void SetGlobalLightTextures(RenderGraph graph, IRasterRenderGraphBuilder builder, ContextContainer frameData, int batchIndex, bool isLitView) + void SetGlobalLightTextures(RenderGraph graph, IRasterRenderGraphBuilder builder, ContextContainer frameData, int batchIndex, bool isLightingActive) { Renderer2DData rendererData = frameData.Get().renderingData; var layerBatch = frameData.Get().layerBatches[batchIndex]; var lightTextures = frameData.Get().lightTextures[batchIndex]; - if (isLitView) + if (isLightingActive) { if (layerBatch.lightStats.useLights) { 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 4eaccc9f8fb..ee9bbd216a3 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 @@ -649,8 +649,16 @@ void CreateCameraDepthCopyTexture(RenderGraph renderGraph, RenderTextureDescript var depthDescriptor = descriptor; depthDescriptor.msaaSamples = 1;// Depth-Only pass don't use MSAA - depthDescriptor.graphicsFormat = GraphicsFormat.R32_SFloat; - depthDescriptor.depthStencilFormat = GraphicsFormat.None; + if (PlatformAutoDetect.hasRenderToR32F) + { + depthDescriptor.graphicsFormat = GraphicsFormat.R32_SFloat; + depthDescriptor.depthStencilFormat = GraphicsFormat.None; + } + else + { + depthDescriptor.graphicsFormat = GraphicsFormat.None; + depthDescriptor.depthStencilFormat = CoreUtils.GetDefaultDepthOnlyFormat(); + } resourceData.cameraDepthTexture = UniversalRenderer.CreateRenderGraphTexture(renderGraph, depthDescriptor, "_CameraDepthTexture", true); } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs index ba3e04305e6..df55470b141 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs @@ -1563,6 +1563,7 @@ internal SoftShadowQuality softShadowQuality /// Specifies if this UniversalRenderPipelineAsset should use dynamic batching. /// /// + [Obsolete("supportsDynamicBatching is deprecated and will be removed in a future release. #from(6000.5)", false)] public bool supportsDynamicBatching { get => m_SupportsDynamicBatching; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs index 4fbafd82804..60ad8a2ebdd 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsRendering.cs @@ -214,7 +214,15 @@ internal bool blockReflectionProbeAtlasOverlay /// but the Universal Render Pipeline's upscaling filter is not set to STP. /// internal bool blockSTPOverlay { - get { return fullScreenDebugMode == DebugFullScreenMode.STP && UniversalRenderPipeline.asset.upscalingFilter != UpscalingFilterSelection.STP; } + get { + var asset = UniversalRenderPipeline.asset; + return asset != null && fullScreenDebugMode == DebugFullScreenMode.STP && +#if ENABLE_UPSCALER_FRAMEWORK + asset.upscalerName != STPIUpscaler.upscalerName; +#else + asset.upscalingFilter != UpscalingFilterSelection.STP; +#endif + } } #region Pixel validation diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalRenderingData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalRenderingData.cs index 62316da81c1..3f565760ce4 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalRenderingData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalRenderingData.cs @@ -17,6 +17,7 @@ public class UniversalRenderingData : ContextItem /// True if the pipeline supports dynamic batching. /// This settings doesn't apply when drawing shadow casters. Dynamic batching is always disabled when drawing shadow casters. /// + [System.Obsolete("supportsDynamicBatching is deprecated and will be removed in a future release. #from(6000.5)", false)] public bool supportsDynamicBatching; /// @@ -56,7 +57,9 @@ public class UniversalRenderingData : ContextItem public override void Reset() { cullResults = default; +#pragma warning disable 618 supportsDynamicBatching = default; +#pragma warning restore 618 perObjectData = default; renderingMode = default; stencilLodCrossFadeEnabled = default; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs index 6590fbbd61e..5e94504891a 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs @@ -60,7 +60,9 @@ private static DrawingSettings GetDrawingSettings(Camera camera, bool supportsDy var drawingSettings = new DrawingSettings(ShaderTagId.none, sortingSettings) { perObjectData = PerObjectData.MotionVectors, +#pragma warning disable 618 enableDynamicBatching = supportsDynamicBatching, +#pragma warning restore 618 enableInstancing = true, lodCrossFadeStencilMask = 0, // Disable stencil-based lod because depth copy before motion vector pass doesn't copy stencils. }; @@ -174,7 +176,9 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, in Tex passData.cameraDepth = cameraDepthTexture; builder.UseTexture(cameraDepthTexture, AccessFlags.Read); +#pragma warning disable 618 InitRendererLists(ref passData, ref renderingData.cullResults, renderingData.supportsDynamicBatching, renderGraph); +#pragma warning restore 618 builder.UseRendererList(passData.rendererListHdl); if (motionVectorColor.IsValid()) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs index b77c5e707e8..22ef5d258b8 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs @@ -70,7 +70,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Debug.Assert(motionData != null); } - io.cameraInstanceID = cameraData.camera.GetEntityId().GetRawData(); + io.cameraInstanceID = EntityId.ToULong(cameraData.camera.GetEntityId()); io.nearClipPlane = cameraData.camera.nearClipPlane; io.farClipPlane = cameraData.camera.farClipPlane; io.fieldOfViewDegrees = cameraData.camera.fieldOfView; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/XRDepthMotionPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/XRDepthMotionPass.cs index 5bcdf649d9b..b5217e6181d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/XRDepthMotionPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/XRDepthMotionPass.cs @@ -68,7 +68,9 @@ private static DrawingSettings GetObjectMotionDrawingSettings(Camera camera, boo var drawingSettings = new DrawingSettings(k_MotionOnlyShaderTagId, sortingSettings) { perObjectData = PerObjectData.MotionVectors, +#pragma warning disable 618 enableDynamicBatching = false, +#pragma warning restore 618 enableInstancing = true, }; drawingSettings.SetShaderPassName(0, k_MotionOnlyShaderTagId); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs index 3daca3a2cd4..aca8ae7c47f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs @@ -751,7 +751,9 @@ public static DrawingSettings CreateDrawingSettings(ShaderTagId shaderTagId, Uni { perObjectData = renderingData.perObjectData, mainLightIndex = lightData.mainLightIndex, +#pragma warning disable 618 enableDynamicBatching = renderingData.supportsDynamicBatching, +#pragma warning restore 618 // Disable instancing for preview cameras. This is consistent with the built-in forward renderer. Also fixes case 1127324. enableInstancing = camera.cameraType != CameraType.Preview, diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs index ec5d24af052..06b6a55ff3d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs @@ -235,6 +235,10 @@ void SetPerCameraShaderVariables(RasterCommandBuffer cmd, UniversalCameraData ca { cameraWidth = (float)cameraTargetSizeCopy.x; cameraHeight = (float)cameraTargetSizeCopy.y; + + // Multi-pass needs to set unity_StereoEyeIndex builtin param for skybox-panoramic.shader to work correctly (UUM-120719) + if (!cameraData.xr.singlePassEnabled) + cmd.SetGlobalVector(XRBuiltinShaderConstants.unity_StereoEyeIndex, new Vector4(cameraData.xr.multipassId, 0, 0, 0)); } if (camera.allowDynamicResolution) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index 74d013532d9..c68e8cfc77d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -1808,7 +1808,9 @@ static UniversalRenderingData CreateRenderingData(ContextContainer frameData, Un UniversalLightData universalLightData = frameData.Get(); UniversalRenderingData data = frameData.Get(); +#pragma warning disable 618 data.supportsDynamicBatching = settings.supportsDynamicBatching; +#pragma warning restore 618 data.perObjectData = GetPerObjectLightFlags(universalLightData, settings, renderingMode); UniversalRenderer universalRenderer = renderer as UniversalRenderer; @@ -2596,17 +2598,17 @@ static void ApplyAdaptivePerformance(UniversalCameraData cameraData) // TODO if (!cameraData.xr.enabled) { - cameraData.cameraTargetDescriptor.width = (int)(cameraData.camera.pixelWidth * cameraData.renderScale); - cameraData.cameraTargetDescriptor.height = (int)(cameraData.camera.pixelHeight * cameraData.renderScale); + cameraData.cameraTargetDescriptor.width = Mathf.Max(1, (int)(cameraData.pixelWidth * cameraData.renderScale)); + cameraData.cameraTargetDescriptor.height = Mathf.Max(1, (int)(cameraData.pixelHeight * cameraData.renderScale)); #if ENABLE_UPSCALER_FRAMEWORK IUpscaler activeUpscaler = upscaling.activeUpscaler; if (activeUpscaler != null) // An IUpscaler is active. { // It might want to change the pre-upscale resolution. Negotiate with it. - Vector2Int res = new Vector2Int(cameraData.cameraTargetDescriptor.width, cameraData.scaledHeight); + Vector2Int res = new Vector2Int(cameraData.cameraTargetDescriptor.width, cameraData.cameraTargetDescriptor.height); activeUpscaler.NegotiatePreUpscaleResolution(ref res, new Vector2Int(cameraData.pixelWidth, cameraData.pixelHeight)); - cameraData.cameraTargetDescriptor.width = res.x; - cameraData.cameraTargetDescriptor.height = res.y; + cameraData.cameraTargetDescriptor.width = Mathf.Max(1, res.x); + cameraData.cameraTargetDescriptor.height = Mathf.Max(1, res.y); } #endif cameraData.scaledWidth = cameraData.cameraTargetDescriptor.width; @@ -2625,8 +2627,10 @@ static void ApplyAdaptivePerformance(ContextContainer frameData) UniversalShadowData shadowData = frameData.Get(); UniversalPostProcessingData postProcessingData = frameData.Get(); +#pragma warning disable 618 if (AdaptivePerformance.AdaptivePerformanceRenderSettings.SkipDynamicBatching) renderingData.supportsDynamicBatching = false; +#pragma warning restore 618 var MainLightShadowmapResolutionMultiplier = AdaptivePerformance.AdaptivePerformanceRenderSettings.MainLightShadowmapResolutionMultiplier; shadowData.mainLightShadowmapWidth = (int)(shadowData.mainLightShadowmapWidth * MainLightShadowmapResolutionMultiplier); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs index 4f1199a83d8..96d706763fa 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs @@ -143,6 +143,7 @@ internal RenderingData(ContextContainer frameData) /// True if the pipeline supports dynamic batching. /// This settings doesn't apply when drawing shadow casters. Dynamic batching is always disabled when drawing shadow casters. /// + [Obsolete("supportsDynamicBatching is deprecated and will be removed in a future release. #from(6000.5)", false)] public ref bool supportsDynamicBatching => ref frameData.Get().supportsDynamicBatching; /// @@ -2014,6 +2015,7 @@ private sealed class PlatformDetectionCache public readonly bool isSwitch; public readonly bool isSwitch2; public readonly bool isRunningOnPowerVRGPU; + public readonly bool hasRenderToR32F; public PlatformDetectionCache() { @@ -2029,6 +2031,7 @@ public PlatformDetectionCache() isSwitch = Application.platform == RuntimePlatform.Switch; isSwitch2 = Application.platform == RuntimePlatform.Switch2; isRunningOnPowerVRGPU = SystemInfo.graphicsDeviceName.Contains("PowerVR"); + hasRenderToR32F = SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.Render); } } @@ -2081,6 +2084,11 @@ private static bool IsRunningXRMobile() internal static bool isRunningOnPowerVRGPU => platformCache.Value.isRunningOnPowerVRGPU; + /// + /// If true, then the runtime device supports R32_SFloat render targets. Not guaranteed on GLES 3.1 or earlier. + /// + internal static bool hasRenderToR32F => platformCache.Value.hasRenderToR32F; + /// /// Gives the SH evaluation mode when set to automatically detect. /// diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs index 735807ba34c..a5814d5e642 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs @@ -620,9 +620,9 @@ internal override void OnRecordRenderGraph(RenderGraph renderGraph, ScriptableRe bool requirePrepass = requirePrepassForTextures || useDepthPriming; - // Only use a depth format when we do a prepass directly the cameraDepthTexture. If we do depth priming (ie, prepass to the activeCameraDepth), we don't do a prepass to the texture. Instead, we do a copy from the primed attachment. + // Only use a depth format when we do a prepass directly to the cameraDepthTexture, or if R32F color format is not supported. If we do depth priming (ie, prepass to the activeCameraDepth), we don't do a prepass to the texture. Instead, we do a copy from the primed attachment. bool prepassToCameraDepthTexture = requirePrepassForTextures && !usesDeferredLighting && !useDepthPriming; - bool depthTextureIsDepthFormat = prepassToCameraDepthTexture; + bool depthTextureIsDepthFormat = prepassToCameraDepthTexture || !PlatformAutoDetect.hasRenderToR32F; bool requireCopyFromDepth = renderPassInputs.requiresDepthTexture && !prepassToCameraDepthTexture; // We configure this for the first camera of the stack and overlay camera will reuse create color/depth var diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/DepthBlit/DepthBlitCopyDepthPass.cs b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/DepthBlit/DepthBlitCopyDepthPass.cs index 40c98cedd19..ba71f6de3fe 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/DepthBlit/DepthBlitCopyDepthPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/DepthBlit/DepthBlitCopyDepthPass.cs @@ -88,8 +88,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.SetRenderFunc((PassData data, RasterGraphContext context) => { // Enable an MSAA shader keyword based on the source texture MSAA sample count + // when depth must be resolved manually in the copy shader RTHandle sourceTex = data.source; - int cameraSamples = sourceTex.rt.antiAliasing; + int cameraSamples = sourceTex.rt.bindTextureMS ? sourceTex.rt.antiAliasing : 1; context.cmd.SetKeyword(data.keyword_DepthMsaa2, cameraSamples == 2); context.cmd.SetKeyword(data.keyword_DepthMsaa4, cameraSamples == 4); context.cmd.SetKeyword(data.keyword_DepthMsaa8, cameraSamples == 8); diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader index c0d3d988160..531cf6cf339 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader @@ -71,7 +71,7 @@ Shader "Hidden/Light2D" half _InverseHDREmulationScale; - Varyings vert_shape_shared(float3 position, Attributes a) + Varyings vert_shape_shared(float3 position, Attributes a, PerLight2D light) { Varyings o = (Varyings)0; @@ -96,7 +96,7 @@ Shader "Hidden/Light2D" Varyings vert_provider(Attributes a, PerLight2D light) { - return vert_shape_shared(a.positionOS, a); + return vert_shape_shared(a.positionOS, a, light); } @@ -108,7 +108,7 @@ Shader "Hidden/Light2D" positionOS.x = positionOS.x + _L2D_FALLOFF_DISTANCE * a.color.r; positionOS.y = positionOS.y + _L2D_FALLOFF_DISTANCE * a.color.g; - return vert_shape_shared(positionOS, a); + return vert_shape_shared(positionOS, a, light); } Varyings vert_point(Attributes a, PerLight2D light) diff --git a/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md b/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md index 5cfbb956fbc..011ab4a6cec 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md +++ b/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md @@ -29,7 +29,7 @@ To connect [ports](Port.md) between two existing [nodes](Node.md) or with the [m The line resulting from that connection is called an [edge](Edge.md). -You can only connect an output port to a input port, or vice-versa, and you can't connect two ports of the same node together. +You can only connect an output port to an input port, or vice-versa, and you can't connect two ports of the same node together. ## Add and connect a node from an existing port diff --git a/Packages/com.unity.shadergraph/Documentation~/Expression-Node.md b/Packages/com.unity.shadergraph/Documentation~/Expression-Node.md new file mode 100644 index 00000000000..b5f16f0adce --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Expression-Node.md @@ -0,0 +1,31 @@ +# Expression node + +Use the Expression node to specify a complex mathematical expression as a string instead of using multiple [Math nodes](Math-Nodes.md). + +## Input ports + +The number and type of input ports automatically adjust to the values of the [node controls](#controls). Unity adds an input port for each variable in the expression in the text field. + +## Output port + +| **Name** | **Type** | **Description** | +| :--- | :--- | :--- | +| **Out** | Depends on the selected **Type** in the [node controls](#controls). | The value resulting from the expression specified in the text field. | + +## Controls + +| **Name** | **Description** | +| :--- | :--- | +| **Type** | Specifies the data type to use for all input and output ports of the node. The options are:
  • **Vector 1**
  • **Vector 2**
  • **Vector 3**
  • **Vector 4**
| +| (Text field) | Use this field to specify the mathematical expression. The field supports the following:
  • Math operators: `+`, `-`, `*`, `/`, and parentheses.
  • HLSL intrinsic functions: for example, `frac` and `saturate`.
  • Vector swizzling: for example, `a.xw`.
  • Vector construction: `float2(x, y)`.
| + +## Example + +If you specify the expression: + +`a + b * c / 2` + +* Unity adds three input ports to the node: **A**, **B**, and **C**. +* If you input 1, 2, and 10, the node calculates `1 + 2 * 10 / 2` and outputs the result to the **Out** port. + +**Note**: If you use Shader Graph math nodes instead, the example requires three separate nodes: [Divide](Divide-Node.md), [Multiply](Multiply-Node.md), and [Add](Add-Node.md). \ No newline at end of file diff --git a/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md b/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md index 240330c6fd7..f8325607a00 100644 --- a/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md +++ b/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md @@ -108,7 +108,7 @@ To use a Color property instead of a Color node in your shader graph, follow the 1. Save your graph, and return to the material's Inspector. - The property you added in the graph now appears in the material's Inspector. Any changes you make to the property from the Inspector affects all objects that use this material. + The property you added to the graph now appears in the material's Inspector. Any changes you make to the property from the Inspector affect all objects that use this material. ## Additional resources diff --git a/Packages/com.unity.shadergraph/Documentation~/Switch-Node.md b/Packages/com.unity.shadergraph/Documentation~/Switch-Node.md new file mode 100644 index 00000000000..a301a419c63 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Switch-Node.md @@ -0,0 +1,37 @@ +# Switch node + +Use the Switch node to branch based on different cases with value comparisons. + +## Input ports + +| **Name** | **Type** | **Description** | +| :--- | :--- | :--- | +| **Predicate** | Float | The value to test against the conditions. | +| **Fallback** | Dynamic | The fallback value when the **Predicate** doesn't meet any of the conditions. | + +The other input ports allow you to input different branches for each condition you set up for the node. The presence, number and order of these ports depend on the way you set up the conditions. Use one of the two following options: + +* Set up conditions within the node in the [Node settings](#node-settings) through the **Conditions** table. + +* Set up conditions through a [**Float** Property](Property-Types.md#float) you configure as an **Enum** and connect to the **Predicate** port. + +## Output port + +| **Name** | **Type** | **Description** | +| :--- | :--- | :--- | +| **Out** | Dynamic | The value from the input port that the **Predicate** meets the condition of, otherwise the value from the **Fallback** input port. | + +## Node settings + +| **Name** | **Description** | +| :--- | :--- | +| **Floor Predicate** | Rounds down the value of the predicate before testing it against the conditions.
Enable this property to make sure the node still outputs values when the **Predicate** doesn't exactly match a **Condition**. | +| **Conditions** | Defines the list of conditions within the node and creates the corresponding input ports.
To add a [condition](#condition), select **Add** (+).

**Note**: If you connect a **Float** Property configured as an **Enum** to the **Predicate** port, the Switch node ignores the **Conditions** list and uses the **Entries** of the connected Property instead. | + +### Condition + +| **Name** | **Description** | +| :--- | :--- | +| **Name** | The condition's name, which Unity also uses as the name for the corresponding input port. Unity automatically names the conditions with letters in alphabetical order and you can't edit them. | +| **Type** | The type of comparison to make between the **Predicate** and the condition's **Value**. The options are:
  • Equal
  • Not Equal
  • Less
  • Less Or Equal
  • Greater
  • Greater Or Equal
| +| **Value** | The value to test the **Predicate** against, according to the condition's **Type**. | diff --git a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md index 6fac9b7bfc4..bd722e7a769 100644 --- a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md @@ -289,6 +289,7 @@ * [Sample Element Texture](sample-element-texture-node.md) * [Utility](Utility-Nodes.md) * [Custom Function](Custom-Function-Node.md) + * [Expression](Expression-Node.md) * [Preview](Preview-Node.md) * High Definition Render Pipeline * [Emission](Emission-Node.md) @@ -318,6 +319,7 @@ * [Nand](Nand-Node.md) * [Not](Not-Node.md) * [Or](Or-Node.md) + * [Switch](Switch-Node.md) * [UV](UV-Nodes.md) * [Flipbook](Flipbook-Node.md) * [Parallax Mapping](Parallax-Mapping-Node.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Utility-Nodes.md b/Packages/com.unity.shadergraph/Documentation~/Utility-Nodes.md index fdf7276670c..b757964c4fb 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Utility-Nodes.md +++ b/Packages/com.unity.shadergraph/Documentation~/Utility-Nodes.md @@ -1,23 +1,25 @@ # Utility nodes -Enable essential logic operations, previews, and sub-graph referencing. +Explore nodes that enable essential logic operations, customization with HLSL, complex math expressions, and previews. -| **Topic** | **Description** | -|--------------------------------|------------------------------------------------------------------------------------| -| [Preview](Preview-Node.md) | Provides a preview window and passes the input value through without modification. | -| [Sub-Graph](Sub-graph-Node.md) | Provides a reference to a Sub-graph asset. | +| **Topic** | **Description** | +| :--- | :--- | +| [Custom Function](Custom-Function-Node.md) | Returns the results of a custom HLSL function specified as a string or in a referenced file. | +| [Expression](Expression-Node.md) | Returns the result of a custom mathematical expression specified as a string. | +| [Preview](Preview-Node.md) | Provides a preview window and passes the input value through without modification. | ## Logic -| **Topic** | **Description** | -|------------------------------------|---------------------------------------------------------------------------------------------------| -| [All](All-Node.md) | Returns true if all components of the input In are non-zero. | -| [And](And-Node.md) | Returns true if both the inputs A and B are true. | -| [Any](Any-Node.md) | Returns true if any of the components of the input In are non-zero. | -| [Branch](Branch-Node.md) | Provides a dynamic branch to the shader. | -| [Comparison](Comparison-Node.md) | Compares the two input values A and B based on the condition selected on the dropdown. | -| [Is Infinite](Is-Infinite-Node.md) | Returns true if any of the components of the input In is an infinite value. | -| [Is NaN](Is-NaN-Node.md) | Returns true if any of the components of the input In is not a number (NaN). | -| [Nand](Nand-Node.md) | Returns true if both the inputs A and B are false. | -| [Not](Not-Node.md) | Returns the opposite of input In. If In is true, the output is false. Otherwise, it returns true. | -| [Or](Or-Node.md) | Returns true if either input A or input B is true. | +| **Topic** | **Description** | +| :--- | :--- | +| [All](All-Node.md) | Returns true if all components of the input In are non-zero. | +| [And](And-Node.md) | Returns true if both the inputs A and B are true. | +| [Any](Any-Node.md) | Returns true if any of the components of the input In are non-zero. | +| [Branch](Branch-Node.md) | Provides a dynamic branch to the shader. | +| [Comparison](Comparison-Node.md) | Compares the two input values A and B based on the condition selected on the dropdown. | +| [Is Infinite](Is-Infinite-Node.md) | Returns true if any of the components of the input In is an infinite value. | +| [Is NaN](Is-NaN-Node.md) | Returns true if any of the components of the input In is not a number (NaN). | +| [Nand](Nand-Node.md) | Returns true if both the inputs A and B are false. | +| [Not](Not-Node.md) | Returns the opposite of input In. If In is true, the output is false. Otherwise, it returns true. | +| [Or](Or-Node.md) | Returns true if either input A or input B is true. | +| [Switch](Switch-Node.md) | Enables branching based on different cases with value comparisons. | diff --git a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs index af11406fae3..f6d2a171c63 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs @@ -2070,6 +2070,7 @@ public void ReplaceWith(GraphData other) m_GraphPrecision = other.m_GraphPrecision; m_PreviewMode = other.m_PreviewMode; m_OutputNode = other.m_OutputNode; + m_SubDatas.CopyFrom(other.m_SubDatas); if ((this.vertexContext.position != other.vertexContext.position) || (this.fragmentContext.position != other.fragmentContext.position)) diff --git a/Packages/com.unity.shadergraph/Editor/Data/Graphs/ShaderKeyword.cs b/Packages/com.unity.shadergraph/Editor/Data/Graphs/ShaderKeyword.cs index 1cbab74f7de..2bc1f332194 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Graphs/ShaderKeyword.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Graphs/ShaderKeyword.cs @@ -68,6 +68,9 @@ public KeywordType keywordType internal bool IsDynamic => m_KeywordDefinition == KeywordDefinition.DynamicBranch; + // If true, indicates that ShaderGraph may pre-compute permutations containing this keyword + internal bool IsPermutable => !IsDynamic && !IsShaderBuildSettingsCompatible; + [SerializeField] private KeywordDefinition m_KeywordDefinition = KeywordDefinition.ShaderFeature; @@ -104,6 +107,8 @@ public List entries set => m_Entries = value; } + public bool HasNoneEntry => entries.Count > 0 && entries[0].IsNoneKeyword; + [SerializeField] private int m_Value; @@ -116,6 +121,17 @@ public int value [SerializeField] private bool m_IsEditable = true; // this serializes !isBuiltIn + [SerializeField] + private bool m_IsShaderBuildSettingsCompatible = true; + + // Note that if this field is true, we must effectively treat this keyword as a dynamic branch for code gen + // purposes as its definition may be overridden by project settings. + public bool IsShaderBuildSettingsCompatible + { + get => m_IsShaderBuildSettingsCompatible; + set => m_IsShaderBuildSettingsCompatible = value; + } + public bool isBuiltIn { get => !m_IsEditable; @@ -130,6 +146,21 @@ public bool isBuiltIn internal override ConcreteSlotValueType concreteShaderValueType => keywordType.ToConcreteSlotValueType(); + public IEnumerable<(KeywordEntry entry, int value)> GetEntriesExcludingNone() + { + for (int i = HasNoneEntry ? 1 : 0; i < entries.Count; ++i) + yield return (entries[i], i); + } + + // Enumerates the enum's entries in the order one would emit 'if', 'else if', and 'else' branches + public IEnumerable<(KeywordEntry entry, int value)> GetEntriesInBranchOrder() + { + foreach (var entry in GetEntriesExcludingNone()) + yield return entry; + if (HasNoneEntry) + yield return (entries[0], 0); + } + public override string GetOldDefaultReferenceName() { // _ON suffix is required for exposing Boolean type to Material @@ -184,10 +215,16 @@ public string GetKeywordPreviewDeclarationString() case KeywordType.Boolean: return $"#define {referenceName} {(value == 0 ? "false" : " true")}"; case KeywordType.Enum: - string result = $"#define {referenceName}_{entries[value].referenceName} true"; - for (int i = 0; i < entries.Count; ++i) - if (i != value) - result += $"\n#define {referenceName}_{entries[i].referenceName} false"; + string result = entries[value].IsNoneKeyword ? + string.Empty : $"#define {referenceName}_{entries[value].referenceName} true"; + foreach ((KeywordEntry entry, int entryValue) in GetEntriesExcludingNone()) + { + if (entryValue != value) + { + string newline = result.Length == 0 ? string.Empty : "\n"; + result += $"{newline}#define {referenceName}_{entry.referenceName} false"; + } + } return result; default: throw new ArgumentOutOfRangeException(); @@ -196,9 +233,19 @@ public string GetKeywordPreviewDeclarationString() else switch (keywordType) { case KeywordType.Boolean: - return value == 1 ? $"#define {referenceName}" : string.Empty; + return value == 1 ? $"#define {referenceName} true" : $"static const bool {referenceName} = false;"; case KeywordType.Enum: - return $"#define {referenceName}_{entries[value].referenceName}"; + string enumResult = entries[value].IsNoneKeyword ? + string.Empty : $"#define {referenceName}_{entries[value].referenceName} true"; + foreach ((KeywordEntry entry, int entryValue) in GetEntriesExcludingNone()) + { + if (entryValue != value) + { + string newline = enumResult.Length == 0 ? string.Empty : "\n"; + enumResult += $"{newline}static const bool {referenceName}_{entry.referenceName} = false;"; + } + } + return enumResult; default: throw new ArgumentOutOfRangeException(); } @@ -219,16 +266,17 @@ internal override ShaderInput Copy() keywordScope = keywordScope, entries = entries, keywordStages = keywordStages, - overrideReferenceName = overrideReferenceName + overrideReferenceName = overrideReferenceName, + IsShaderBuildSettingsCompatible = IsShaderBuildSettingsCompatible, }; } - public override int latestVersion => 1; + public override int latestVersion => 2; public override void OnAfterDeserialize(string json) { if (sgVersion == 0) { - // we now allow keywords to control whether they are exposed (for Material control) or not. + // Version 1 allows keywords to control whether they are exposed (for Material control) or not. // old exposable keywords set their exposed state to maintain previous behavior // (where bool keywords only showed up in the material when ending in "_ON") if (isExposable) @@ -240,6 +288,14 @@ public override void OnAfterDeserialize(string json) } ChangeVersion(1); } + if (sgVersion < 2) + { + // Version 2 marks the point at which we changed KeywordNode code gen to be compatible with + // Shader Build Settings. Legacy shader graphs should default to incompatible KeywordNode + // code gen. + IsShaderBuildSettingsCompatible = false; + ChangeVersion(2); + } } } } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Implementation/NodeUtils.cs b/Packages/com.unity.shadergraph/Editor/Data/Implementation/NodeUtils.cs index 79dabe57d86..fdc95e42bd5 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Implementation/NodeUtils.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Implementation/NodeUtils.cs @@ -118,7 +118,7 @@ public static void DepthFirstCollectNodesFromNode(ICollection x.Key == keywordNode.keyword).FirstOrDefault(); ids = new int[] { keywordNode.GetSlotIdForPermutation(valueInPermutation) }; diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs index f3810ccf737..e9da0019805 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs @@ -141,7 +141,8 @@ void UpdatePorts() public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode) { var outputSlot = FindOutputSlot(OutputSlotId); - if (keyword.keywordDefinition == KeywordDefinition.DynamicBranch) + if (keyword.keywordDefinition == KeywordDefinition.DynamicBranch + || keyword.IsShaderBuildSettingsCompatible) { switch (keyword.keywordType) { @@ -152,16 +153,23 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo break; case KeywordType.Enum: sb.AppendLine(string.Format($"{outputSlot.concreteValueType.ToShaderString()} {GetVariableNameForSlot(OutputSlotId)};")); - for(int i = 0; i < keyword.entries.Count; ++i) + int i = 0; + foreach ((KeywordEntry entry, int entryValue) in keyword.GetEntriesInBranchOrder()) { - var keywordEntry = keyword.entries[i]; - string keywordName = $"{keyword.referenceName}_{keywordEntry.referenceName}"; - var value = GetSlotValue(keywordEntry.id, generationMode); - sb.AppendLine(string.Format($"{(i != 0 ? "else" : "")} if({keywordName}) {GetVariableNameForSlot(OutputSlotId)} = {value};")); + string keywordName = $"{keyword.referenceName}_{entry.referenceName}"; + var value = GetSlotValue(entry.id, generationMode); + string assignment = $"{GetVariableNameForSlot(OutputSlotId)} = {value};"; + if (i == 0) + sb.AppendLine($"if ({keywordName}) {assignment}"); + else if (i == keyword.entries.Count - 1) + sb.AppendLine($"else {assignment}"); + else + sb.AppendLine($"else if ({keywordName}) {assignment}"); + ++i; } break; } - } + } else switch (keyword.keywordType) { case KeywordType.Boolean: @@ -181,12 +189,13 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo case KeywordType.Enum: { // Iterate all entries in the keyword - for (int i = 0; i < keyword.entries.Count; i++) + int i = 0; + foreach ((KeywordEntry entry, int entryValue) in keyword.GetEntriesInBranchOrder()) { // Insert conditional if (i == 0) { - sb.AppendLine($"#if defined({keyword.referenceName}_{keyword.entries[i].referenceName})"); + sb.AppendLine($"#if defined({keyword.referenceName}_{entry.referenceName})"); } else if (i == keyword.entries.Count - 1) { @@ -194,12 +203,14 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo } else { - sb.AppendLine($"#elif defined({keyword.referenceName}_{keyword.entries[i].referenceName})"); + sb.AppendLine($"#elif defined({keyword.referenceName}_{entry.referenceName})"); } // Append per-slot code - var value = GetSlotValue(GetSlotIdForPermutation(new KeyValuePair(keyword, i)), generationMode); + var value = GetSlotValue(GetSlotIdForPermutation(new KeyValuePair(keyword, entryValue)), generationMode); sb.AppendLine(string.Format($"{outputSlot.concreteValueType.ToShaderString()} {GetVariableNameForSlot(OutputSlotId)} = {value};")); + + ++i; } // End condition diff --git a/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordCollector.cs b/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordCollector.cs index 6f4dcbb8a5e..7e0cd195ba9 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordCollector.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordCollector.cs @@ -25,7 +25,7 @@ public void AddShaderKeyword(ShaderKeyword chunk) keywords.Add(chunk); - if (!chunk.IsDynamic) + if (chunk.IsPermutable) permutableKeywords.Add(chunk); } @@ -67,21 +67,29 @@ public void CalculateKeywordPermutations() for (int i = 0; i < permutableKeywords.Count; i++) { - currentPermutation.Add(new KeyValuePair(permutableKeywords[i], 0)); + var firstEntryValue = GetEntryValues(permutableKeywords[i]).First(); + currentPermutation.Add(new KeyValuePair(permutableKeywords[i], firstEntryValue)); } // Recursively permute keywords PermuteKeywords(permutableKeywords, currentPermutation, 0); } + IEnumerable GetEntryValues(ShaderKeyword keyword) + { + if (keyword.keywordType == KeywordType.Enum) + return keyword.GetEntriesInBranchOrder().Select(x => x.value); + else + return new int[] { 0, 1 }; + } + void PermuteKeywords(List keywords, List> currentPermutation, int currentIndex) { if (currentIndex == keywords.Count) return; // Iterate each possible keyword at the current index - int entryCount = keywords[currentIndex].keywordType == KeywordType.Enum ? keywords[currentIndex].entries.Count : 2; - for (int i = 0; i < entryCount; i++) + foreach (int i in GetEntryValues(keywords[currentIndex])) { // Set the index in the current permutation to the correct value currentPermutation[currentIndex] = new KeyValuePair(keywords[currentIndex], i); diff --git a/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordUtil.cs b/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordUtil.cs index cf65282f808..bcf7aa5c881 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordUtil.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Util/KeywordUtil.cs @@ -233,15 +233,20 @@ public static void GetKeywordPermutationDeclarations(ShaderStringBuilder sb, Lis // Iterate all keywords that are part of the permutation for (int i = 0; i < permutations[p].Count; i++) { + (ShaderKeyword keyword, int entryValue) = permutations[p][i]; + // When previous keyword was inserted subsequent requires && string and = appendAnd ? " && " : string.Empty; - switch (permutations[p][i].Key.keywordType) + switch (keyword.keywordType) { case KeywordType.Enum: { - sb.Append($"{and}defined({permutations[p][i].Key.referenceName}_{permutations[p][i].Key.entries[permutations[p][i].Value].referenceName})"); - appendAnd = true; + if (!keyword.entries[entryValue].IsNoneKeyword) + { + sb.Append($"{and}defined({keyword.referenceName}_{keyword.entries[entryValue].referenceName})"); + appendAnd = true; + } break; } case KeywordType.Boolean: diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs index fdd036d609e..48cfd26f2d7 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs @@ -1722,6 +1722,19 @@ void BuildKeywordFields(PropertySheet propertySheet, ShaderInput shaderInput) propertySheet.Add(help); } + var isShaderBuildSettingsCompatibleDrawer = new ToggleDataPropertyDrawer(); + propertySheet.Add(isShaderBuildSettingsCompatibleDrawer.CreateGUI( + newValue => + { + this._preChangeValueCallback("Change Keyword Allow Definition Override"); + keyword.IsShaderBuildSettingsCompatible = newValue.isOn; + this._postChangeValueCallback(modificationScope: ModificationScope.Graph); + }, + new ToggleData(keyword.IsShaderBuildSettingsCompatible), + "Allow Definition Override", + out VisualElement isShaderBuildSettingsCompatibleToggle, + tooltip: "Indicates whether this keyword's definition can be overridden by the project's shader build settings.")); + typeField.SetEnabled(!keyword.isBuiltIn); { var isOverridablePropertyDrawer = new ToggleDataPropertyDrawer(); @@ -1730,15 +1743,15 @@ void BuildKeywordFields(PropertySheet propertySheet, ShaderInput shaderInput) propertySheet.Add(isOverridablePropertyDrawer.CreateGUI( newValue => { - this._preChangeValueCallback("Change Keyword Is Overridable"); + this._preChangeValueCallback("Change Keyword Allow State Override"); keyword.keywordScope = newValue.isOn ? KeywordScope.Global : KeywordScope.Local; }, new ToggleData(toggleState), - "Is Overridable", + "Allow State Override", out keywordScopeField, - tooltip: "Indicate whether this keyword's state can be overridden through the Shader.SetKeyword scripting interface.")); + tooltip: "Indicates whether this keyword's state can be overridden through the Shader.SetKeyword scripting interface.")); keywordScopeField.SetEnabled(enabledState); } BuildExposedField(propertySheet); @@ -1794,6 +1807,24 @@ void BuildEnumKeywordField(PropertySheet propertySheet, ShaderKeyword keyword) // Clamp value between entry list int value = Mathf.Clamp(keyword.value, 0, keyword.entries.Count - 1); + // Include "none" entry + var includeNoneDrawer = new ToggleDataPropertyDrawer(); + propertySheet.Add(includeNoneDrawer.CreateGUI( + (newValue) => + { + this._preChangeValueCallback("Change Include None Value"); + if (newValue.isOn) + keyword.entries.Insert(0, new KeywordEntry(GetFirstUnusedKeywordID(), "None", string.Empty)); + else + keyword.entries.RemoveAll(entry => entry.IsNoneKeyword); + this._postChangeValueCallback(); + this._keywordChangedCallback(); + }, + new ToggleData(keyword.HasNoneEntry), + "Include \"none\" entry", + out VisualElement includeNoneToggle, + tooltip: "Indicates whether the enum can assume a \"none\" value as indicated by the \"_\" keyword.")); + // Default field var field = new PopupField(keyword.entries.Select(x => x.displayName).ToList(), value); field.RegisterValueChangedCallback(evt => @@ -2044,6 +2075,7 @@ void KeywordAddCallbacks() { KeywordEntry entry = ((KeywordEntry)m_KeywordReorderableList.list[index]); EditorGUI.BeginChangeCheck(); + EditorGUI.BeginDisabled(entry.IsNoneKeyword); Rect displayRect = new Rect(rect.x, rect.y, rect.width / 2, EditorGUIUtility.singleLineHeight); var displayName = EditorGUI.DelayedTextField(displayRect, entry.displayName, EditorStyles.label); @@ -2052,6 +2084,7 @@ void KeywordAddCallbacks() var referenceName = EditorGUI.TextField(new Rect(rect.x + rect.width / 2, rect.y, rect.width / 2, EditorGUIUtility.singleLineHeight), entry.referenceName, keyword.isBuiltIn ? EditorStyles.label : greyLabel); + EditorGUI.EndDisabled(); if (EditorGUI.EndChangeCheck()) { this._preChangeValueCallback("Edit Enum Keyword Entry"); @@ -2177,6 +2210,24 @@ void KeywordRemoveEntry(ReorderableList list) void KeywordReorderEntries(ReorderableList list) { + if (shaderInput is not ShaderKeyword keyword) + return; + + // Ensure that the "none" entry is always at position 0 + int noneEntryIndex = 0; + for (; noneEntryIndex < list.list.Count; ++noneEntryIndex) + { + KeywordEntry entry = (KeywordEntry)list.list[noneEntryIndex]; + if (entry.IsNoneKeyword) + break; + } + if (0 < noneEntryIndex && noneEntryIndex < list.list.Count) + { + object noneEntry = list.list[noneEntryIndex]; + list.list.RemoveAt(noneEntryIndex); + list.list.Insert(0, noneEntry); + } + this._preChangeValueCallback("Reorder Keyword Entry"); this._postChangeValueCallback(true); this._keywordChangedCallback(); diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/SwitchNodePropertyDrawer.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/SwitchNodePropertyDrawer.cs index 4583aea7f64..28066615d5d 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/SwitchNodePropertyDrawer.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/SwitchNodePropertyDrawer.cs @@ -1,8 +1,7 @@ using System; using UnityEditor.Graphing; -using UnityEngine.UIElements; using UnityEngine; -using System.Collections.Generic; +using UnityEngine.UIElements; namespace UnityEditor.ShaderGraph.Drawing.Inspector.PropertyDrawers { @@ -33,17 +32,23 @@ internal override void AddCustomNodeProperties(VisualElement parentElement, Abst return; var listView = new ReorderableListView(node.m_cases, "Conditions"); - listView.InitializeItemCallback += (List List) => - { - return new SwitchNode.EntryCase { comparisonType = ComparisonType.Equal, threshold = List.Count }; - }; - listView.ValueChangedCallback += (List list) => - { - node.owner.owner.RegisterCompleteObjectUndo("switch Entry List Change"); - node.Dirty(ModificationScope.Topological); - node.UpdateNodeAfterDeserialization(); - }; + listView.OnNewItemCallback += + () => new SwitchNode.EntryCase { comparisonType = ComparisonType.Equal, threshold = node.m_cases.Count }; + + listView.OnBeforeChangeCallback += + (ReorderableListView.ListActionType changeType) => + { + node.owner.owner.RegisterCompleteObjectUndo($"{changeType} Switch Condition"); + }; + + listView.OnChangeCallback += + (ReorderableListView.ListActionType changeType) => + { + node.Dirty(ModificationScope.Topological); + node.UpdateNodeAfterDeserialization(); + inspectorUpdateDelegate(); + }; listView.DrawItemCallback += (Rect rect, int idx) => { diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Views/ReorderableListView.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Views/ReorderableListView.cs index d7df13c6c80..b3fd00ad653 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Views/ReorderableListView.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Views/ReorderableListView.cs @@ -7,23 +7,32 @@ namespace UnityEditor.ShaderGraph.Drawing { internal class ReorderableListView : VisualElement { + internal enum ListActionType { Add, Remove, Reorder } + List m_DataList; - string m_header; + GUIContent m_header; + float? m_ElementHeight; ReorderableList m_ReorderableList; - internal delegate T InitializeItemDelegate(List list); - internal InitializeItemDelegate InitializeItemCallback; + public delegate void OnBeforeChangeDelegate(ListActionType actionType); + public OnBeforeChangeDelegate OnBeforeChangeCallback; + + public delegate void OnChangeDelegate(ListActionType actionType); + public OnChangeDelegate OnChangeCallback; - internal delegate void ValueChangedDelegate(List list); - internal ValueChangedDelegate ValueChangedCallback; + public delegate T OnNewItemDelegate(); + public OnNewItemDelegate OnNewItemCallback; internal delegate void DrawItemDelegate(Rect rect, int idx); internal DrawItemDelegate DrawItemCallback; - internal ReorderableListView(List dataList, string header) + internal ReorderableListView(List dataList, string header, float? elementHeight = null) : this(dataList, new GUIContent(header, ""), elementHeight) {} + + internal ReorderableListView(List dataList, GUIContent header, float? elementHeight = null) { m_DataList = dataList; m_header = header; + m_ElementHeight = elementHeight; styleSheets.Add(Resources.Load("Styles/ReorderableSlotListView")); Add(new IMGUIContainer(() => OnGUIHandler()) { name = "ListContainer" }); @@ -37,15 +46,46 @@ void OnGUIHandler() m_ReorderableList.DoLayoutList(); } - internal void RecreateList(List dataList, string header) + internal void RecreateList(List dataList, GUIContent header) { m_DataList = dataList; m_header = header; - m_ReorderableList = new ReorderableList(m_DataList, typeof(T), true, true, true, true); + var m_TmpList = new List(dataList.Capacity); + foreach (T item in dataList) + m_TmpList.Add(false); + + m_ReorderableList = new ReorderableList(m_TmpList, typeof(bool), true, true, true, true); + if (m_ElementHeight.HasValue) + m_ReorderableList.elementHeight = m_ElementHeight.Value; - if (InitializeItemCallback != null) - m_ReorderableList.onAddCallback += (ReorderableList list) - => m_DataList.Add(InitializeItemCallback(m_DataList)); + m_ReorderableList.onAddCallback += (ReorderableList list) => + { + OnBeforeChangeCallback?.Invoke(ListActionType.Add); + T item = OnNewItemCallback != null ? OnNewItemCallback() : default(T); + m_DataList.Add(item); + m_TmpList.Add(false); + OnChangeCallback?.Invoke(ListActionType.Add); + }; + + m_ReorderableList.onRemoveCallback += (ReorderableList list) => + { + int index = list.index; + if (index < 0 || index >= list.count) + return; + OnBeforeChangeCallback?.Invoke(ListActionType.Remove); + m_DataList.RemoveAt(index); + m_TmpList.RemoveAt(index); + OnChangeCallback?.Invoke(ListActionType.Remove); + }; + + m_ReorderableList.onReorderCallbackWithDetails += (ReorderableList list, int oldIndex, int newIndex) => + { + OnBeforeChangeCallback?.Invoke(ListActionType.Reorder); + var item = m_DataList[oldIndex]; + m_DataList.RemoveAt(oldIndex); + m_DataList.Insert(newIndex, item); + OnChangeCallback?.Invoke(ListActionType.Reorder); + }; m_ReorderableList.drawHeaderCallback += (Rect rect) => EditorGUI.LabelField(new Rect(rect.x, rect.y, rect.width - 10, rect.height), m_header); @@ -53,10 +93,6 @@ internal void RecreateList(List dataList, string header) if (DrawItemCallback != null) m_ReorderableList.drawElementCallback += (Rect rect, int index, bool isActive, bool isFocused) => DrawItemCallback(rect, index); - - if (ValueChangedCallback != null) - m_ReorderableList.onChangedCallback += (ReorderableList list) - => ValueChangedCallback(m_DataList); } } } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Data/KeywordEntry.cs b/Packages/com.unity.shadergraph/Editor/Generation/Data/KeywordEntry.cs index 41bc0e3787e..e21b1cb234f 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Data/KeywordEntry.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Data/KeywordEntry.cs @@ -10,6 +10,9 @@ internal struct KeywordEntry public string displayName; public string referenceName; + // Is this entry the "none" keyword (i.e. "_") + public bool IsNoneKeyword => string.IsNullOrEmpty(referenceName); + // In this case, we will handle the actual IDs later public KeywordEntry(string displayName, string referenceName) { diff --git a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Tests/HDRP_Runtime_Graphics_Tests.cs b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Tests/HDRP_Runtime_Graphics_Tests.cs index 45151e1bc7a..5efce49336e 100644 --- a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Tests/HDRP_Runtime_Graphics_Tests.cs +++ b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Tests/HDRP_Runtime_Graphics_Tests.cs @@ -77,6 +77,11 @@ public void SetDefaultResolution() graphicsDeviceTypes: new GraphicsDeviceType[] { GraphicsDeviceType.Metal }, architectures: new Architecture[] { Architecture.X64 } )] + [IgnoreGraphicsTest( + "009-SG-FullScreenTarget$", + "https://jira.unity3d.com/browse/UUM-140915", + runtimePlatforms: new RuntimePlatform[] { RuntimePlatform.PS5, RuntimePlatform.Switch, RuntimePlatform.WindowsPlayer } + )] [IgnoreGraphicsTest( "010-BRG-Simple", "Unstable: https://jira.unity3d.com/browse/UUM-134572", diff --git a/Tests/SRPTests/Projects/HDRP_RuntimeTests/ProjectSettings/TagManager.asset b/Tests/SRPTests/Projects/HDRP_RuntimeTests/ProjectSettings/TagManager.asset index 1c92a7840ec..ea8b1a4ba01 100644 --- a/Tests/SRPTests/Projects/HDRP_RuntimeTests/ProjectSettings/TagManager.asset +++ b/Tests/SRPTests/Projects/HDRP_RuntimeTests/ProjectSettings/TagManager.asset @@ -2,7 +2,7 @@ %TAG !u! tag:unity3d.com,2011: --- !u!78 &1 TagManager: - serializedVersion: 2 + serializedVersion: 3 tags: [] layers: - Default @@ -12,11 +12,11 @@ TagManager: - Water - UI - - - - - - - - - - - + - Composite Layer 0 - Background + - Composite Layer 0 - Foreground + - Composite Layer 1 + - Transparent 1 + - Transparent 2 - - - @@ -41,3 +41,6 @@ TagManager: - name: Default uniqueID: 0 locked: 0 + m_RenderingLayers: + - Default + m_MigratedRenderPipelines: [] diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/KeywordTests.cs b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/KeywordTests.cs index d20d11b0ce5..5621937bcf7 100644 --- a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/KeywordTests.cs +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/KeywordTests.cs @@ -12,21 +12,33 @@ namespace UnityEditor.ShaderGraph.UnitTests [TestFixture] internal class KeywordTests { - const string kExpectedPreviewDeclaration = @"#define BOOLEAN_E0DB5C9A_ON -#define ENUM_F6B920FA_A -#define ENUM_7ECD6A43_D + const string kExpectedPreviewDeclaration = @"#define BOOLEAN_E0DB5C9A_ON true +static const bool BOOLEAN_12C0E932_ON = false; +static const bool ENUM_F6B920FA_A = false; +static const bool ENUM_F6B920FA_B = false; +static const bool ENUM_F6B920FA_C = false; +#define ENUM_7ECD6A43_D true +static const bool ENUM_7ECD6A43_A = false; +static const bool ENUM_7ECD6A43_B = false; +static const bool ENUM_7ECD6A43_C = false; #define _DYNAMIC_BOOLEAN false #define _DYNAMIC_ENUM_A true #define _DYNAMIC_ENUM_B false #define _DYNAMIC_ENUM_C false +#define _COMPATIBLE_BOOLEAN true +#define _COMPATIBLE_ENUM_A true +static const bool _COMPATIBLE_ENUM_B = false; +static const bool _COMPATIBLE_ENUM_C = false; "; const string kExpectedForRealsDeclaration = @"#pragma shader_feature_local _ BOOLEAN_E0DB5C9A_ON #pragma multi_compile _ BOOLEAN_12C0E932_ON -#pragma shader_feature_local ENUM_F6B920FA_A ENUM_F6B920FA_B ENUM_F6B920FA_C +#pragma shader_feature_local _ ENUM_F6B920FA_A ENUM_F6B920FA_B ENUM_F6B920FA_C #pragma multi_compile ENUM_7ECD6A43_A ENUM_7ECD6A43_B ENUM_7ECD6A43_C ENUM_7ECD6A43_D #pragma dynamic_branch_local _ _DYNAMIC_BOOLEAN #pragma dynamic_branch_local _DYNAMIC_ENUM_A _DYNAMIC_ENUM_B _DYNAMIC_ENUM_C +#pragma shader_feature_local _ _COMPATIBLE_BOOLEAN +#pragma shader_feature_local _COMPATIBLE_ENUM_A _COMPATIBLE_ENUM_B _COMPATIBLE_ENUM_C "; static string kExpectedPermutationDeclaration = @"#if defined(BOOLEAN_E0DB5C9A_ON) && defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_A) @@ -53,78 +65,110 @@ internal class KeywordTests #define KEYWORD_PERMUTATION_10 #elif defined(BOOLEAN_E0DB5C9A_ON) && defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_11 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_12 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_13 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_14 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_15 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_16 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_17 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_18 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_19 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_20 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_21 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_22 -#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_23 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_24 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_25 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_26 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_27 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_28 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_29 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_30 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_E0DB5C9A_ON) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_31 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_32 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_33 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_34 -#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_35 -#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_36 -#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_37 -#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_38 -#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_39 -#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_40 -#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_41 -#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_42 -#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_D) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_43 -#elif defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_A) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_A) #define KEYWORD_PERMUTATION_44 -#elif defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_B) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_B) #define KEYWORD_PERMUTATION_45 -#elif defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_C) +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_C) #define KEYWORD_PERMUTATION_46 -#else +#elif defined(BOOLEAN_12C0E932_ON) && defined(ENUM_7ECD6A43_D) #define KEYWORD_PERMUTATION_47 +#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_A) + #define KEYWORD_PERMUTATION_48 +#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_B) + #define KEYWORD_PERMUTATION_49 +#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_C) + #define KEYWORD_PERMUTATION_50 +#elif defined(ENUM_F6B920FA_A) && defined(ENUM_7ECD6A43_D) + #define KEYWORD_PERMUTATION_51 +#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_A) + #define KEYWORD_PERMUTATION_52 +#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_B) + #define KEYWORD_PERMUTATION_53 +#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_C) + #define KEYWORD_PERMUTATION_54 +#elif defined(ENUM_F6B920FA_B) && defined(ENUM_7ECD6A43_D) + #define KEYWORD_PERMUTATION_55 +#elif defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_A) + #define KEYWORD_PERMUTATION_56 +#elif defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_B) + #define KEYWORD_PERMUTATION_57 +#elif defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_C) + #define KEYWORD_PERMUTATION_58 +#elif defined(ENUM_F6B920FA_C) && defined(ENUM_7ECD6A43_D) + #define KEYWORD_PERMUTATION_59 +#elif defined(ENUM_7ECD6A43_A) + #define KEYWORD_PERMUTATION_60 +#elif defined(ENUM_7ECD6A43_B) + #define KEYWORD_PERMUTATION_61 +#elif defined(ENUM_7ECD6A43_C) + #define KEYWORD_PERMUTATION_62 +#else + #define KEYWORD_PERMUTATION_63 #endif "; @@ -306,19 +350,19 @@ public void CanGetPermutationMapPerNode() int booleanAIndex = descendentNodes.IndexOf(booleanANode); List booleanAPermutations = keywordPermutationsPerNode[booleanAIndex]; - Assert.AreEqual(24, booleanAPermutations.Count, "Boolean A had incorrect permutations."); + Assert.AreEqual(32, booleanAPermutations.Count, "Boolean A had incorrect permutations."); int booleanBIndex = descendentNodes.IndexOf(booleanBNode); List booleanBPermutations = keywordPermutationsPerNode[booleanBIndex]; - Assert.AreEqual(48, booleanBPermutations.Count, "Boolean B had incorrect permutations."); + Assert.AreEqual(64, booleanBPermutations.Count, "Boolean B had incorrect permutations."); int enumAIndex = descendentNodes.IndexOf(enumANode); List enumAPermutations = keywordPermutationsPerNode[enumAIndex]; - Assert.AreEqual(12, enumAPermutations.Count, "Enum A had incorrect permutations."); + Assert.AreEqual(16, enumAPermutations.Count, "Enum A had incorrect permutations."); int enumBIndex = descendentNodes.IndexOf(enumBNode); List enumBPermutations = keywordPermutationsPerNode[enumBIndex]; - Assert.AreEqual(24, enumBPermutations.Count, "Enum B had incorrect permutations."); + Assert.AreEqual(32, enumBPermutations.Count, "Enum B had incorrect permutations."); } [Test] @@ -339,10 +383,10 @@ public void KeywordEnumCanAddAndRemovePort() Assert.Fail("One or more Keywords Nodes not in graph."); } - KeywordEntry newEntry1 = new KeywordEntry(4, "D", "D"); - KeywordEntry newEntry2 = new KeywordEntry(5, "E", "E"); - KeywordEntry newEntry3 = new KeywordEntry(6, "F", "F"); - KeywordEntry newEntry4 = new KeywordEntry(5, "E", "E"); + KeywordEntry newEntry1 = new KeywordEntry(14, "D", "D"); + KeywordEntry newEntry2 = new KeywordEntry(15, "E", "E"); + KeywordEntry newEntry3 = new KeywordEntry(16, "F", "F"); + KeywordEntry newEntry4 = new KeywordEntry(15, "E", "E"); enumAKeyword.entries.Add(newEntry1); @@ -350,13 +394,13 @@ public void KeywordEnumCanAddAndRemovePort() enumAKeyword.entries.Add(newEntry3); enumBKeyword.entries.Add(newEntry4); - Assert.AreEqual(6, enumAKeyword.entries.Count, "Enum A Keyword has incorrect # of entries after adding"); + Assert.AreEqual(7, enumAKeyword.entries.Count, "Enum A Keyword has incorrect # of entries after adding"); Assert.AreEqual(5, enumBKeyword.entries.Count, "Enum B Keyword has incorrect # of entries after adding"); enumANode.UpdateNode(); enumBNode.UpdateNode(); - Assert.AreEqual(7, enumANode.GetSlots().Count(), "Enum A Node has incorrect # of entries after adding"); + Assert.AreEqual(8, enumANode.GetSlots().Count(), "Enum A Node has incorrect # of entries after adding"); Assert.AreEqual(6, enumBNode.GetSlots().Count(), "Enum B Node has incorrect # of entries after adding"); enumAKeyword.entries.Remove(newEntry1); @@ -364,13 +408,13 @@ public void KeywordEnumCanAddAndRemovePort() enumAKeyword.entries.Remove(newEntry3); enumBKeyword.entries.Remove(newEntry4); - Assert.AreEqual(3, enumAKeyword.entries.Count, "Enum A Keyword has incorrect # of entries after removing"); + Assert.AreEqual(4, enumAKeyword.entries.Count, "Enum A Keyword has incorrect # of entries after removing"); Assert.AreEqual(4, enumBKeyword.entries.Count, "Enum B Keyword has incorrect # of entries after removing"); enumANode.UpdateNode(); enumBNode.UpdateNode(); - Assert.AreEqual(4, enumANode.GetSlots().Count(), "Enum A Node has incorrect # of entries after removing"); + Assert.AreEqual(5, enumANode.GetSlots().Count(), "Enum A Node has incorrect # of entries after removing"); Assert.AreEqual(5, enumBNode.GetSlots().Count(), "Enum B Node has incorrect # of entries after removing"); } } diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Keywords.shadergraph b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Keywords.shadergraph index 469a9c305ed..2ed4c7b10dd 100644 --- a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Keywords.shadergraph +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Keywords.shadergraph @@ -21,6 +21,12 @@ }, { "m_Id": "bfafbf3bdc9d44839c4db829f1da01c8" + }, + { + "m_Id": "54a86e9f1df84c85bee455c7dce69614" + }, + { + "m_Id": "9108a9df9105480ab9ed13759085fa00" } ], "m_Dropdowns": [], @@ -71,6 +77,12 @@ }, { "m_Id": "67937a9e85444dd4bea5c776d2488aa6" + }, + { + "m_Id": "cfc594ef53bf42d988efa55f8f7f8522" + }, + { + "m_Id": "0c0a54c21d2f49eaaa761bca8606c96b" } ], "m_GroupDatas": [ @@ -80,6 +92,20 @@ ], "m_StickyNoteDatas": [], "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "0c0a54c21d2f49eaaa761bca8606c96b" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "aeacb51020546084a0afbf1f65764148" + }, + "m_SlotId": 2 + } + }, { "m_OutputSlot": { "m_Node": { @@ -178,6 +204,20 @@ "m_SlotId": 1 } }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cfc594ef53bf42d988efa55f8f7f8522" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "aeacb51020546084a0afbf1f65764148" + }, + "m_SlotId": 1 + } + }, { "m_OutputSlot": { "m_Node": { @@ -249,12 +289,15 @@ } { - "m_SGVersion": 1, + "m_SGVersion": 2, "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", "m_ObjectId": "04da55743a5842cea5ae00c183a1f026", "m_Guid": { "m_GuidSerialized": "c82c78b7-b675-49dd-a3a5-61567e0c04a5" }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, "m_Name": "Boolean B", "m_DefaultRefNameVersion": 0, "m_RefNameGeneratedByDisplayName": "", @@ -270,7 +313,8 @@ "m_KeywordStages": 63, "m_Entries": [], "m_Value": 0, - "m_IsEditable": true + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": false } { @@ -281,6 +325,7 @@ "m_DisplayName": "On", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "On", "m_StageCapability": 3, "m_Value": { @@ -294,9 +339,81 @@ "y": 0.0, "z": 0.0, "w": 0.0 + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "0c0a54c21d2f49eaaa761bca8606c96b", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Compatible Enum", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -795.2001342773438, + "y": 768.800048828125, + "width": 208.800048828125, + "height": 327.2000732421875 + } + }, + "m_Slots": [ + { + "m_Id": "1883420c868041cbbad76dcdde74a236" + }, + { + "m_Id": "b295e0ff33224a3ab944b735527efa7b" + }, + { + "m_Id": "a965b19c90ff431cbb1748effd30907c" + }, + { + "m_Id": "440f6d2914954974943ddcecabefa121" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "9108a9df9105480ab9ed13759085fa00" } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0c6710f61cad4258a92864b54d27be56", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": true +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -305,6 +422,7 @@ "m_DisplayName": "B", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "B", "m_StageCapability": 3, "m_Value": { @@ -318,7 +436,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -329,6 +448,7 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": { @@ -342,7 +462,34 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "1883420c868041cbbad76dcdde74a236", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": true } { @@ -353,6 +500,7 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": { @@ -366,7 +514,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": true } { @@ -408,12 +557,15 @@ } { - "m_SGVersion": 1, + "m_SGVersion": 2, "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", "m_ObjectId": "26de5479e9304f4d8026c0c2330bbcd3", "m_Guid": { "m_GuidSerialized": "52bfe1ca-6742-434b-a73c-16b394288658" }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, "m_Name": "Enum A", "m_DefaultRefNameVersion": 0, "m_RefNameGeneratedByDisplayName": "", @@ -428,6 +580,11 @@ "m_KeywordScope": 0, "m_KeywordStages": 63, "m_Entries": [ + { + "id": 4, + "displayName": "None", + "referenceName": "" + }, { "id": 1, "displayName": "A", @@ -445,7 +602,8 @@ } ], "m_Value": 0, - "m_IsEditable": true + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": false } { @@ -490,6 +648,7 @@ "m_DisplayName": "Normal", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Normal", "m_StageCapability": 1, "m_Value": { @@ -514,22 +673,53 @@ "m_DisplayName": "X", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "X", "m_StageCapability": 3, "m_Value": 0.0, "m_DefaultValue": 0.0, "m_Labels": [ "X" - ] + ], + "m_LiteralMode": false } { - "m_SGVersion": 1, + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "3872e8839b9148d19a34363b18cfdfd4", + "m_Id": 4, + "m_DisplayName": "None", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 2, "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", "m_ObjectId": "3a09ef30d1b248a08a135b23c82fec7d", "m_Guid": { "m_GuidSerialized": "9c5a0e14-b5da-46fe-906a-75d8683bac21" }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, "m_Name": "Boolean A", "m_DefaultRefNameVersion": 0, "m_RefNameGeneratedByDisplayName": "", @@ -545,7 +735,8 @@ "m_KeywordStages": 63, "m_Entries": [], "m_Value": 1, - "m_IsEditable": true + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": false } { @@ -556,6 +747,7 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": { @@ -569,7 +761,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": true } { @@ -580,6 +773,7 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": { @@ -593,7 +787,34 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "440f6d2914954974943ddcecabefa121", + "m_Id": 3, + "m_DisplayName": "C", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "C", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false } { @@ -604,6 +825,7 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": { @@ -617,7 +839,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": true } { @@ -662,6 +885,35 @@ } } +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "54a86e9f1df84c85bee455c7dce69614", + "m_Guid": { + "m_GuidSerialized": "f5622c07-b8ff-46ed-8b72-743410cd58b2" + }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, + "m_Name": "Compatible Boolean", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Compatible Boolean", + "m_DefaultReferenceName": "_COMPATIBLE_BOOLEAN", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [], + "m_Value": 1, + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": true +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -670,6 +922,7 @@ "m_DisplayName": "C", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "C", "m_StageCapability": 3, "m_Value": { @@ -683,7 +936,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -728,6 +982,7 @@ "m_DisplayName": "B", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "B", "m_StageCapability": 3, "m_Value": { @@ -741,7 +996,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -767,6 +1023,12 @@ }, { "m_Id": "bfafbf3bdc9d44839c4db829f1da01c8" + }, + { + "m_Id": "54a86e9f1df84c85bee455c7dce69614" + }, + { + "m_Id": "9108a9df9105480ab9ed13759085fa00" } ] } @@ -784,7 +1046,7 @@ "m_Position": { "serializedVersion": "2", "x": -795.0687255859375, - "y": 406.19525146484377, + "y": 406.19525146484375, "width": 0.0, "height": 0.0 } @@ -826,7 +1088,7 @@ "m_Position": { "serializedVersion": "2", "x": -795.0, - "y": 188.00001525878907, + "y": 188.00001525878906, "width": 130.5, "height": 141.9999542236328 } @@ -858,6 +1120,32 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "758c3ed6949d45718d91b91e7f6128ed", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -866,6 +1154,7 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": { @@ -879,7 +1168,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": true } { @@ -890,13 +1180,15 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": 0.0, "m_DefaultValue": 0.0, "m_Labels": [ "X" - ] + ], + "m_LiteralMode": true } { @@ -975,6 +1267,7 @@ "m_DisplayName": "Off", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Off", "m_StageCapability": 3, "m_Value": { @@ -988,7 +1281,53 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "9108a9df9105480ab9ed13759085fa00", + "m_Guid": { + "m_GuidSerialized": "2060f05d-15fb-44ed-b844-5fbdcdd1781a" + }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, + "m_Name": "Compatible Enum", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Compatible Enum", + "m_DefaultReferenceName": "_COMPATIBLE_ENUM", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_KeywordType": 1, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [ + { + "id": 1, + "displayName": "A", + "referenceName": "A" + }, + { + "id": 2, + "displayName": "B", + "referenceName": "B" + }, + { + "id": 3, + "displayName": "C", + "referenceName": "C" + } + ], + "m_Value": 0, + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": true } { @@ -999,6 +1338,7 @@ "m_DisplayName": "B", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "B", "m_StageCapability": 3, "m_Value": { @@ -1012,7 +1352,34 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "9cea1c71774e4053b1c4051e6220d9f5", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false } { @@ -1023,6 +1390,7 @@ "m_DisplayName": "A", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "A", "m_StageCapability": 3, "m_Value": { @@ -1036,7 +1404,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -1047,11 +1416,13 @@ "m_DisplayName": "Alpha Clip Threshold", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "AlphaClipThreshold", "m_StageCapability": 2, "m_Value": 0.5, "m_DefaultValue": 0.5, - "m_Labels": [] + "m_Labels": [], + "m_LiteralMode": false } { @@ -1096,6 +1467,7 @@ "m_DisplayName": "A", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "A", "m_StageCapability": 3, "m_Value": { @@ -1109,7 +1481,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -1152,16 +1525,20 @@ "m_CustomColors": { "m_SerializableColors": [] }, - "m_Value": 0.0 + "m_Value": 0.0, + "m_ConstIntMode": false } { - "m_SGVersion": 1, + "m_SGVersion": 2, "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", "m_ObjectId": "a92b31bb852e42668b89643108e34f6e", "m_Guid": { "m_GuidSerialized": "8595fd77-227a-4d36-a528-b158bc480344" }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, "m_Name": "Dynamic Boolean", "m_DefaultRefNameVersion": 1, "m_RefNameGeneratedByDisplayName": "Dynamic Boolean", @@ -1177,7 +1554,34 @@ "m_KeywordStages": 63, "m_Entries": [], "m_Value": 0, - "m_IsEditable": true + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "a965b19c90ff431cbb1748effd30907c", + "m_Id": 2, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false } { @@ -1188,6 +1592,7 @@ "m_DisplayName": "D", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "D", "m_StageCapability": 3, "m_Value": { @@ -1201,7 +1606,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -1252,6 +1658,32 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b295e0ff33224a3ab944b735527efa7b", + "m_Id": 1, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.BlockNode", @@ -1292,8 +1724,8 @@ "m_ObjectId": "b6bd1e3b1cb3493ebad17e816a3e2022", "m_Title": "All Tests", "m_Position": { - "x": -398.0, - "y": 242.5 + "x": -398.39996337890625, + "y": 241.99990844726563 } } @@ -1305,6 +1737,7 @@ "m_DisplayName": "C", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "C", "m_StageCapability": 3, "m_Value": { @@ -1318,7 +1751,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -1343,6 +1777,9 @@ { "m_Id": "1766295331fb0e86ace971e2d2f5242e" }, + { + "m_Id": "3872e8839b9148d19a34363b18cfdfd4" + }, { "m_Id": "f19db572ea8de685a03f12300ffa0928" }, @@ -1369,7 +1806,10 @@ { "m_SGVersion": 2, "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", - "m_ObjectId": "b9fd58f3de83458e9280c94b83a79d9a" + "m_ObjectId": "b9fd58f3de83458e9280c94b83a79d9a", + "m_KeepLightingVariants": false, + "m_DefaultDecalBlending": true, + "m_DefaultSSAO": true } { @@ -1380,6 +1820,7 @@ "m_DisplayName": "On", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "On", "m_StageCapability": 3, "m_Value": { @@ -1393,16 +1834,20 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { - "m_SGVersion": 1, + "m_SGVersion": 2, "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", "m_ObjectId": "bfafbf3bdc9d44839c4db829f1da01c8", "m_Guid": { "m_GuidSerialized": "44503cc9-e8b1-48a5-9007-e563efb551c2" }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, "m_Name": "Dynamic Enum", "m_DefaultRefNameVersion": 1, "m_RefNameGeneratedByDisplayName": "Dynamic Enum", @@ -1434,7 +1879,8 @@ } ], "m_Value": 0, - "m_IsEditable": true + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": false } { @@ -1445,11 +1891,13 @@ "m_DisplayName": "Alpha", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Alpha", "m_StageCapability": 2, "m_Value": 1.0, "m_DefaultValue": 1.0, - "m_Labels": [] + "m_Labels": [], + "m_LiteralMode": false } { @@ -1460,6 +1908,7 @@ "m_DisplayName": "Position", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Position", "m_StageCapability": 1, "m_Value": { @@ -1484,6 +1933,7 @@ "m_DisplayName": "Off", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Off", "m_StageCapability": 3, "m_Value": { @@ -1497,6 +1947,49 @@ "y": 0.0, "z": 0.0, "w": 0.0 + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "cfc594ef53bf42d988efa55f8f7f8522", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Compatible Boolean", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -795.2001342773438, + "y": 599.2000732421875, + "width": 160.79998779296875, + "height": 119.199951171875 + } + }, + "m_Slots": [ + { + "m_Id": "0c6710f61cad4258a92864b54d27be56" + }, + { + "m_Id": "9cea1c71774e4053b1c4051e6220d9f5" + }, + { + "m_Id": "758c3ed6949d45718d91b91e7f6128ed" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "54a86e9f1df84c85bee455c7dce69614" } } @@ -1550,6 +2043,7 @@ "m_DisplayName": "Tangent", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Tangent", "m_StageCapability": 1, "m_Value": { @@ -1574,6 +2068,7 @@ "m_DisplayName": "Base Color", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "BaseColor", "m_StageCapability": 2, "m_Value": { @@ -1604,6 +2099,7 @@ "m_DisplayName": "C", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "C", "m_StageCapability": 3, "m_Value": { @@ -1617,7 +2113,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -1638,6 +2135,7 @@ "m_CastShadows": true, "m_ReceiveShadows": true, "m_DisableTint": false, + "m_Sort3DAs2DCompatible": false, "m_AdditionalMotionVectorMode": 0, "m_AlembicMotionVectors": false, "m_SupportsLODCrossFade": false, @@ -1653,6 +2151,7 @@ "m_DisplayName": "On", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "On", "m_StageCapability": 3, "m_Value": { @@ -1666,16 +2165,20 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { - "m_SGVersion": 1, + "m_SGVersion": 2, "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", "m_ObjectId": "edd4a1d26af44be49401145ff7d846ff", "m_Guid": { "m_GuidSerialized": "91abb4d7-036e-4dac-88f8-9a14f26d6099" }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, "m_Name": "Enum B", "m_DefaultRefNameVersion": 0, "m_RefNameGeneratedByDisplayName": "", @@ -1712,7 +2215,8 @@ } ], "m_Value": 3, - "m_IsEditable": true + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": false } { @@ -1723,6 +2227,7 @@ "m_DisplayName": "A", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "A", "m_StageCapability": 3, "m_Value": { @@ -1736,7 +2241,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -1747,6 +2253,7 @@ "m_DisplayName": "Out", "m_SlotType": 1, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Out", "m_StageCapability": 3, "m_Value": { @@ -1760,7 +2267,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": true } { @@ -1771,6 +2279,7 @@ "m_DisplayName": "In", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "In", "m_StageCapability": 3, "m_Value": { @@ -1784,7 +2293,8 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } { @@ -1795,6 +2305,7 @@ "m_DisplayName": "Off", "m_SlotType": 0, "m_Hidden": false, + "m_HideConnector": false, "m_ShaderOutputName": "Off", "m_StageCapability": 3, "m_Value": { @@ -1808,6 +2319,6 @@ "y": 0.0, "z": 0.0, "w": 0.0 - } + }, + "m_LiteralMode": false } - diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Scenes/InputNodes.unity b/Tests/SRPTests/Projects/ShaderGraph/Assets/Scenes/InputNodes.unity index b3a8e6af441..dc6c8821b82 100644 --- a/Tests/SRPTests/Projects/ShaderGraph/Assets/Scenes/InputNodes.unity +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Scenes/InputNodes.unity @@ -2589,6 +2589,8 @@ Transform: - {fileID: 2064675061} - {fileID: 1475762081} - {fileID: 1824269727} + - {fileID: 680989477} + - {fileID: 528895095} m_Father: {fileID: 134715868} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &315644273 @@ -2821,7 +2823,6 @@ MonoBehaviour: IncorrectPixelsThreshold: 0.0000038146973 UseHDR: 0 UseBackBuffer: 0 - ImageResolution: 0 ActiveImageTests: 1 ActivePixelTests: 7 WaitFrames: 2 @@ -4305,6 +4306,118 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 524449747} m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &528895094 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 528895095} + - component: {fileID: 528895098} + - component: {fileID: 528895097} + - component: {fileID: 528895096} + m_Layer: 0 + m_Name: BuildSettingCompatibleEnumKeyword + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &528895095 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 528895094} + serializedVersion: 2 + m_LocalRotation: {x: -0.5, y: 0.5, z: 0.5, w: 0.5} + m_LocalPosition: {x: -2, y: 0, z: 3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 303484558} + m_LocalEulerAnglesHint: {x: -90, y: 180, z: -90} +--- !u!135 &528895096 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 528895094} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &528895097 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 528895094} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: c711b1f2a36ce8447ae0683ca4ed0fbf, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &528895098 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 528895094} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &529652655 GameObject: m_ObjectHideFlags: 0 @@ -5471,6 +5584,118 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 661742757} m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &680989476 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 680989477} + - component: {fileID: 680989480} + - component: {fileID: 680989479} + - component: {fileID: 680989478} + m_Layer: 0 + m_Name: EnumKeyword + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &680989477 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 680989476} + serializedVersion: 2 + m_LocalRotation: {x: -0.5, y: 0.5, z: 0.5, w: 0.5} + m_LocalPosition: {x: -2, y: 0, z: 4} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 303484558} + m_LocalEulerAnglesHint: {x: -90, y: 180, z: -90} +--- !u!135 &680989478 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 680989476} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &680989479 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 680989476} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: c711b1f2a36ce8447ae0683ca4ed0fbf, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &680989480 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 680989476} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &697337477 GameObject: m_ObjectHideFlags: 0 diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatiableEnumKeyword.shadergraph b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatiableEnumKeyword.shadergraph new file mode 100644 index 00000000000..f9ddef23ead --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatiableEnumKeyword.shadergraph @@ -0,0 +1,683 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "08404ca839d14d59a2979fdf1ed0a545", + "m_Properties": [], + "m_Keywords": [ + { + "m_Id": "d249fed72f98472b8ed4af7058ae48d1" + } + ], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "da7169b9f36445e781434d3d00fe316f" + } + ], + "m_Nodes": [ + { + "m_Id": "cce409e6d9ee4a4f85ad80c0e81a98db" + }, + { + "m_Id": "c349abf1b6a64effaabb14d5070b96e2" + }, + { + "m_Id": "e3b0bb68afd24e5295f4da2e83108a18" + }, + { + "m_Id": "4e31a7300a9e4b3cbd555a603ca8413f" + }, + { + "m_Id": "2746f503d4744030a2a61a10eb507748" + }, + { + "m_Id": "98cc58d7b6584a19a6e44b4fe78bb026" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [ + { + "m_Id": "04ef0d71ffc343bfa51d297168a6a9ec" + } + ], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2746f503d4744030a2a61a10eb507748" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "98cc58d7b6584a19a6e44b4fe78bb026" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "98cc58d7b6584a19a6e44b4fe78bb026" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "4e31a7300a9e4b3cbd555a603ca8413f" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "cce409e6d9ee4a4f85ad80c0e81a98db" + }, + { + "m_Id": "c349abf1b6a64effaabb14d5070b96e2" + }, + { + "m_Id": "e3b0bb68afd24e5295f4da2e83108a18" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "4e31a7300a9e4b3cbd555a603ca8413f" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_SubDatas": [], + "m_ActiveTargets": [ + { + "m_Id": "c868a1eeda8a48df8a67394438c8ba72" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StickyNoteData", + "m_ObjectId": "04ef0d71ffc343bfa51d297168a6a9ec", + "m_Title": "Note", + "m_Content": "This shader should mirror the basic EnumKeyword shader, but the keyword set is made overrideable by the Shader Build Settings.\n\nThe project should also be overriding this keyword set to be dynamic branch, rather than static.", + "m_TextSize": 0, + "m_Theme": 0, + "m_Position": { + "serializedVersion": "2", + "x": -383.6000061035156, + "y": -30.400001525878906, + "width": 200.0, + "height": 192.8000030517578 + }, + "m_Group": { + "m_Id": "" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "096c21da88614a1a9536e845b4325109", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 1.0, + "m_DefaultValue": 0.0, + "m_Labels": [], + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "116db4bf5cb0434c8d48f85a154528a0", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "14be3ba500d14def86e3936669aa495b", + "m_Id": 2, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "1b0ac17a43f0404a84f726f225170fc0", + "m_Id": 1, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "2746f503d4744030a2a61a10eb507748", + "m_Group": { + "m_Id": "" + }, + "m_Name": "InputNodesBuildSettingCompatibleEnumKeyword", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -742.800048828125, + "y": 200.00001525878906, + "width": 327.20001220703125, + "height": 119.20002746582031 + } + }, + "m_Slots": [ + { + "m_Id": "116db4bf5cb0434c8d48f85a154528a0" + }, + { + "m_Id": "1b0ac17a43f0404a84f726f225170fc0" + }, + { + "m_Id": "14be3ba500d14def86e3936669aa495b" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "d249fed72f98472b8ed4af7058ae48d1" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "4a5700436055450896f6700102947d04", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "4e31a7300a9e4b3cbd555a603ca8413f", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "e2de9283911a4faeae2ef79d0145bcee" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "85d3345367254283a33c9bb44fcbec9c", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "8a90cc18ceb84d25b0c79fe222d6f74a", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ComparisonNode", + "m_ObjectId": "98cc58d7b6584a19a6e44b4fe78bb026", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Comparison", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -277.9999694824219, + "y": 200.00001525878906, + "width": 146.39993286132813, + "height": 136.40003967285156 + } + }, + "m_Slots": [ + { + "m_Id": "cafcb7d25512458cbe9b64cbe07a5704" + }, + { + "m_Id": "096c21da88614a1a9536e845b4325109" + }, + { + "m_Id": "e6a29ab9b96443ae9291240c55cd3265" + } + ], + "synonyms": [ + "equal", + "greater than", + "less than" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_ComparisonType": 0 +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "a23499b68c644c35a084d2ea66fa59e3", + "m_KeepLightingVariants": false, + "m_DefaultDecalBlending": true, + "m_DefaultSSAO": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "c349abf1b6a64effaabb14d5070b96e2", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "85d3345367254283a33c9bb44fcbec9c" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "c868a1eeda8a48df8a67394438c8ba72", + "m_Datas": [], + "m_ActiveSubTarget": { + "m_Id": "a23499b68c644c35a084d2ea66fa59e3" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_DisableTint": false, + "m_Sort3DAs2DCompatible": false, + "m_AdditionalMotionVectorMode": 0, + "m_AlembicMotionVectors": false, + "m_SupportsLODCrossFade": false, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "cafcb7d25512458cbe9b64cbe07a5704", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [], + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "cce409e6d9ee4a4f85ad80c0e81a98db", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "4a5700436055450896f6700102947d04" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "d249fed72f98472b8ed4af7058ae48d1", + "m_Guid": { + "m_GuidSerialized": "3ad10300-eac9-4f3f-bb36-ed43d04fb849" + }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, + "m_Name": "InputNodesBuildSettingCompatibleEnumKeyword", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "InputNodesBuildSettingCompatibleEnumKeyword", + "m_DefaultReferenceName": "_INPUTNODESBUILDSETTINGCOMPATIBLEENUMKEYWORD", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_KeywordType": 1, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [ + { + "id": 1, + "displayName": "A", + "referenceName": "A" + }, + { + "id": 2, + "displayName": "B", + "referenceName": "B" + } + ], + "m_Value": 1, + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "da7169b9f36445e781434d3d00fe316f", + "m_Name": "", + "m_ChildObjectList": [ + { + "m_Id": "d249fed72f98472b8ed4af7058ae48d1" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "e2de9283911a4faeae2ef79d0145bcee", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "e3b0bb68afd24e5295f4da2e83108a18", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "8a90cc18ceb84d25b0c79fe222d6f74a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BooleanMaterialSlot", + "m_ObjectId": "e6a29ab9b96443ae9291240c55cd3265", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": false, + "m_DefaultValue": false +} + diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.mat b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.mat new file mode 100644 index 00000000000..aacb4a4aa72 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4248922376544952985 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BuildSettingCompatibleEnumKeyword + m_Shader: {fileID: -6465566751694194690, guid: b98824ba3d9ce484f9b7020eaeb8f45c, + type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: + - _INPUTNODESENUMKEYWORD_B + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _INPUTNODESENUMKEYWORD: 1 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueControl: 0 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _ScreenSpaceReflections: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.mat.meta b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.mat.meta new file mode 100644 index 00000000000..189a25bd14c --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7e135ce1fc2f1e2468b796d6d1a6dc15 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.shadergraph.meta b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.shadergraph.meta new file mode 100644 index 00000000000..8ee8eab756b --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/BuildSettingCompatibleEnumKeyword.shadergraph.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: b98824ba3d9ce484f9b7020eaeb8f45c +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} + useAsTemplate: 0 + exposeTemplateAsShader: 0 + indexedData: {instanceID: 0} + template: + name: + category: + description: + icon: {instanceID: 0} + thumbnail: {instanceID: 0} + order: 0 diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.mat b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.mat new file mode 100644 index 00000000000..909e00b6ce9 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4248922376544952985 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: EnumKeyword + m_Shader: {fileID: -6465566751694194690, guid: 48808af23a2e5db4ea94a9710cbe9e87, + type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _INPUTNODESENUMKEYWORD_B + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _INPUTNODESENUMKEYWORD: 1 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueControl: 0 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _ScreenSpaceReflections: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.mat.meta b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.mat.meta new file mode 100644 index 00000000000..7b147c63361 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c711b1f2a36ce8447ae0683ca4ed0fbf +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.shadergraph b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.shadergraph new file mode 100644 index 00000000000..0fc77f7c1b5 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.shadergraph @@ -0,0 +1,659 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "08404ca839d14d59a2979fdf1ed0a545", + "m_Properties": [], + "m_Keywords": [ + { + "m_Id": "d249fed72f98472b8ed4af7058ae48d1" + } + ], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "da7169b9f36445e781434d3d00fe316f" + } + ], + "m_Nodes": [ + { + "m_Id": "cce409e6d9ee4a4f85ad80c0e81a98db" + }, + { + "m_Id": "c349abf1b6a64effaabb14d5070b96e2" + }, + { + "m_Id": "e3b0bb68afd24e5295f4da2e83108a18" + }, + { + "m_Id": "4e31a7300a9e4b3cbd555a603ca8413f" + }, + { + "m_Id": "2746f503d4744030a2a61a10eb507748" + }, + { + "m_Id": "98cc58d7b6584a19a6e44b4fe78bb026" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2746f503d4744030a2a61a10eb507748" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "98cc58d7b6584a19a6e44b4fe78bb026" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "98cc58d7b6584a19a6e44b4fe78bb026" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "4e31a7300a9e4b3cbd555a603ca8413f" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "cce409e6d9ee4a4f85ad80c0e81a98db" + }, + { + "m_Id": "c349abf1b6a64effaabb14d5070b96e2" + }, + { + "m_Id": "e3b0bb68afd24e5295f4da2e83108a18" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "4e31a7300a9e4b3cbd555a603ca8413f" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_SubDatas": [], + "m_ActiveTargets": [ + { + "m_Id": "c868a1eeda8a48df8a67394438c8ba72" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "096c21da88614a1a9536e845b4325109", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 1.0, + "m_DefaultValue": 0.0, + "m_Labels": [], + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "116db4bf5cb0434c8d48f85a154528a0", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "14be3ba500d14def86e3936669aa495b", + "m_Id": 2, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "1b0ac17a43f0404a84f726f225170fc0", + "m_Id": 1, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "2746f503d4744030a2a61a10eb507748", + "m_Group": { + "m_Id": "" + }, + "m_Name": "InputNodesEnumKeyword", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -656.0000610351563, + "y": 200.0000457763672, + "width": 194.00003051757813, + "height": 119.20002746582031 + } + }, + "m_Slots": [ + { + "m_Id": "116db4bf5cb0434c8d48f85a154528a0" + }, + { + "m_Id": "1b0ac17a43f0404a84f726f225170fc0" + }, + { + "m_Id": "14be3ba500d14def86e3936669aa495b" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "d249fed72f98472b8ed4af7058ae48d1" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "4a5700436055450896f6700102947d04", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "4e31a7300a9e4b3cbd555a603ca8413f", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "e2de9283911a4faeae2ef79d0145bcee" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "85d3345367254283a33c9bb44fcbec9c", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "8a90cc18ceb84d25b0c79fe222d6f74a", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ComparisonNode", + "m_ObjectId": "98cc58d7b6584a19a6e44b4fe78bb026", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Comparison", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -310.4000549316406, + "y": 200.00001525878906, + "width": 146.40008544921875, + "height": 136.40003967285156 + } + }, + "m_Slots": [ + { + "m_Id": "cafcb7d25512458cbe9b64cbe07a5704" + }, + { + "m_Id": "096c21da88614a1a9536e845b4325109" + }, + { + "m_Id": "e6a29ab9b96443ae9291240c55cd3265" + } + ], + "synonyms": [ + "equal", + "greater than", + "less than" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_ComparisonType": 0 +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "a23499b68c644c35a084d2ea66fa59e3", + "m_KeepLightingVariants": false, + "m_DefaultDecalBlending": true, + "m_DefaultSSAO": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "c349abf1b6a64effaabb14d5070b96e2", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "85d3345367254283a33c9bb44fcbec9c" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "c868a1eeda8a48df8a67394438c8ba72", + "m_Datas": [], + "m_ActiveSubTarget": { + "m_Id": "a23499b68c644c35a084d2ea66fa59e3" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_DisableTint": false, + "m_Sort3DAs2DCompatible": false, + "m_AdditionalMotionVectorMode": 0, + "m_AlembicMotionVectors": false, + "m_SupportsLODCrossFade": false, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "cafcb7d25512458cbe9b64cbe07a5704", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [], + "m_LiteralMode": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "cce409e6d9ee4a4f85ad80c0e81a98db", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "4a5700436055450896f6700102947d04" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "d249fed72f98472b8ed4af7058ae48d1", + "m_Guid": { + "m_GuidSerialized": "3ad10300-eac9-4f3f-bb36-ed43d04fb849" + }, + "promotedFromAssetID": "", + "promotedFromCategoryName": "", + "promotedOrdering": -1, + "m_Name": "InputNodesEnumKeyword", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "InputNodesEnumKeyword", + "m_DefaultReferenceName": "_INPUTNODESENUMKEYWORD", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_KeywordType": 1, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [ + { + "id": 1, + "displayName": "A", + "referenceName": "A" + }, + { + "id": 2, + "displayName": "B", + "referenceName": "B" + } + ], + "m_Value": 1, + "m_IsEditable": true, + "m_IsShaderBuildSettingsCompatible": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "da7169b9f36445e781434d3d00fe316f", + "m_Name": "", + "m_ChildObjectList": [ + { + "m_Id": "d249fed72f98472b8ed4af7058ae48d1" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "e2de9283911a4faeae2ef79d0145bcee", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "e3b0bb68afd24e5295f4da2e83108a18", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "8a90cc18ceb84d25b0c79fe222d6f74a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BooleanMaterialSlot", + "m_ObjectId": "e6a29ab9b96443ae9291240c55cd3265", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_HideConnector": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": false, + "m_DefaultValue": false +} + diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.shadergraph.meta b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.shadergraph.meta new file mode 100644 index 00000000000..6e83211e971 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Basic/EnumKeyword.shadergraph.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 48808af23a2e5db4ea94a9710cbe9e87 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} + useAsTemplate: 0 + exposeTemplateAsShader: 0 + indexedData: {instanceID: 0} + template: + name: + category: + description: + icon: {instanceID: 0} + thumbnail: {instanceID: 0} + order: 0 diff --git a/Tests/SRPTests/Projects/ShaderGraph/ProjectSettings/GraphicsSettings.asset b/Tests/SRPTests/Projects/ShaderGraph/ProjectSettings/GraphicsSettings.asset index e93833a2c10..d3e9be93f9b 100644 --- a/Tests/SRPTests/Projects/ShaderGraph/ProjectSettings/GraphicsSettings.asset +++ b/Tests/SRPTests/Projects/ShaderGraph/ProjectSettings/GraphicsSettings.asset @@ -3,7 +3,7 @@ --- !u!30 &1 GraphicsSettings: m_ObjectHideFlags: 0 - serializedVersion: 12 + serializedVersion: 16 m_Deferred: m_Mode: 1 m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} @@ -13,9 +13,6 @@ GraphicsSettings: m_ScreenSpaceShadows: m_Mode: 1 m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} - m_LegacyDeferred: - m_Mode: 1 - m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} m_DepthNormals: m_Mode: 1 m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} @@ -28,6 +25,7 @@ GraphicsSettings: m_LensFlare: m_Mode: 1 m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} + m_VideoShadersIncludeMode: 2 m_AlwaysIncludedShaders: - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} @@ -36,6 +34,16 @@ GraphicsSettings: - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} m_PreloadedShaders: [] + m_PreloadShadersBatchTimeLimit: -1 + m_GraphicsStateCollection: {fileID: 0} + m_CollectionStartupAction: 0 + m_TraceSavePath: TracedCollection + m_TraceSendToEditor: 1 + m_AdditionalWarmupCollections: [] + m_WarmupAsync: 1 + m_EnableCacheMissTracing: 0 + m_WarmupProgressivelyLimit: -1 + m_CacheMissCollectionPath: CacheMissCollection m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} m_CustomRenderPipeline: {fileID: 11400000, guid: 9c068d834ef325345b87395bd103e074, @@ -48,6 +56,8 @@ GraphicsSettings: m_LightmapStripping: 0 m_FogStripping: 0 m_InstancingStripping: 0 + m_BrgStripping: 0 + m_DefaultLightBaker: 0 m_LightmapKeepPlain: 1 m_LightmapKeepDirCombined: 1 m_LightmapKeepDynamicPlain: 1 @@ -58,5 +68,22 @@ GraphicsSettings: m_FogKeepExp: 1 m_FogKeepExp2: 1 m_AlbedoSwatchInfos: [] + m_RenderPipelineGlobalSettingsMap: + UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 35bc433cead364605bb59ecbb49e64e3, + type: 2} + m_ShaderBuildSettings: + keywordDeclarationOverrides: + - keywords: + - name: _INPUTNODESBUILDSETTINGCOMPATIBLEENUMKEYWORD_A + keepInBuild: 1 + - name: _INPUTNODESBUILDSETTINGCOMPATIBLEENUMKEYWORD_B + keepInBuild: 1 + variantGenerationMode: 3 + numInternalDefines: 0 + defines: [] m_LightsUseLinearIntensity: 1 - m_LightsUseColorTemperature: 0 + m_LightsUseColorTemperature: 1 + m_LogWhenShaderIsCompiled: 0 + m_LightProbeOutsideHullStrategy: 0 + m_CameraRelativeLightCulling: 0 + m_CameraRelativeShadowCulling: 0 diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/Tests/HDRP_VisualEffectsGraph_GraphicsTests.cs b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/Tests/HDRP_VisualEffectsGraph_GraphicsTests.cs index 4faf68ebe36..7ac63ee7142 100644 --- a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/Tests/HDRP_VisualEffectsGraph_GraphicsTests.cs +++ b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/Tests/HDRP_VisualEffectsGraph_GraphicsTests.cs @@ -14,6 +14,7 @@ public class VFXGraphicsTests { [IgnoreGraphicsTest("05_MotionVectors", "No reference images provided")] [IgnoreGraphicsTest("13_Decals", "No reference images provided")] + [IgnoreGraphicsTest("027_RWTexture", "Disabled for Instability https://jira.unity3d.com/browse/UUM-140028", runtimePlatforms: new RuntimePlatform[] { RuntimePlatform.GameCoreXboxOne })] [IgnoreGraphicsTest("32_ExcludeFromTAA", "No reference images provided")] [IgnoreGraphicsTest("34_ShaderGraphGeneration", "No reference images provided")] [IgnoreGraphicsTest("ShadergraphSampleScene", "Unstable in QV")]