Browse Source

Merge branch 'asr-console' into armasr

# Conflicts:
#	Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/ffxm_fsr2_common.cginc
armasr
Nico de Poel 10 months ago
parent
commit
1c599af0b6
  1. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs
  2. 5
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrContext.cs
  3. 13
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs
  4. 16
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/ffxm_fsr2_common.cginc
  5. 9
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_common_types.h
  6. 19
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_accumulate_pass_fs.hlsl
  7. 4
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_autogen_reactive_pass_fs.hlsl
  8. 11
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_depth_clip_pass_fs.hlsl
  9. 4
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_rcas_pass_fs.hlsl
  10. 7
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_reconstruct_previous_depth_pass_fs.hlsl
  11. 1
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_accumulate.h
  12. 8
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_callbacks_hlsl.h
  13. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_depth_clip.h
  14. 4
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_reproject.h

2
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs

@ -44,7 +44,7 @@ namespace ArmASR
flags |= InitializationFlags.EnableDebugChecking; flags |= InitializationFlags.EnableDebugChecking;
#endif #endif
Debug.Log($"Setting up ASR with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}");
Debug.Log($"Setting up ASR {variant} with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}");
var contextDescription = new ContextDescription var contextDescription = new ContextDescription
{ {

5
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrContext.cs

@ -96,7 +96,7 @@ namespace ArmASR
_lockPass = new AsrLockPass(_contextDescription, _resources, _upscalerConstantsBuffer); _lockPass = new AsrLockPass(_contextDescription, _resources, _upscalerConstantsBuffer);
_accumulatePass = new AsrAccumulatePass(_contextDescription, _resources, _upscalerConstantsBuffer); _accumulatePass = new AsrAccumulatePass(_contextDescription, _resources, _upscalerConstantsBuffer);
_sharpenPass = new AsrSharpenPass(_contextDescription, _resources, _upscalerConstantsBuffer, _rcasConstantsBuffer); _sharpenPass = new AsrSharpenPass(_contextDescription, _resources, _upscalerConstantsBuffer, _rcasConstantsBuffer);
_generateReactivePass = new AsrGenerateReactivePass(_contextDescription, _resources, _generateReactiveConstantsBuffer);
_generateReactivePass = new AsrGenerateReactivePass(_contextDescription, _resources, _upscalerConstantsBuffer, _generateReactiveConstantsBuffer);
} }
public void Destroy() public void Destroy()
@ -198,6 +198,9 @@ namespace ArmASR
commandBuffer.SetRenderTarget(AsrShaderIDs.UavReconstructedPrevNearestDepth); commandBuffer.SetRenderTarget(AsrShaderIDs.UavReconstructedPrevNearestDepth);
commandBuffer.ClearRenderTarget(false, true, depthInverted ? Color.clear : Color.white); commandBuffer.ClearRenderTarget(false, true, depthInverted ? Color.clear : Color.white);
commandBuffer.SetRenderTarget(AsrShaderIDs.UavNewLocks);
commandBuffer.ClearRenderTarget(false, true, Color.clear);
// Auto exposure // Auto exposure
SetupSpdConstants(dispatchParams, out var dispatchThreadGroupCount); SetupSpdConstants(dispatchParams, out var dispatchThreadGroupCount);

13
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs

