From fdd6b171bbdbde729e936c45d025f70a66d75478 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 12 Oct 2023 23:12:53 +0200 Subject: [PATCH] Stability fixes --- Source/Editor/Content/GUI/ContentView.cs | 2 ++ Source/Engine/Graphics/Materials/DecalMaterialShader.cpp | 2 ++ .../Engine/Graphics/Materials/DeferredMaterialShader.cpp | 7 ++++++- Source/Engine/Graphics/Materials/ForwardMaterialShader.cpp | 2 ++ Source/Engine/Scripting/Runtime/DotNet.cpp | 2 +- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Content/GUI/ContentView.cs b/Source/Editor/Content/GUI/ContentView.cs index e1a3acdf6..34b62f081 100644 --- a/Source/Editor/Content/GUI/ContentView.cs +++ b/Source/Editor/Content/GUI/ContentView.cs @@ -279,6 +279,8 @@ namespace FlaxEditor.Content.GUI // Sort items depending on sortMethod parameter _children.Sort(((control, control1) => { + if (control == null || control1 == null) + return 0; if (sortType == SortType.AlphabeticReverse) { if (control.CompareTo(control1) > 0) diff --git a/Source/Engine/Graphics/Materials/DecalMaterialShader.cpp b/Source/Engine/Graphics/Materials/DecalMaterialShader.cpp index 9ba2975b2..36dfc4615 100644 --- a/Source/Engine/Graphics/Materials/DecalMaterialShader.cpp +++ b/Source/Engine/Graphics/Materials/DecalMaterialShader.cpp @@ -92,6 +92,8 @@ bool DecalMaterialShader::Load() { GPUPipelineState::Description psDesc0 = GPUPipelineState::Description::DefaultNoDepth; psDesc0.VS = _shader->GetVS("VS_Decal"); + if (psDesc0.VS == nullptr) + return true; psDesc0.PS = _shader->GetPS("PS_Decal"); psDesc0.CullMode = CullMode::Normal; diff --git a/Source/Engine/Graphics/Materials/DeferredMaterialShader.cpp b/Source/Engine/Graphics/Materials/DeferredMaterialShader.cpp index 52a0bd551..a899dbc12 100644 --- a/Source/Engine/Graphics/Materials/DeferredMaterialShader.cpp +++ b/Source/Engine/Graphics/Materials/DeferredMaterialShader.cpp @@ -136,6 +136,7 @@ void DeferredMaterialShader::Unload() bool DeferredMaterialShader::Load() { + bool failed = false; auto psDesc = GPUPipelineState::Description::Default; psDesc.DepthWriteEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthWrite) == MaterialFeaturesFlags::None; if (EnumHasAnyFlags(_info.FeaturesFlags, MaterialFeaturesFlags::DisableDepthTest)) @@ -155,16 +156,20 @@ bool DeferredMaterialShader::Load() // GBuffer Pass psDesc.VS = _shader->GetVS("VS"); + failed |= psDesc.VS == nullptr; psDesc.PS = _shader->GetPS("PS_GBuffer"); _cache.Default.Init(psDesc); psDesc.VS = _shader->GetVS("VS", 1); + failed |= psDesc.VS == nullptr; _cacheInstanced.Default.Init(psDesc); // GBuffer Pass with lightmap (pixel shader permutation for USE_LIGHTMAP=1) psDesc.VS = _shader->GetVS("VS"); + failed |= psDesc.VS == nullptr; psDesc.PS = _shader->GetPS("PS_GBuffer", 1); _cache.DefaultLightmap.Init(psDesc); psDesc.VS = _shader->GetVS("VS", 1); + failed |= psDesc.VS == nullptr; _cacheInstanced.DefaultLightmap.Init(psDesc); // GBuffer Pass with skinning @@ -233,5 +238,5 @@ bool DeferredMaterialShader::Load() psDesc.VS = _shader->GetVS("VS_Skinned"); _cache.DepthSkinned.Init(psDesc); - return false; + return failed; } diff --git a/Source/Engine/Graphics/Materials/ForwardMaterialShader.cpp b/Source/Engine/Graphics/Materials/ForwardMaterialShader.cpp index d391f3295..9fb532b4e 100644 --- a/Source/Engine/Graphics/Materials/ForwardMaterialShader.cpp +++ b/Source/Engine/Graphics/Materials/ForwardMaterialShader.cpp @@ -174,6 +174,8 @@ bool ForwardMaterialShader::Load() // Forward Pass psDesc.VS = _shader->GetVS("VS"); + if (psDesc.VS == nullptr) + return true; psDesc.PS = _shader->GetPS("PS_Forward"); psDesc.DepthWriteEnable = false; psDesc.BlendMode = BlendingMode::AlphaBlend; diff --git a/Source/Engine/Scripting/Runtime/DotNet.cpp b/Source/Engine/Scripting/Runtime/DotNet.cpp index 3d35983fd..b3e5a0072 100644 --- a/Source/Engine/Scripting/Runtime/DotNet.cpp +++ b/Source/Engine/Scripting/Runtime/DotNet.cpp @@ -802,7 +802,7 @@ bool MAssembly::LoadImage(const String& assemblyPath, const StringView& nativePa // Register the editor module location for Assembly resolver else { - RegisterNativeLibrary(_name.Get(), StringAnsi(assemblyPath).Get()); + RegisterNativeLibrary(_name.Get(), assemblyPath.Get()); } #endif