Browse Source

Backported fixes that we already know are going to be necessary for full Unity support:

- Removed empty parantheses on GroupMemoryBarrier macro, which confuse the 2020.1 shader compiler
- Added padding field to cbFSR2 to make it exactly 128 bytes in size, which gives correct buffer alignment on iOS Metal
- Changed auto-exposure reset threshold value to 1e4f, as part of a fix for black screen flashes in OpenGL Core on Nvidia GPUs
- Clamp luma to >= 0 in auto-exposure to fix artifacting in OpenGL Core on Nvidia GPUs
- Removed #extension directives meant for GLSL, which cause shader compiler warnings in Unity
asr-console
Nico de Poel 11 months ago
parent
commit
d77922cc4b
  1. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_core_hlsl.h
  2. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_callbacks_hlsl.h
  3. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_common.h
  4. 1
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_compute_luminance_pyramid.h
  5. 6
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/spd/ffxm_spd.h

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

@ -32,7 +32,7 @@
/// A define for abstracting compute memory barriers between shading languages.
///
/// @ingroup HLSLCore
#define FFXM_GROUP_MEMORY_BARRIER() GroupMemoryBarrierWithGroupSync()
#define FFXM_GROUP_MEMORY_BARRIER GroupMemoryBarrierWithGroupSync()
/// A define for abstracting compute atomic additions between shading languages.
///

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

@ -79,6 +79,8 @@
FfxFloat32 fDeltaTime;
FfxFloat32 fDynamicResChangeFactor;
FfxFloat32 fViewSpaceToMetersFactor;
FfxFloat32 fPadding;
};
#define FFXM_FSR2_CONSTANT_BUFFER_1_SIZE (sizeof(cbFSR2) / 4) // Number of 32-bit values. This must be kept in sync with the cbFSR2 size.

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

@ -57,7 +57,7 @@ FFXM_STATIC const FfxFloat32 fAverageLanczosWeightPerFrame = 0.74f * fUpsampleLa
FFXM_STATIC const FfxFloat32 fAccumulationMaxOnMotion = 3.0f * fUpsampleLanczosWeightScale;
// Auto exposure
FFXM_STATIC const FfxFloat32 resetAutoExposureAverageSmoothing = 1e8f;
FFXM_STATIC const FfxFloat32 resetAutoExposureAverageSmoothing = 1e4f;
// Optimizations defines
#ifndef FFXM_OPT_USE_GATHER_OPS

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

@ -82,6 +82,7 @@ void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 index, FfxUInt32
{
FfxFloat32 rate = 1.0f;
result = prev + (result - prev) * (1 - exp(-DeltaTime() * rate));
result = ffxMax(0.0f, result);
}
FfxFloat32x2 spdOutput = FfxFloat32x2(ComputeAutoExposureFromLavg(result), result);
SPD_SetExposureBuffer(spdOutput);

6
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/spd/ffxm_spd.h

@ -119,12 +119,12 @@ FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFl
//_____________________________________________________________/\_______________________________________________________________
#if defined(FFXM_GLSL) && !defined(FFXM_SPD_NO_WAVE_OPERATIONS)
#extension GL_KHR_shader_subgroup_quad:require
//#extension GL_KHR_shader_subgroup_quad:require
#endif
void ffxSpdWorkgroupShuffleBarrier()
{
FFXM_GROUP_MEMORY_BARRIER();
FFXM_GROUP_MEMORY_BARRIER;
}
// Only last active workgroup should proceed
@ -578,7 +578,7 @@ void SpdDownsample(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxU
#if FFXM_HALF
#if defined(FFXM_GLSL)
#extension GL_EXT_shader_subgroup_extended_types_float16:require
//#extension GL_EXT_shader_subgroup_extended_types_float16:require
#endif
FfxFloat16x4 SpdReduceQuadH(FfxFloat16x4 v)

Loading…
Cancel
Save