@ -215,8 +215,8 @@ namespace ArmASR
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvDilatedDepth, AsrShaderIDs.UavDilatedDepth); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvDilatedDepth, AsrShaderIDs.UavDilatedDepth);
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvPrevDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex ^ 1]); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvPrevDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex ^ 1]);
_mrt[0] = AsrShaderIDs.RtDilatedReactiveMasks; // fDilatedReactiveMasks
_mrt[1] = AsrShaderIDs.RtPreparedInputColor; // fTonemapped
_mrt[0] = AsrShaderIDs.RtPreparedInputColor; // fTonemapped
_mrt[1] = AsrShaderIDs.RtDilatedReactiveMasks; // fDilatedReactiveMasks
FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride); FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride);
BlitFragment(commandBuffer, _mrt); BlitFragment(commandBuffer, _mrt);
@ -277,9 +277,7 @@ namespace ArmASR
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvAutoExposure, Resources.AutoExposure[frameIndex]); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvAutoExposure, Resources.AutoExposure[frameIndex]);
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]);
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvInternalTemporalReactive, Resources.InternalReactive[frameIndex ^ 1]); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvInternalTemporalReactive, Resources.InternalReactive[frameIndex ^ 1]);
// UAV binding in fragment shader, index needs to match the register binding in HLSL
commandBuffer.SetRandomWriteTarget(4, AsrShaderIDs.UavNewLocks);
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvNewLocks, AsrShaderIDs.UavNewLocks);
if (ContextDescription.Variant == Asr.Variant.Quality) if (ContextDescription.Variant == Asr.Variant.Quality)
{ {
@ -329,8 +327,8 @@ namespace ArmASR
{ {
private readonly ComputeBuffer _generateReactiveConstants; private readonly ComputeBuffer _generateReactiveConstants;
public AsrGenerateReactivePass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer generateReactiveConstants)
: base(contextDescription, resources, null)
public AsrGenerateReactivePass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants, ComputeBuffer generateReactiveConstants)
: base(contextDescription, resources, constants)
{ {
_generateReactiveConstants = generateReactiveConstants; _generateReactiveConstants = generateReactiveConstants;
@ -348,6 +346,7 @@ namespace ArmASR
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvOpaqueOnly, dispatchParams.ColorOpaqueOnly); commandBuffer.SetGlobalResource(AsrShaderIDs.SrvOpaqueOnly, dispatchParams.ColorOpaqueOnly);
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputColor, dispatchParams.ColorPreUpscale); commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputColor, dispatchParams.ColorPreUpscale);
FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride);
FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbGenReactive, _generateReactiveConstants, 0, _generateReactiveConstants.stride); FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbGenReactive, _generateReactiveConstants, 0, _generateReactiveConstants.stride);
BlitFragment(commandBuffer, dispatchParams.OutReactive.RenderTarget); BlitFragment(commandBuffer, dispatchParams.OutReactive.RenderTarget);

16
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/ffxm_fsr2_common.cginc

@ -1,4 +1,4 @@
#pragma warning(disable: 3078) // Loop control variable conflicts
#pragma warning(disable: 3078) // Loop control variable conflicts
#pragma warning(disable: 3203) // Signed/unsigned mismatch #pragma warning(disable: 3203) // Signed/unsigned mismatch
#pragma warning(disable: 3205) // Conversion from larger type to smaller, possible loss of data #pragma warning(disable: 3205) // Conversion from larger type to smaller, possible loss of data
#pragma warning(disable: 3556) // Integer divides might be much slower, try using uints if possible #pragma warning(disable: 3556) // Integer divides might be much slower, try using uints if possible
@ -6,7 +6,7 @@
// Doesn't work for: // Doesn't work for:
// - DX11: forces use of DXC which is not supported // - DX11: forces use of DXC which is not supported
// - XB1: native FP16 seems to be unsupported // - XB1: native FP16 seems to be unsupported
#if defined(SHADER_API_VULKAN)
#if defined(SHADER_API_VULKAN) || defined(SHADER_API_PSSL)
//#pragma require Native16Bit // *sigh* Unity STILL ignores the #if guard when compiling for standalone //#pragma require Native16Bit // *sigh* Unity STILL ignores the #if guard when compiling for standalone
#endif #endif
@ -38,3 +38,15 @@
#define InterlockedMin(dest, val) { (dest) = min((dest), (val)); } #define InterlockedMin(dest, val) { (dest) = min((dest), (val)); }
#define InterlockedMax(dest, val) { (dest) = max((dest), (val)); } #define InterlockedMax(dest, val) { (dest) = max((dest), (val)); }
#endif #endif
// PSSL uses different semantics and doesn't support certain type qualifiers
#if defined(SHADER_API_PSSL)
#define SV_VERTEXID S_VERTEX_ID
#define SV_POSITION S_POSITION
#define SV_TARGET0 S_TARGET_OUTPUT0
#define SV_TARGET1 S_TARGET_OUTPUT1
#define SV_TARGET2 S_TARGET_OUTPUT2
#define SV_TARGET3 S_TARGET_OUTPUT3
#define unorm
#define globallycoherent
#endif

