Merge branch 'FlaxEngine:master' into fix/nullable

This commit is contained in:
Mateusz Karbowiak
2024-10-17 20:34:32 +02:00
committed by GitHub
18 changed files with 63 additions and 55 deletions

View File

@@ -10,15 +10,12 @@ jobs:
# Editor # Editor
editor-linux: editor-linux:
name: Editor (Linux, Development x64) name: Editor (Linux, Development x64)
runs-on: "ubuntu-20.04" runs-on: "ubuntu-24.04"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f .github/workflows/build_linux_sources.list /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
- name: Setup Vulkan - name: Setup Vulkan
uses: ./.github/actions/vulkan uses: ./.github/actions/vulkan
@@ -41,7 +38,7 @@ jobs:
# Game # Game
game-linux: game-linux:
name: Game (Linux, Release x64) name: Game (Linux, Release x64)
runs-on: "ubuntu-20.04" runs-on: "ubuntu-24.04"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@@ -1,4 +0,0 @@
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

View File

@@ -76,7 +76,7 @@ jobs:
# Linux # Linux
package-linux-editor: package-linux-editor:
name: Editor (Linux) name: Editor (Linux)
runs-on: "ubuntu-20.04" runs-on: "ubuntu-24.04"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -86,9 +86,6 @@ jobs:
git lfs pull git lfs pull
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f .github/workflows/build_linux_sources.list /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
- name: Setup Vulkan - name: Setup Vulkan
uses: ./.github/actions/vulkan uses: ./.github/actions/vulkan
@@ -110,7 +107,7 @@ jobs:
path: Output/FlaxEditorLinux.zip path: Output/FlaxEditorLinux.zip
package-linux-game: package-linux-game:
name: Game (Linux) name: Game (Linux)
runs-on: "ubuntu-20.04" runs-on: "ubuntu-24.04"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -120,9 +117,6 @@ jobs:
git lfs pull git lfs pull
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f .github/workflows/build_linux_sources.list /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
- name: Setup Vulkan - name: Setup Vulkan
uses: ./.github/actions/vulkan uses: ./.github/actions/vulkan

View File

@@ -10,7 +10,7 @@ jobs:
# Tests on Linux # Tests on Linux
tests-linux: tests-linux:
name: Tests (Linux) name: Tests (Linux)
runs-on: "ubuntu-20.04" runs-on: "ubuntu-24.04"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -28,9 +28,6 @@ jobs:
git lfs pull git lfs pull
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f .github/workflows/build_linux_sources.list /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
- name: Build - name: Build
run: | run: |

View File

@@ -4,7 +4,7 @@
"Major": 1, "Major": 1,
"Minor": 9, "Minor": 9,
"Revision": 0, "Revision": 0,
"Build": 6604 "Build": 6605
}, },
"Company": "Flax", "Company": "Flax",
"Copyright": "Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.", "Copyright": "Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.",

View File

@@ -275,7 +275,7 @@ bool DeployDataStep::Perform(CookingData& data)
DEPLOY_NATIVE_FILE("libmonosgen-2.0.dylib"); DEPLOY_NATIVE_FILE("libmonosgen-2.0.dylib");
DEPLOY_NATIVE_FILE("libSystem.IO.Compression.Native.dylib"); DEPLOY_NATIVE_FILE("libSystem.IO.Compression.Native.dylib");
DEPLOY_NATIVE_FILE("libSystem.Native.dylib"); DEPLOY_NATIVE_FILE("libSystem.Native.dylib");
DEPLOY_NATIVE_FILE("libSystem.NET.Security.Native.dylib"); DEPLOY_NATIVE_FILE("libSystem.Net.Security.Native.dylib");
DEPLOY_NATIVE_FILE("libSystem.Security.Cryptography.Native.Apple.dylib"); DEPLOY_NATIVE_FILE("libSystem.Security.Cryptography.Native.Apple.dylib");
break; break;
#undef DEPLOY_NATIVE_FILE #undef DEPLOY_NATIVE_FILE

View File

