diff --git a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset index 16fd828cb91..a4c11a93a76 100644 --- a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset +++ b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset @@ -10,6 +10,7 @@ VFXManager: m_RenderPipeSettingsPath: Packages/com.unity.visualeffectgraph/Shaders/RenderPipeline/HDRP m_FixedTimeStep: 0.016666668 m_MaxDeltaTime: 0.05 - m_CompiledVersion: 4 + m_MaxScrubTime: 30 + m_CompiledVersion: 5 m_RuntimeVersion: 23 m_RuntimeResources: {fileID: 11400000, guid: bc10b42afe3813544bffd38ae2cd893d, type: 2} diff --git a/TestProjects/VisualEffectGraph_URP/ProjectSettings/VFXManager.asset b/TestProjects/VisualEffectGraph_URP/ProjectSettings/VFXManager.asset index 4b514c8bc7a..e9d53c7d2da 100644 --- a/TestProjects/VisualEffectGraph_URP/ProjectSettings/VFXManager.asset +++ b/TestProjects/VisualEffectGraph_URP/ProjectSettings/VFXManager.asset @@ -10,6 +10,7 @@ VFXManager: m_RenderPipeSettingsPath: Packages/com.unity.visualeffectgraph/Shaders/RenderPipeline/universal m_FixedTimeStep: 0.016666668 m_MaxDeltaTime: 0.05 - m_CompiledVersion: 4 + m_MaxScrubTime: 30 + m_CompiledVersion: 5 m_RuntimeVersion: 23 m_RuntimeResources: {fileID: 11400000, guid: bc10b42afe3813544bffd38ae2cd893d, type: 2} diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 5d07315af11..35d759576bf 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Gradient field doesn't support HDR values [Case 1381867](https://issuetracker.unity3d.com/product/unity/issues/guid/1381867/) +- Allows for attribute-less systems. [Case 1341789](https://issuetracker.unity3d.com/product/unity/issues/guid/1341789/) +- Editing the values in the graph did not impact the system in real-time after saving [Case 1371089](https://issuetracker.unity3d.com/product/unity/issues/guid/1371089/) +- Fixed null reference exception when opening another VFX and a debug mode is enabled [Case 1347420](https://issuetracker.unity3d.com/product/unity/issues/guid/1347420/) ## [13.1.2] - 2021-11-05 diff --git a/com.unity.visualeffectgraph/Editor/Compiler/VFXGraphCompiledData.cs b/com.unity.visualeffectgraph/Editor/Compiler/VFXGraphCompiledData.cs index d017452cdd1..edc0cb6aa46 100644 --- a/com.unity.visualeffectgraph/Editor/Compiler/VFXGraphCompiledData.cs +++ b/com.unity.visualeffectgraph/Editor/Compiler/VFXGraphCompiledData.cs @@ -44,7 +44,8 @@ class VFXGraphCompiledData { // 3: Serialize material // 4: Bounds helper change - public const uint compiledVersion = 4; + // 5: HasAttributeBuffer flag + public const uint compiledVersion = 5; public VFXGraphCompiledData(VFXGraph graph) { diff --git a/com.unity.visualeffectgraph/Editor/Data/VFXDataParticle.cs b/com.unity.visualeffectgraph/Editor/Data/VFXDataParticle.cs index 67f5527de87..fb40630a3bc 100644 --- a/com.unity.visualeffectgraph/Editor/Data/VFXDataParticle.cs +++ b/com.unity.visualeffectgraph/Editor/Data/VFXDataParticle.cs @@ -661,9 +661,10 @@ public override void FillDescs( attributeSourceBufferIndex = dependentBuffers.attributeBuffers[m_DependenciesIn.FirstOrDefault()]; eventGPUFrom = dependentBuffers.eventBuffers[this]; } - + var systemFlag = VFXSystemFlag.SystemDefault; if (attributeBufferIndex != -1) { + systemFlag |= VFXSystemFlag.SystemHasAttributeBuffer; systemBufferMappings.Add(new VFXMapping("attributeBuffer", attributeBufferIndex)); } @@ -683,7 +684,6 @@ public override void FillDescs( systemBufferMappings.Add(new VFXMapping("sourceAttributeBuffer", attributeSourceBufferIndex)); } - var systemFlag = VFXSystemFlag.SystemDefault; if (eventGPUFrom != -1) { systemFlag |= VFXSystemFlag.SystemReceivedEventGPU; diff --git a/com.unity.visualeffectgraph/Editor/Debug/VFXUIDebug.cs b/com.unity.visualeffectgraph/Editor/Debug/VFXUIDebug.cs index 6b4ade13bb9..cdd4cc8f717 100644 --- a/com.unity.visualeffectgraph/Editor/Debug/VFXUIDebug.cs +++ b/com.unity.visualeffectgraph/Editor/Debug/VFXUIDebug.cs @@ -489,10 +489,6 @@ public void SetDebugMode(Modes mode, VFXComponentBoard componentBoard, bool forc break; case Modes.None: None(); - Clear(); - break; - default: - Clear(); break; } } @@ -521,25 +517,7 @@ private void UpdateDebugMode(VFXGraph graph) //.. but in some case, the onRuntimeDataChanged is called too soon, need to update twice //because VFXUIDebug relies on VisualEffect : See m_VFX.GetParticleSystemNames - m_View.schedule.Execute(() => - { - UpdateDebugMode(); - }).ExecuteLater(0 /* next frame */); - } - - void ClearDebugMode() - { - switch (m_CurrentMode) - { - case Modes.Efficiency: - m_Graph.onRuntimeDataChanged -= UpdateDebugMode; - break; - case Modes.Alive: - m_Graph.onRuntimeDataChanged -= UpdateDebugMode; - break; - default: - break; - } + m_View.schedule.Execute(UpdateDebugMode).ExecuteLater(0 /* next frame */); } public void SetVisualEffect(VisualEffect vfx) @@ -989,7 +967,7 @@ void InitSystemInfoArray() public void Clear() { - ClearDebugMode(); + m_Graph.onRuntimeDataChanged -= UpdateDebugMode; if (m_ComponentBoard != null && m_Curves != null) m_ComponentBoard.contentContainer.Remove(m_Curves); diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs index dee81729392..4a56fc71b23 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs @@ -500,7 +500,9 @@ public void Detach() m_EventsContainer.Clear(); m_Events.Clear(); if (m_DebugUI != null) - m_DebugUI.Clear(); + { + m_DebugUI.SetDebugMode(VFXUIDebug.Modes.None, this, true); + } DeleteBoundsRecorder(); RefreshInitializeErrors(); diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index c7235fcf60b..6eb7b16827a 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -1624,7 +1624,15 @@ internal void OnSave() if (EditorUtility.IsDirty(graph) || UnityEngine.Object.ReferenceEquals(graph, controller.graph)) { graph.UpdateSubAssets(); - graph.GetResource().WriteAsset(); + try + { + VFXGraph.compilingInEditMode = !m_IsRuntimeMode; + graph.GetResource().WriteAsset(); + } + finally + { + VFXGraph.compilingInEditMode = false; + } } } } diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 9d70f283dc6..45e927bab97 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -265,7 +265,15 @@ static string[] OnWillSaveAssets(string[] paths) if (vfxResource != null) { vfxResource.GetOrCreateGraph().UpdateSubAssets(); - vfxResource.WriteAsset(); // write asset as the AssetDatabase won't do it. + try + { + VFXGraph.compilingInEditMode = vfxResource.GetOrCreateGraph().GetCompilationMode() == VFXCompilationMode.Edition; + vfxResource.WriteAsset(); // write asset as the AssetDatabase won't do it. + } + finally + { + VFXGraph.compilingInEditMode = false; + } } } Profiler.EndSample(); @@ -354,6 +362,8 @@ class VFXGraph : VFXModel public readonly VFXErrorManager errorManager = new VFXErrorManager(); + [NonSerialized] + internal static bool compilingInEditMode = false; public override void OnEnable() { @@ -694,6 +704,11 @@ public void SetCompilationMode(VFXCompilationMode mode, bool reimport = true) } } + public VFXCompilationMode GetCompilationMode() + { + return m_CompilationMode; + } + public void SetForceShaderValidation(bool forceShaderValidation, bool reimport = true) { if (m_ForceShaderValidation != forceShaderValidation) @@ -933,6 +948,9 @@ public void SanitizeForImport() public void CompileForImport() { + if (VFXGraph.compilingInEditMode) + m_CompilationMode = VFXCompilationMode.Edition; + if (!GetResource().isSubgraph) { // Don't pursue the compile if one of the dependency is not yet loaded diff --git a/com.unity.visualeffectgraph/Shaders/SDFBaker/GenSdfRayMap.compute b/com.unity.visualeffectgraph/Shaders/SDFBaker/GenSdfRayMap.compute index f8d3fdff459..a690d2dfe60 100644 --- a/com.unity.visualeffectgraph/Shaders/SDFBaker/GenSdfRayMap.compute +++ b/com.unity.visualeffectgraph/Shaders/SDFBaker/GenSdfRayMap.compute @@ -20,7 +20,7 @@ #pragma kernel ChooseDirectionTriangleOnly #pragma kernel SurfaceClosing -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 #include "Packages/com.unity.visualeffectgraph/Shaders/SDFBaker/SdfUtils.hlsl" diff --git a/com.unity.visualeffectgraph/Shaders/Sort.compute b/com.unity.visualeffectgraph/Shaders/Sort.compute index 05327e68006..ec666f886c5 100644 --- a/com.unity.visualeffectgraph/Shaders/Sort.compute +++ b/com.unity.visualeffectgraph/Shaders/Sort.compute @@ -5,7 +5,7 @@ #pragma kernel MergePass MERGE_PASS=MergePass FINAL_PASS=0 #pragma kernel MergeFinalPass MERGE_PASS=MergeFinalPass FINAL_PASS=1 -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 #pragma multi_compile __ VFX_SORT_USE_ELEMENT_COUNT_BUFFER diff --git a/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute b/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute index e8035e87866..10e9328428b 100644 --- a/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute +++ b/com.unity.visualeffectgraph/Shaders/UpdateStrips.compute @@ -1,6 +1,6 @@ #pragma kernel UpdateParticleStrip -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 #include "HLSLSupport.cginc" diff --git a/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute b/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute index c33e42f0dc3..2594c139ece 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute +++ b/com.unity.visualeffectgraph/Shaders/VFXCopyBuffer.compute @@ -2,7 +2,7 @@ #pragma kernel CSVFXInitDeadListBuffer #pragma kernel CSVFXZeroInitBuffer -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 #include "HLSLSupport.cginc" diff --git a/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute b/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute index 749f36ddac0..5988c48a9a3 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute +++ b/com.unity.visualeffectgraph/Shaders/VFXFillIndirectArgs.compute @@ -1,6 +1,6 @@ #pragma kernel CSVFXIndirectArgs -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 #include "HLSLSupport.cginc" diff --git a/com.unity.visualeffectgraph/Shaders/VFXGlobalSortKeys.template b/com.unity.visualeffectgraph/Shaders/VFXGlobalSortKeys.template index d9d7c19e1d3..2b133c340f1 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXGlobalSortKeys.template +++ b/com.unity.visualeffectgraph/Shaders/VFXGlobalSortKeys.template @@ -1,5 +1,5 @@ #pragma kernel CSMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 ${VFXGlobalInclude} ${VFXGlobalDeclaration} ${VFXPerPassInclude} diff --git a/com.unity.visualeffectgraph/Shaders/VFXInit.template b/com.unity.visualeffectgraph/Shaders/VFXInit.template index f7cf0cadf19..3bb2af0c827 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXInit.template +++ b/com.unity.visualeffectgraph/Shaders/VFXInit.template @@ -1,5 +1,5 @@ #pragma kernel CSMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 ${VFXGlobalInclude} ${VFXGlobalDeclaration} diff --git a/com.unity.visualeffectgraph/Shaders/VFXOutputUpdate.template b/com.unity.visualeffectgraph/Shaders/VFXOutputUpdate.template index 18f1989235a..85919b5cd16 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXOutputUpdate.template +++ b/com.unity.visualeffectgraph/Shaders/VFXOutputUpdate.template @@ -1,5 +1,5 @@ #pragma kernel CSMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 ${VFXGlobalInclude} ${VFXGlobalDeclaration} diff --git a/com.unity.visualeffectgraph/Shaders/VFXUpdate.template b/com.unity.visualeffectgraph/Shaders/VFXUpdate.template index 372911598e7..c580de19a74 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXUpdate.template +++ b/com.unity.visualeffectgraph/Shaders/VFXUpdate.template @@ -1,5 +1,5 @@ #pragma kernel CSMain -#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl +#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch opengl gles3 ${VFXGlobalInclude} ${VFXGlobalDeclaration} ${VFXInclude("Shaders/VFXParticleCommon.template")}