9
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_common_types.h

@ -472,10 +472,7 @@ typedef FfxUInt32x4 Prefix##_U4;
#if defined(SHADER_API_PSSL) #if defined(SHADER_API_PSSL)
#define unorm
#define globallycoherent
#if FFX_HALF
#if FFXM_HALF
#define FFXM_MIN16_F half #define FFXM_MIN16_F half
#define FFXM_MIN16_F2 half2 #define FFXM_MIN16_F2 half2
@ -507,7 +504,7 @@ typedef FfxUInt32x4 Prefix##_U4;
#define FFXM_16BIT_U3 ushort3 #define FFXM_16BIT_U3 ushort3
#define FFXM_16BIT_U4 ushort4 #define FFXM_16BIT_U4 ushort4
#else // FFX_HALF
#else // FFXM_HALF
#define FFXM_MIN16_F float #define FFXM_MIN16_F float
#define FFXM_MIN16_F2 float2 #define FFXM_MIN16_F2 float2
@ -539,7 +536,7 @@ typedef FfxUInt32x4 Prefix##_U4;
#define FFXM_16BIT_U3 uint3 #define FFXM_16BIT_U3 uint3
#define FFXM_16BIT_U4 uint4 #define FFXM_16BIT_U4 uint4
#endif // FFX_HALF
#endif // FFXM_HALF
#endif // #if defined(SHADER_API_PSSL) #endif // #if defined(SHADER_API_PSSL)

19
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_accumulate_pass_fs.hlsl

@ -35,8 +35,7 @@
#define FSR2_BIND_SRV_AUTO_EXPOSURE 9 #define FSR2_BIND_SRV_AUTO_EXPOSURE 9
#define FSR2_BIND_SRV_LUMA_HISTORY 10 #define FSR2_BIND_SRV_LUMA_HISTORY 10
#define FSR2_BIND_SRV_TEMPORAL_REACTIVE 11 #define FSR2_BIND_SRV_TEMPORAL_REACTIVE 11
#define FSR2_BIND_UAV_NEW_LOCKS 4
#define FSR2_BIND_SRV_NEW_LOCKS 12
#define FSR2_BIND_CB_FSR2 0 #define FSR2_BIND_CB_FSR2 0
@ -56,6 +55,12 @@
#include "fsr2/ffxm_fsr2_reproject.h" #include "fsr2/ffxm_fsr2_reproject.h"
#include "fsr2/ffxm_fsr2_accumulate.h" #include "fsr2/ffxm_fsr2_accumulate.h"
#if defined(SHADER_API_PSSL)
#pragma PSSL_target_output_format(target 0 FMT_FP16_ABGR)
#pragma PSSL_target_output_format(target 1 FMT_FP16_ABGR)
#pragma PSSL_target_output_format(target 2 FMT_FP16_ABGR)
#endif
struct AccumulateOutputsFS struct AccumulateOutputsFS
{ {
#if !FFXM_SHADER_QUALITY_BALANCED_OR_PERFORMANCE #if !FFXM_SHADER_QUALITY_BALANCED_OR_PERFORMANCE
@ -63,14 +68,14 @@ struct AccumulateOutputsFS
FfxFloat32x2 fLockStatus : SV_TARGET1; FfxFloat32x2 fLockStatus : SV_TARGET1;
FfxFloat32x4 fLumaHistory : SV_TARGET2; FfxFloat32x4 fLumaHistory : SV_TARGET2;
#if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0 #if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0
FfxFloat32x3 fColor : SV_TARGET3;
FfxFloat32x4 fColor : SV_TARGET3;
#endif #endif
#else // FFXM_SHADER_QUALITY_BALANCED_OR_PERFORMANCE #else // FFXM_SHADER_QUALITY_BALANCED_OR_PERFORMANCE
FfxFloat32x3 fUpscaledColor : SV_TARGET0;
FfxFloat32x4 fUpscaledColor : SV_TARGET0;
FfxFloat32 fTemporalReactive : SV_TARGET1; FfxFloat32 fTemporalReactive : SV_TARGET1;
FfxFloat32x2 fLockStatus : SV_TARGET2; FfxFloat32x2 fLockStatus : SV_TARGET2;
#if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0 #if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0
FfxFloat32x3 fColor : SV_TARGET3;
FfxFloat32x4 fColor : SV_TARGET3;
#endif #endif
#endif #endif
}; };
@ -84,12 +89,12 @@ AccumulateOutputsFS main(float4 SvPosition : SV_POSITION)
output.fColorAndWeight = result.fColorAndWeight; output.fColorAndWeight = result.fColorAndWeight;
output.fLumaHistory = result.fLumaHistory; output.fLumaHistory = result.fLumaHistory;
#else #else
output.fUpscaledColor = result.fUpscaledColor;
output.fUpscaledColor = FfxFloat32x4(result.fUpscaledColor, 1.0f);
output.fTemporalReactive = result.fTemporalReactive; output.fTemporalReactive = result.fTemporalReactive;
#endif #endif
output.fLockStatus = result.fLockStatus; output.fLockStatus = result.fLockStatus;
#if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0 #if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0
output.fColor = result.fColor;
output.fColor = FfxFloat32x4(result.fColor, 1.0f);
#endif #endif
return output; return output;
} }

