unhardcode FSR1 stuff
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if COMPILE_WITH_FSR1
|
||||
using FidelityFX;
|
||||
#endif
|
||||
#if COMPILE_WITH_DLSS
|
||||
using NVIDIA;
|
||||
#endif
|
||||
@@ -22,6 +24,7 @@ public enum UpscalingMode
|
||||
// Holds Console variables and commands to control engine behaviour
|
||||
public static class EngineSubsystem
|
||||
{
|
||||
#if COMPILE_WITH_FSR1
|
||||
private static FSR _fsrPlugin;
|
||||
public static FSR FsrPlugin
|
||||
{
|
||||
@@ -32,6 +35,7 @@ public static class EngineSubsystem
|
||||
return _fsrPlugin;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if COMPILE_WITH_DLSS
|
||||
private static DLSS _dlssPlugin;
|
||||
@@ -145,14 +149,12 @@ public static class EngineSubsystem
|
||||
#if COMPILE_WITH_DLSS
|
||||
if (DlssPlugin.PostFx?.Enabled ?? false)
|
||||
return ((int)UpscalingMode.DLSS).ToString();
|
||||
#else
|
||||
if (false) { }
|
||||
#endif
|
||||
|
||||
else if (FsrPlugin.PostFx?.Enabled ?? false)
|
||||
#if COMPILE_WITH_FSR1
|
||||
if (FsrPlugin.PostFx?.Enabled ?? false)
|
||||
return ((int)UpscalingMode.FSR1).ToString();
|
||||
else
|
||||
return ((int)UpscalingMode.None).ToString();
|
||||
#endif
|
||||
return ((int)UpscalingMode.None).ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -183,9 +185,16 @@ public static class EngineSubsystem
|
||||
upscaling = UpscalingMode.None;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if COMPILE_WITH_FSR1
|
||||
if (FsrPlugin.PostFx != null)
|
||||
FsrPlugin.PostFx.Enabled = upscaling == UpscalingMode.FSR1;
|
||||
#else
|
||||
if (upscaling == UpscalingMode.FSR1)
|
||||
{
|
||||
Console.Print("FSR1 not supported: compiled without COMPILE_WITH_FSR1");
|
||||
upscaling = UpscalingMode.None;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,13 +260,21 @@ public static class EngineSubsystem
|
||||
}
|
||||
}
|
||||
|
||||
#if !COMPILE_WITH_FSR1
|
||||
private static float dummy_Fsr1Sharpness;
|
||||
#endif
|
||||
|
||||
[ConsoleVariable("r_fsr_sharpness")]
|
||||
public static string FsrSharpness
|
||||
{
|
||||
get
|
||||
{
|
||||
// In shader, the value of 0 is the max sharpness...
|
||||
#if COMPILE_WITH_FSR1
|
||||
float sharpness = 2.0f - FsrPlugin.PostFx.Sharpness;
|
||||
#else
|
||||
float sharpness = 2.0f - dummy_Fsr1Sharpness;
|
||||
#endif
|
||||
return sharpness.ToString();
|
||||
}
|
||||
set
|
||||
@@ -265,7 +282,11 @@ public static class EngineSubsystem
|
||||
if (float.TryParse(value, out float valueFloat))
|
||||
{
|
||||
valueFloat = Mathf.Clamp(valueFloat, 0f, 2.0f);
|
||||
#if COMPILE_WITH_FSR1
|
||||
FsrPlugin.PostFx.Sharpness = 2.0f - valueFloat;
|
||||
#else
|
||||
dummy_Fsr1Sharpness = 2.0f - valueFloat;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//#define COMPILE_WITH_DLSS
|
||||
//#define COMPILE_WITH_FSR1
|
||||
|
||||
using Flax.Build;
|
||||
using Flax.Build.NativeCpp;
|
||||
@@ -34,7 +35,7 @@ public class Game : GameModule
|
||||
//Tags["Network"] = string.Empty;
|
||||
//options.PublicDependencies.Add("Networking");
|
||||
|
||||
options.PrivateDependencies.Add("FidelityFXFSR");
|
||||
|
||||
|
||||
//options.ScriptingAPI.FileReferences.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "DotNet", "Newtonsoft.Json.dll"));
|
||||
|
||||
@@ -43,6 +44,10 @@ public class Game : GameModule
|
||||
#if COMPILE_WITH_DLSS
|
||||
DLSS.ConditionalImport(options, options.PrivateDependencies);
|
||||
options.ScriptingAPI.Defines.Add("COMPILE_WITH_DLSS");
|
||||
#endif
|
||||
#if COMPILE_WITH_FSR1
|
||||
options.PrivateDependencies.Add("FidelityFXFSR");
|
||||
options.ScriptingAPI.Defines.Add("COMPILE_WITH_FSR1");
|
||||
#endif
|
||||
// Here you can modify the build options for your game module
|
||||
// To reference another module use: options.PublicDependencies.Add("Audio");
|
||||
|
||||
Reference in New Issue
Block a user