Browse Source

Added Core SRP dependency, updated some code to Unity 6.7 standards, and updated copyright year for modified files.

srp
Nico de Poel 3 weeks ago
parent
commit
ddd3e57daf
  1. 7
      Runtime/FSR2/Fsr2.cs
  2. 7
      Runtime/FSR3/Fsr3Upscaler.cs
  3. 8
      Runtime/FSR3/Fsr3UpscalerContext.cs
  4. 4
      Runtime/FSR3/Fsr3UpscalerPass.cs
  5. 4
      Runtime/FidelityFX.FSR.asmdef
  6. 4
      Shaders/ffx_fsr3upscaler_accumulate_pass.compute
  7. 4
      Shaders/ffx_fsr3upscaler_autogen_reactive_pass.compute
  8. 4
      Shaders/ffx_fsr3upscaler_debug_view_pass.compute
  9. 4
      Shaders/ffx_fsr3upscaler_luma_instability_pass.compute
  10. 4
      Shaders/ffx_fsr3upscaler_luma_pyramid_pass.compute
  11. 4
      Shaders/ffx_fsr3upscaler_prepare_inputs_pass.compute
  12. 4
      Shaders/ffx_fsr3upscaler_prepare_reactivity_pass.compute
  13. 4
      Shaders/ffx_fsr3upscaler_rcas_pass.compute
  14. 4
      Shaders/ffx_fsr3upscaler_shading_change_pass.compute
  15. 4
      Shaders/ffx_fsr3upscaler_shading_change_pyramid_pass.compute
  16. 4
      Shaders/ffx_fsr3upscaler_tcr_autogen_pass.compute
  17. 2
      Shaders/ffx_fsr_unity_common.cginc

7
Runtime/FSR2/Fsr2.cs

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -40,9 +40,8 @@ namespace FidelityFX.FSR2
else else
flags &= ~InitializationFlags.EnableDepthInverted; flags &= ~InitializationFlags.EnableDepthInverted;
#if UNITY_EDITOR || DEVELOPMENT_BUILD
flags |= InitializationFlags.EnableDebugChecking;
#endif
if (Debug.isDebugBuild)
flags |= InitializationFlags.EnableDebugChecking;
Debug.Log($"Setting up FSR2 with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}"); Debug.Log($"Setting up FSR2 with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}");

7
Runtime/FSR3/Fsr3Upscaler.cs

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -40,9 +40,8 @@ namespace FidelityFX.FSR3
else else
flags &= ~InitializationFlags.EnableDepthInverted; flags &= ~InitializationFlags.EnableDepthInverted;
#if UNITY_EDITOR || DEVELOPMENT_BUILD
flags |= InitializationFlags.EnableDebugChecking;
#endif
if (Debug.isDebugBuild)
flags |= InitializationFlags.EnableDebugChecking;
Debug.Log($"Setting up FSR3 Upscaler with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}"); Debug.Log($"Setting up FSR3 Upscaler with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}");

8
Runtime/FSR3/Fsr3UpscalerContext.cs

@ -48,9 +48,7 @@ namespace FidelityFX.FSR3
private Fsr3UpscalerPass _sharpenPass; private Fsr3UpscalerPass _sharpenPass;
private Fsr3UpscalerPass _generateReactivePass; private Fsr3UpscalerPass _generateReactivePass;
private Fsr3UpscalerPass _tcrAutogeneratePass; private Fsr3UpscalerPass _tcrAutogeneratePass;
#if UNITY_EDITOR || DEVELOPMENT_BUILD
private Fsr3UpscalerPass _debugViewPass; private Fsr3UpscalerPass _debugViewPass;
#endif
private readonly Fsr3UpscalerResources _resources = new Fsr3UpscalerResources(); private readonly Fsr3UpscalerResources _resources = new Fsr3UpscalerResources();
@ -118,16 +116,12 @@ namespace FidelityFX.FSR3
_sharpenPass = new Fsr3UpscalerSharpenPass(_contextDescription, _resources, _upscalerConstantsBuffer, _rcasConstantsBuffer); _sharpenPass = new Fsr3UpscalerSharpenPass(_contextDescription, _resources, _upscalerConstantsBuffer, _rcasConstantsBuffer);
_generateReactivePass = new Fsr3UpscalerGenerateReactivePass(_contextDescription, _resources, _generateReactiveConstantsBuffer); _generateReactivePass = new Fsr3UpscalerGenerateReactivePass(_contextDescription, _resources, _generateReactiveConstantsBuffer);
_tcrAutogeneratePass = new Fsr3UpscalerTcrAutogeneratePass(_contextDescription, _resources, _upscalerConstantsBuffer, _tcrAutogenerateConstantsBuffer); _tcrAutogeneratePass = new Fsr3UpscalerTcrAutogeneratePass(_contextDescription, _resources, _upscalerConstantsBuffer, _tcrAutogenerateConstantsBuffer);
#if UNITY_EDITOR || DEVELOPMENT_BUILD
_debugViewPass = new Fsr3UpscalerDebugViewPass(_contextDescription, _resources, _upscalerConstantsBuffer); _debugViewPass = new Fsr3UpscalerDebugViewPass(_contextDescription, _resources, _upscalerConstantsBuffer);
#endif
} }
public void Destroy() public void Destroy()
{ {
#if UNITY_EDITOR || DEVELOPMENT_BUILD
DestroyPass(ref _debugViewPass); DestroyPass(ref _debugViewPass);
#endif
DestroyPass(ref _tcrAutogeneratePass); DestroyPass(ref _tcrAutogeneratePass);
DestroyPass(ref _generateReactivePass); DestroyPass(ref _generateReactivePass);
DestroyPass(ref _lumaPyramidPass); DestroyPass(ref _lumaPyramidPass);
@ -289,12 +283,10 @@ namespace FidelityFX.FSR3
_sharpenPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, threadGroupsX, threadGroupsY); _sharpenPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, threadGroupsX, threadGroupsY);
} }
#if UNITY_EDITOR || DEVELOPMENT_BUILD
if ((dispatchParams.Flags & Fsr3Upscaler.DispatchFlags.DrawDebugView) != 0) if ((dispatchParams.Flags & Fsr3Upscaler.DispatchFlags.DrawDebugView) != 0)
{ {
_debugViewPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchDstX, dispatchDstY); _debugViewPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchDstX, dispatchDstY);
} }
#endif
_resourceFrameIndex = (_resourceFrameIndex + 1) % MaxQueuedFrames; _resourceFrameIndex = (_resourceFrameIndex + 1) % MaxQueuedFrames;

