Browse Source

Bunch of fixes to make ASR Quality somewhat work on PS5, without reactive mask still:

- Define macros for various VS/FS binding intrinsics
- Use pragmas to set output formats for render targets that aren't normal RGBA
- Added alpha channel to color output targets, so that they're 4-channel instead of 3
- Pass FSR2 constant buffer to reactive mask shader (may not matter)
asr-console
Nico de Poel 11 months ago
parent
commit
c4b59c7dc3
  1. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrContext.cs
  2. 5
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs
  3. 9
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/ffxm_fsr2_common.cginc
  4. 12
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_accumulate_pass_fs.hlsl
  5. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_autogen_reactive_pass_fs.hlsl
  6. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_depth_clip_pass_fs.hlsl
  7. 4
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_rcas_pass_fs.hlsl
  8. 4
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_reconstruct_previous_depth_pass_fs.hlsl

2
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);
_accumulatePass = new AsrAccumulatePass(_contextDescription, _resources, _upscalerConstantsBuffer);
_sharpenPass = new AsrSharpenPass(_contextDescription, _resources, _upscalerConstantsBuffer, _rcasConstantsBuffer);
_generateReactivePass = new AsrGenerateReactivePass(_contextDescription, _resources, _generateReactiveConstantsBuffer);
_generateReactivePass = new AsrGenerateReactivePass(_contextDescription, _resources, _upscalerConstantsBuffer, _generateReactiveConstantsBuffer);
}
public void Destroy()

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

@ -328,8 +328,8 @@ namespace ArmASR
{
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;
@ -347,6 +347,7 @@ namespace ArmASR
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvOpaqueOnly, dispatchParams.ColorOpaqueOnly);
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputColor, dispatchParams.ColorPreUpscale);
FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride);
FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbGenReactive, _generateReactiveConstants, 0, _generateReactiveConstants.stride);
BlitFragment(commandBuffer, dispatchParams.OutReactive.RenderTarget);

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

@ -31,3 +31,12 @@
#define InterlockedMin(dest, val) { (dest) = min((dest), (val)); }
#define InterlockedMax(dest, val) { (dest) = max((dest), (val)); }
#endif
#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
#endif

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

@ -56,6 +56,8 @@
#include "fsr2/ffxm_fsr2_reproject.h"
#include "fsr2/ffxm_fsr2_accumulate.h"
#pragma PSSL_target_output_format(target 1 FMT_FP16_ABGR)
struct AccumulateOutputsFS
{
#if !FFXM_SHADER_QUALITY_BALANCED_OR_PERFORMANCE
@ -63,14 +65,14 @@ struct AccumulateOutputsFS
FfxFloat32x2 fLockStatus : SV_TARGET1;
FfxFloat32x4 fLumaHistory : SV_TARGET2;
#if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0
FfxFloat32x3 fColor : SV_TARGET3;
FfxFloat32x4 fColor : SV_TARGET3;
#endif
#else // FFXM_SHADER_QUALITY_BALANCED_OR_PERFORMANCE
FfxFloat32x3 fUpscaledColor : SV_TARGET0;
FfxFloat32x4 fUpscaledColor : SV_TARGET0;
FfxFloat32 fTemporalReactive : SV_TARGET1;
FfxFloat32x2 fLockStatus : SV_TARGET2;
#if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0
FfxFloat32x3 fColor : SV_TARGET3;
FfxFloat32x4 fColor : SV_TARGET3;
#endif
#endif
};
@ -84,12 +86,12 @@ AccumulateOutputsFS main(float4 SvPosition : SV_POSITION)
output.fColorAndWeight = result.fColorAndWeight;
output.fLumaHistory = result.fLumaHistory;
#else
output.fUpscaledColor = result.fUpscaledColor;
output.fUpscaledColor = FfxFloat32x4(result.fUpscaledColor, 1.0f);
output.fTemporalReactive = result.fTemporalReactive;
#endif
output.fLockStatus = result.fLockStatus;
#if FFXM_FSR2_OPTION_APPLY_SHARPENING == 0
output.fColor = result.fColor;
output.fColor = FfxFloat32x4(result.fColor, 1.0f);
#endif
return output;
}

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

@ -36,6 +36,8 @@
#include "fsr2/ffxm_fsr2_callbacks_hlsl.h"
#include "fsr2/ffxm_fsr2_common.h"
#pragma PSSL_target_output_format(default FMT_32_R)
struct GenReactiveMaskOutputs
{
FfxFloat32 fReactiveMask : SV_TARGET0;

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

@ -45,6 +45,8 @@
#include "fsr2/ffxm_fsr2_sample.h"
#include "fsr2/ffxm_fsr2_depth_clip.h"
#pragma PSSL_target_output_format(target 0 FMT_FP16_ABGR)
struct DepthClipOutputsFS
{
FfxFloat32x2 fDilatedReactiveMasks : SV_TARGET0;

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

4
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,10 @@
#include "fsr2/ffxm_fsr2_sample.h"
#include "fsr2/ffxm_fsr2_reconstruct_dilated_velocity_and_previous_depth.h"
#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)
struct ReconstructPrevDepthOutputsFS
{
FfxFloat32 fDepth : SV_TARGET0;

Loading…
Cancel
Save