diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/AssemblyInfo.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/AssemblyInfo.cs index 306bf1bd40a..3441704c446 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/AssemblyInfo.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/AssemblyInfo.cs @@ -2,3 +2,4 @@ [assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor")] [assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Tests")] +[assembly: InternalsVisibleTo("UnityEngine.TestTools.Graphics.Contexts")] diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs index d1a4065ae61..ef5b25010d6 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.Validator.cs @@ -89,14 +89,14 @@ internal static bool IsGPUResidentDrawerSupportedBySRP(GPUResidentDrawerSettings message = Strings.allowInEditModeDisabled; return false; } - + // Disable GRD in any external AssetImporter child process. GRD isn't made for AssetImporter workflow/lifetime // Avoid memory leak warning messages and also some future issues (UUM-90039) if (AssetDatabase.IsAssetImportWorkerProcess()) return false; #endif // If we are forcing the system, no need to perform further checks - if (IsForcedOnViaCommandLine()) + if (IsForcedOnViaCommandLine() || MaintainContext) return true; if (GraphicsSettings.currentRenderPipeline is not IGPUResidentRenderPipeline asset) 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 22791454b0f..b68f923232d 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs @@ -113,7 +113,7 @@ public static void UpdateInstanceOccluders(RenderGraph renderGraph, in OccluderP public static void ReinitializeIfNeeded() { #if UNITY_EDITOR - if (!IsForcedOnViaCommandLine() && (IsProjectSupported() != IsEnabled())) + if (!IsForcedOnViaCommandLine() && !MaintainContext && (IsProjectSupported() != IsEnabled())) { Reinitialize(); } @@ -247,7 +247,7 @@ internal static GPUResidentDrawerSettings GetGlobalSettingsFromRPAsset() /// Is GRD forced on via the command line via -force-gpuresidentdrawer. Editor only. /// /// true if forced on - private static bool IsForcedOnViaCommandLine() + internal static bool IsForcedOnViaCommandLine() { #if UNITY_EDITOR return s_IsForcedOnViaCommandLine; @@ -260,7 +260,7 @@ private static bool IsForcedOnViaCommandLine() /// Is occlusion culling forced on via the command line via -force-gpuocclusion. Editor only. /// /// true if forced on - private static bool IsOcclusionForcedOnViaCommandLine() + internal static bool IsOcclusionForcedOnViaCommandLine() { #if UNITY_EDITOR return s_IsOcclusionForcedOnViaCommandLine; @@ -269,6 +269,10 @@ private static bool IsOcclusionForcedOnViaCommandLine() #endif } + internal static bool MaintainContext { get; set; } = false; + + internal static bool ForceOcclusion { get; set; } = false; + internal static void Reinitialize() { var settings = GetGlobalSettingsFromRPAsset(); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs index bd41fe40c8f..5cc3d10cd79 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs @@ -61,6 +61,7 @@ public class InternalRenderGraphContext internal RenderGraphDefaultResources defaultResources; internal RenderGraphPass executingPass; internal bool contextlessTesting; + internal bool forceResourceCreation; } // This whole thing is a bit of a mess InternalRenderGraphContext is public (but all members are internal) @@ -1186,6 +1187,15 @@ public void BeginRecording(in RenderGraphParameters parameters) m_RenderGraphContext.renderGraphPool = m_RenderGraphPool; m_RenderGraphContext.defaultResources = m_DefaultResources; + // With the actual implementation of the Frame Debugger, we cannot re-use resources during the same frame + // or it breaks the rendering of the pass preview, since the FD copies the texture after the execution of the RG. + m_RenderGraphContext.forceResourceCreation = +#if UNITY_EDITOR || DEVELOPMENT_BUILD + FrameDebugger.enabled; +#else + false; +#endif + if (m_DebugParameters.immediateMode) { UpdateCurrentCompiledGraph(graphHash: -1, forceNoCaching: true); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs index 9a4f6fda084..923fa80be85 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs @@ -1034,7 +1034,7 @@ internal bool CreatePooledResource(InternalRenderGraphContext rgContext, int typ var resource = m_RenderGraphResources[type].resourceArray[index]; if (!resource.imported) { - resource.CreatePooledGraphicsResource(); + resource.CreatePooledGraphicsResource(rgContext.forceResourceCreation); if (m_RenderGraphDebug.enableLogging) resource.LogCreation(m_FrameInformationLogger); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs index df4c4ccc562..61b72e84fa5 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs @@ -188,7 +188,7 @@ public virtual bool NeedsFallBack() return requestFallBack && writeCount == 0; } - public virtual void CreatePooledGraphicsResource() { } + public virtual void CreatePooledGraphicsResource(bool forceResourceCreation) { } public virtual void CreateGraphicsResource() { } public virtual void UpdateGraphicsResource() { } public virtual void ReleasePooledGraphicsResource(int frameIndex) { } @@ -236,7 +236,7 @@ public override void ReleaseGraphicsResource() graphicsResource = null; } - public override void CreatePooledGraphicsResource() + public override void CreatePooledGraphicsResource(bool forceResourceCreation) { Debug.Assert(m_Pool != null, "RenderGraphResource: CreatePooledGraphicsResource should only be called for regular pooled resources"); @@ -247,7 +247,7 @@ public override void CreatePooledGraphicsResource() // If the pool doesn't have any available resource that we can use, we will create one // In any case, we will update the graphicsResource name based on the RenderGraph resource name - if (!m_Pool.TryGetResource(hashCode, out graphicsResource)) + if (forceResourceCreation || !m_Pool.TryGetResource(hashCode, out graphicsResource)) { CreateGraphicsResource(); } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/XR/XRGraphicsAutomatedTests.cs b/Packages/com.unity.render-pipelines.core/Runtime/XR/XRGraphicsAutomatedTests.cs index 9cbb50ad6e3..b1c64f65bad 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/XR/XRGraphicsAutomatedTests.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/XR/XRGraphicsAutomatedTests.cs @@ -24,7 +24,7 @@ static bool activatedFromCommandLine /// /// Used by render pipelines to initialize XR tests. /// - public static bool enabled { get; } = activatedFromCommandLine; + public static bool enabled { get; set; } = activatedFromCommandLine; /// /// Set by automated test framework and read by render pipelines. diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl index bf20910ed5f..47edf1fb58e 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl @@ -651,7 +651,7 @@ float3 AcesTonemap(float3 aces) // --- Red modifier --- // half hue = rgb_2_hue(half3(aces)); - half centeredHue = center_hue(hue, RRT_RED_HUE); + float centeredHue = center_hue(hue, RRT_RED_HUE); // UUM-125596 Must be float for subsequent calculations float hueWeight; { //hueWeight = cubic_basis_shaper(centeredHue, RRT_RED_WIDTH); diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityDOTSInstancing.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityDOTSInstancing.hlsl index b934dac7c25..50b0029512e 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityDOTSInstancing.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityDOTSInstancing.hlsl @@ -294,7 +294,7 @@ void SetupDOTSInstanceSelectMasks() {} #ifdef UNITY_DOTS_INSTANCING_UNIFORM_BUFFER CBUFFER_START(unity_DOTSInstancing_IndirectInstanceVisibility) - float4 unity_DOTSInstancing_IndirectInstanceVisibilityRaw[4096]; + float4 unity_DOTSInstancing_IndirectInstanceVisibilityRaw[1024]; CBUFFER_END #else ByteAddressBuffer unity_DOTSInstancing_IndirectInstanceVisibility; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/CustomPassNodes.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/CustomPassNodes.cs index 5edfcd5e1c8..424a027aa13 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/CustomPassNodes.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/CustomPassNodes.cs @@ -19,8 +19,6 @@ public CustomColorBufferNode() UpdateNodeAfterDeserialization(); } - public override string documentationURL => NodeUtils.GetDocumentationString("HD-Custom-Color"); - const int kUvInputSlotId = 0; const string kUvInputSlotName = "UV"; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/EmissionNode.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/EmissionNode.cs index c212be49ebf..3b43a6123c4 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/EmissionNode.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/EmissionNode.cs @@ -21,7 +21,7 @@ public EmissionNode() UpdateNodeAfterDeserialization(); } - public override string documentationURL => Documentation.GetPageLink("SGNode-Emission"); + public override string documentationURL => NodeUtils.GetDocumentationString("Emission"); [SerializeField] EmissiveIntensityUnit _intensityUnit; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/ExposureNode.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/ExposureNode.cs index 8febdec5409..e3ee515121e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/ExposureNode.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/ExposureNode.cs @@ -36,8 +36,6 @@ public ExposureNode() UpdateNodeAfterDeserialization(); } - public override string documentationURL => Documentation.GetPageLink("SGNode-Exposure"); - [SerializeField] ExposureType m_ExposureType; [EnumControl("Type")] diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/FresnelEquationNode.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/FresnelEquationNode.cs index 8ff0d46fd42..9adb39a1949 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/FresnelEquationNode.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/FresnelEquationNode.cs @@ -33,8 +33,6 @@ class HDFresnelEquationNode : AbstractMaterialNode const string kFresnelOutputSlotName = "Fresnel"; - public override string documentationURL => Documentation.GetPageLink("Fresnel-Equation-Node"); - private enum FresnelSlots { kDotVectorsInputSlotId, diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/SurfaceGradientResolveNormal.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/SurfaceGradientResolveNormal.cs index 86a7b20a525..ad49a5ce72b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/SurfaceGradientResolveNormal.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/SurfaceGradientResolveNormal.cs @@ -18,8 +18,6 @@ public SurfaceGradientResolveNormal() UpdateNodeAfterDeserialization(); } - public override string documentationURL => Documentation.GetPageLink("SurfaceGradientResolveNormal"); - const int kNormalInputSlotId = 0; const string kNormalInputSlotName = "Normal"; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs index c905caf5f24..aa26004f005 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs @@ -369,7 +369,7 @@ static void BuildDispatchIndirectArguments(BuildGPULightListPassData data, bool // clear dispatch indirect buffer cmd.SetComputeBufferParam(data.clearDispatchIndirectShader, s_ClearDispatchIndirectKernel, HDShaderIDs.g_DispatchIndirectBuffer, data.output.dispatchIndirectBuffer); - cmd.DispatchCompute(data.clearDispatchIndirectShader, s_ClearDispatchIndirectKernel, 1, 1, 1); + cmd.DispatchCompute(data.clearDispatchIndirectShader, s_ClearDispatchIndirectKernel, HDUtils.DivRoundUp(LightDefinitions.s_NumFeatureVariants, k_ThreadGroupOptimalSize), 1, data.viewCount); // add tiles to indirect buffer cmd.SetComputeBufferParam(data.buildDispatchIndirectShader, s_BuildIndirectKernel, HDShaderIDs.g_DispatchIndirectBuffer, data.output.dispatchIndirectBuffer); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs index 023d66b8d6a..b0b34637ed3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs @@ -26,6 +26,9 @@ public partial class HDRenderPipelineAsset : RenderPipelineAsset public override string renderPipelineShaderTag => HDRenderPipeline.k_ShaderTagName; + /// + protected override bool requiresCompatibleRenderPipelineGlobalSettings => true; + [System.NonSerialized] internal bool isInOnValidateCall = false; diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Nodes/UniversalSampleBufferNode.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Nodes/UniversalSampleBufferNode.cs index 913e3011768..1cc29013da3 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Nodes/UniversalSampleBufferNode.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Nodes/UniversalSampleBufferNode.cs @@ -47,8 +47,6 @@ public BufferType bufferType } } - public override string documentationURL => Documentation.GetPageLink(Documentation.packageName, "SGNode-Universal-Sample-Buffer"); - public UniversalSampleBufferNode() { name = "URP Sample Buffer"; diff --git a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/SerializedUniversalRenderPipelineAsset.cs b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/SerializedUniversalRenderPipelineAsset.cs index d75c71bcbf2..f9c489e5199 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/SerializedUniversalRenderPipelineAsset.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/SerializedUniversalRenderPipelineAsset.cs @@ -71,7 +71,6 @@ internal class SerializedUniversalRenderPipelineAsset public SerializedProperty mixedLightingSupportedProp { get; } public SerializedProperty useRenderingLayers { get; } public SerializedProperty supportsLightCookies { get; } - public SerializedProperty debugLevelProp { get; } public SerializedProperty volumeFrameworkUpdateModeProp { get; } public SerializedProperty volumeProfileProp { get; } @@ -163,7 +162,6 @@ public SerializedUniversalRenderPipelineAsset(SerializedObject serializedObject) mixedLightingSupportedProp = serializedObject.FindProperty("m_MixedLightingSupported"); useRenderingLayers = serializedObject.FindProperty("m_SupportsLightLayers"); supportsLightCookies = serializedObject.FindProperty("m_SupportsLightCookies"); - debugLevelProp = serializedObject.FindProperty("m_DebugLevel"); volumeFrameworkUpdateModeProp = serializedObject.FindProperty("m_VolumeFrameworkUpdateMode"); volumeProfileProp = serializedObject.FindProperty("m_VolumeProfile"); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Drawers.cs b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Drawers.cs index 8468d798f59..8fadab49b1f 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Drawers.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAsset/UniversalRenderPipelineAssetUI.Drawers.cs @@ -171,7 +171,6 @@ static void DrawRenderingAdditional(SerializedUniversalRenderPipelineAsset seria { EditorGUILayout.PropertyField(serialized.srpBatcher, Styles.srpBatcher); EditorGUILayout.PropertyField(serialized.supportsDynamicBatching, Styles.dynamicBatching); - EditorGUILayout.PropertyField(serialized.debugLevelProp, Styles.debugLevel); EditorGUILayout.PropertyField(serialized.storeActionsOptimizationProperty, Styles.storeActionsOptimizationText); } 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 65f7eca605b..178f4e58e95 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 @@ -31,7 +31,6 @@ 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 GUIContent debugLevel = EditorGUIUtility.TrTextContent("Debug Level", "Controls the level of debug information generated by the render pipeline. When Profiling is selected, the pipeline provides detailed profiling tags."); // Quality public static GUIContent hdrText = EditorGUIUtility.TrTextContent("HDR", "Controls the global HDR settings."); 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 902af562a6e..41f83922508 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs @@ -1620,6 +1620,9 @@ public int numIterationsEnclosingSphere /// public override string renderPipelineShaderTag => UniversalRenderPipeline.k_ShaderTagName; + /// + protected override bool requiresCompatibleRenderPipelineGlobalSettings => true; + /// Names used for display of rendering layer masks. [Obsolete("This property is obsolete. Use RenderingLayerMask API and Tags & Layers project settings instead. #from(23.3)", false)] public override string[] renderingLayerMaskNames => RenderingLayerMask.GetDefinedRenderingLayerNames(); @@ -1673,10 +1676,10 @@ static class Strings } /// - public bool IsGPUResidentDrawerSupportedBySRP(out string message, out LogType severty) + public bool IsGPUResidentDrawerSupportedBySRP(out string message, out LogType severity) { message = string.Empty; - severty = LogType.Warning; + severity = LogType.Warning; // if any of the renderers are not set to Forward+ return false foreach (var rendererData in m_RendererDataList) @@ -1968,5 +1971,6 @@ public bool isStpUsed { get { return m_UpscalingFilter == UpscalingFilterSelection.STP; } } + } } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RenderGraph/RenderGraphGraphicsAutomatedTests.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RenderGraph/RenderGraphGraphicsAutomatedTests.cs index df3a7efdae6..b1ea13566ec 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RenderGraph/RenderGraphGraphicsAutomatedTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RenderGraph/RenderGraphGraphicsAutomatedTests.cs @@ -22,7 +22,7 @@ static bool activatedFromCommandLine /// /// Used by render pipelines to initialize RenderGraph tests. /// - public static bool enabled { get; } = activatedFromCommandLine; + public static bool enabled { get; set; } = activatedFromCommandLine; } } diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl index ad0631b6407..cd9c4988c41 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl @@ -392,9 +392,12 @@ float ComputeFogIntensity(float fogFactor) half3 MixFogColor(half3 fragColor, half3 fogColor, half fogFactor) { #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + if (IsFogEnabled()) + { half fogIntensity = ComputeFogIntensity(fogFactor); // Workaround for UUM-61728: using a manual lerp to avoid rendering artifacts on some GPUs when Vulkan is used fragColor = fragColor * fogIntensity + fogColor * (half(1.0) - fogIntensity); + } #endif return fragColor; } diff --git a/Packages/com.unity.shadergraph/Documentation~/HD-Custom-Color-Node.md b/Packages/com.unity.shadergraph/Documentation~/Custom-Color-Buffer-Node.md similarity index 96% rename from Packages/com.unity.shadergraph/Documentation~/HD-Custom-Color-Node.md rename to Packages/com.unity.shadergraph/Documentation~/Custom-Color-Buffer-Node.md index a50424309f0..c9a51f67c79 100644 --- a/Packages/com.unity.shadergraph/Documentation~/HD-Custom-Color-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Custom-Color-Buffer-Node.md @@ -1,4 +1,4 @@ -# Custom Color Node (HDRP) +# Custom Color Buffer Node (HDRP) The Custom Color Node accesses the custom pass color buffer allocated by HDRP. diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Nodes.md b/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Nodes.md index 2ae0b3724bd..34a482954f0 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Nodes.md +++ b/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Nodes.md @@ -4,6 +4,6 @@ Access properties and data of custom render textures, including size, slice inde | **Topic** | **Description** | |--------------------------------------------------------|----------------------------------------------------------------| -| [Custom Render Texture Slice](Custom-Texture-Slice.md) | Access the custom render texture slice index and cubemap face. | -| [Custom Render Texture Size](Custom-Texture-Size.md) | Access the custom render texture size. | -| [Custom Render Texture Self](Custom-Texture-Self.md) | Access the custom render texture from the previous update. | +| [Custom Render Texture Self](Custom-Render-Texture-Self-Node.md) | Access the custom render texture from the previous update. | +| [Custom Render Texture Size](Custom-Render-Texture-Size-Node.md) | Access the custom render texture size. | +| [Slice Index / Cubemap Face](Slice-Index-Cubemap-Face-Node.md) | Access the custom render texture slice index and cubemap face. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Self.md b/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Self-Node.md similarity index 100% rename from Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Self.md rename to Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Self-Node.md diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Size.md b/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Size-Node.md similarity index 100% rename from Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Size.md rename to Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture-Size-Node.md diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture.md.meta b/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture.md.meta deleted file mode 100644 index b48d1b25daa..00000000000 --- a/Packages/com.unity.shadergraph/Documentation~/Custom-Render-Texture.md.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d9f940345f7b44c9a3fb7de04f59264c -timeCreated: 1721813605 \ No newline at end of file diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Self.md.meta b/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Self.md.meta deleted file mode 100644 index 80b73f7e2ca..00000000000 --- a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Self.md.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: dc70aae0237140c39655012772dfaec0 -timeCreated: 1721813623 \ No newline at end of file diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Size.md.meta b/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Size.md.meta deleted file mode 100644 index 4b3e2bdf88f..00000000000 --- a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Size.md.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c08245aa849d4003859deb1cbe0e9dd3 -timeCreated: 1721813649 \ No newline at end of file diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Slice.md.meta b/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Slice.md.meta deleted file mode 100644 index 0f3cdceab35..00000000000 --- a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Slice.md.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 959569f6b11b4449b793d4930158b695 -timeCreated: 1721813672 \ No newline at end of file diff --git a/Packages/com.unity.shadergraph/Documentation~/Sub-Graph-Dropdown-Node.md b/Packages/com.unity.shadergraph/Documentation~/Dropdown-Node.md similarity index 84% rename from Packages/com.unity.shadergraph/Documentation~/Sub-Graph-Dropdown-Node.md rename to Packages/com.unity.shadergraph/Documentation~/Dropdown-Node.md index d98ffd4be4e..338871e09e2 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Sub-Graph-Dropdown-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Dropdown-Node.md @@ -1,6 +1,6 @@ -# Sub Graph Dropdown node +# Dropdown node -The Sub Graph Dropdown node is a node representation of a Dropdown property. It allows you to create a custom dropdown menu on a Sub Graph node in its parent Shader Graph. You can specify the number of options that appear in the dropdown menu, and their names. +The Dropdown node is a node representation of a Dropdown property. It allows you to create a custom dropdown menu on a Subgraph node in its parent Shader Graph. You can specify the number of options that appear in the dropdown menu, and their names. After you create a Dropdown property and add a Dropdown node to a Subgraph, the Subgraph node in any parent Shader Graph displays with a dropdown control. diff --git a/Packages/com.unity.shadergraph/Documentation~/Fraction-Node.md b/Packages/com.unity.shadergraph/Documentation~/Fraction-Node.md index dcc84d4b83c..0fe0900ac45 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Fraction-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Fraction-Node.md @@ -1,8 +1,14 @@ -# Fraction Node +# Fraction node -## Description +The Fraction node returns the fractional part of an input, also known as the decimal part. The range is 0 to 1. For example, the fractional part of 3.75 is 0.75. -Returns the fractional (or decimal) part of input **In**; which is greater than or equal to 0 and less than 1. +The Fraction node calculates the result using the following formula: + +``` +fractional_part = input - floor(input) +``` + +As a result, the node returns a positive value if you input a negative number. For example, the fractional part of -3.75 is 0.25. ## Ports diff --git a/Packages/com.unity.shadergraph/Documentation~/Graph-Settings-Tab.md b/Packages/com.unity.shadergraph/Documentation~/Graph-Settings-Tab.md index 949b6a8f959..86443d00ade 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Graph-Settings-Tab.md +++ b/Packages/com.unity.shadergraph/Documentation~/Graph-Settings-Tab.md @@ -1,20 +1,40 @@ -# Graph Settings Tab +# Graph Settings tab reference -## Description +Use the **Graph Settings** tab in the [Graph Inspector](Internal-Inspector.md) window to change settings that affect the current shader graph as a whole. -The **Graph Settings** tab on the [Graph Inspector](Internal-Inspector.md) makes it possible to change settings that affect the Shader Graph as a whole. +## General properties -![](images/GraphSettings_Menu.png) +| Property | Description | +| :--- | :--- | +| **Precision** | Select a default [Precision Mode](Precision-Modes.md) for the entire graph. You can override the precision mode at the node level in your graph. | +| **Preview** | Select your preferred preview mode for the nodes that support preview. The options are:
  • **Inherit**: The Unity Editor automatically selects the preview mode to use.
  • **Preview 2D**: Renders the output of the sub graph as a flat two-dimensional preview.
  • **Preview 3D**: Renders the output of the sub graph on a three-dimensional object such as a sphere.