4
Runtime/FSR3/Fsr3UpscalerPass.cs

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -457,7 +457,6 @@ namespace FidelityFX.FSR3
} }
} }
#if UNITY_EDITOR || DEVELOPMENT_BUILD
internal class Fsr3UpscalerDebugViewPass : Fsr3UpscalerPass internal class Fsr3UpscalerDebugViewPass : Fsr3UpscalerPass
{ {
public Fsr3UpscalerDebugViewPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) public Fsr3UpscalerDebugViewPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants)
@ -483,5 +482,4 @@ namespace FidelityFX.FSR3
commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1);
} }
} }
#endif
} }

4
Runtime/FidelityFX.FSR.asmdef

@ -1,7 +1,9 @@
{ {
"name": "FidelityFX.FSR", "name": "FidelityFX.FSR",
"rootNamespace": "FidelityFX", "rootNamespace": "FidelityFX",
"references": [],
"references": [
"GUID:df380645f10b7bc4b97d4f5eb6303d95"
],
"includePlatforms": [], "includePlatforms": [],
"excludePlatforms": [], "excludePlatforms": [],
"allowUnsafeCode": false, "allowUnsafeCode": false,

4
Shaders/ffx_fsr3upscaler_accumulate_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,7 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
// Ensure the correct value is defined for this keyword, as it is used to select one of multiple sampler functions // Ensure the correct value is defined for this keyword, as it is used to select one of multiple sampler functions
#ifdef FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE #ifdef FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE

4
Shaders/ffx_fsr3upscaler_autogen_reactive_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl" #include "shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl"

4
Shaders/ffx_fsr3upscaler_debug_view_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_debug_view_pass.hlsl" #include "shaders/ffx_fsr3upscaler_debug_view_pass.hlsl"

4
Shaders/ffx_fsr3upscaler_luma_instability_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_luma_instability_pass.hlsl" #include "shaders/ffx_fsr3upscaler_luma_instability_pass.hlsl"

4
Shaders/ffx_fsr3upscaler_luma_pyramid_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,7 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
// Wave operations require shader model 6.0; this can only be enabled when using DXC on D3D12 // Wave operations require shader model 6.0; this can only be enabled when using DXC on D3D12
// These pragmas are commented out by default as Unity will sometimes ignore the #if's and try to enable these features anyway. // These pragmas are commented out by default as Unity will sometimes ignore the #if's and try to enable these features anyway.

4
Shaders/ffx_fsr3upscaler_prepare_inputs_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -26,6 +26,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_prepare_inputs_pass.hlsl" #include "shaders/ffx_fsr3upscaler_prepare_inputs_pass.hlsl"

4
Shaders/ffx_fsr3upscaler_prepare_reactivity_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_prepare_reactivity_pass.hlsl" #include "shaders/ffx_fsr3upscaler_prepare_reactivity_pass.hlsl"

4
Shaders/ffx_fsr3upscaler_rcas_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -22,6 +22,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_rcas_pass.hlsl" #include "shaders/ffx_fsr3upscaler_rcas_pass.hlsl"

4
Shaders/ffx_fsr3upscaler_shading_change_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_shading_change_pass.hlsl" #include "shaders/ffx_fsr3upscaler_shading_change_pass.hlsl"

4
Shaders/ffx_fsr3upscaler_shading_change_pyramid_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,7 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
// Wave operations require shader model 6.0; this can only be enabled when using DXC on D3D12 // Wave operations require shader model 6.0; this can only be enabled when using DXC on D3D12
#define FFX_SPD_NO_WAVE_OPERATIONS #define FFX_SPD_NO_WAVE_OPERATIONS

4
Shaders/ffx_fsr3upscaler_tcr_autogen_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -25,6 +25,6 @@
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY #pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#include "ffx_fsr_unity_common.cginc"
#include_with_pragmas "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl" #include "shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl"

2
Shaders/ffx_fsr_unity_common.cginc

@ -1,4 +1,4 @@
// Copyright (c) 2024 Nico de Poel
// Copyright (c) 2026 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal

Loading…
Cancel
Save