initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
121
thirdparty/amd-fsr2/patches/0002-godot-fsr2-options.patch
vendored
Normal file
121
thirdparty/amd-fsr2/patches/0002-godot-fsr2-options.patch
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
diff --git a/thirdparty/amd-fsr2/ffx_fsr2.cpp b/thirdparty/amd-fsr2/ffx_fsr2.cpp
|
||||
index 3970aa7f5b..ec571b9cd2 100644
|
||||
--- a/thirdparty/amd-fsr2/ffx_fsr2.cpp
|
||||
+++ b/thirdparty/amd-fsr2/ffx_fsr2.cpp
|
||||
@@ -952,6 +952,8 @@ static FfxErrorCode fsr2Dispatch(FfxFsr2Context_Private* context, const FfxFsr2D
|
||||
context->constants.lumaMipDimensions[0] = uint32_t(context->constants.maxRenderSize[0] / mipDiv);
|
||||
context->constants.lumaMipDimensions[1] = uint32_t(context->constants.maxRenderSize[1] / mipDiv);
|
||||
|
||||
+ memcpy(context->constants.reprojectionMatrix, params->reprojectionMatrix, sizeof(context->constants.reprojectionMatrix));
|
||||
+
|
||||
// reactive mask bias
|
||||
const int32_t threadGroupWorkRegionDim = 8;
|
||||
const int32_t dispatchSrcX = (context->constants.renderSize[0] + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim;
|
||||
diff --git a/thirdparty/amd-fsr2/ffx_fsr2.h b/thirdparty/amd-fsr2/ffx_fsr2.h
|
||||
index 2a1c74abb1..dfcd4caf35 100644
|
||||
--- a/thirdparty/amd-fsr2/ffx_fsr2.h
|
||||
+++ b/thirdparty/amd-fsr2/ffx_fsr2.h
|
||||
@@ -146,6 +146,7 @@ typedef struct FfxFsr2DispatchDescription {
|
||||
float autoReactiveScale; ///< A value to scale the reactive mask
|
||||
float autoReactiveMax; ///< A value to clamp the reactive mask
|
||||
|
||||
+ float reprojectionMatrix[16]; ///< The matrix used for reprojecting pixels with invalid motion vectors by using the depth.
|
||||
} FfxFsr2DispatchDescription;
|
||||
|
||||
/// A structure encapsulating the parameters for automatic generation of a reactive mask
|
||||
diff --git a/thirdparty/amd-fsr2/ffx_fsr2_private.h b/thirdparty/amd-fsr2/ffx_fsr2_private.h
|
||||
index 6b5fbc5117..8a9aec5778 100644
|
||||
--- a/thirdparty/amd-fsr2/ffx_fsr2_private.h
|
||||
+++ b/thirdparty/amd-fsr2/ffx_fsr2_private.h
|
||||
@@ -44,6 +44,9 @@ typedef struct Fsr2Constants {
|
||||
float deltaTime;
|
||||
float dynamicResChangeFactor;
|
||||
float viewSpaceToMetersFactor;
|
||||
+
|
||||
+ float pad;
|
||||
+ float reprojectionMatrix[16];
|
||||
} Fsr2Constants;
|
||||
|
||||
struct FfxFsr2ContextDescription;
|
||||
diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
|
||||
index 31d68292d4..2e98c8a6c5 100644
|
||||
--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
|
||||
+++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
|
||||
@@ -35,7 +35,7 @@
|
||||
#endif
|
||||
#define FSR2_BIND_SRV_INTERNAL_UPSCALED 3
|
||||
#define FSR2_BIND_SRV_LOCK_STATUS 4
|
||||
-#define FSR2_BIND_SRV_INPUT_DEPTH_CLIP 5
|
||||
+//#define FSR2_BIND_SRV_INPUT_DEPTH_CLIP 5
|
||||
#define FSR2_BIND_SRV_PREPARED_INPUT_COLOR 6
|
||||
#define FSR2_BIND_SRV_LUMA_INSTABILITY 7
|
||||
#define FSR2_BIND_SRV_LANCZOS_LUT 8
|
||||
@@ -52,6 +52,10 @@
|
||||
|
||||
#define FSR2_BIND_CB_FSR2 18
|
||||
|
||||
+#if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
|
||||
+#define FSR2_BIND_SRV_INPUT_DEPTH 5
|
||||
+#endif
|
||||
+
|
||||
#include "ffx_fsr2_callbacks_glsl.h"
|
||||
#include "ffx_fsr2_common.h"
|
||||
#include "ffx_fsr2_sample.h"
|
||||
diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h b/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h
|
||||
index 10da13fb81..b610037cc6 100644
|
||||
--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h
|
||||
+++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h
|
||||
@@ -52,6 +52,9 @@
|
||||
FfxFloat32 fDeltaTime;
|
||||
FfxFloat32 fDynamicResChangeFactor;
|
||||
FfxFloat32 fViewSpaceToMetersFactor;
|
||||
+
|
||||
+ FfxFloat32 fPad;
|
||||
+ mat4 mReprojectionMatrix;
|
||||
} cbFSR2;
|
||||
#endif
|
||||
|
||||
@@ -317,7 +320,11 @@ FfxFloat32 LoadInputDepth(FfxInt32x2 iPxPos)
|
||||
#if defined(FSR2_BIND_SRV_REACTIVE_MASK)
|
||||
FfxFloat32 LoadReactiveMask(FfxInt32x2 iPxPos)
|
||||
{
|
||||
+#if FFX_FSR2_OPTION_GODOT_REACTIVE_MASK_CLAMP
|
||||
+ return min(texelFetch(r_reactive_mask, FfxInt32x2(iPxPos), 0).r, 0.9f);
|
||||
+#else
|
||||
return texelFetch(r_reactive_mask, FfxInt32x2(iPxPos), 0).r;
|
||||
+#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -354,6 +361,16 @@ FfxFloat32x2 LoadInputMotionVector(FfxInt32x2 iPxDilatedMotionVectorPos)
|
||||
{
|
||||
FfxFloat32x2 fSrcMotionVector = texelFetch(r_input_motion_vectors, iPxDilatedMotionVectorPos, 0).xy;
|
||||
|
||||
+#if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
|
||||
+ bool bInvalidMotionVector = all(lessThanEqual(fSrcMotionVector, vec2(-1.0f, -1.0f)));
|
||||
+ if (bInvalidMotionVector)
|
||||
+ {
|
||||
+ FfxFloat32 fSrcDepth = LoadInputDepth(iPxDilatedMotionVectorPos);
|
||||
+ FfxFloat32x2 fUv = (iPxDilatedMotionVectorPos + FfxFloat32(0.5)) / RenderSize();
|
||||
+ fSrcMotionVector = FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS_FUNCTION(fUv, fSrcDepth, cbFSR2.mReprojectionMatrix);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale();
|
||||
|
||||
#if FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
|
||||
diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
|
||||
index 7d6a66b8ac..5c042c332a 100644
|
||||
--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
|
||||
+++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
|
||||
@@ -40,6 +40,10 @@
|
||||
#define FSR2_BIND_CB_FSR2 11
|
||||
#define FSR2_BIND_CB_REACTIVE 12
|
||||
|
||||
+#if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
|
||||
+#define FSR2_BIND_SRV_INPUT_DEPTH 13
|
||||
+#endif
|
||||
+
|
||||
#include "ffx_fsr2_callbacks_glsl.h"
|
||||
#include "ffx_fsr2_common.h"
|
||||
|
Reference in New Issue
Block a user