This property is available only in [sub graphs](Sub-graph.md). | -### Graph Settings options +## Target Settings -| Menu Item | Description | -|:----------|:------------| -| **Precision** | Select **Single** or **Half** from the [Precision](Precision-Modes.md) dropdown menu as the graph's default Precision Mode for the entire graph. | -| **Preview Mode** | Select your preferred preview mode for a node that has a preview from the following options:
  • **Inherit**: The Unity Editor automatically selects the preview mode to use.
  • **Preview 2D**: Renders the output of the Sub Graph as a flat two-dimensional preview.
  • **Preview 3D**: Renders the output of the Sub Graph on a three-dimensional object such as a sphere.
This property is available only when you selected a [Sub Graph](Sub-graph.md). | -| **Active Targets** | A list that contains selected targets. You can add or remove **Active Targets** by selecting the **Add (+)** and **Remove (−)** buttons, respectively.
Shader Graph supports three targets:
  • **Built-in**: Shaders for Unity’s [Built-In Render Pipeline](xref:um-render-pipelines).
  • **Custom Render Texture**: Shaders for updating [Custom Render Textures](Custom-Render-Texture.md).
  • **Universal**: Shaders for the [Universal Render Pipeline](xref:um-shaders-in-universalrp-reference).
The available properties displayed depend on the targets you have added to the list. Refer to the [Shader Material Inspector window properties](xref:um-shaders-in-universalrp-reference) for the respective **Materials** you select for the **Built-in** and **Universal** targets.| +Add or remove graph targets to the current shader graph and set target properties according to the selected material type. + +### Active Targets + +A list that contains the [graph targets](Graph-Target.md) selected for the current shader graph. Select the **Add (+)** and **Remove (−)** buttons to add or remove **Active Targets**. + +Shader Graph supports the following target types: +* **Custom Render Texture**: Shaders for updating [Custom Render Textures](Custom-Render-Texture.md). +* **Built-in**: Shaders for Unity’s [Built-In Render Pipeline](xref:built-in-render-pipeline). +* **Universal**: Shaders for the [Universal Render Pipeline (URP)](xref:um-universal-render-pipeline), available only if your project uses URP. +* **HDRP**: Shaders for the [High Definition Render Pipeline (HDRP)](xref:high-definition-render-pipeline), available only if your project uses HDRP. + +### Target properties + +Each graph target added in the list of **Active Targets** has its own set of properties. + +| Property | Description | +| :--- | :--- | +| **Material** | Selects a material type for the target. The available options depend on the current target type. | +| Other properties (contextual) | A set of material and shader related properties that correspond to the current target type and the **Material** you select for the target.
  • For Universal Render Pipeline (URP) target properties, refer to [Shader graph material Inspector window reference for URP](xref:um-shaders-in-universalrp-reference).
  • For High Definition Render Pipeline (HDRP) target properties, refer to HDRP's [Shader Graph materials reference](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/shader-graph-materials-reference.html).