4
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_autogen_reactive_pass_fs.hlsl

@ -36,6 +36,10 @@
#include "fsr2/ffxm_fsr2_callbacks_hlsl.h" #include "fsr2/ffxm_fsr2_callbacks_hlsl.h"
#include "fsr2/ffxm_fsr2_common.h" #include "fsr2/ffxm_fsr2_common.h"
#if defined(SHADER_API_PSSL)
#pragma PSSL_target_output_format(default FMT_FP16_ABGR)
#endif
struct GenReactiveMaskOutputs struct GenReactiveMaskOutputs
{ {
FfxFloat32 fReactiveMask : SV_TARGET0; FfxFloat32 fReactiveMask : SV_TARGET0;

11
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_depth_clip_pass_fs.hlsl

@ -45,10 +45,15 @@
#include "fsr2/ffxm_fsr2_sample.h" #include "fsr2/ffxm_fsr2_sample.h"
#include "fsr2/ffxm_fsr2_depth_clip.h" #include "fsr2/ffxm_fsr2_depth_clip.h"
#if defined(SHADER_API_PSSL)
#pragma PSSL_target_output_format(target 0 FMT_FP16_ABGR)
#pragma PSSL_target_output_format(target 1 FMT_FP16_ABGR)
#endif
struct DepthClipOutputsFS struct DepthClipOutputsFS
{ {
FfxFloat32x2 fDilatedReactiveMasks : SV_TARGET0;
FfxFloat32x4 fTonemapped : SV_TARGET1;
FfxFloat32x4 fTonemapped : SV_TARGET0;
FfxFloat32x2 fDilatedReactiveMasks : SV_TARGET1;
}; };
DepthClipOutputsFS main(float4 SvPosition : SV_POSITION) DepthClipOutputsFS main(float4 SvPosition : SV_POSITION)
@ -56,7 +61,7 @@ DepthClipOutputsFS main(float4 SvPosition : SV_POSITION)
uint2 uPixelCoord = uint2(SvPosition.xy); uint2 uPixelCoord = uint2(SvPosition.xy);
DepthClipOutputs result = DepthClip(uPixelCoord); DepthClipOutputs result = DepthClip(uPixelCoord);
DepthClipOutputsFS output = (DepthClipOutputsFS)0; DepthClipOutputsFS output = (DepthClipOutputsFS)0;
output.fDilatedReactiveMasks = result.fDilatedReactiveMasks;
output.fTonemapped = result.fTonemapped; output.fTonemapped = result.fTonemapped;
output.fDilatedReactiveMasks = result.fDilatedReactiveMasks;
return output; return output;
} }

