|
|
@ -340,17 +340,17 @@ FfxUInt32x2 SPD_RenderSize() |
|
|
#endif // #if defined(FSR2_BIND_CB_SPD) |
|
|
#endif // #if defined(FSR2_BIND_CB_SPD) |
|
|
|
|
|
|
|
|
// Declare and sample camera buffers as regular textures, unless overridden |
|
|
// Declare and sample camera buffers as regular textures, unless overridden |
|
|
#if !defined(UNITY_FSR_TEX2D) |
|
|
|
|
|
#define UNITY_FSR_TEX2D(type) Texture2D<type> |
|
|
|
|
|
|
|
|
#if !defined(UNITY_FFX_TEX2D) |
|
|
|
|
|
#define UNITY_FFX_TEX2D(type) Texture2D<type> |
|
|
#endif |
|
|
#endif |
|
|
#if !defined(UNITY_FSR_RWTEX2D) |
|
|
|
|
|
#define UNITY_FSR_RWTEX2D(type) RWTexture2D<type> |
|
|
|
|
|
|
|
|
#if !defined(UNITY_FFX_RWTEX2D) |
|
|
|
|
|
#define UNITY_FFX_RWTEX2D(type) RWTexture2D<type> |
|
|
#endif |
|
|
#endif |
|
|
#if !defined(UNITY_FSR_POS) |
|
|
|
|
|
#define UNITY_FSR_POS(pxPos) (pxPos) |
|
|
|
|
|
|
|
|
#if !defined(UNITY_FFX_POS) |
|
|
|
|
|
#define UNITY_FFX_POS(pxPos) (pxPos) |
|
|
#endif |
|
|
#endif |
|
|
#if !defined(UNITY_FSR_UV) |
|
|
|
|
|
#define UNITY_FSR_UV(uv) (uv) |
|
|
|
|
|
|
|
|
#if !defined(UNITY_FFX_UV) |
|
|
|
|
|
#define UNITY_FFX_UV(uv) (uv) |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
SamplerState s_PointClamp : register(s0); |
|
|
SamplerState s_PointClamp : register(s0); |
|
|
@ -358,16 +358,16 @@ SamplerState s_LinearClamp : register(s1); |
|
|
|
|
|
|
|
|
// SRVs |
|
|
// SRVs |
|
|
#if defined FSR2_BIND_SRV_INPUT_COLOR |
|
|
#if defined FSR2_BIND_SRV_INPUT_COLOR |
|
|
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_COLOR); |
|
|
|
|
|
|
|
|
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_COLOR); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_SRV_INPUT_OPAQUE_ONLY |
|
|
#if defined FSR2_BIND_SRV_INPUT_OPAQUE_ONLY |
|
|
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY); |
|
|
|
|
|
|
|
|
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_SRV_INPUT_MOTION_VECTORS |
|
|
#if defined FSR2_BIND_SRV_INPUT_MOTION_VECTORS |
|
|
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_MOTION_VECTORS); |
|
|
|
|
|
|
|
|
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_MOTION_VECTORS); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_SRV_INPUT_DEPTH |
|
|
#if defined FSR2_BIND_SRV_INPUT_DEPTH |
|
|
UNITY_FSR_TEX2D(FfxFloat32) r_input_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_DEPTH); |
|
|
|
|
|
|
|
|
UNITY_FFX_TEX2D(FfxFloat32) r_input_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_DEPTH); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_SRV_INPUT_EXPOSURE |
|
|
#if defined FSR2_BIND_SRV_INPUT_EXPOSURE |
|
|
Texture2D<FfxFloat32x2> r_input_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_EXPOSURE); |
|
|
Texture2D<FfxFloat32x2> r_input_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_EXPOSURE); |
|
|
@ -376,10 +376,10 @@ SamplerState s_LinearClamp : register(s1); |
|
|
Texture2D<FfxFloat32x2> r_auto_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_AUTO_EXPOSURE); |
|
|
Texture2D<FfxFloat32x2> r_auto_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_AUTO_EXPOSURE); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_SRV_REACTIVE_MASK |
|
|
#if defined FSR2_BIND_SRV_REACTIVE_MASK |
|
|
UNITY_FSR_TEX2D(FfxFloat32) r_reactive_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_REACTIVE_MASK); |
|
|
|
|
|
|
|
|
UNITY_FFX_TEX2D(FfxFloat32) r_reactive_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_REACTIVE_MASK); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK |
|
|
#if defined FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK |
|
|
UNITY_FSR_TEX2D(FfxFloat32) r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK); |
|
|
|
|
|
|
|
|
UNITY_FFX_TEX2D(FfxFloat32) r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH |
|
|
#if defined FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH |
|
|
Texture2D<FfxUInt32> r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH); |
|
|
Texture2D<FfxUInt32> r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH); |
|
|
@ -463,7 +463,7 @@ SamplerState s_LinearClamp : register(s1); |
|
|
RWTexture2D<FfxFloat32x4> rw_luma_history : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LUMA_HISTORY); |
|
|
RWTexture2D<FfxFloat32x4> rw_luma_history : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LUMA_HISTORY); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_UAV_UPSCALED_OUTPUT |
|
|
#if defined FSR2_BIND_UAV_UPSCALED_OUTPUT |
|
|
UNITY_FSR_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_UPSCALED_OUTPUT); |
|
|
|
|
|
|
|
|
UNITY_FFX_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_UPSCALED_OUTPUT); |
|
|
#endif |
|
|
#endif |
|
|
#if defined FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE |
|
|
#if defined FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE |
|
|
globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE); |
|
|
globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE); |
|
|
@ -514,42 +514,42 @@ FfxFloat32 SampleMipLuma(FfxFloat32x2 fUV, FfxUInt32 mipLevel) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_DEPTH) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_DEPTH) |
|
|
FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos) |
|
|
FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos) |
|
|
{ |
|
|
{ |
|
|
return r_input_depth[UNITY_FSR_POS(iPxPos)]; |
|
|
|
|
|
|
|
|
return r_input_depth[UNITY_FFX_POS(iPxPos)]; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(FSR2_BIND_SRV_INPUT_DEPTH) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_DEPTH) |
|
|
FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV) |
|
|
FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV) |
|
|
{ |
|
|
{ |
|
|
return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).x; |
|
|
|
|
|
|
|
|
return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).x; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(FSR2_BIND_SRV_REACTIVE_MASK) |
|
|
#if defined(FSR2_BIND_SRV_REACTIVE_MASK) |
|
|
FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos) |
|
|
FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos) |
|
|
{ |
|
|
{ |
|
|
return r_reactive_mask[UNITY_FSR_POS(iPxPos)]; |
|
|
|
|
|
|
|
|
return r_reactive_mask[UNITY_FFX_POS(iPxPos)]; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK) |
|
|
#if defined(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK) |
|
|
FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos) |
|
|
FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos) |
|
|
{ |
|
|
{ |
|
|
return r_transparency_and_composition_mask[UNITY_FSR_POS(iPxPos)]; |
|
|
|
|
|
|
|
|
return r_transparency_and_composition_mask[UNITY_FFX_POS(iPxPos)]; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(FSR2_BIND_SRV_INPUT_COLOR) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_COLOR) |
|
|
FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos) |
|
|
FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos) |
|
|
{ |
|
|
{ |
|
|
return r_input_color_jittered[UNITY_FSR_POS(iPxPos)].rgb; |
|
|
|
|
|
|
|
|
return r_input_color_jittered[UNITY_FFX_POS(iPxPos)].rgb; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(FSR2_BIND_SRV_INPUT_COLOR) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_COLOR) |
|
|
FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV) |
|
|
FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV) |
|
|
{ |
|
|
{ |
|
|
return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).rgb; |
|
|
|
|
|
|
|
|
return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).rgb; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
@ -563,7 +563,7 @@ FfxFloat32x3 LoadPreparedInputColor(FfxUInt32x2 iPxPos) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_MOTION_VECTORS) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_MOTION_VECTORS) |
|
|
FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos) |
|
|
FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos) |
|
|
{ |
|
|
{ |
|
|
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FSR_POS(iPxDilatedMotionVectorPos)].xy; |
|
|
|
|
|
|
|
|
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FFX_POS(iPxDilatedMotionVectorPos)].xy; |
|
|
|
|
|
|
|
|
FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); |
|
|
FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); |
|
|
|
|
|
|
|
|
@ -622,7 +622,7 @@ void StoreInternalColorAndWeight(FfxUInt32x2 iPxPos, FfxFloat32x4 fColorAndWeigh |
|
|
#if defined(FSR2_BIND_UAV_UPSCALED_OUTPUT) |
|
|
#if defined(FSR2_BIND_UAV_UPSCALED_OUTPUT) |
|
|
void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) |
|
|
void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) |
|
|
{ |
|
|
{ |
|
|
rw_upscaled_output[UNITY_FSR_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f); |
|
|
|
|
|
|
|
|
rw_upscaled_output[UNITY_FFX_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
@ -833,7 +833,7 @@ void StoreDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETE |
|
|
#if defined(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY) |
|
|
#if defined(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY) |
|
|
FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) |
|
|
FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) |
|
|
{ |
|
|
{ |
|
|
return r_input_opaque_only[UNITY_FSR_POS(iPxPos)].xyz; |
|
|
|
|
|
|
|
|
return r_input_opaque_only[UNITY_FFX_POS(iPxPos)].xyz; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|