@@ -950,7 +950,7 @@ namespace FlaxEditor.Modules
MainWindow = null; MainWindow = null;
// Capture project icon screenshot (not in play mode and if editor was used for some time) // Capture project icon screenshot (not in play mode and if editor was used for some time)
if (!Editor.StateMachine.IsPlayMode && Time.TimeSinceStartup >= 5.0f) if (!Editor.StateMachine.IsPlayMode && Time.TimeSinceStartup >= 5.0f && GPUDevice.Instance?.RendererType != RendererType.Null)
{ {
Editor.Log("Capture project icon screenshot"); Editor.Log("Capture project icon screenshot");
_projectIconScreenshotTimeout = Time.TimeSinceStartup + 0.8f; // wait 800ms for a screenshot task _projectIconScreenshotTimeout = Time.TimeSinceStartup + 0.8f; // wait 800ms for a screenshot task

View File

@@ -80,12 +80,12 @@ public:
public: public:
bool operator==(const Color32& other) const bool operator==(const Color32& other) const
{ {
return R == other.R && G == other.G && B == other.B && A == other.A; return Raw == other.Raw;
} }
bool operator!=(const Color32& other) const bool operator!=(const Color32& other) const
{ {
return R != other.R || G != other.G || B != other.B || A != other.A; return Raw != other.Raw;
} }
Color32 operator+(const Color32& b) const Color32 operator+(const Color32& b) const
@@ -138,7 +138,7 @@ public:
// Returns true if color is fully transparent (all components are equal zero). // Returns true if color is fully transparent (all components are equal zero).
bool IsTransparent() const bool IsTransparent() const
{ {
return R + G + B + A == 0; return Raw == 0;
} }
// Returns true if color has opacity channel in use (different from 255). // Returns true if color has opacity channel in use (different from 255).
@@ -222,7 +222,7 @@ namespace Math
{ {
FORCE_INLINE static bool NearEqual(const Color32& a, const Color32& b) FORCE_INLINE static bool NearEqual(const Color32& a, const Color32& b)
{ {
return a == b; return a.Raw == b.Raw;
} }
} }

View File

@@ -173,8 +173,8 @@ public:
/// <summary> /// <summary>
/// Frequency of shadow updates at the maximum distance from the view at which shadows are still rendered. This value is multiplied by ShadowsUpdateRate and allows scaling the update rate in-between the shadow range. For example, if light is near view, it will get normal shadow updates but will reduce this rate when far from view. See ShadowsUpdateRate to learn more. /// Frequency of shadow updates at the maximum distance from the view at which shadows are still rendered. This value is multiplied by ShadowsUpdateRate and allows scaling the update rate in-between the shadow range. For example, if light is near view, it will get normal shadow updates but will reduce this rate when far from view. See ShadowsUpdateRate to learn more.
/// </summary> /// </summary>
API_FIELD(Attributes="EditorOrder(105), EditorDisplay(\"Shadow\", \"Update Rate At Distance\"), Limit(0.0f, 1.0f)") API_FIELD(Attributes="EditorOrder(101), EditorDisplay(\"Shadow\", \"Update Rate At Distance\"), Limit(0.0f, 1.0f)")
float ShadowsUpdateRateAtDistance = 0.5f; float ShadowsUpdateRateAtDistance = 1.0f;
/// <summary> /// <summary>
/// Defines the resolution of the shadow map texture used to draw objects projection from light-point-of-view. Higher values increase shadow quality at cost of performance. /// Defines the resolution of the shadow map texture used to draw objects projection from light-point-of-view. Higher values increase shadow quality at cost of performance.

View File

@@ -330,6 +330,7 @@ public:
for (auto it = Lights.Begin(); it.IsNotEnd(); ++it) for (auto it = Lights.Begin(); it.IsNotEnd(); ++it)
{ {
auto& atlasLight = it->Value; auto& atlasLight = it->Value;
atlasLight.StaticState = ShadowAtlasLight::Unused;
atlasLight.Cache.StaticValid = false; atlasLight.Cache.StaticValid = false;
for (int32 i = 0; i < atlasLight.TilesCount; i++) for (int32 i = 0; i < atlasLight.TilesCount; i++)
atlasLight.Tiles[i].ClearDynamic(); atlasLight.Tiles[i].ClearDynamic();
@@ -370,7 +371,8 @@ public:
for (auto& e : Lights) for (auto& e : Lights)
{ {
auto& atlasLight = e.Value; auto& atlasLight = e.Value;
if (atlasLight.StaticState == ShadowAtlasLight::CopyStaticShadow && atlasLight.Bounds.Intersects(bounds)) if ((atlasLight.StaticState == ShadowAtlasLight::CopyStaticShadow || atlasLight.StaticState == ShadowAtlasLight::NoStaticGeometry)
&& atlasLight.Bounds.Intersects(bounds))
{ {
// Invalidate static shadow // Invalidate static shadow
atlasLight.Cache.StaticValid = false; atlasLight.Cache.StaticValid = false;
@@ -719,8 +721,14 @@ bool ShadowsPass::SetupLight(ShadowsCustomBuffer& shadows, RenderContext& render
} }
switch (atlasLight.StaticState) switch (atlasLight.StaticState)
{ {
case ShadowAtlasLight::CopyStaticShadow:
case ShadowAtlasLight::NoStaticGeometry: case ShadowAtlasLight::NoStaticGeometry:
// Light was modified so attempt to find the static shadow again
if (!atlasLight.Cache.StaticValid && atlasLight.HasStaticShadowContext)
{
atlasLight.StaticState = ShadowAtlasLight::WaitForGeometryCheck;
break;
}
case ShadowAtlasLight::CopyStaticShadow:
case ShadowAtlasLight::FailedToInsertTiles: case ShadowAtlasLight::FailedToInsertTiles:
// Skip collecting static draws // Skip collecting static draws
atlasLight.HasStaticShadowContext = false; atlasLight.HasStaticShadowContext = false;
@@ -728,7 +736,7 @@ bool ShadowsPass::SetupLight(ShadowsCustomBuffer& shadows, RenderContext& render
} }
if (atlasLight.HasStaticShadowContext) if (atlasLight.HasStaticShadowContext)
{ {
// If rendering finds any static draws then it's set to true // If rendering finds any static draws then it will be set to true
for (auto& tile : atlasLight.Tiles) for (auto& tile : atlasLight.Tiles)
tile.HasStaticGeometry = false; tile.HasStaticGeometry = false;
} }
@@ -1367,7 +1375,7 @@ void ShadowsPass::RenderShadowMaps(RenderContextBatch& renderContextBatch)
const ShadowsCustomBuffer* shadowsPtr = renderContext.Buffers->FindCustomBuffer<ShadowsCustomBuffer>(TEXT("Shadows"), false); const ShadowsCustomBuffer* shadowsPtr = renderContext.Buffers->FindCustomBuffer<ShadowsCustomBuffer>(TEXT("Shadows"), false);
if (shadowsPtr == nullptr || shadowsPtr->Lights.IsEmpty() || shadowsPtr->LastFrameUsed != Engine::FrameCount) if (shadowsPtr == nullptr || shadowsPtr->Lights.IsEmpty() || shadowsPtr->LastFrameUsed != Engine::FrameCount)
return; return;
PROFILE_GPU_CPU("ShadowMaps"); PROFILE_GPU_CPU("Shadow Maps");
const ShadowsCustomBuffer& shadows = *shadowsPtr; const ShadowsCustomBuffer& shadows = *shadowsPtr;
GPUContext* context = GPUDevice::Instance->GetMainContext(); GPUContext* context = GPUDevice::Instance->GetMainContext();
context->ResetSR(); context->ResetSR();
@@ -1384,9 +1392,29 @@ void ShadowsPass::RenderShadowMaps(RenderContextBatch& renderContextBatch)
for (auto& e : shadows.Lights) for (auto& e : shadows.Lights)
{ {
ShadowAtlasLight& atlasLight = e.Value; ShadowAtlasLight& atlasLight = e.Value;
if (atlasLight.StaticState != ShadowAtlasLight::UpdateStaticShadow || !atlasLight.HasStaticShadowContext || atlasLight.ContextCount == 0) if (!atlasLight.HasStaticShadowContext || atlasLight.ContextCount == 0)
continue; continue;
int32 contextIndex = 0; int32 contextIndex = 0;
if (atlasLight.StaticState == ShadowAtlasLight::WaitForGeometryCheck)
{
// Check for any static geometry to use in static shadow map
for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++)
{
ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex];
contextIndex++; // Skip dynamic context
auto& shadowContextStatic = renderContextBatch.Contexts[atlasLight.ContextIndex + contextIndex++];
if (!shadowContextStatic.List->DrawCallsLists[(int32)DrawCallsListType::Depth].IsEmpty() || !shadowContextStatic.List->ShadowDepthDrawCallsList.IsEmpty())
{
tile.HasStaticGeometry = true;
}
}
}
if (atlasLight.StaticState != ShadowAtlasLight::UpdateStaticShadow)
continue;
contextIndex = 0;
for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++) for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++)
{ {
ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex]; ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex];

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -37,7 +37,6 @@ public class assimp : DepsModule
case TargetPlatform.Linux: case TargetPlatform.Linux:
case TargetPlatform.Mac: case TargetPlatform.Mac:
options.OutputFiles.Add(Path.Combine(depsRoot, "libassimp.a")); options.OutputFiles.Add(Path.Combine(depsRoot, "libassimp.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libIrrXML.a"));
break; break;
default: throw new InvalidPlatformException(options.Platform.Target); default: throw new InvalidPlatformException(options.Platform.Target);
} }

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System; using System.Collections.Generic;
using System.IO; using System.IO;
using Flax.Build; using Flax.Build;
@@ -122,13 +122,19 @@ namespace Flax.Deps.Dependencies
} }
case TargetPlatform.Linux: case TargetPlatform.Linux:
{ {
var envVars = new Dictionary<string, string>
{
{ "CC", "clang-13" },
{ "CC_FOR_BUILD", "clang-13" },
{ "CXX", "clang++-13" },
};
// Build for Linux // Build for Linux
RunCmake(root, platform, TargetArchitecture.x64, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig); RunCmake(root, platform, TargetArchitecture.x64, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig, envVars);
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError); Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError, envVars);
configHeaderFilePath = Path.Combine(root, "include", "assimp", "config.h"); configHeaderFilePath = Path.Combine(root, "include", "assimp", "config.h");
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
Utilities.FileCopy(Path.Combine(root, "lib", "libassimp.a"), Path.Combine(depsFolder, "libassimp.a")); Utilities.FileCopy(Path.Combine(root, "lib", "libassimp.a"), Path.Combine(depsFolder, "libassimp.a"));
Utilities.FileCopy(Path.Combine(root, "lib", "libIrrXML.a"), Path.Combine(depsFolder, "libIrrXML.a"));
break; break;
} }
case TargetPlatform.Mac: case TargetPlatform.Mac:
@@ -141,7 +147,7 @@ namespace Flax.Deps.Dependencies
configHeaderFilePath = Path.Combine(root, "include", "assimp", "config.h"); configHeaderFilePath = Path.Combine(root, "include", "assimp", "config.h");
var depsFolder = GetThirdPartyFolder(options, platform, architecture); var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(root, "lib", "libassimp.a"), Path.Combine(depsFolder, "libassimp.a")); Utilities.FileCopy(Path.Combine(root, "lib", "libassimp.a"), Path.Combine(depsFolder, "libassimp.a"));
Utilities.FileCopy(Path.Combine(root, "lib", "libIrrXML.a"), Path.Combine(depsFolder, "libIrrXML.a")); Utilities.Run("make", "clean", null, root, Utilities.RunOptions.ThrowExceptionOnError);
} }
break; break;
} }