Skip to content

Commit c82048c

Browse files
committed
added this patch (GPUOpen-Effects#27)
dlss depth is between 0 and 1 so it wont be a problme
1 parent 026a9fc commit c82048c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/ffx-fsr2-api/shaders/ffx_fsr2_callbacks_glsl.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,9 @@ void SetReconstructedDepth(FfxInt32x2 iPxSample, FfxUInt32 uValue)
591591
void StoreDilatedDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 fDepth)
592592
{
593593
#if defined(FSR2_BIND_UAV_DILATED_DEPTH)
594+
#if !FFX_FSR2_OPTION_INVERTED_DEPTH
595+
fDepth = 1.0 - fDepth; // Preserve precision as well as we can in FP16.
596+
#endif
594597
//FfxUInt32 uDepth = f32tof16(fDepth);
595598
imageStore(rw_dilatedDepth, iPxPos, vec4(fDepth, 0.0f, 0.0f, 0.0f));
596599
#endif
@@ -625,7 +628,13 @@ FfxFloat32x2 SampleDilatedMotionVector(FfxFloat32x2 fUV)
625628
FfxFloat32 LoadDilatedDepth(FfxInt32x2 iPxInput)
626629
{
627630
#if defined(FSR2_BIND_SRV_DILATED_DEPTH)
628-
return texelFetch(r_dilatedDepth, iPxInput, 0).r;
631+
FfxFloat32 fDepth = texelFetch(r_dilatedDepth, iPxInput, 0).r;
632+
633+
#if !FFX_FSR2_OPTION_INVERTED_DEPTH
634+
fDepth = 1.0 - fDepth; // Reconstruct from FP16.
635+
#endif
636+
637+
return fDepth;
629638
#else
630639
return 0.f;
631640
#endif

src/ffx-fsr2-api/shaders/ffx_fsr2_callbacks_hlsl.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,11 @@ void SetReconstructedDepth(FfxUInt32x2 iPxSample, const FfxUInt32 uValue)
745745
void StoreDilatedDepth(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 fDepth)
746746
{
747747
#if defined(FSR2_BIND_UAV_DILATED_DEPTH) || defined(FFX_INTERNAL)
748+
749+
#if !FFX_FSR2_OPTION_INVERTED_DEPTH
750+
fDepth = 1.0 - fDepth; // Preserve precision as well as we can in FP16.
751+
#endif
752+
748753
rw_dilatedDepth[iPxPos] = fDepth;
749754
#endif
750755
}
@@ -778,7 +783,13 @@ FfxFloat32x2 SampleDilatedMotionVector(FfxFloat32x2 fUV)
778783
FfxFloat32 LoadDilatedDepth(FfxUInt32x2 iPxInput)
779784
{
780785
#if defined(FSR2_BIND_SRV_DILATED_DEPTH) || defined(FFX_INTERNAL)
781-
return r_dilatedDepth[iPxInput];
786+
FfxFloat32 fDepth = r_dilatedDepth[iPxInput];
787+
788+
#if !FFX_FSR2_OPTION_INVERTED_DEPTH
789+
fDepth = 1.0 - fDepth; // Reconstruct from FP16.
790+
#endif
791+
792+
return fDepth;
782793
#else
783794
return 0.f;
784795
#endif

0 commit comments

Comments
 (0)