4
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_rcas_pass_fs.hlsl

@ -39,7 +39,7 @@
struct RCASOutputsFS struct RCASOutputsFS
{ {
FfxFloat32x3 fUpscaledColor : SV_TARGET0;
FfxFloat32x4 fUpscaledColor : SV_TARGET0;
}; };
RCASOutputsFS main(float4 SvPosition : SV_POSITION) RCASOutputsFS main(float4 SvPosition : SV_POSITION)
@ -47,6 +47,6 @@ RCASOutputsFS main(float4 SvPosition : SV_POSITION)
uint2 uPixelCoord = uint2(SvPosition.xy); uint2 uPixelCoord = uint2(SvPosition.xy);
RCASOutputs result = RCAS(uPixelCoord); RCASOutputs result = RCAS(uPixelCoord);
RCASOutputsFS output = (RCASOutputsFS)0; RCASOutputsFS output = (RCASOutputsFS)0;
output.fUpscaledColor = result.fUpscaledColor;
output.fUpscaledColor = FfxFloat32x4(result.fUpscaledColor, 1.0f);
return output; return output;
} }

7
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_reconstruct_previous_depth_pass_fs.hlsl

@ -41,6 +41,13 @@
#include "fsr2/ffxm_fsr2_sample.h" #include "fsr2/ffxm_fsr2_sample.h"
#include "fsr2/ffxm_fsr2_reconstruct_dilated_velocity_and_previous_depth.h" #include "fsr2/ffxm_fsr2_reconstruct_dilated_velocity_and_previous_depth.h"
#if defined(SHADER_API_PSSL)
#pragma PSSL_target_output_format(target 0 FMT_32_R)
#pragma PSSL_target_output_format(target 1 FMT_FP16_ABGR)
#pragma PSSL_target_output_format(target 2 FMT_32_R)
#pragma PSSL_target_output_format(target 3 FMT_32_R)
#endif
struct ReconstructPrevDepthOutputsFS struct ReconstructPrevDepthOutputsFS
{ {
FfxFloat32 fDepth : SV_TARGET0; FfxFloat32 fDepth : SV_TARGET0;

1
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_accumulate.h

@ -372,7 +372,6 @@ AccumulateOutputs Accumulate(FfxInt32x2 iPxHrPos)
#if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0 #if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0
results.fColor = fHistoryColor; results.fColor = fHistoryColor;
#endif #endif
StoreNewLocks(iPxHrPos, 0);
return results; return results;
} }

8
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_callbacks_hlsl.h

@ -379,7 +379,11 @@ SamplerState s_LinearClamp : register(s1);
// UAV declarations // UAV declarations
#if defined FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH #if defined FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH
#if defined(SHADER_API_PSSL) && defined(SHADER_STAGE_FRAGMENT)
RWTexture2D<FfxUInt32> rw_reconstructed_previous_nearest_depth; // Need to use implicit register binding for random write targets on PS4/5
#else
RWTexture2D<FfxUInt32> rw_reconstructed_previous_nearest_depth : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH); RWTexture2D<FfxUInt32> rw_reconstructed_previous_nearest_depth : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH);
#endif
#endif #endif
#if defined FSR2_BIND_UAV_DILATED_MOTION_VECTORS #if defined FSR2_BIND_UAV_DILATED_MOTION_VECTORS
RWTexture2D<FfxFloat32x2> rw_dilated_motion_vectors : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_MOTION_VECTORS); RWTexture2D<FfxFloat32x2> rw_dilated_motion_vectors : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_MOTION_VECTORS);
@ -397,7 +401,11 @@ SamplerState s_LinearClamp : register(s1);
RWTexture2D<FfxFloat32> rw_lock_input_luma : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LOCK_INPUT_LUMA); RWTexture2D<FfxFloat32> rw_lock_input_luma : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LOCK_INPUT_LUMA);
#endif #endif
#if defined FSR2_BIND_UAV_NEW_LOCKS #if defined FSR2_BIND_UAV_NEW_LOCKS
#if defined(SHADER_API_PSSL) && defined(SHADER_STAGE_FRAGMENT)
RWTexture2D<unorm FfxFloat32> rw_new_locks; // Need to use implicit register binding for random write targets on PS4/5
#else
RWTexture2D<unorm FfxFloat32> rw_new_locks : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_NEW_LOCKS); RWTexture2D<unorm FfxFloat32> rw_new_locks : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_NEW_LOCKS);
#endif
#endif #endif
#if defined FSR2_BIND_UAV_PREPARED_INPUT_COLOR #if defined FSR2_BIND_UAV_PREPARED_INPUT_COLOR
RWTexture2D<FfxFloat32x4> rw_prepared_input_color : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREPARED_INPUT_COLOR); RWTexture2D<FfxFloat32x4> rw_prepared_input_color : FFXM_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREPARED_INPUT_COLOR);

