Skip to content

Commit

Permalink
[Rendering] EffectSystem: Remove dependency to Game class and move Ef…
Browse files Browse the repository at this point in the history
…fectCompilationMode in the same namespace
  • Loading branch information
xen2 committed Feb 15, 2019
1 parent 9b11625 commit 0cc2134
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 5 additions & 0 deletions sources/engine/Xenko.Engine/Engine/Game.cs
Expand Up @@ -372,6 +372,11 @@ protected override void Initialize()
// If requested in game settings, compile effects remotely and/or notify new shader requests
EffectSystem.Compiler = EffectSystem.CreateEffectCompiler(Content.FileProvider, EffectSystem, Settings?.PackageName, Settings?.EffectCompilation ?? EffectCompilationMode.Local, Settings?.RecordUsedEffects ?? false);

// Setup shader compiler settings from a compilation mode.
// TODO: We might want to provide overrides on the GameSettings to specify debug and/or optim level specifically.
if (Settings != null)
EffectSystem.SetCompilationMode(Settings.CompilationMode);

GameSystems.Add(EffectSystem);

GameSystems.Add(Streaming);
Expand Down
14 changes: 4 additions & 10 deletions sources/engine/Xenko.Engine/Rendering/EffectSystem.cs
Expand Up @@ -7,12 +7,8 @@
using System.Threading.Tasks;
using Xenko.Core;
using Xenko.Core.Diagnostics;
using Xenko.Core.Extensions;
using Xenko.Core.IO;
using Xenko.Core.ReferenceCounting;
using Xenko.Core.Serialization.Contents;
using Xenko.Engine;
using Xenko.Engine.Design;
using Xenko.Games;
using Xenko.Graphics;
using Xenko.Shaders;
Expand Down Expand Up @@ -79,13 +75,11 @@ public override void Initialize()
directoryWatcher.Modified += FileModifiedEvent;
// TODO: xkfx too
#endif
}

// Setup shader compiler settings from a compilation mode.
// TODO: We might want to provide overrides on the GameSettings to specify debug and/or optim level specifically.
if (Game != null && (((Game)Game).Settings != null))
{
effectCompilerParameters.ApplyCompilationMode(((Game)Game).Settings.CompilationMode);
}
public void SetCompilationMode(CompilationMode compilationMode)
{
effectCompilerParameters.ApplyCompilationMode(compilationMode);
}

protected override void Destroy()
Expand Down

0 comments on commit 0cc2134

Please sign in to comment.