|
|
|
@ -322,21 +322,35 @@ FfxUInt32x2 SPD_RenderSize() |
|
|
|
} |
|
|
|
#endif // #if defined(FSR3UPSCALER_BIND_CB_SPD) |
|
|
|
|
|
|
|
// Declare and sample camera buffers as regular textures, unless overridden |
|
|
|
#if !defined(UNITY_FSR3_TEX2D) |
|
|
|
#define UNITY_FSR3_TEX2D(type) Texture2D<type> |
|
|
|
#endif |
|
|
|
#if !defined(UNITY_FSR3_RWTEX2D) |
|
|
|
#define UNITY_FSR3_RWTEX2D(type) RWTexture2D<type> |
|
|
|
#endif |
|
|
|
#if !defined(UNITY_FSR3_POS) |
|
|
|
#define UNITY_FSR3_POS(pxPos) (pxPos) |
|
|
|
#endif |
|
|
|
#if !defined(UNITY_FSR3_UV) |
|
|
|
#define UNITY_FSR3_UV(uv) (uv) |
|
|
|
#endif |
|
|
|
|
|
|
|
SamplerState s_PointClamp : register(s0); |
|
|
|
SamplerState s_LinearClamp : register(s1); |
|
|
|
|
|
|
|
// SRVs |
|
|
|
#if defined FSR3UPSCALER_BIND_SRV_INPUT_COLOR |
|
|
|
Texture2D<FfxFloat32x4> r_input_color_jittered : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_COLOR); |
|
|
|
UNITY_FSR3_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_COLOR); |
|
|
|
#endif |
|
|
|
#if defined FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY |
|
|
|
Texture2D<FfxFloat32x4> r_input_opaque_only : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY); |
|
|
|
UNITY_FSR3_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY); |
|
|
|
#endif |
|
|
|
#if defined FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS |
|
|
|
Texture2D<FfxFloat32x4> r_input_motion_vectors : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS); |
|
|
|
UNITY_FSR3_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS); |
|
|
|
#endif |
|
|
|
#if defined FSR3UPSCALER_BIND_SRV_INPUT_DEPTH |
|
|
|
Texture2D<FfxFloat32> r_input_depth : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH); |
|
|
|
UNITY_FSR3_TEX2D(FfxFloat32) r_input_depth : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH); |
|
|
|
#endif |
|
|
|
#if defined FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE |
|
|
|
Texture2D<FfxFloat32x2> r_input_exposure : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE); |
|
|
|
@ -432,7 +446,7 @@ SamplerState s_LinearClamp : register(s1); |
|
|
|
RWTexture2D<FfxFloat32x4> rw_luma_history : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_LUMA_HISTORY); |
|
|
|
#endif |
|
|
|
#if defined FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT |
|
|
|
RWTexture2D<FfxFloat32x4> rw_upscaled_output : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT); |
|
|
|
UNITY_FSR3_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT); |
|
|
|
#endif |
|
|
|
#if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE |
|
|
|
globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_shading_change : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE); |
|
|
|
@ -483,14 +497,14 @@ FfxFloat32 SampleMipLuma(FfxFloat32x2 fUV, FfxUInt32 mipLevel) |
|
|
|
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH) |
|
|
|
FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos) |
|
|
|
{ |
|
|
|
return r_input_depth[iPxPos]; |
|
|
|
return r_input_depth[UNITY_FSR3_POS(iPxPos)]; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH) |
|
|
|
FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV) |
|
|
|
{ |
|
|
|
return r_input_depth.SampleLevel(s_LinearClamp, fUV, 0).x; |
|
|
|
return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FSR3_UV(fUV), 0).x; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
@ -511,14 +525,14 @@ FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos) |
|
|
|
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_COLOR) |
|
|
|
FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos) |
|
|
|
{ |
|
|
|
return r_input_color_jittered[iPxPos].rgb; |
|
|
|
return r_input_color_jittered[UNITY_FSR3_POS(iPxPos)].rgb; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_COLOR) |
|
|
|
FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV) |
|
|
|
{ |
|
|
|
return r_input_color_jittered.SampleLevel(s_LinearClamp, fUV, 0).rgb; |
|
|
|
return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FSR3_UV(fUV), 0).rgb; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
@ -532,7 +546,7 @@ FfxFloat32x3 LoadPreparedInputColor(FfxUInt32x2 iPxPos) |
|
|
|
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS) |
|
|
|
FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos) |
|
|
|
{ |
|
|
|
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[iPxDilatedMotionVectorPos].xy; |
|
|
|
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FSR3_POS(iPxDilatedMotionVectorPos)].xy; |
|
|
|
|
|
|
|
FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); |
|
|
|
|
|
|
|
@ -591,7 +605,7 @@ void StoreInternalColorAndWeight(FfxUInt32x2 iPxPos, FfxFloat32x4 fColorAndWeigh |
|
|
|
#if defined(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT) |
|
|
|
void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) |
|
|
|
{ |
|
|
|
rw_upscaled_output[iPxPos] = FfxFloat32x4(fColor, 1.f); |
|
|
|
rw_upscaled_output[UNITY_FSR3_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
@ -802,7 +816,7 @@ void StoreDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETE |
|
|
|
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY) |
|
|
|
FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) |
|
|
|
{ |
|
|
|
return r_input_opaque_only[iPxPos].xyz; |
|
|
|
return r_input_opaque_only[UNITY_FSR3_POS(iPxPos)].xyz; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|