-
Notifications
You must be signed in to change notification settings - Fork 316
Expand file tree
/
Copy pathffx_interface.h
More file actions
587 lines (545 loc) · 27.6 KB
/
ffx_interface.h
File metadata and controls
587 lines (545 loc) · 27.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
// This file is part of the FidelityFX SDK.
//
// Copyright (C) 2025 Advanced Micro Devices, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
#include "ffx_assert.h"
#include "ffx_internal_types.h"
#include "ffx_error.h"
#include "ffx_message.h"
#if defined(__cplusplus)
#define FFX_CPU
extern "C" {
#endif // #if defined(__cplusplus)
/// @defgroup Backends Backends
/// Core interface declarations and natively supported backends
///
/// @ingroup ffxSDK
/// @defgroup FfxInterface FfxInterface
/// FidelityFX SDK function signatures and core defines requiring
/// overrides for backend implementation.
///
/// @ingroup Backends
FFX_FORWARD_DECLARE(FfxInterface);
/// FidelityFX SDK major version.
///
/// @ingroup FfxInterface
#define FFX_SDK_VERSION_MAJOR (2)
/// FidelityFX SDK minor version.
///
/// @ingroup FfxInterface
#define FFX_SDK_VERSION_MINOR (0)
/// FidelityFX SDK patch version.
///
/// @ingroup FfxInterface
#define FFX_SDK_VERSION_PATCH (0)
/// Macro to pack a FidelityFX SDK version id together.
///
/// @ingroup FfxInterface
#define FFX_SDK_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch )
/// Stand in type for FfxPass
///
/// These will be defined for each effect individually (i.e. FfxFsr2Pass).
/// They are used to fetch the proper blob index to build effect shaders
///
/// @ingroup FfxInterface
typedef uint32_t FfxPass;
/// Get the SDK version of the backend context.
///
/// @param [in] backendInterface A pointer to the backend interface.
///
/// @returns
/// The SDK version a backend was built with.
///
/// @ingroup FfxInterface
typedef FfxVersionNumber(*FfxGetSDKVersionFunc)(
FfxInterface* backendInterface);
/// Get effect VRAM usage.
///
/// Newer effects may require support that legacy versions of the SDK will not be
/// able to provide. A version query is thus required to ensure an effect component
/// will always be paired with a backend which will support all needed functionality.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] effectContextId The context space to be used for the effect in question.
/// @param [out] outVramUsage The effect memory usage structure to fill out.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxGetEffectGpuMemoryUsageFunc)(FfxInterface* backendInterface, FfxUInt32 effectContextId, FfxApiEffectMemoryUsage* outVramUsage);
/// Create and initialize the backend context.
///
/// The callback function sets up the backend context for rendering.
/// It will create or reference the device and create required internal data structures.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] effect The effect the context is being created for
/// @param [in] bindlessConfig A pointer to the bindless configuration, if required by the effect.
/// @param [out] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxCreateBackendContextFunc)(
FfxInterface* backendInterface,
FfxEffect effect,
FfxEffectBindlessConfig* bindlessConfig,
FfxUInt32* effectContextId);
/// Get a list of capabilities of the device.
///
/// When creating an <c><i>FfxEffectContext</i></c> it is desirable for the FFX
/// core implementation to be aware of certain characteristics of the platform
/// that is being targetted. This is because some optimizations which FFX SDK
/// attempts to perform are more effective on certain classes of hardware than
/// others, or are not supported by older hardware. In order to avoid cases
/// where optimizations actually have the effect of decreasing performance, or
/// reduce the breadth of support provided by FFX SDK, the FFX interface queries the
/// capabilities of the device to make such decisions.
///
/// For target platforms with fixed hardware support you need not implement
/// this callback function by querying the device, but instead may hardcore
/// what features are available on the platform.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [out] outDeviceCapabilities The device capabilities structure to fill out.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode(*FfxGetDeviceCapabilitiesFunc)(
FfxInterface* backendInterface,
FfxDeviceCapabilities* outDeviceCapabilities);
/// Destroy the backend context and dereference the device.
///
/// This function is called when the <c><i>FfxEffectContext</i></c> is destroyed.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode(*FfxDestroyBackendContextFunc)(
FfxInterface* backendInterface,
FfxUInt32 effectContextId);
/// Create a resource.
///
/// This callback is intended for the backend to create internal resources.
///
/// Please note: It is also possible that the creation of resources might
/// itself cause additional resources to be created by simply calling the
/// <c><i>FfxCreateResourceFunc</i></c> function pointer again. This is
/// useful when handling the initial creation of resources which must be
/// initialized. The flow in such a case would be an initial call to create the
/// CPU-side resource, another to create the GPU-side resource, and then a call
/// to schedule a copy render job to move the data between the two. Typically
/// this type of function call flow is only seen during the creation of an
/// <c><i>FfxEffectContext</i></c>.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] createResourceDescription A pointer to a <c><i>FfxCreateResourceDescription</i></c>.
/// @param [in] effectContextId The context space to be used for the effect in question.
/// @param [out] outResource A pointer to a <c><i>FfxApiResource</i></c> object.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxCreateResourceFunc)(
FfxInterface* backendInterface,
const FfxCreateResourceDescription* createResourceDescription,
FfxUInt32 effectContextId,
FfxResourceInternal* outResource);
/// Register a resource in the backend for the current frame.
///
/// Since the FfxInterface and the backends are not aware how many different
/// resources will get passed in over time, it's not safe
/// to register all resources simultaneously in the backend.
/// Also passed resources may not be valid after the dispatch call.
/// As a result it's safest to register them as FfxResourceInternal
/// and clear them at the end of the dispatch call.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] inResource A pointer to a <c><i>FfxApiResource</i></c>.
/// @param [in] effectContextId The context space to be used for the effect in question.
/// @param [out] outResource A pointer to a <c><i>FfxResourceInternal</i></c> object.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode(*FfxRegisterResourceFunc)(
FfxInterface* backendInterface,
const FfxApiResource* inResource,
FfxUInt32 effectContextId,
FfxResourceInternal* outResource);
/// Get an FfxApiResource from an FfxResourceInternal resource.
///
/// At times it is necessary to create an FfxApiResource representation
/// of an internally created resource in order to register it with a
/// child effect context. This function sets up the FfxApiResource needed
/// to register.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] resource The <c><i>FfxResourceInternal</i></c> for which to setup an FfxApiResource.
///
/// @returns
/// An FfxApiResource built from the internal resource
///
/// @ingroup FfxInterface
typedef FfxApiResource(*FfxGetResourceFunc)(
FfxInterface* backendInterface,
FfxResourceInternal resource);
/// Unregister all temporary FfxResourceInternal from the backend.
///
/// Unregister FfxResourceInternal referencing resources passed to
/// a function as a parameter.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] commandList A pointer to a <c><i>FfxCommandList</i></c> structure.
/// @param [in] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode(*FfxUnregisterResourcesFunc)(
FfxInterface* backendInterface,
FfxCommandList commandList,
FfxUInt32 effectContextId);
/// Register a resource in the static bindless table of the backend.
///
/// A static resource will persist in their respective bindless table until it is
/// overwritten by a different resource at the same index.
/// The calling code must take care not to immediately register a new resource at an index
/// that might be in use by an in-flight frame.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] desc A pointer to an <c><i>FfxStaticResourceDescription</i></c>.
/// @param [in] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxRegisterStaticResourceFunc)(FfxInterface* backendInterface,
const FfxStaticResourceDescription* desc,
FfxUInt32 effectContextId);
/// Retrieve a <c><i>FfxApiResourceDescription</i></c> matching a
/// <c><i>FfxApiResource</i></c> structure.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] resource A pointer to a <c><i>FfxApiResource</i></c> object.
///
/// @returns
/// A description of the resource.
///
/// @ingroup FfxInterface
typedef FfxApiResourceDescription (*FfxGetResourceDescriptionFunc)(
FfxInterface* backendInterface,
FfxResourceInternal resource);
/// Destroy a resource
///
/// This callback is intended for the backend to release an internal resource.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] resource A pointer to a <c><i>FfxApiResource</i></c> object.
/// @param [in] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxDestroyResourceFunc)(
FfxInterface* backendInterface,
FfxResourceInternal resource,
FfxUInt32 effectContextId);
/// Map resource memory
///
/// Maps the memory of the resource to a pointer and returns it.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] resource A pointer to a <c><i>FfxApiResource</i></c> object.
/// @param [out] ptr A pointer to the mapped memory.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxMapResourceFunc)(FfxInterface* backendInterface, FfxResourceInternal resource, void** ptr);
/// Unmap resource memory
///
/// Unmaps previously mapped memory of a resource.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] resource A pointer to a <c><i>FfxApiResource</i></c> object.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxUnmapResourceFunc)(FfxInterface* backendInterface, FfxResourceInternal resource);
/// Create a heap
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] createHeapDescription A pointer to a <c><i>FfxCreateHeapDescription</i></c> object.
/// @param [in] effectContextId The context space to be used for the effect in question.
/// @param [out] outHeap A pointer to a <c><i>FfxResourceHeap</i></c> object.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxCreateHeapFunc)(FfxInterface* backendInterface, const FfxCreateHeapDescription* createHeapDescription, FfxUInt32 effectContextId, FfxResourceHeap* outHeap);
/// Destroy a heap
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] heap A pointer to a <c><i>FfxResourceHeap</i></c> object.
/// @param [in] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxDestroyHeapFunc)(FfxInterface* backendInterface, FfxResourceHeap heap, FfxUInt32 effectContextId);
/// Destroy a resource
///
/// This callback is intended for the backend to release an internal resource.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] resource A pointer to a <c><i>FfxApiResource</i></c> object.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxStageConstantBufferDataFunc)(
FfxInterface* backendInterface,
void* data,
FfxUInt32 size,
FfxConstantBuffer* constantBuffer);
/// Create a render pipeline.
///
/// A rendering pipeline contains the shader as well as resource bindpoints
/// and samplers.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] pass The identifier for the pass.
/// @param [in] pipelineDescription A pointer to a <c><i>FfxPipelineDescription</i></c> describing the pipeline to be created.
/// @param [in] effectContextId The context space to be used for the effect in question.
/// @param [out] outPipeline A pointer to a <c><i>FfxPipelineState</i></c> structure which should be populated.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxCreatePipelineFunc)(
FfxInterface* backendInterface,
FfxShaderBlob* pShaderBlob,
const FfxPipelineDescription* pipelineDescription,
FfxUInt32 effectContextId,
FfxPipelineState* outPipeline);
/// Destroy a render pipeline.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] effectContextId The context space to be used for the effect in question.
/// @param [out] pipeline A pointer to a <c><i>FfxPipelineState</i></c> structure which should be released.
/// @param [in] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxDestroyPipelineFunc)(
FfxInterface* backendInterface,
FfxPipelineState* pipeline,
FfxUInt32 effectContextId);
/// Schedule a render job to be executed on the next call of
/// <c><i>FfxExecuteGpuJobsFunc</i></c>.
///
/// Render jobs can perform one of three different tasks: clear, copy or
/// compute dispatches.
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] job A pointer to a <c><i>FfxGpuJobDescription</i></c> structure.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxScheduleGpuJobFunc)(
FfxInterface* backendInterface,
const FfxGpuJobDescription* job);
/// Execute scheduled render jobs on the <c><i>comandList</i></c> provided.
///
/// The recording of the graphics API commands should take place in this
/// callback function, the render jobs which were previously enqueued (via
/// callbacks made to <c><i>FfxScheduleGpuJobFunc</i></c>) should be
/// processed in the order they were received. Advanced users might choose to
/// reorder the rendering jobs, but should do so with care to respect the
/// resource dependencies.
///
/// Depending on the precise contents of <c><i>FfxDispatchDescription</i></c> a
/// different number of render jobs might have previously been enqueued (for
/// example if sharpening is toggled on and off).
///
/// @param [in] backendInterface A pointer to the backend interface.
/// @param [in] commandList A pointer to a <c><i>FfxCommandList</i></c> structure.
/// @param [in] effectContextId The context space to be used for the effect in question.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// Anything else The operation failed.
///
/// @ingroup FfxInterface
typedef FfxErrorCode (*FfxExecuteGpuJobsFunc)(
FfxInterface* backendInterface,
FfxCommandList commandList,
FfxUInt32 effectContextId);
typedef struct FfxFrameGenerationConfig FfxFrameGenerationConfig;
typedef FfxErrorCode (*FfxSwapChainConfigureFrameGenerationFunc)(FfxFrameGenerationConfig const* config);
/// Query the ABI version of the swapchain.
///
/// @param [in] swapchain The <c><i>FfxSwapchain</i></c> to query.
///
/// @ingroup FfxInterface
typedef FfxABIVersion(*FfxGetSwapchainABIFunc)(FfxSwapchain swapchain);
/// A structure encapsulating the interface between the core implementation of
/// the FfxInterface and any graphics API that it should ultimately call.
///
/// This set of functions serves as an abstraction layer between FfxInterfae and the
/// API used to implement it. While the FidelityFX SDK ships with backends for DirectX12 and
/// Vulkan, it is possible to implement your own backend for other platforms
/// which sit on top of your engine's own abstraction layer. For details on the
/// expectations of what each function should do you should refer the
/// description of the following function pointer types:
/// - <c><i>FfxCreateDeviceFunc</i></c>
/// - <c><i>FfxGetDeviceCapabilitiesFunc</i></c>
/// - <c><i>FfxDestroyDeviceFunc</i></c>
/// - <c><i>FfxCreateResourceFunc</i></c>
/// - <c><i>FfxRegisterResourceFunc</i></c>
/// - <c><i>FfxGetResourceFunc</i></c>
/// - <c><i>FfxUnregisterResourcesFunc</i></c>
/// - <c><i>FfxGetResourceDescriptionFunc</i></c>
/// - <c><i>FfxDestroyResourceFunc</i></c>
/// - <c><i>FfxCreatePipelineFunc</i></c>
/// - <c><i>FfxDestroyPipelineFunc</i></c>
/// - <c><i>FfxScheduleGpuJobFunc</i></c>
/// - <c><i>FfxExecuteGpuJobsFunc</i></c>
/// - <c><i>FfxBeginMarkerFunc</i></c>
/// - <c><i>FfxEndMarkerFunc</i></c>
/// - <c><i>FfxRegisterConstantBufferAllocatorFunc</i></c>
/// - <c><i>FfxGetSwapchainABIFunc</i></c>
///
/// Depending on the graphics API that is abstracted by the backend, it may be
/// required that the backend is to some extent stateful. To ensure that
/// applications retain full control to manage the memory used by the FidelityFX SDK, the
/// <c><i>scratchBuffer</i></c> and <c><i>scratchBufferSize</i></c> fields are
/// provided. A backend should provide a means of specifying how much scratch
/// memory is required for its internal implementation (e.g: via a function
/// or constant value). The application is then responsible for allocating that
/// memory and providing it when setting up the SDK backend. Backends provided
/// with the FidelityFX SDK do not perform dynamic memory allocations, and instead
/// sub-allocate all memory from the scratch buffers provided.
///
/// The <c><i>scratchBuffer</i></c> and <c><i>scratchBufferSize</i></c> fields
/// should be populated according to the requirements of each backend. For
/// example, if using the DirectX 12 backend you should call the
/// <c><i>ffxGetScratchMemorySizeDX12</i></c> function. It is not required
/// that custom backend implementations use a scratch buffer.
///
/// Any functional addition to this interface mandates a version
/// bump to ensure full functionality across effects and backends.
///
/// @ingroup FfxInterface
typedef struct FfxInterface {
// FidelityFX SDK 1.0 callback handles
FfxGetSDKVersionFunc fpGetSDKVersion; ///< A callback function to query the SDK version.
FfxGetEffectGpuMemoryUsageFunc fpGetEffectGpuMemoryUsage; ///< A callback function to query effect Gpu memory usage
FfxCreateBackendContextFunc fpCreateBackendContext; ///< A callback function to create and initialize the backend context.
FfxGetDeviceCapabilitiesFunc fpGetDeviceCapabilities; ///< A callback function to query device capabilites.
FfxDestroyBackendContextFunc fpDestroyBackendContext; ///< A callback function to destroy the backendcontext. This also dereferences the device.
FfxCreateResourceFunc fpCreateResource; ///< A callback function to create a resource.
FfxRegisterResourceFunc fpRegisterResource; ///< A callback function to register an external resource.
FfxGetResourceFunc fpGetResource; ///< A callback function to convert an internal resource to external resource type
FfxUnregisterResourcesFunc fpUnregisterResources; ///< A callback function to unregister external resource.
FfxRegisterStaticResourceFunc fpRegisterStaticResource; ///< A callback function to register a static resource.
FfxGetResourceDescriptionFunc fpGetResourceDescription; ///< A callback function to retrieve a resource description.
FfxDestroyResourceFunc fpDestroyResource; ///< A callback function to destroy a resource.
FfxMapResourceFunc fpMapResource; ///< A callback function to map a resource.
FfxUnmapResourceFunc fpUnmapResource; ///< A callback function to unmap a resource.
FfxStageConstantBufferDataFunc fpStageConstantBufferDataFunc; ///< A callback function to copy constant buffer data into staging memory.
FfxCreatePipelineFunc fpCreatePipeline; ///< A callback function to create a render or compute pipeline.
FfxDestroyPipelineFunc fpDestroyPipeline; ///< A callback function to destroy a render or compute pipeline.
FfxScheduleGpuJobFunc fpScheduleGpuJob; ///< A callback function to schedule a render job.
FfxExecuteGpuJobsFunc fpExecuteGpuJobs; ///< A callback function to execute all queued render jobs.
// FidelityFX SDK 1.1 callback handles
FfxSwapChainConfigureFrameGenerationFunc fpSwapChainConfigureFrameGeneration; ///< A callback function to configure swap chain present callback.
// FidelityFX SDK 2.1 callback handles
FfxGetSwapchainABIFunc fpGetSwapchainABI; ///< A callback function to query a swapchain's ABI version.
FfxCreateHeapFunc fpCreateHeap; ///< A callback function to create a heap.
FfxDestroyHeapFunc fpDestroyHeap; ///< A callback function to destroy a heap.
void* scratchBuffer; ///< A preallocated buffer for memory utilized internally by the backend.
size_t scratchBufferSize; ///< Size of the buffer pointed to by <c><i>scratchBuffer</i></c>.
FfxDevice device; ///< A backend specific device
} FfxInterface;
#if defined(__cplusplus)
}
#endif // #if defined(__cplusplus)