2
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_depth_clip.h

@ -27,8 +27,8 @@
struct DepthClipOutputs struct DepthClipOutputs
{ {
FfxFloat32x2 fDilatedReactiveMasks;
FfxFloat32x4 fTonemapped; FfxFloat32x4 fTonemapped;
FfxFloat32x2 fDilatedReactiveMasks;
}; };
FFXM_STATIC const FfxFloat32 DepthClipBaseScale = 4.0f; FFXM_STATIC const FfxFloat32 DepthClipBaseScale = 4.0f;

4
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_reproject.h

@ -331,7 +331,7 @@ void ReprojectHistoryColor(const AccumulationPassCommonParams params, FFXM_PARAM
LockState ReprojectHistoryLockStatus(const AccumulationPassCommonParams params, FFXM_PARAMETER_OUT FfxFloat32x2 fReprojectedLockStatus) LockState ReprojectHistoryLockStatus(const AccumulationPassCommonParams params, FFXM_PARAMETER_OUT FfxFloat32x2 fReprojectedLockStatus)
{ {
LockState state = { FFXM_FALSE, FFXM_FALSE }; LockState state = { FFXM_FALSE, FFXM_FALSE };
const FfxFloat32 fNewLockIntensity = LoadRwNewLocks(params.iPxHrPos);
const FfxFloat32 fNewLockIntensity = LoadNewLocks(params.iPxHrPos);
state.NewLock = fNewLockIntensity > (127.0f / 255.0f); state.NewLock = fNewLockIntensity > (127.0f / 255.0f);
FfxFloat32 fInPlaceLockLifetime = state.NewLock ? fNewLockIntensity : 0; FfxFloat32 fInPlaceLockLifetime = state.NewLock ? fNewLockIntensity : 0;
@ -368,7 +368,7 @@ void ReprojectHistoryColor(const AccumulationPassCommonParams params, FFXM_PARAM
LockState ReprojectHistoryLockStatus(const AccumulationPassCommonParams params, FFXM_PARAMETER_OUT FfxFloat16x2 fReprojectedLockStatus) LockState ReprojectHistoryLockStatus(const AccumulationPassCommonParams params, FFXM_PARAMETER_OUT FfxFloat16x2 fReprojectedLockStatus)
{ {
LockState state = { FFXM_FALSE, FFXM_FALSE }; LockState state = { FFXM_FALSE, FFXM_FALSE };
const FfxFloat16 fNewLockIntensity = FfxFloat16(LoadRwNewLocks(params.iPxHrPos));
const FfxFloat16 fNewLockIntensity = FfxFloat16(LoadNewLocks(params.iPxHrPos));
state.NewLock = fNewLockIntensity > (127.0f / 255.0f); state.NewLock = fNewLockIntensity > (127.0f / 255.0f);
FfxFloat16 fInPlaceLockLifetime = state.NewLock ? fNewLockIntensity : FfxFloat16(0); FfxFloat16 fInPlaceLockLifetime = state.NewLock ? fNewLockIntensity : FfxFloat16(0);

Loading…
Cancel
Save