Debian Codegraph @

thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_hlsl.h

raw symbols SCIP
1 // This file is part of the FidelityFX SDK.
2 //
3 // Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 // THE SOFTWARE.
21
22 #include "ffx_fsr2_resources.h"
23
24 #if defined(FFX_GPU)
25 #ifdef __hlsl_dx_compiler
26 #pragma dxc diagnostic push
27 #pragma dxc diagnostic ignored "-Wambig-lit-shift"
28 #endif //__hlsl_dx_compiler
29 #include "ffx_core.h"
30 #ifdef __hlsl_dx_compiler
31 #pragma dxc diagnostic pop
32 #endif //__hlsl_dx_compiler
33 #endif // #if defined(FFX_GPU)
34
35 #if defined(FFX_GPU)
36 #ifndef FFX_FSR2_PREFER_WAVE64
37 #define FFX_FSR2_PREFER_WAVE64
38 #endif // #if defined(FFX_GPU)
39
40 #if defined(FFX_GPU)
41 #pragma warning(disable: 3205) // conversion from larger type to smaller
42 #endif // #if defined(FFX_GPU)
43
44 #define DECLARE_SRV_REGISTER(regIndex) t##regIndex
45 #define DECLARE_UAV_REGISTER(regIndex) u##regIndex
46 #define DECLARE_CB_REGISTER(regIndex) b##regIndex
47 #define FFX_FSR2_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex))
48 #define FFX_FSR2_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex))
49 #define FFX_FSR2_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex))
50
51 #if defined(FSR2_BIND_CB_FSR2) || defined(FFX_INTERNAL)
52 cbuffer cbFSR2 : FFX_FSR2_DECLARE_CB(FSR2_BIND_CB_FSR2)
53 {
54 FfxInt32x2 iRenderSize;
55 FfxInt32x2 iMaxRenderSize;
56 FfxInt32x2 iDisplaySize;
57 FfxInt32x2 iInputColorResourceDimensions;
58 FfxInt32x2 iLumaMipDimensions;
59 FfxInt32 iLumaMipLevelToUse;
60 FfxInt32 iFrameIndex;
61
62 FfxFloat32x4 fDeviceToViewDepth;
63 FfxFloat32x2 fJitter;
64 FfxFloat32x2 fMotionVectorScale;
65 FfxFloat32x2 fDownscaleFactor;
66 FfxFloat32x2 fMotionVectorJitterCancellation;
67 FfxFloat32 fPreExposure;
68 FfxFloat32 fPreviousFramePreExposure;
69 FfxFloat32 fTanHalfFOV;
70 FfxFloat32 fJitterSequenceLength;
71 FfxFloat32 fDeltaTime;
72 FfxFloat32 fDynamicResChangeFactor;
73 FfxFloat32 fViewSpaceToMetersFactor;
74 };
75
76 #define FFX_FSR2_CONSTANT_BUFFER_1_SIZE (sizeof(cbFSR2) / 4) // Number of 32-bit values. This must be kept in sync with the cbFSR2 size.
77 #endif
78
79 #if defined(FFX_GPU)
80 #define FFX_FSR2_ROOTSIG_STRINGIFY(p) FFX_FSR2_ROOTSIG_STR(p)
81 #define FFX_FSR2_ROOTSIG_STR(p) #p
82 #define FFX_FSR2_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \
83 "DescriptorTable(SRV(t0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \
84 "RootConstants(num32BitConstants=" FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_CONSTANT_BUFFER_1_SIZE) ", b0), " \
85 "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \
86 "addressU = TEXTURE_ADDRESS_CLAMP, " \
87 "addressV = TEXTURE_ADDRESS_CLAMP, " \
88 "addressW = TEXTURE_ADDRESS_CLAMP, " \
89 "comparisonFunc = COMPARISON_NEVER, " \
90 "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \
91 "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \
92 "addressU = TEXTURE_ADDRESS_CLAMP, " \
93 "addressV = TEXTURE_ADDRESS_CLAMP, " \
94 "addressW = TEXTURE_ADDRESS_CLAMP, " \
95 "comparisonFunc = COMPARISON_NEVER, " \
96 "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )]
97
98 #define FFX_FSR2_CONSTANT_BUFFER_2_SIZE 6 // Number of 32-bit values. This must be kept in sync with max( cbRCAS , cbSPD) size.
99
100 #define FFX_FSR2_CB2_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \
101 "DescriptorTable(SRV(t0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \
102 "RootConstants(num32BitConstants=" FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_CONSTANT_BUFFER_1_SIZE) ", b0), " \
103 "RootConstants(num32BitConstants=" FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_CONSTANT_BUFFER_2_SIZE) ", b1), " \
104 "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \
105 "addressU = TEXTURE_ADDRESS_CLAMP, " \
106 "addressV = TEXTURE_ADDRESS_CLAMP, " \
107 "addressW = TEXTURE_ADDRESS_CLAMP, " \
108 "comparisonFunc = COMPARISON_NEVER, " \
109 "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \
110 "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \
111 "addressU = TEXTURE_ADDRESS_CLAMP, " \
112 "addressV = TEXTURE_ADDRESS_CLAMP, " \
113 "addressW = TEXTURE_ADDRESS_CLAMP, " \
114 "comparisonFunc = COMPARISON_NEVER, " \
115 "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )]
116 #if defined(FFX_FSR2_EMBED_ROOTSIG)
117 #define FFX_FSR2_EMBED_ROOTSIG_CONTENT FFX_FSR2_ROOTSIG
118 #define FFX_FSR2_EMBED_CB2_ROOTSIG_CONTENT FFX_FSR2_CB2_ROOTSIG
119 #else
120 #define FFX_FSR2_EMBED_ROOTSIG_CONTENT
121 #define FFX_FSR2_EMBED_CB2_ROOTSIG_CONTENT
122 #endif // #if FFX_FSR2_EMBED_ROOTSIG
123 #endif // #if defined(FFX_GPU)
124
125 /* Define getter functions in the order they are defined in the CB! */
126 FfxInt32x2 RenderSize()
127 {
128 return iRenderSize;
129 }
130
131 FfxInt32x2 MaxRenderSize()
132 {
133 return iMaxRenderSize;
134 }
135
136 FfxInt32x2 DisplaySize()
137 {
138 return iDisplaySize;
139 }
140
141 FfxInt32x2 InputColorResourceDimensions()
142 {
143 return iInputColorResourceDimensions;
144 }
145
146 FfxInt32x2 LumaMipDimensions()
147 {
148 return iLumaMipDimensions;
149 }
150
151 FfxInt32 LumaMipLevelToUse()
152 {
153 return iLumaMipLevelToUse;
154 }
155
156 FfxInt32 FrameIndex()
157 {
158 return iFrameIndex;
159 }
160
161 FfxFloat32x2 Jitter()
162 {
163 return fJitter;
164 }
165
166 FfxFloat32x4 DeviceToViewSpaceTransformFactors()
167 {
168 return fDeviceToViewDepth;
169 }
170
171 FfxFloat32x2 MotionVectorScale()
172 {
173 return fMotionVectorScale;
174 }
175
176 FfxFloat32x2 DownscaleFactor()
177 {
178 return fDownscaleFactor;
179 }
180
181 FfxFloat32x2 MotionVectorJitterCancellation()
182 {
183 return fMotionVectorJitterCancellation;
184 }
185
186 FfxFloat32 PreExposure()
187 {
188 return fPreExposure;
189 }
190
191 FfxFloat32 PreviousFramePreExposure()
192 {
193 return fPreviousFramePreExposure;
194 }
195
196 FfxFloat32 TanHalfFoV()
197 {
198 return fTanHalfFOV;
199 }
200
201 FfxFloat32 JitterSequenceLength()
202 {
203 return fJitterSequenceLength;
204 }
205
206 FfxFloat32 DeltaTime()
207 {
208 return fDeltaTime;
209 }
210
211 FfxFloat32 DynamicResChangeFactor()
212 {
213 return fDynamicResChangeFactor;
214 }
215
216 FfxFloat32 ViewSpaceToMetersFactor()
217 {
218 return fViewSpaceToMetersFactor;
219 }
220
221
222 SamplerState s_PointClamp : register(s0);
223 SamplerState s_LinearClamp : register(s1);
224
225 // SRVs
226 #if defined(FFX_INTERNAL)
227 Texture2D<FfxFloat32x4> r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_OPAQUE_ONLY);
228 Texture2D<FfxFloat32x4> r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_COLOR);
229 Texture2D<FfxFloat32x4> r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_MOTION_VECTORS);
230 Texture2D<FfxFloat32> r_input_depth : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_DEPTH);
231 Texture2D<FfxFloat32x2> r_input_exposure : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_EXPOSURE);
232 Texture2D<FfxFloat32x2> r_auto_exposure : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTO_EXPOSURE);
233 Texture2D<FfxFloat32> r_reactive_mask : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_REACTIVE_MASK);
234 Texture2D<FfxFloat32> r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_TRANSPARENCY_AND_COMPOSITION_MASK);
235 Texture2D<FfxUInt32> r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_RECONSTRUCTED_PREVIOUS_NEAREST_DEPTH);
236 Texture2D<FfxFloat32x2> r_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS);
237 Texture2D<FfxFloat32x2> r_previous_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREVIOUS_DILATED_MOTION_VECTORS);
238 Texture2D<FfxFloat32> r_dilatedDepth : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_DEPTH);
239 Texture2D<FfxFloat32x4> r_internal_upscaled_color : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR);
240 Texture2D<unorm FfxFloat32x2> r_lock_status : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS);
241 Texture2D<FfxFloat32> r_lock_input_luma : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_INPUT_LUMA);
242 Texture2D<unorm FfxFloat32> r_new_locks : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_NEW_LOCKS);
243 Texture2D<FfxFloat32x4> r_prepared_input_color : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREPARED_INPUT_COLOR);
244 Texture2D<FfxFloat32x4> r_luma_history : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LUMA_HISTORY);
245 Texture2D<FfxFloat32x4> r_rcas_input : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_RCAS_INPUT);
246 Texture2D<FfxFloat32> r_lanczos_lut : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LANCZOS_LUT);
247 Texture2D<FfxFloat32> r_imgMips : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE);
248 Texture2D<FfxFloat32> r_upsample_maximum_bias_lut : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTITIER_UPSAMPLE_MAXIMUM_BIAS_LUT);
249 Texture2D<unorm FfxFloat32x2> r_dilated_reactive_masks : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_REACTIVE_MASKS);
250 Texture2D<float3> r_input_prev_color_pre_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR);
251 Texture2D<float3> r_input_prev_color_post_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR);
252
253 Texture2D<FfxFloat32x4> r_debug_out : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DEBUG_OUTPUT);
254
255 // UAV declarations
256 RWTexture2D<FfxUInt32> rw_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_RECONSTRUCTED_PREVIOUS_NEAREST_DEPTH);
257 RWTexture2D<FfxFloat32x2> rw_dilated_motion_vectors : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS);
258 RWTexture2D<FfxFloat32> rw_dilatedDepth : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_DEPTH);
259 RWTexture2D<FfxFloat32x4> rw_internal_upscaled_color : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR);
260 RWTexture2D<unorm FfxFloat32x2> rw_lock_status : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS);
261 RWTexture2D<FfxFloat32> rw_lock_input_luma : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_INPUT_LUMA);
262 RWTexture2D<unorm FfxFloat32> rw_new_locks : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_NEW_LOCKS);
263 RWTexture2D<FfxFloat32x4> rw_prepared_input_color : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_PREPARED_INPUT_COLOR);
264 RWTexture2D<FfxFloat32x4> rw_luma_history : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_LUMA_HISTORY);
265 RWTexture2D<FfxFloat32x4> rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_UPSCALED_OUTPUT);
266
267 globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE);
268 globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_5 : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_5);
269 RWTexture2D<unorm FfxFloat32x2> rw_dilated_reactive_masks : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_REACTIVE_MASKS);
270 RWTexture2D<FfxFloat32x2> rw_auto_exposure : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTO_EXPOSURE);
271 globallycoherent RWTexture2D<FfxUInt32> rw_spd_global_atomic : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_SPD_ATOMIC_COUNT);
272 RWTexture2D<FfxFloat32x4> rw_debug_out : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DEBUG_OUTPUT);
273
274 RWTexture2D<float> rw_output_autoreactive : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTOREACTIVE);
275 RWTexture2D<float> rw_output_autocomposition : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTOCOMPOSITION);
276 RWTexture2D<float3> rw_output_prev_color_pre_alpha : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR);
277 RWTexture2D<float3> rw_output_prev_color_post_alpha : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR);
278
279 #else // #if defined(FFX_INTERNAL)
280 #if defined FSR2_BIND_SRV_INPUT_COLOR
281 Texture2D<FfxFloat32x4> r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_COLOR);
282 #endif
283 #if defined FSR2_BIND_SRV_INPUT_OPAQUE_ONLY
284 Texture2D<FfxFloat32x4> r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY);
285 #endif
286 #if defined FSR2_BIND_SRV_INPUT_MOTION_VECTORS
287 Texture2D<FfxFloat32x4> r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_MOTION_VECTORS);
288 #endif
289 #if defined FSR2_BIND_SRV_INPUT_DEPTH
290 Texture2D<FfxFloat32> r_input_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_DEPTH);
291 #endif
292 #if defined FSR2_BIND_SRV_INPUT_EXPOSURE
293 Texture2D<FfxFloat32x2> r_input_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_EXPOSURE);
294 #endif
295 #if defined FSR2_BIND_SRV_AUTO_EXPOSURE
296 Texture2D<FfxFloat32x2> r_auto_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_AUTO_EXPOSURE);
297 #endif
298 #if defined FSR2_BIND_SRV_REACTIVE_MASK
299 Texture2D<FfxFloat32> r_reactive_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_REACTIVE_MASK);
300 #endif
301 #if defined FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK
302 Texture2D<FfxFloat32> r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK);
303 #endif
304 #if defined FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH
305 Texture2D<FfxUInt32> r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH);
306 #endif
307 #if defined FSR2_BIND_SRV_DILATED_MOTION_VECTORS
308 Texture2D<FfxFloat32x2> r_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_DILATED_MOTION_VECTORS);
309 #endif
310 #if defined FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS
311 Texture2D<FfxFloat32x2> r_previous_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS);
312 #endif
313 #if defined FSR2_BIND_SRV_DILATED_DEPTH
314 Texture2D<FfxFloat32> r_dilatedDepth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_DILATED_DEPTH);
315 #endif
316 #if defined FSR2_BIND_SRV_INTERNAL_UPSCALED
317 Texture2D<FfxFloat32x4> r_internal_upscaled_color : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INTERNAL_UPSCALED);
318 #endif
319 #if defined FSR2_BIND_SRV_LOCK_STATUS
320 Texture2D<unorm FfxFloat32x2> r_lock_status : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LOCK_STATUS);
321 #endif
322 #if defined FSR2_BIND_SRV_LOCK_INPUT_LUMA
323 Texture2D<FfxFloat32> r_lock_input_luma : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LOCK_INPUT_LUMA);
324 #endif
325 #if defined FSR2_BIND_SRV_NEW_LOCKS
326 Texture2D<unorm FfxFloat32> r_new_locks : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_NEW_LOCKS);
327 #endif
328 #if defined FSR2_BIND_SRV_PREPARED_INPUT_COLOR
329 Texture2D<FfxFloat32x4> r_prepared_input_color : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_PREPARED_INPUT_COLOR);
330 #endif
331 #if defined FSR2_BIND_SRV_LUMA_HISTORY
332 Texture2D<unorm FfxFloat32x4> r_luma_history : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LUMA_HISTORY);
333 #endif
334 #if defined FSR2_BIND_SRV_RCAS_INPUT
335 Texture2D<FfxFloat32x4> r_rcas_input : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RCAS_INPUT);
336 #endif
337 #if defined FSR2_BIND_SRV_LANCZOS_LUT
338 Texture2D<FfxFloat32> r_lanczos_lut : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LANCZOS_LUT);
339 #endif
340 #if defined FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS
341 Texture2D<FfxFloat32> r_imgMips : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS);
342 #endif
343 #if defined FSR2_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT
344 Texture2D<FfxFloat32> r_upsample_maximum_bias_lut : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT);
345 #endif
346 #if defined FSR2_BIND_SRV_DILATED_REACTIVE_MASKS
347 Texture2D<unorm FfxFloat32x2> r_dilated_reactive_masks : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_DILATED_REACTIVE_MASKS);
348 #endif
349
350 #if defined FSR2_BIND_SRV_PREV_PRE_ALPHA_COLOR
351 Texture2D<float3> r_input_prev_color_pre_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR);
352 #endif
353 #if defined FSR2_BIND_SRV_PREV_POST_ALPHA_COLOR
354 Texture2D<float3> r_input_prev_color_post_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR);
355 #endif
356
357 // UAV declarations
358 #if defined FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH
359 RWTexture2D<FfxUInt32> rw_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH);
360 #endif
361 #if defined FSR2_BIND_UAV_DILATED_MOTION_VECTORS
362 RWTexture2D<FfxFloat32x2> rw_dilated_motion_vectors : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_MOTION_VECTORS);
363 #endif
364 #if defined FSR2_BIND_UAV_DILATED_DEPTH
365 RWTexture2D<FfxFloat32> rw_dilatedDepth : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_DEPTH);
366 #endif
367 #if defined FSR2_BIND_UAV_INTERNAL_UPSCALED
368 RWTexture2D<FfxFloat32x4> rw_internal_upscaled_color : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_INTERNAL_UPSCALED);
369 #endif
370 #if defined FSR2_BIND_UAV_LOCK_STATUS
371 RWTexture2D<unorm FfxFloat32x2> rw_lock_status : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LOCK_STATUS);
372 #endif
373 #if defined FSR2_BIND_UAV_LOCK_INPUT_LUMA
374 RWTexture2D<FfxFloat32> rw_lock_input_luma : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LOCK_INPUT_LUMA);
375 #endif
376 #if defined FSR2_BIND_UAV_NEW_LOCKS
377 RWTexture2D<unorm FfxFloat32> rw_new_locks : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_NEW_LOCKS);
378 #endif
379 #if defined FSR2_BIND_UAV_PREPARED_INPUT_COLOR
380 RWTexture2D<FfxFloat32x4> rw_prepared_input_color : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREPARED_INPUT_COLOR);
381 #endif
382 #if defined FSR2_BIND_UAV_LUMA_HISTORY
383 RWTexture2D<FfxFloat32x4> rw_luma_history : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LUMA_HISTORY);
384 #endif
385 #if defined FSR2_BIND_UAV_UPSCALED_OUTPUT
386 RWTexture2D<FfxFloat32x4> rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_UPSCALED_OUTPUT);
387 #endif
388 #if defined FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE
389 globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE);
390 #endif
391 #if defined FSR2_BIND_UAV_EXPOSURE_MIP_5
392 globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_5 : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_5);
393 #endif
394 #if defined FSR2_BIND_UAV_DILATED_REACTIVE_MASKS
395 RWTexture2D<unorm FfxFloat32x2> rw_dilated_reactive_masks : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_REACTIVE_MASKS);
396 #endif
397 #if defined FSR2_BIND_UAV_EXPOSURE
398 RWTexture2D<FfxFloat32x2> rw_exposure : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE);
399 #endif
400 #if defined FSR2_BIND_UAV_AUTO_EXPOSURE
401 RWTexture2D<FfxFloat32x2> rw_auto_exposure : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_AUTO_EXPOSURE);
402 #endif
403 #if defined FSR2_BIND_UAV_SPD_GLOBAL_ATOMIC
404 globallycoherent RWTexture2D<FfxUInt32> rw_spd_global_atomic : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_SPD_GLOBAL_ATOMIC);
405 #endif
406
407 #if defined FSR2_BIND_UAV_AUTOREACTIVE
408 RWTexture2D<float> rw_output_autoreactive : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_AUTOREACTIVE);
409 #endif
410 #if defined FSR2_BIND_UAV_AUTOCOMPOSITION
411 RWTexture2D<float> rw_output_autocomposition : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_AUTOCOMPOSITION);
412 #endif
413 #if defined FSR2_BIND_UAV_PREV_PRE_ALPHA_COLOR
414 RWTexture2D<float3> rw_output_prev_color_pre_alpha : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREV_PRE_ALPHA_COLOR);
415 #endif
416 #if defined FSR2_BIND_UAV_PREV_POST_ALPHA_COLOR
417 RWTexture2D<float3> rw_output_prev_color_post_alpha : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREV_POST_ALPHA_COLOR);
418 #endif
419 #endif // #if defined(FFX_INTERNAL)
420
421 #if defined(FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS) || defined(FFX_INTERNAL)
422 FfxFloat32 LoadMipLuma(FfxUInt32x2 iPxPos, FfxUInt32 mipLevel)
423 {
424 return r_imgMips.mips[mipLevel][iPxPos];
425 }
426 #endif
427
428 #if defined(FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS) || defined(FFX_INTERNAL)
429 FfxFloat32 SampleMipLuma(FfxFloat32x2 fUV, FfxUInt32 mipLevel)
430 {
431 return r_imgMips.SampleLevel(s_LinearClamp, fUV, mipLevel);
432 }
433 #endif
434
435 #if defined(FSR2_BIND_SRV_INPUT_DEPTH) || defined(FFX_INTERNAL)
436 FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos)
437 {
438 return r_input_depth[iPxPos];
439 }
440 #endif
441
442 #if defined(FSR2_BIND_SRV_INPUT_DEPTH) || defined(FFX_INTERNAL)
443 FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV)
444 {
445 return r_input_depth.SampleLevel(s_LinearClamp, fUV, 0).x;
446 }
447 #endif
448
449 #if defined(FSR2_BIND_SRV_REACTIVE_MASK) || defined(FFX_INTERNAL)
450 FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos)
451 {
452 return r_reactive_mask[iPxPos];
453 }
454 #endif
455
456 #if defined(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK) || defined(FFX_INTERNAL)
457 FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos)
458 {
459 return r_transparency_and_composition_mask[iPxPos];
460 }
461 #endif
462
463 #if defined(FSR2_BIND_SRV_INPUT_COLOR) || defined(FFX_INTERNAL)
464 FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos)
465 {
466 return r_input_color_jittered[iPxPos].rgb;
467 }
468 #endif
469
470 #if defined(FSR2_BIND_SRV_INPUT_COLOR) || defined(FFX_INTERNAL)
471 FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV)
472 {
473 return r_input_color_jittered.SampleLevel(s_LinearClamp, fUV, 0).rgb;
474 }
475 #endif
476
477 #if defined(FSR2_BIND_SRV_PREPARED_INPUT_COLOR) || defined(FFX_INTERNAL)
478 FfxFloat32x3 LoadPreparedInputColor(FfxUInt32x2 iPxPos)
479 {
480 return r_prepared_input_color[iPxPos].xyz;
481 }
482 #endif
483
484 #if defined(FSR2_BIND_SRV_INPUT_MOTION_VECTORS) || defined(FFX_INTERNAL)
485 FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos)
486 {
487 FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[iPxDilatedMotionVectorPos].xy;
488
489 FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale();
490
491 #if FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
492 fUvMotionVector -= MotionVectorJitterCancellation();
493 #endif
494
495 return fUvMotionVector;
496 }
497 #endif
498
499 #if defined(FSR2_BIND_SRV_INTERNAL_UPSCALED) || defined(FFX_INTERNAL)
500 FfxFloat32x4 LoadHistory(FfxUInt32x2 iPxHistory)
501 {
502 return r_internal_upscaled_color[iPxHistory];
503 }
504 #endif
505
506 #if defined(FSR2_BIND_UAV_LUMA_HISTORY) || defined(FFX_INTERNAL)
507 void StoreLumaHistory(FfxUInt32x2 iPxPos, FfxFloat32x4 fLumaHistory)
508 {
509 rw_luma_history[iPxPos] = fLumaHistory;
510 }
511 #endif
512
513 #if defined(FSR2_BIND_SRV_LUMA_HISTORY) || defined(FFX_INTERNAL)
514 FfxFloat32x4 SampleLumaHistory(FfxFloat32x2 fUV)
515 {
516 return r_luma_history.SampleLevel(s_LinearClamp, fUV, 0);
517 }
518 #endif
519
520 #if defined(FFX_INTERNAL)
521 FfxFloat32x4 SampleDebug(FfxFloat32x2 fUV)
522 {
523 return r_debug_out.SampleLevel(s_LinearClamp, fUV, 0).w;
524 }
525 #endif
526
527 #if defined(FSR2_BIND_UAV_INTERNAL_UPSCALED) || defined(FFX_INTERNAL)
528 void StoreReprojectedHistory(FfxUInt32x2 iPxHistory, FfxFloat32x4 fHistory)
529 {
530 rw_internal_upscaled_color[iPxHistory] = fHistory;
531 }
532 #endif
533
534 #if defined(FSR2_BIND_UAV_INTERNAL_UPSCALED) || defined(FFX_INTERNAL)
535 void StoreInternalColorAndWeight(FfxUInt32x2 iPxPos, FfxFloat32x4 fColorAndWeight)
536 {
537 rw_internal_upscaled_color[iPxPos] = fColorAndWeight;
538 }
539 #endif
540
541 #if defined(FSR2_BIND_UAV_UPSCALED_OUTPUT) || defined(FFX_INTERNAL)
542 void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor)
543 {
544 rw_upscaled_output[iPxPos] = FfxFloat32x4(fColor, 1.f);
545 }
546 #endif
547
548 //LOCK_LIFETIME_REMAINING == 0
549 //Should make LockInitialLifetime() return a const 1.0f later
550 #if defined(FSR2_BIND_SRV_LOCK_STATUS) || defined(FFX_INTERNAL)
551 FfxFloat32x2 LoadLockStatus(FfxUInt32x2 iPxPos)
552 {
553 return r_lock_status[iPxPos];
554 }
555 #endif
556
557 #if defined(FSR2_BIND_UAV_LOCK_STATUS) || defined(FFX_INTERNAL)
558 void StoreLockStatus(FfxUInt32x2 iPxPos, FfxFloat32x2 fLockStatus)
559 {
560 rw_lock_status[iPxPos] = fLockStatus;
561 }
562 #endif
563
564 #if defined(FSR2_BIND_SRV_LOCK_INPUT_LUMA) || defined(FFX_INTERNAL)
565 FfxFloat32 LoadLockInputLuma(FfxUInt32x2 iPxPos)
566 {
567 return r_lock_input_luma[iPxPos];
568 }
569 #endif
570
571 #if defined(FSR2_BIND_UAV_LOCK_INPUT_LUMA) || defined(FFX_INTERNAL)
572 void StoreLockInputLuma(FfxUInt32x2 iPxPos, FfxFloat32 fLuma)
573 {
574 rw_lock_input_luma[iPxPos] = fLuma;
575 }
576 #endif
577
578 #if defined(FSR2_BIND_SRV_NEW_LOCKS) || defined(FFX_INTERNAL)
579 FfxFloat32 LoadNewLocks(FfxUInt32x2 iPxPos)
580 {
581 return r_new_locks[iPxPos];
582 }
583 #endif
584
585 #if defined(FSR2_BIND_UAV_NEW_LOCKS) || defined(FFX_INTERNAL)
586 FfxFloat32 LoadRwNewLocks(FfxUInt32x2 iPxPos)
587 {
588 return rw_new_locks[iPxPos];
589 }
590 #endif
591
592 #if defined(FSR2_BIND_UAV_NEW_LOCKS) || defined(FFX_INTERNAL)
593 void StoreNewLocks(FfxUInt32x2 iPxPos, FfxFloat32 newLock)
594 {
595 rw_new_locks[iPxPos] = newLock;
596 }
597 #endif
598
599 #if defined(FSR2_BIND_UAV_PREPARED_INPUT_COLOR) || defined(FFX_INTERNAL)
600 void StorePreparedInputColor(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 fTonemapped)
601 {
602 rw_prepared_input_color[iPxPos] = fTonemapped;
603 }
604 #endif
605
606 #if defined(FSR2_BIND_SRV_PREPARED_INPUT_COLOR) || defined(FFX_INTERNAL)
607 FfxFloat32 SampleDepthClip(FfxFloat32x2 fUV)
608 {
609 return r_prepared_input_color.SampleLevel(s_LinearClamp, fUV, 0).w;
610 }
611 #endif
612
613 #if defined(FSR2_BIND_SRV_LOCK_STATUS) || defined(FFX_INTERNAL)
614 FfxFloat32x2 SampleLockStatus(FfxFloat32x2 fUV)
615 {
616 FfxFloat32x2 fLockStatus = r_lock_status.SampleLevel(s_LinearClamp, fUV, 0);
617 return fLockStatus;
618 }
619 #endif
620
621 #if defined(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH) || defined(FFX_INTERNAL)
622 FfxFloat32 LoadReconstructedPrevDepth(FfxUInt32x2 iPxPos)
623 {
624 return asfloat(r_reconstructed_previous_nearest_depth[iPxPos]);
625 }
626 #endif
627
628 #if defined(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH) || defined(FFX_INTERNAL)
629 void StoreReconstructedDepth(FfxUInt32x2 iPxSample, FfxFloat32 fDepth)
630 {
631 FfxUInt32 uDepth = asuint(fDepth);
632
633 #if FFX_FSR2_OPTION_INVERTED_DEPTH
634 InterlockedMax(rw_reconstructed_previous_nearest_depth[iPxSample], uDepth);
635 #else
636 InterlockedMin(rw_reconstructed_previous_nearest_depth[iPxSample], uDepth); // min for standard, max for inverted depth
637 #endif
638 }
639 #endif
640
641 #if defined(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH) || defined(FFX_INTERNAL)
642 void SetReconstructedDepth(FfxUInt32x2 iPxSample, const FfxUInt32 uValue)
643 {
644 rw_reconstructed_previous_nearest_depth[iPxSample] = uValue;
645 }
646 #endif
647
648 #if defined(FSR2_BIND_UAV_DILATED_DEPTH) || defined(FFX_INTERNAL)
649 void StoreDilatedDepth(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 fDepth)
650 {
651 rw_dilatedDepth[iPxPos] = fDepth;
652 }
653 #endif
654
655 #if defined(FSR2_BIND_UAV_DILATED_MOTION_VECTORS) || defined(FFX_INTERNAL)
656 void StoreDilatedMotionVector(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 fMotionVector)
657 {
658 rw_dilated_motion_vectors[iPxPos] = fMotionVector;
659 }
660 #endif
661
662 #if defined(FSR2_BIND_SRV_DILATED_MOTION_VECTORS) || defined(FFX_INTERNAL)
663 FfxFloat32x2 LoadDilatedMotionVector(FfxUInt32x2 iPxInput)
664 {
665 return r_dilated_motion_vectors[iPxInput].xy;
666 }
667 #endif
668
669 #if defined(FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS) || defined(FFX_INTERNAL)
670 FfxFloat32x2 LoadPreviousDilatedMotionVector(FfxUInt32x2 iPxInput)
671 {
672 return r_previous_dilated_motion_vectors[iPxInput].xy;
673 }
674
675 FfxFloat32x2 SamplePreviousDilatedMotionVector(FfxFloat32x2 uv)
676 {
677 return r_previous_dilated_motion_vectors.SampleLevel(s_LinearClamp, uv, 0).xy;
678 }
679 #endif
680
681 #if defined(FSR2_BIND_SRV_DILATED_DEPTH) || defined(FFX_INTERNAL)
682 FfxFloat32 LoadDilatedDepth(FfxUInt32x2 iPxInput)
683 {
684 return r_dilatedDepth[iPxInput];
685 }
686 #endif
687
688 #if defined(FSR2_BIND_SRV_INPUT_EXPOSURE) || defined(FFX_INTERNAL)
689 FfxFloat32 Exposure()
690 {
691 FfxFloat32 exposure = r_input_exposure[FfxUInt32x2(0, 0)].x;
692
693 if (exposure == 0.0f) {
694 exposure = 1.0f;
695 }
696
697 return exposure;
698 }
699 #endif
700
701 #if defined(FSR2_BIND_SRV_AUTO_EXPOSURE) || defined(FFX_INTERNAL)
702 FfxFloat32 AutoExposure()
703 {
704 FfxFloat32 exposure = r_auto_exposure[FfxUInt32x2(0, 0)].x;
705
706 if (exposure == 0.0f) {
707 exposure = 1.0f;
708 }
709
710 return exposure;
711 }
712 #endif
713
714 FfxFloat32 SampleLanczos2Weight(FfxFloat32 x)
715 {
716 #if defined(FSR2_BIND_SRV_LANCZOS_LUT) || defined(FFX_INTERNAL)
717 return r_lanczos_lut.SampleLevel(s_LinearClamp, FfxFloat32x2(x / 2, 0.5f), 0);
718 #else
719 return 0.f;
720 #endif
721 }
722
723 #if defined(FSR2_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT) || defined(FFX_INTERNAL)
724 FfxFloat32 SampleUpsampleMaximumBias(FfxFloat32x2 uv)
725 {
726 // Stored as a SNORM, so make sure to multiply by 2 to retrieve the actual expected range.
727 return FfxFloat32(2.0) * r_upsample_maximum_bias_lut.SampleLevel(s_LinearClamp, abs(uv) * 2.0, 0);
728 }
729 #endif
730
731 #if defined(FSR2_BIND_SRV_DILATED_REACTIVE_MASKS) || defined(FFX_INTERNAL)
732 FfxFloat32x2 SampleDilatedReactiveMasks(FfxFloat32x2 fUV)
733 {
734 return r_dilated_reactive_masks.SampleLevel(s_LinearClamp, fUV, 0);
735 }
736 #endif
737
738 #if defined(FSR2_BIND_SRV_DILATED_REACTIVE_MASKS) || defined(FFX_INTERNAL)
739 FfxFloat32x2 LoadDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos)
740 {
741 return r_dilated_reactive_masks[iPxPos];
742 }
743 #endif
744
745 #if defined(FSR2_BIND_UAV_DILATED_REACTIVE_MASKS) || defined(FFX_INTERNAL)
746 void StoreDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 fDilatedReactiveMasks)
747 {
748 rw_dilated_reactive_masks[iPxPos] = fDilatedReactiveMasks;
749 }
750 #endif
751
752 #if defined(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY) || defined(FFX_INTERNAL)
753 FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos)
754 {
755 return r_input_opaque_only[iPxPos].xyz;
756 }
757 #endif
758
759 #if defined(FSR2_BIND_SRV_PREV_PRE_ALPHA_COLOR) || defined(FFX_INTERNAL)
760 FfxFloat32x3 LoadPrevPreAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos)
761 {
762 return r_input_prev_color_pre_alpha[iPxPos];
763 }
764 #endif
765
766 #if defined(FSR2_BIND_SRV_PREV_POST_ALPHA_COLOR) || defined(FFX_INTERNAL)
767 FfxFloat32x3 LoadPrevPostAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos)
768 {
769 return r_input_prev_color_post_alpha[iPxPos];
770 }
771 #endif
772
773 #if defined(FSR2_BIND_UAV_AUTOREACTIVE) || defined(FFX_INTERNAL)
774 #if defined(FSR2_BIND_UAV_AUTOCOMPOSITION) || defined(FFX_INTERNAL)
775 void StoreAutoReactive(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F2 fReactive)
776 {
777 rw_output_autoreactive[iPxPos] = fReactive.x;
778
779 rw_output_autocomposition[iPxPos] = fReactive.y;
780 }
781 #endif
782 #endif
783
784 #if defined(FSR2_BIND_UAV_PREV_PRE_ALPHA_COLOR) || defined(FFX_INTERNAL)
785 void StorePrevPreAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F3 color)
786 {
787 rw_output_prev_color_pre_alpha[iPxPos] = color;
788
789 }
790 #endif
791
792 #if defined(FSR2_BIND_UAV_PREV_POST_ALPHA_COLOR) || defined(FFX_INTERNAL)
793 void StorePrevPostAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F3 color)
794 {
795 rw_output_prev_color_post_alpha[iPxPos] = color;
796 }
797 #endif
798
799 #endif // #if defined(FFX_GPU)