| +| **Custom Editor GUI** | Renders a custom editor GUI in the Inspector window of the material. Enter the name of the GUI class in the field. For more information, refer to [Control material properties in the Inspector window](xref:um-writing-shader-display-types) and [Custom Editor block in ShaderLab reference](xref:um-sl-custom-editor). | +| **Support VFX Graph** | Enables this shader graph to support the [Visual Effect Graph](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest) to render particles.
**Note**: This option is only available for certain material types. | ## Additional resources + - [Precision Modes](Precision-Modes.md) -- [Example Custom Render Texture with Shader Graph](Custom-Render-Texture-Example.md) -- [Custom Editor block in ShaderLab reference](xref:um-sl-custom-editor) \ No newline at end of file +- [Graph targets](Graph-Target.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Material-Quality-Keyword-Node.md b/Packages/com.unity.shadergraph/Documentation~/Material-Quality-Keyword-Node.md new file mode 100644 index 00000000000..87627bd4e61 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Material-Quality-Keyword-Node.md @@ -0,0 +1,13 @@ +# Material Quality Keyword node + +The Material Quality Keyword node adds and uses global keywords MATERIAL_QUALITY_HIGH, MATERIAL_QUALITY_MEDIUM and MATERIAL_QUALITY_LOW and enables different behaviors for each one of the available quality types. + +**Note**: +* Adding this keyword increases the amount of shader variants. +* These quality keywords are only available in URP and HDRP, they are not available at the Built-in Render Pipeline. + +To manually set the quality level from a C# script, use the `UnityEngine.Rendering.MaterialQualityUtilities.SetGlobalShaderKeywords(...)` function. + +## Additional resources: + +* [Keywords](Keywords.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Property-Node.md b/Packages/com.unity.shadergraph/Documentation~/Property-Node.md new file mode 100644 index 00000000000..b1664651226 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Property-Node.md @@ -0,0 +1,3 @@ +# Property node + +Returns the value of the associated [Blackboard](Blackboard.md) Property. diff --git a/Packages/com.unity.shadergraph/Documentation~/Raytracing-Quality-Keyword-Node.md b/Packages/com.unity.shadergraph/Documentation~/Raytracing-Quality-Keyword-Node.md new file mode 100644 index 00000000000..a4862b487cc --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Raytracing-Quality-Keyword-Node.md @@ -0,0 +1,11 @@ +# Raytracing Quality Keyword node + +**Note**: +* Adding this keyword increases the amount of shader variants. +* These quality keywords are only available in HDRP, they are not available with the Built-in and Universal Render Pipelines. + +Refer to `https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.4/manual/SGNode-Raytracing-Quality.html` for more information. + +## Additional resources: + +* [Keywords](Keywords.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Redirect-Node.md b/Packages/com.unity.shadergraph/Documentation~/Redirect-Node.md new file mode 100644 index 00000000000..c3c68f89e81 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Redirect-Node.md @@ -0,0 +1,8 @@ +# Redirect node + +Use redirect nodes to improve the graph's organization. They have no effect on the generated shader code. + +Redirect nodes don't appear in the node search. To add a redirect node, do one of the following: +- Double click on a wire. +- Right click on a wire and select **Add Redirect Node**. +- Select a wire and press `Ctrl/Cmd + R` on the keyboard. diff --git a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Slice.md b/Packages/com.unity.shadergraph/Documentation~/Slice-Index-Cubemap-Face-Node.md similarity index 97% rename from Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Slice.md rename to Packages/com.unity.shadergraph/Documentation~/Slice-Index-Cubemap-Face-Node.md index efb39dc3f2f..24626b92cb1 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Custom-Texture-Slice.md +++ b/Packages/com.unity.shadergraph/Documentation~/Slice-Index-Cubemap-Face-Node.md @@ -1,4 +1,4 @@ -# Custom Render Texture Slice Node +# Slice Index / Cubemap Face Node ## Description diff --git a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md index f00d3cb3c42..64e16a28c85 100644 --- a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md @@ -83,10 +83,10 @@ * [Split](Split-Node.md) * [Swizzle](Swizzle-Node.md) * [Custom Render Texture](Custom-Render-Texture-Nodes.md) - * [Self](Custom-Texture-Self.md) - * [Size](Custom-Texture-Size.md) - * [Slice](Custom-Texture-Slice.md) - * [Dropdowns](Sub-Graph-Dropdown-Node.md) + * [Self](Custom-Render-Texture-Self-Node.md) + * [Size](Custom-Render-Texture-Size-Node.md) + * [Slice Index / Cubemap Face](Slice-Index-Cubemap-Face-Node.md) + * [Dropdown](Dropdown-Node.md) * [Input](Input-Nodes.md) * Basic * [Boolean](Boolean-Node.md) @@ -126,7 +126,7 @@ * Lighting * [Ambient](Ambient-Node.md) * [Baked GI](Baked-GI-Node.md) - * [Main Light Direction](https://docs.unity3d.com/Packages/com.unity.shadergraph@13.1/manual/Main-Light-Direction-Node.html) + * [Main Light Direction](Main-Light-Direction-Node.md) * [Reflection Probe](Reflection-Probe-Node.md) * Matrix * [Matrix 2x2](Matrix-2x2-Node.md) @@ -166,6 +166,9 @@ * [Texture 2D Asset](Texture-2D-Asset-Node.md) * [Texture 3D Asset](Texture-3D-Asset-Node.md) * [Texture Size](Texture-Size-Node.md) + * [Keyword](Keyword-Node.md) + * [Material Quality](Material-Quality-Keyword-Node.md) + * [Raytracing Quality](Raytracing-Quality-Keyword-Node.md) * [Math](Math-Nodes.md) * Advanced * [Absolute](Absolute-Node.md) @@ -258,6 +261,8 @@ * [Rectangle](Rectangle-Node.md) * [Rounded Polygon](Rounded-Polygon-Node.md) * [Rounded Rectangle](Rounded-Rectangle-Node.md) + * [Property](Property-Node.md) + * [Redirect](Redirect-Node.md) * [SpeedTree](SpeedTree8-SubGraphAssets.md) * [Sub Graphs](Sub-graph-Node.md) * [UVCombine](UVCombine-Node.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/images/GraphSettings_Menu.png b/Packages/com.unity.shadergraph/Documentation~/images/GraphSettings_Menu.png deleted file mode 100644 index 33717fc6f61..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/GraphSettings_Menu.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/PropertyNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/PropertyNode.cs index b1f0703cad7..a8376469ca0 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/PropertyNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/PropertyNode.cs @@ -20,7 +20,7 @@ public PropertyNode() } // Property-Types - public override string documentationURL => UnityEngine.Rendering.ShaderGraph.Documentation.GetPageLink("Property-Types"); + public override string documentationURL => UnityEngine.Rendering.ShaderGraph.Documentation.GetPageLink("Property-Node"); public override void UpdateNodeAfterDeserialization() { diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs index 732c0a4b19e..6b000443f58 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs @@ -21,6 +21,8 @@ class CustomFunctionNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesF public override IEnumerable allowedNodeVersions => new int[] { 1 }; + public override string documentationURL => NodeUtils.GetDocumentationString("Custom Function"); + [Serializable] public class MinimalCustomFunctionNode : IHasDependencies { diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/DropdownNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/DropdownNode.cs index 71c6a45dbef..4891b815f7c 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/DropdownNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/DropdownNode.cs @@ -14,6 +14,8 @@ class DropdownNode : AbstractMaterialNode, IOnAssetEnabled, IGeneratesBodyCode, { internal const int k_MinEnumEntries = 2; + public override string documentationURL => NodeUtils.GetDocumentationString("Dropdown"); + public DropdownNode() { UpdateNodeAfterDeserialization(); 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 fe70eabc218..b636d928514 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs @@ -16,6 +16,13 @@ class KeywordNode : AbstractMaterialNode, IOnAssetEnabled, IGeneratesBodyCode, I internal const int k_MinEnumEntries = 2; internal const int k_MaxEnumEntries = 8; + public override string documentationURL => NodeUtils.GetDocumentationString(keyword.overrideReferenceName switch + { + "MATERIAL_QUALITY" => "Material Quality Keyword", + "RAYTRACING_SHADER_GRAPH" => "Raytracing Quality Keyword", + _ => "Keyword", + }); + public KeywordNode() { UpdateNodeAfterDeserialization(); diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeData.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeData.cs index 54827e025e1..2a65f64c80c 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeData.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/RedirectNodeData.cs @@ -12,6 +12,8 @@ class RedirectNodeData : AbstractMaterialNode public const int kInputSlotID = 0; public const int kOutputSlotID = 1; + public override string documentationURL => NodeUtils.GetDocumentationString("Redirect"); + public RedirectNodeData() { name = "Redirect Node"; diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs index 621923b2142..6d26f8e3a9d 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs @@ -153,6 +153,42 @@ void InstallSample(string sampleName) private static readonly ProfilerMarker AddGroupsMarker = new ProfilerMarker("AddGroups"); private static readonly ProfilerMarker AddStickyNotesMarker = new ProfilerMarker("AddStickyNotes"); + + static GUIContent saveIcon; + static GUIContent SaveIcon => + saveIcon ??= new GUIContent(EditorGUIUtility.IconContent("SaveActive").image, "Save"); + + static GUIContent dropdownIcon; + static GUIContent DropdownIcon => + dropdownIcon ??= EditorGUIUtility.IconContent("Dropdown"); + + static GUIContent blackboardIcon; + static GUIContent BlackboardIcon + { + get + { + if (blackboardIcon == null) + { + var suffix = (EditorGUIUtility.isProSkin ? "_dark" : "") + (EditorGUIUtility.pixelsPerPoint >= 2 ? "@2x" : ""); + var path = $"Icons/blackboard{suffix}"; + blackboardIcon = new GUIContent(Resources.Load(path), "Blackboard"); + } + return blackboardIcon; + } + } + + static GUIContent inspectorIcon; + static GUIContent InspectorIcon => + inspectorIcon ??= new GUIContent(EditorGUIUtility.IconContent("UnityEditor.InspectorWindow").image, "Graph Inspector"); + + static GUIContent previewIcon; + static GUIContent PreviewIcon => + previewIcon ??= new GUIContent(EditorGUIUtility.IconContent("PreMatSphere").image, "Main Preview"); + + static GUIContent helpIcon; + static GUIContent HelpIcon => + helpIcon ??= new GUIContent(EditorGUIUtility.IconContent("_Help").image, "Open Shader Graph User Manual"); + public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManager messageManager, string graphName) { m_GraphViewGroupTitleChanged = OnGroupTitleChanged; @@ -172,7 +208,6 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage m_UserViewSettings = JsonUtility.FromJson(serializedSettings) ?? new UserViewSettings(); m_ColorManager = new ColorManager(m_UserViewSettings.colorProvider); - List toolbarExtensions = new(); foreach (var type in TypeCache.GetTypesDerivedFrom(typeof(IShaderGraphToolbarExtension)).Where(e => !e.IsGenericType)) { @@ -183,12 +218,12 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage var toolbar = new IMGUIContainer(() => { GUILayout.BeginHorizontal(EditorStyles.toolbar); - if (GUILayout.Button(new GUIContent(EditorGUIUtility.FindTexture("SaveActive"), "Save"), EditorStyles.toolbarButton)) + if (GUILayout.Button(SaveIcon, EditorStyles.toolbarButton)) { if (saveRequested != null) saveRequested(); } - if (GUILayout.Button(EditorResources.Load("d_dropdown"), EditorStyles.toolbarButton)) + if (GUILayout.Button(DropdownIcon, EditorStyles.toolbarButton)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Save As..."), false, () => saveAsRequested()); @@ -218,22 +253,22 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage GUILayout.Label("Color Mode"); var newColorIndex = EditorGUILayout.Popup(m_ColorManager.activeIndex, colorProviders, GUILayout.Width(100f)); GUILayout.Space(4); - m_UserViewSettings.isBlackboardVisible = GUILayout.Toggle(m_UserViewSettings.isBlackboardVisible, new GUIContent(Resources.Load("Icons/blackboard"), "Blackboard"), EditorStyles.toolbarButton); + + m_UserViewSettings.isBlackboardVisible = GUILayout.Toggle(m_UserViewSettings.isBlackboardVisible, BlackboardIcon, EditorStyles.toolbarButton); GUILayout.Space(6); - m_UserViewSettings.isInspectorVisible = GUILayout.Toggle(m_UserViewSettings.isInspectorVisible, new GUIContent(EditorGUIUtility.TrIconContent("d_UnityEditor.InspectorWindow").image, "Graph Inspector"), EditorStyles.toolbarButton); + m_UserViewSettings.isInspectorVisible = GUILayout.Toggle(m_UserViewSettings.isInspectorVisible, InspectorIcon, EditorStyles.toolbarButton); GUILayout.Space(6); - m_UserViewSettings.isPreviewVisible = GUILayout.Toggle(m_UserViewSettings.isPreviewVisible, new GUIContent(EditorGUIUtility.FindTexture("PreMatSphere"), "Main Preview"), EditorStyles.toolbarButton); + m_UserViewSettings.isPreviewVisible = GUILayout.Toggle(m_UserViewSettings.isPreviewVisible, PreviewIcon, EditorStyles.toolbarButton); - if (GUILayout.Button(new GUIContent(EditorGUIUtility.TrIconContent("_Help").image, "Open Shader Graph User Manual"), EditorStyles.toolbarButton)) + if (GUILayout.Button(HelpIcon, EditorStyles.toolbarButton)) { Application.OpenURL(UnityEngine.Rendering.ShaderGraph.Documentation.GetPageLink("index")); - //Application.OpenURL("https://docs.unity3d.com/Packages/com.unity.shadergraph@17.0/manual/index.html"); // TODO : point to latest? } - if (GUILayout.Button(EditorResources.Load("d_dropdown"), EditorStyles.toolbarButton)) + if (GUILayout.Button(DropdownIcon, EditorStyles.toolbarButton)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Shader Graph Samples"), false, () => @@ -257,10 +292,6 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage { Application.OpenURL("https://forum.unity.com/forums/shader-graph.346/"); }); - menu.AddItem(new GUIContent("Shader Graph Roadmap"), false, () => - { - Application.OpenURL("https://portal.productboard.com/unity/1-unity-platform-rendering-visual-effects/tabs/7-shader-graph"); - }); menu.ShowAsContext(); } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSlice.cs b/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSlice.cs index ebc6c5cf1e0..89036ca4f70 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSlice.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSlice.cs @@ -21,6 +21,8 @@ public CustomTextureSlice() UpdateNodeAfterDeserialization(); } + public override string documentationURL => NodeUtils.GetDocumentationString("Slice Index Cubemap Face"); + protected int[] validSlots => new[] { OutputSlotCubeFaceId, OutputSlot3DSliceId }; public sealed override void UpdateNodeAfterDeserialization() diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png index a1890e476f6..ef9cf24ebf2 100644 Binary files a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png and b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png differ diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png.meta b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png.meta index 261716fb516..1459c548f29 100644 --- a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png.meta +++ b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard.png.meta @@ -3,10 +3,10 @@ guid: 954de74b6fa234cfbb474898019e0acf TextureImporter: internalIDToNameTable: [] externalObjects: {} - serializedVersion: 11 + serializedVersion: 13 mipmaps: mipMapMode: 0 - enableMipMap: 1 + enableMipMap: 0 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 @@ -20,11 +20,12 @@ TextureImporter: externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 + flipGreenChannel: 0 isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 vTOnly: 0 - ignoreMasterTextureLimit: 0 + ignoreMipmapLimit: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -36,10 +37,10 @@ TextureImporter: filterMode: 1 aniso: 1 mipBias: 0 - wrapU: 0 - wrapV: 0 + wrapU: 1 + wrapV: 1 wrapW: 0 - nPOTScale: 1 + nPOTScale: 0 lightmap: 0 compressionQuality: 50 spriteMode: 0 @@ -51,9 +52,9 @@ TextureImporter: spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 - alphaIsTransparency: 0 + alphaIsTransparency: 1 spriteTessellationDetail: -1 - textureType: 0 + textureType: 2 textureShape: 1 singleChannelComponent: 0 flipbookRows: 1 @@ -63,8 +64,10 @@ TextureImporter: textureFormatSet: 0 ignorePngGamma: 0 applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 1 platformSettings: - - serializedVersion: 3 + - serializedVersion: 4 buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 @@ -74,12 +77,27 @@ TextureImporter: crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] + customData: physicsShape: [] bones: [] spriteID: @@ -89,10 +107,11 @@ TextureImporter: edges: [] weights: [] secondaryTextures: [] + spriteCustomMetadata: + entries: [] nameFileIdTable: {} - spritePackingTag: + mipmapLimitGroupName: pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png index 9ac3ac234d1..b6e7cfb49ec 100644 Binary files a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png and b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png differ diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png.meta b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png.meta index 5110aac8a38..cc505911d1c 100644 --- a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png.meta +++ b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard@2x.png.meta @@ -3,10 +3,10 @@ guid: aed2175e23cfe426e8678485b004714e TextureImporter: internalIDToNameTable: [] externalObjects: {} - serializedVersion: 11 + serializedVersion: 13 mipmaps: mipMapMode: 0 - enableMipMap: 1 + enableMipMap: 0 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 @@ -20,11 +20,12 @@ TextureImporter: externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 + flipGreenChannel: 0 isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 vTOnly: 0 - ignoreMasterTextureLimit: 0 + ignoreMipmapLimit: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -36,10 +37,10 @@ TextureImporter: filterMode: 1 aniso: 1 mipBias: 0 - wrapU: 0 - wrapV: 0 + wrapU: 1 + wrapV: 1 wrapW: 0 - nPOTScale: 1 + nPOTScale: 0 lightmap: 0 compressionQuality: 50 spriteMode: 0 @@ -51,9 +52,9 @@ TextureImporter: spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 - alphaIsTransparency: 0 + alphaIsTransparency: 1 spriteTessellationDetail: -1 - textureType: 0 + textureType: 2 textureShape: 1 singleChannelComponent: 0 flipbookRows: 1 @@ -63,8 +64,10 @@ TextureImporter: textureFormatSet: 0 ignorePngGamma: 0 applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 1 platformSettings: - - serializedVersion: 3 + - serializedVersion: 4 buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 @@ -74,12 +77,27 @@ TextureImporter: crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] + customData: physicsShape: [] bones: [] spriteID: @@ -89,10 +107,11 @@ TextureImporter: edges: [] weights: [] secondaryTextures: [] + spriteCustomMetadata: + entries: [] nameFileIdTable: {} - spritePackingTag: + mipmapLimitGroupName: pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark.png b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark.png new file mode 100644 index 00000000000..a1890e476f6 Binary files /dev/null and b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark.png differ diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark.png.meta b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark.png.meta new file mode 100644 index 00000000000..87c105f225a --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark.png.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: 2162b791346804a7792168e6fc526ced +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark@2x.png b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark@2x.png new file mode 100644 index 00000000000..8d845e531e6 Binary files /dev/null and b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark@2x.png differ diff --git a/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark@2x.png.meta b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark@2x.png.meta new file mode 100644 index 00000000000..47cd3253e57 --- /dev/null +++ b/Packages/com.unity.shadergraph/Editor/Resources/Icons/blackboard_dark@2x.png.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: aa09d480b04b3437db2ba9c9cdbc77be +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs index 06ce1e14708..c952b694feb 100644 --- a/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs +++ b/Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime/CustomToggle.cs @@ -61,6 +61,7 @@ public Graphic Graphic protected override void Awake() { base.Awake(); + onValueChanged.AddListener((x) => UpdateMaterial()); } #if UNITY_EDITOR @@ -85,31 +86,13 @@ protected override void OnValidate() if (!PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying) CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); - UpdateMaterial(true); + UpdateMaterial(); } #endif - public void UpdateMaterial(bool findGroupToggles = false) + public void UpdateMaterial() { - if (group != null) - { - if (findGroupToggles) // only used in Edit mode when ToggleGroup isn't initialized already - { - foreach (var t in FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None)) - if (t.group == group) - t.Graphic.SetMaterialDirty(); - } - else - { - foreach(var t in group.ActiveToggles()) - if (t is CustomToggle customToggle) - customToggle.Graphic.SetMaterialDirty(); - } - } - else - { - Graphic.SetMaterialDirty(); - } + Graphic.SetMaterialDirty(); } protected override void DoStateTransition(SelectionState state, bool instant) @@ -121,8 +104,7 @@ protected override void DoStateTransition(SelectionState state, bool instant) public virtual Material GetModifiedMaterial(Material baseMaterial) { - _material ??= new Material(baseMaterial); - + _material ??= new(baseMaterial); _material.CopyPropertiesFromMaterial(baseMaterial); if (_material.HasFloat(StatePropertyId)) @@ -130,7 +112,7 @@ public virtual Material GetModifiedMaterial(Material baseMaterial) if (_material.HasFloat(IsOnPropertyId)) _material.SetFloat(IsOnPropertyId, isOn ? 1 : 0); - + return _material; } diff --git a/Tests/SRPTests/Packages/local.gtf.references/package.json b/Tests/SRPTests/Packages/local.gtf.references/package.json new file mode 100644 index 00000000000..0e787a179de --- /dev/null +++ b/Tests/SRPTests/Packages/local.gtf.references/package.json @@ -0,0 +1,18 @@ +{ + "displayName": "Graphics Test Framework (published v9)", + "name": "local.gtf.references", + "version": "1.0.0", + "unity": "6000.0", + "description": "Shim package that contains a reference to the com.unity.testframework.graphics package for easier version pinning.", + "keywords": [ + "qa", + "test", + "testing", + "tests", + "graphics" + ], + "category": "Libraries", + "dependencies": { + "com.unity.testframework.graphics": "8.12.0-exp.2" + } +} diff --git a/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json b/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json index afced47110f..1f7a6ca6ef3 100644 --- a/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json +++ b/Tests/SRPTests/Projects/HDRP_Tests/Packages/manifest.json @@ -11,7 +11,7 @@ "com.unity.render-pipelines.high-definition-config": "file:../../../../../Packages/com.unity.render-pipelines.high-definition-config", "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.12.0-exp.2", + "local.gtf.references": "file:../../../Packages/local.gtf.references", "com.unity.testing.hdrp": "file:../../../Packages/com.unity.testing.hdrp", "com.unity.testing.common-graphics": "file:../../../Packages/com.unity.testing.common-graphics", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", @@ -58,5 +58,14 @@ "com.unity.testing.hdrp", "com.unity.testing.xr", "com.unity.shadergraph" + ], + "scopedRegistries": [ + { + "name": "UPM Candidates (GTF)", + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates", + "scopes": [ + "com.unity.testframework.graphics" + ] + } ] } diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json index 60c3ebd78aa..bd77405e2ee 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Packages/manifest.json @@ -17,7 +17,7 @@ "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.visualeffectgraph": "file:../../../../../Packages/com.unity.visualeffectgraph", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.12.0-exp.2", + "local.gtf.references": "file:../../../Packages/local.gtf.references", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", "com.unity.modules.ai": "1.0.0", @@ -57,5 +57,14 @@ "com.unity.render-pipelines.universal", "com.unity.testing.xr", "com.unity.testing.urp" + ], + "scopedRegistries": [ + { + "name": "UPM Candidates (GTF)", + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates", + "scopes": [ + "com.unity.testframework.graphics" + ] + } ] } diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json index b5fd395ebbd..2a1a9bddcc4 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Packages/manifest.json @@ -15,7 +15,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.12.0-exp.2", + "local.gtf.references": "file:../../../Packages/local.gtf.references", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.common-graphics": "file:../../../Packages/com.unity.testing.common-graphics", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", @@ -57,5 +57,14 @@ "com.unity.render-pipelines.universal", "com.unity.testing.xr", "com.unity.testing.urp" + ], + "scopedRegistries": [ + { + "name": "UPM Candidates (GTF)", + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates", + "scopes": [ + "com.unity.testframework.graphics" + ] + } ] } diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json index a847c0f2f0d..6272f7c6403 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Lighting/Packages/manifest.json @@ -14,7 +14,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.12.0-exp.2", + "local.gtf.references": "file:../../../Packages/local.gtf.references", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", @@ -55,5 +55,14 @@ "com.unity.render-pipelines.universal", "com.unity.testing.xr", "com.unity.testing.urp" + ], + "scopedRegistries": [ + { + "name": "UPM Candidates (GTF)", + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates", + "scopes": [ + "com.unity.testframework.graphics" + ] + } ] } diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json index d62ad97bc29..3335c535708 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Packages/manifest.json @@ -15,7 +15,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.12.0-exp.2", + "local.gtf.references": "file:../../../Packages/local.gtf.references", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", @@ -56,5 +56,14 @@ "com.unity.render-pipelines.universal", "com.unity.testing.xr", "com.unity.testing.urp" + ], + "scopedRegistries": [ + { + "name": "UPM Candidates (GTF)", + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates", + "scopes": [ + "com.unity.testframework.graphics" + ] + } ] } diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json b/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json index fd1656e562a..2df3845d080 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Packages/manifest.json @@ -14,7 +14,7 @@ "com.unity.shadergraph": "file:../../../../../Packages/com.unity.shadergraph", "com.unity.rendering.light-transport": "file:../../../../../Packages/com.unity.rendering.light-transport", "local.utf.references": "file:../../../Packages/local.utf.references", - "com.unity.testframework.graphics": "8.12.0-exp.2", + "local.gtf.references": "file:../../../Packages/local.gtf.references", "com.unity.testing.urp": "file:../../../Packages/com.unity.testing.urp", "com.unity.testing.xr": "file:../../../Packages/com.unity.testing.xr", "com.unity.ugui": "2.0.0", @@ -55,5 +55,14 @@ "com.unity.render-pipelines.universal", "com.unity.testing.xr", "com.unity.testing.urp" + ], + "scopedRegistries": [ + { + "name": "UPM Candidates (GTF)", + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates", + "scopes": [ + "com.unity.testframework.graphics" + ] + } ] }