1pub const FFX_MAX_NUM_SRVS: u32 = 16;
4pub const FFX_MAX_NUM_UAVS: u32 = 8;
5pub const FFX_MAX_NUM_CONST_BUFFERS: u32 = 2;
6pub const FFX_MAX_CONST_SIZE: u32 = 64;
7pub const FFX_UNSPECIFIED_VERSION: u32 = 4294946048;
8pub const FFX_MAXIMUM_PATH: u32 = 260;
9pub const FFX_FSR2_VERSION_MAJOR: u32 = 2;
10pub const FFX_FSR2_VERSION_MINOR: u32 = 2;
11pub const FFX_FSR2_VERSION_PATCH: u32 = 0;
12pub const FFX_FSR2_CONTEXT_SIZE: u32 = 16536;
13#[doc = "< Unknown format"]
14pub const FFX_SURFACE_FORMAT_UNKNOWN: SurfaceFormat = 0;
15#[doc = "< 32 bit per channel, 4 channel typeless format"]
16pub const FFX_SURFACE_FORMAT_R32G32B32A32_TYPELESS: SurfaceFormat = 1;
17#[doc = "< 32 bit per channel, 4 channel float format"]
18pub const FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT: SurfaceFormat = 2;
19#[doc = "< 16 bit per channel, 4 channel float format"]
20pub const FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT: SurfaceFormat = 3;
21#[doc = "< 16 bit per channel, 4 channel unsigned normalized format"]
22pub const FFX_SURFACE_FORMAT_R16G16B16A16_UNORM: SurfaceFormat = 4;
23#[doc = "< 32 bit per channel, 2 channel float format"]
24pub const FFX_SURFACE_FORMAT_R32G32_FLOAT: SurfaceFormat = 5;
25#[doc = "< 32 bit per channel, 1 channel float format"]
26pub const FFX_SURFACE_FORMAT_R32_UINT: SurfaceFormat = 6;
27#[doc = "< 8 bit per channel, 4 channel float format"]
28pub const FFX_SURFACE_FORMAT_R8G8B8A8_TYPELESS: SurfaceFormat = 7;
29#[doc = "< 8 bit per channel, 4 channel unsigned normalized format"]
30pub const FFX_SURFACE_FORMAT_R8G8B8A8_UNORM: SurfaceFormat = 8;
31#[doc = "< 32 bit 3 channel float format"]
32pub const FFX_SURFACE_FORMAT_R11G11B10_FLOAT: SurfaceFormat = 9;
33#[doc = "< 16 bit per channel, 2 channel float format"]
34pub const FFX_SURFACE_FORMAT_R16G16_FLOAT: SurfaceFormat = 10;
35#[doc = "< 16 bit per channel, 2 channel unsigned int format"]
36pub const FFX_SURFACE_FORMAT_R16G16_UINT: SurfaceFormat = 11;
37#[doc = "< 16 bit per channel, 1 channel float format"]
38pub const FFX_SURFACE_FORMAT_R16_FLOAT: SurfaceFormat = 12;
39#[doc = "< 16 bit per channel, 1 channel unsigned int format"]
40pub const FFX_SURFACE_FORMAT_R16_UINT: SurfaceFormat = 13;
41#[doc = "< 16 bit per channel, 1 channel unsigned normalized format"]
42pub const FFX_SURFACE_FORMAT_R16_UNORM: SurfaceFormat = 14;
43#[doc = "< 16 bit per channel, 1 channel signed normalized format"]
44pub const FFX_SURFACE_FORMAT_R16_SNORM: SurfaceFormat = 15;
45#[doc = "< 8 bit per channel, 1 channel unsigned normalized format"]
46pub const FFX_SURFACE_FORMAT_R8_UNORM: SurfaceFormat = 16;
47#[doc = "< 8 bit per channel, 1 channel unsigned int format"]
48pub const FFX_SURFACE_FORMAT_R8_UINT: SurfaceFormat = 17;
49#[doc = "< 8 bit per channel, 2 channel unsigned normalized format"]
50pub const FFX_SURFACE_FORMAT_R8G8_UNORM: SurfaceFormat = 18;
51#[doc = "< 32 bit per channel, 1 channel float format"]
52pub const FFX_SURFACE_FORMAT_R32_FLOAT: SurfaceFormat = 19;
53#[doc = " An enumeration of surface formats."]
54pub type SurfaceFormat = ::std::os::raw::c_int;
55#[doc = "< No usage flags indicate a resource is read only."]
56pub const FFX_RESOURCE_USAGE_READ_ONLY: ResourceUsage = 0;
57#[doc = "< Indicates a resource will be used as render target."]
58pub const FFX_RESOURCE_USAGE_RENDERTARGET: ResourceUsage = 1;
59#[doc = "< Indicates a resource will be used as UAV."]
60pub const FFX_RESOURCE_USAGE_UAV: ResourceUsage = 2;
61#[doc = " An enumeration of resource usage."]
62pub type ResourceUsage = ::std::os::raw::c_int;
63#[repr(i32)]
64#[doc = " An enumeration of resource states."]
65#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
66pub enum ResourceStates {
67 #[doc = "< Indicates a resource is in the state to be used as UAV."]
68 UNORDERED_ACCESS = 1,
69 #[doc = "< Indicates a resource is in the state to be read by compute shaders."]
70 COMPUTE_READ = 2,
71 #[doc = "< Indicates a resource is in the state to be used as source in a copy command."]
72 COPY_SRC = 4,
73 #[doc = "< Indicates a resource is in the state to be used as destination in a copy command."]
74 COPY_DEST = 8,
75 #[doc = "< Indicates a resource is in generic (slow) read state."]
76 GENERIC_READ = 6,
77}
78#[doc = "< A resource with a single dimension."]
79pub const FFX_RESOURCE_DIMENSION_TEXTURE_1D: ResourceDimension = 0;
80#[doc = "< A resource with two dimensions."]
81pub const FFX_RESOURCE_DIMENSION_TEXTURE_2D: ResourceDimension = 1;
82#[doc = " An enumeration of surface dimensions."]
83pub type ResourceDimension = ::std::os::raw::c_int;
84#[doc = "< No flags."]
85pub const FFX_RESOURCE_FLAGS_NONE: ResourceFlags = 0;
86#[doc = "< A bit indicating a resource does not need to persist across frames."]
87pub const FFX_RESOURCE_FLAGS_ALIASABLE: ResourceFlags = 1;
88#[doc = " An enumeration of surface dimensions."]
89pub type ResourceFlags = ::std::os::raw::c_int;
90#[doc = "< The resource view is an unordered access view (UAV)."]
91pub const FFX_RESOURCE_VIEW_UNORDERED_ACCESS: ResourceViewType = 0;
92#[doc = "< The resource view is a shader resource view (SRV)."]
93pub const FFX_RESOURCE_VIEW_SHADER_READ: ResourceViewType = 1;
94#[doc = " An enumeration of all resource view types."]
95pub type ResourceViewType = ::std::os::raw::c_int;
96#[doc = "< Point sampling."]
97pub const FFX_FILTER_TYPE_POINT: FilterType = 0;
98#[doc = "< Sampling with interpolation."]
99pub const FFX_FILTER_TYPE_LINEAR: FilterType = 1;
100#[doc = " The type of filtering to perform when reading a texture."]
101pub type FilterType = ::std::os::raw::c_int;
102#[doc = "< Shader model 5.1."]
103pub const FFX_SHADER_MODEL_5_1: ShaderModel = 0;
104#[doc = "< Shader model 6.0."]
105pub const FFX_SHADER_MODEL_6_0: ShaderModel = 1;
106#[doc = "< Shader model 6.1."]
107pub const FFX_SHADER_MODEL_6_1: ShaderModel = 2;
108#[doc = "< Shader model 6.2."]
109pub const FFX_SHADER_MODEL_6_2: ShaderModel = 3;
110#[doc = "< Shader model 6.3."]
111pub const FFX_SHADER_MODEL_6_3: ShaderModel = 4;
112#[doc = "< Shader model 6.4."]
113pub const FFX_SHADER_MODEL_6_4: ShaderModel = 5;
114#[doc = "< Shader model 6.5."]
115pub const FFX_SHADER_MODEL_6_5: ShaderModel = 6;
116#[doc = "< Shader model 6.6."]
117pub const FFX_SHADER_MODEL_6_6: ShaderModel = 7;
118#[doc = "< Shader model 6.7."]
119pub const FFX_SHADER_MODEL_6_7: ShaderModel = 8;
120#[doc = " An enumeration of all supported shader models."]
121pub type ShaderModel = ::std::os::raw::c_int;
122#[doc = "< The resource is a buffer."]
123pub const FFX_RESOURCE_TYPE_BUFFER: ResourceType = 0;
124#[doc = "< The resource is a 1-dimensional texture."]
125pub const FFX_RESOURCE_TYPE_TEXTURE1D: ResourceType = 1;
126#[doc = "< The resource is a 2-dimensional texture."]
127pub const FFX_RESOURCE_TYPE_TEXTURE2D: ResourceType = 2;
128#[doc = "< The resource is a 3-dimensional texture."]
129pub const FFX_RESOURCE_TYPE_TEXTURE3D: ResourceType = 3;
130pub type ResourceType = ::std::os::raw::c_int;
131#[doc = "< Local memory."]
132pub const FFX_HEAP_TYPE_DEFAULT: HeapType = 0;
133#[doc = "< Heap used for uploading resources."]
134pub const FFX_HEAP_TYPE_UPLOAD: HeapType = 1;
135#[doc = " An enumeration for different heap types"]
136pub type HeapType = ::std::os::raw::c_int;
137#[doc = "< The GPU job is performing a floating-point clear."]
138pub const FFX_GPU_JOB_CLEAR_FLOAT: GpuJobType = 0;
139#[doc = "< The GPU job is performing a copy."]
140pub const FFX_GPU_JOB_COPY: GpuJobType = 1;
141#[doc = "< The GPU job is performing a compute dispatch."]
142pub const FFX_GPU_JOB_COMPUTE: GpuJobType = 2;
143#[doc = " An enumberation for different render job types"]
144pub type GpuJobType = ::std::os::raw::c_int;
145#[doc = " A typedef representing the graphics device."]
146pub type Device = *mut ::std::os::raw::c_void;
147#[doc = " A typedef representing a command list or command buffer."]
148#[repr(transparent)]
149#[derive(Debug, Copy, Clone)]
150pub struct CommandList(pub *mut ::std::os::raw::c_void);
151#[doc = " A typedef for a root signature."]
152pub type RootSignature = *mut ::std::os::raw::c_void;
153#[doc = " A typedef for a pipeline state object."]
154pub type Pipeline = *mut ::std::os::raw::c_void;
155#[doc = " A structure encapasulating a collection of device capabilities."]
156#[repr(C)]
157#[derive(Debug, Copy, Clone)]
158pub struct DeviceCapabilities {
159 #[doc = "< The minimum shader model supported by the device."]
160 pub minimumSupportedShaderModel: ShaderModel,
161 #[doc = "< The minimum supported wavefront width."]
162 pub waveLaneCountMin: u32,
163 #[doc = "< The maximum supported wavefront width."]
164 pub waveLaneCountMax: u32,
165 #[doc = "< The device supports FP16 in hardware."]
166 pub fp16Supported: bool,
167 #[doc = "< The device supports raytracing."]
168 pub raytracingSupported: bool,
169}
170impl Default for DeviceCapabilities {
171 fn default() -> Self {
172 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
173 unsafe {
174 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
175 s.assume_init()
176 }
177 }
178}
179#[doc = " A structure encapsulating a 2-dimensional point, using 32bit unsigned integers."]
180#[repr(C)]
181#[derive(Debug, Default, Copy, Clone)]
182pub struct Dimensions2D {
183 #[doc = "< The width of a 2-dimensional range."]
184 pub width: u32,
185 #[doc = "< The height of a 2-dimensional range."]
186 pub height: u32,
187}
188#[doc = " A structure encapsulating a 2-dimensional point,"]
189#[repr(C)]
190#[derive(Debug, Default, Copy, Clone)]
191pub struct IntCoords2D {
192 #[doc = "< The x coordinate of a 2-dimensional point."]
193 pub x: i32,
194 #[doc = "< The y coordinate of a 2-dimensional point."]
195 pub y: i32,
196}
197#[doc = " A structure encapsulating a 2-dimensional set of floating point coordinates."]
198#[repr(C)]
199#[derive(Debug, Default, Copy, Clone)]
200pub struct FloatCoords2D {
201 #[doc = "< The x coordinate of a 2-dimensional point."]
202 pub x: f32,
203 #[doc = "< The y coordinate of a 2-dimensional point."]
204 pub y: f32,
205}
206#[doc = " A structure describing a resource."]
207#[repr(C)]
208#[derive(Debug, Copy, Clone)]
209pub struct ResourceDescription {
210 #[doc = "< The type of the resource."]
211 pub type_: ResourceType,
212 #[doc = "< The surface format."]
213 pub format: SurfaceFormat,
214 #[doc = "< The width of the resource."]
215 pub width: u32,
216 #[doc = "< The height of the resource."]
217 pub height: u32,
218 #[doc = "< The depth of the resource."]
219 pub depth: u32,
220 #[doc = "< Number of mips (or 0 for full mipchain)."]
221 pub mipCount: u32,
222 #[doc = "< A set of <c><i>FfxResourceFlags</i></c> flags."]
223 pub flags: ResourceFlags,
224}
225impl Default for ResourceDescription {
226 fn default() -> Self {
227 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
228 unsafe {
229 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
230 s.assume_init()
231 }
232 }
233}
234#[doc = " An outward facing structure containing a resource"]
235#[repr(C)]
236pub struct Resource {
237 #[doc = "< pointer to the resource."]
238 pub resource: *mut ::std::os::raw::c_void,
239 pub name: [widechar; 64usize],
240 pub description: ResourceDescription,
241 pub state: ResourceStates,
242 pub isDepth: bool,
243 pub descriptorData: u64,
244}
245impl Default for Resource {
246 fn default() -> Self {
247 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
248 unsafe {
249 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
250 s.assume_init()
251 }
252 }
253}
254#[doc = " An internal structure containing a handle to a resource and resource views"]
255#[repr(C)]
256#[derive(Debug, Default, Copy, Clone)]
257pub struct ResourceInternal {
258 #[doc = "< The index of the resource."]
259 pub internalIndex: i32,
260}
261#[doc = " A structure defining a resource bind point"]
262#[repr(C)]
263pub struct ResourceBinding {
264 pub slotIndex: u32,
265 pub resourceIdentifier: u32,
266 pub name: [widechar; 64usize],
267}
268impl Default for ResourceBinding {
269 fn default() -> Self {
270 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
271 unsafe {
272 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
273 s.assume_init()
274 }
275 }
276}
277#[doc = " A structure encapsulating a single pass of an algorithm."]
278#[repr(C)]
279pub struct PipelineState {
280 #[doc = "< The pipelines rootSignature"]
281 pub rootSignature: RootSignature,
282 #[doc = "< The pipeline object"]
283 pub pipeline: Pipeline,
284 #[doc = "< Count of UAVs used in this pipeline"]
285 pub uavCount: u32,
286 #[doc = "< Count of SRVs used in this pipeline"]
287 pub srvCount: u32,
288 #[doc = "< Count of constant buffers used in this pipeline"]
289 pub constCount: u32,
290 #[doc = "< Array of ResourceIdentifiers bound as UAVs"]
291 pub uavResourceBindings: [ResourceBinding; 8usize],
292 #[doc = "< Array of ResourceIdentifiers bound as SRVs"]
293 pub srvResourceBindings: [ResourceBinding; 16usize],
294 #[doc = "< Array of ResourceIdentifiers bound as CBs"]
295 pub cbResourceBindings: [ResourceBinding; 2usize],
296}
297impl Default for PipelineState {
298 fn default() -> Self {
299 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
300 unsafe {
301 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
302 s.assume_init()
303 }
304 }
305}
306#[doc = " A structure containing the data required to create a resource."]
307#[repr(C)]
308#[derive(Debug, Copy, Clone)]
309pub struct CreateResourceDescription {
310 #[doc = "< The heap type to hold the resource, typically <c><i>FFX_HEAP_TYPE_DEFAULT</i></c>."]
311 pub heapType: HeapType,
312 #[doc = "< A resource description."]
313 pub resourceDescription: ResourceDescription,
314 #[doc = "< The initial resource state."]
315 pub initalState: ResourceStates,
316 #[doc = "< Size of initial data buffer."]
317 pub initDataSize: u32,
318 #[doc = "< Buffer containing data to fill the resource."]
319 pub initData: *mut ::std::os::raw::c_void,
320 #[doc = "< Name of the resource."]
321 pub name: *const widechar,
322 #[doc = "< Resource usage flags."]
323 pub usage: ResourceUsage,
324 #[doc = "< Internal resource ID."]
325 pub id: u32,
326}
327impl Default for CreateResourceDescription {
328 fn default() -> Self {
329 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
330 unsafe {
331 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
332 s.assume_init()
333 }
334 }
335}
336#[doc = " A structure containing the description used to create a\n <c><i>FfxPipeline</i></c> structure.\n\n A pipeline is the name given to a shader and the collection of state that\n is required to dispatch it. In the context of FSR2 and its architecture\n this means that a <c><i>FfxPipelineDescription</i></c> will map to either a\n monolithic object in an explicit API (such as a\n <c><i>PipelineStateObject</i></c> in DirectX 12). Or a shader and some\n ancillary API objects (in something like DirectX 11).\n\n The <c><i>contextFlags</i></c> field contains a copy of the flags passed\n to <c><i>ffxFsr2ContextCreate</i></c> via the <c><i>flags</i></c> field of\n the <c><i>FfxFsr2InitializationParams</i></c> structure. These flags are\n used to determine which permutation of a pipeline for a specific\n <c><i>FfxFsr2Pass</i></c> should be used to implement the features required\n by each application, as well as to acheive the best performance on specific\n target hardware configurations.\n\n When using one of the provided backends for FSR2 (such as DirectX 12 or\n Vulkan) the data required to create a pipeline is compiled offline and\n included into the backend library that you are using. For cases where the\n backend interface is overriden by providing custom callback function\n implementations care should be taken to respect the contents of the\n <c><i>contextFlags</i></c> field in order to correctly support the options\n provided by FSR2, and acheive best performance.\n\n @ingroup FSR2"]
337#[repr(C)]
338#[derive(Debug, Copy, Clone)]
339pub struct PipelineDescription {
340 #[doc = "< A collection of <c><i>FfxFsr2InitializationFlagBits</i></c> which were passed to the context."]
341 pub contextFlags: u32,
342 #[doc = "< Array of static samplers."]
343 pub samplers: *mut FilterType,
344 #[doc = "< The number of samples contained inside <c><i>samplers</i></c>."]
345 pub samplerCount: usize,
346 #[doc = "< Array containing the sizes of the root constant buffers (count of 32 bit elements)."]
347 pub rootConstantBufferSizes: *const u32,
348 #[doc = "< The number of root constants contained within <c><i>rootConstantBufferSizes</i></c>."]
349 pub rootConstantBufferCount: u32,
350}
351impl Default for PipelineDescription {
352 fn default() -> Self {
353 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
354 unsafe {
355 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
356 s.assume_init()
357 }
358 }
359}
360#[doc = " A structure containing a constant buffer."]
361#[repr(C)]
362#[derive(Debug, Copy, Clone)]
363pub struct ConstantBuffer {
364 #[doc = "< Size of 32 bit chunks used in the constant buffer"]
365 pub uint32Size: u32,
366 #[doc = "< Constant buffer data"]
367 pub data: [u32; 64usize],
368}
369impl Default for ConstantBuffer {
370 fn default() -> Self {
371 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
372 unsafe {
373 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
374 s.assume_init()
375 }
376 }
377}
378#[doc = " A structure describing a clear render job."]
379#[repr(C)]
380#[derive(Debug, Default, Copy, Clone)]
381pub struct ClearFloatJobDescription {
382 #[doc = "< The clear color of the resource."]
383 pub color: [f32; 4usize],
384 #[doc = "< The resource to be cleared."]
385 pub target: ResourceInternal,
386}
387#[doc = " A structure describing a compute render job."]
388#[repr(C)]
389pub struct ComputeJobDescription {
390 #[doc = "< Compute pipeline for the render job."]
391 pub pipeline: PipelineState,
392 #[doc = "< Dispatch dimensions."]
393 pub dimensions: [u32; 3usize],
394 #[doc = "< SRV resources to be bound in the compute job."]
395 pub srvs: [ResourceInternal; 16usize],
396 pub srvNames: [[widechar; 64usize]; 16usize],
397 #[doc = "< UAV resources to be bound in the compute job."]
398 pub uavs: [ResourceInternal; 8usize],
399 #[doc = "< Mip level of UAV resources to be bound in the compute job."]
400 pub uavMip: [u32; 8usize],
401 pub uavNames: [[widechar; 64usize]; 8usize],
402 #[doc = "< Constant buffers to be bound in the compute job."]
403 pub cbs: [ConstantBuffer; 2usize],
404 pub cbNames: [[widechar; 64usize]; 2usize],
405 #[doc = "< Slot index in the descriptor table"]
406 pub cbSlotIndex: [u32; 2usize],
407}
408impl Default for ComputeJobDescription {
409 fn default() -> Self {
410 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
411 unsafe {
412 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
413 s.assume_init()
414 }
415 }
416}
417#[doc = " A structure describing a copy render job."]
418#[repr(C)]
419#[derive(Debug, Default, Copy, Clone)]
420pub struct CopyJobDescription {
421 #[doc = "< Source resource for the copy."]
422 pub src: ResourceInternal,
423 #[doc = "< Destination resource for the copy."]
424 pub dst: ResourceInternal,
425}
426#[doc = " A structure describing a single render job."]
427#[repr(C)]
428pub struct GpuJobDescription {
429 #[doc = "< Type of the job."]
430 pub jobType: GpuJobType,
431 pub __bindgen_anon_1: GpuJobDescription__bindgen_ty_1,
432}
433#[repr(C)]
434pub union GpuJobDescription__bindgen_ty_1 {
435 #[doc = "< Clear job descriptor. Valid when <c><i>jobType</i></c> is <c><i>FFX_RENDER_JOB_CLEAR_FLOAT</i></c>."]
436 pub clearJobDescriptor: ::std::mem::ManuallyDrop<ClearFloatJobDescription>,
437 #[doc = "< Copy job descriptor. Valid when <c><i>jobType</i></c> is <c><i>FFX_RENDER_JOB_COPY</i></c>."]
438 pub copyJobDescriptor: ::std::mem::ManuallyDrop<CopyJobDescription>,
439 #[doc = "< Compute job descriptor. Valid when <c><i>jobType</i></c> is <c><i>FFX_RENDER_JOB_COMPUTE</i></c>."]
440 pub computeJobDescriptor: ::std::mem::ManuallyDrop<ComputeJobDescription>,
441}
442impl Default for GpuJobDescription__bindgen_ty_1 {
443 fn default() -> Self {
444 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
445 unsafe {
446 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
447 s.assume_init()
448 }
449 }
450}
451impl Default for GpuJobDescription {
452 fn default() -> Self {
453 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
454 unsafe {
455 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
456 s.assume_init()
457 }
458 }
459}
460#[doc = " The value of Pi."]
461pub const FFX_PI: f32 = 3.1415927410125732;
462#[doc = " An epsilon value for floating point numbers."]
463pub const FFX_EPSILON: f32 = 0.0000009999999974752427;
464#[doc = " A typedef for the callback function for assert printing.\n\n This can be used to re-route printing of assert messages from the FFX backend\n to another destination. For example instead of the default behaviour of printing\n the assert messages to the debugger's TTY the message can be re-routed to a\n MessageBox in a GUI application.\n\n @param [in] message The message generated by the assert.\n"]
465pub type AssertCallback =
466 ::std::option::Option<unsafe extern "C" fn(message: *const ::std::os::raw::c_char)>;
467extern "C" {
468 #[doc = " Function to report an assert.\n\n @param [in] file The name of the file as a string.\n @param [in] line The index of the line in the file.\n @param [in] condition The boolean condition that was tested.\n @param [in] msg The optional message to print.\n\n @returns\n Always returns true.\n"]
469 #[link_name = "ffxAssertReport"]
470 pub fn AssertReport(
471 file: *const ::std::os::raw::c_char,
472 line: i32,
473 condition: *const ::std::os::raw::c_char,
474 msg: *const ::std::os::raw::c_char,
475 ) -> bool;
476}
477extern "C" {
478 #[doc = " Provides the ability to set a callback for assert messages.\n\n @param [in] callback The callback function that will receive assert messages.\n"]
479 #[link_name = "ffxAssertSetPrintingCallback"]
480 pub fn AssertSetPrintingCallback(callback: AssertCallback);
481}
482#[doc = " Typedef for error codes returned from functions in the FidelityFX SDK."]
483pub type ErrorCode = i32;
484#[doc = "< The operation completed successfully."]
485pub const FFX_OK: ErrorCode = 0;
486#[doc = "< The operation failed due to an invalid pointer."]
487pub const FFX_ERROR_INVALID_POINTER: ErrorCode = -2147483648;
488#[doc = "< The operation failed due to an invalid alignment."]
489pub const FFX_ERROR_INVALID_ALIGNMENT: ErrorCode = -2147483647;
490#[doc = "< The operation failed due to an invalid size."]
491pub const FFX_ERROR_INVALID_SIZE: ErrorCode = -2147483646;
492#[doc = "< The end of the file was encountered."]
493pub const FFX_EOF: ErrorCode = -2147483645;
494#[doc = "< The operation failed because the specified path was invalid."]
495pub const FFX_ERROR_INVALID_PATH: ErrorCode = -2147483644;
496#[doc = "< The operation failed because end of file was reached."]
497pub const FFX_ERROR_EOF: ErrorCode = -2147483643;
498#[doc = "< The operation failed because of some malformed data."]
499pub const FFX_ERROR_MALFORMED_DATA: ErrorCode = -2147483642;
500#[doc = "< The operation failed because it ran out memory."]
501pub const FFX_ERROR_OUT_OF_MEMORY: ErrorCode = -2147483641;
502#[doc = "< The operation failed because the interface was not fully configured."]
503pub const FFX_ERROR_INCOMPLETE_INTERFACE: ErrorCode = -2147483640;
504#[doc = "< The operation failed because of an invalid enumeration value."]
505pub const FFX_ERROR_INVALID_ENUM: ErrorCode = -2147483639;
506#[doc = "< The operation failed because an argument was invalid."]
507pub const FFX_ERROR_INVALID_ARGUMENT: ErrorCode = -2147483638;
508#[doc = "< The operation failed because a value was out of range."]
509pub const FFX_ERROR_OUT_OF_RANGE: ErrorCode = -2147483637;
510#[doc = "< The operation failed because a device was null."]
511pub const FFX_ERROR_NULL_DEVICE: ErrorCode = -2147483636;
512#[doc = "< The operation failed because the backend API returned an error code."]
513pub const FFX_ERROR_BACKEND_API_ERROR: ErrorCode = -2147483635;
514#[doc = "< The operation failed because there was not enough memory."]
515pub const FFX_ERROR_INSUFFICIENT_MEMORY: ErrorCode = -2147483634;
516#[doc = "< A pass which performs depth clipping."]
517pub const FFX_FSR2_PASS_DEPTH_CLIP: Pass = 0;
518#[doc = "< A pass which performs reconstruction of previous frame's depth."]
519pub const FFX_FSR2_PASS_RECONSTRUCT_PREVIOUS_DEPTH: Pass = 1;
520#[doc = "< A pass which calculates pixel locks."]
521pub const FFX_FSR2_PASS_LOCK: Pass = 2;
522#[doc = "< A pass which performs upscaling."]
523pub const FFX_FSR2_PASS_ACCUMULATE: Pass = 3;
524#[doc = "< A pass which performs upscaling when sharpening is used."]
525pub const FFX_FSR2_PASS_ACCUMULATE_SHARPEN: Pass = 4;
526#[doc = "< A pass which performs sharpening."]
527pub const FFX_FSR2_PASS_RCAS: Pass = 5;
528#[doc = "< A pass which generates the luminance mipmap chain for the current frame."]
529pub const FFX_FSR2_PASS_COMPUTE_LUMINANCE_PYRAMID: Pass = 6;
530#[doc = "< An optional pass to generate a reactive mask"]
531pub const FFX_FSR2_PASS_GENERATE_REACTIVE: Pass = 7;
532#[doc = "< An optional pass to generate a texture-and-composition and reactive masks"]
533pub const FFX_FSR2_PASS_TCR_AUTOGENERATE: Pass = 8;
534#[doc = "< The number of passes performed by FSR2."]
535pub const FFX_FSR2_PASS_COUNT: Pass = 9;
536#[doc = " An enumeration of all the passes which constitute the FSR2 algorithm.\n\n FSR2 is implemented as a composite of several compute passes each\n computing a key part of the final result. Each call to the\n <c><i>FfxFsr2ScheduleGpuJobFunc</i></c> callback function will\n correspond to a single pass included in <c><i>FfxFsr2Pass</i></c>. For a\n more comprehensive description of each pass, please refer to the FSR2\n reference documentation.\n\n Please note in some cases e.g.: <c><i>FFX_FSR2_PASS_ACCUMULATE</i></c>\n and <c><i>FFX_FSR2_PASS_ACCUMULATE_SHARPEN</i></c> either one pass or the\n other will be used (they are mutually exclusive). The choice of which will\n depend on the way the <c><i>FfxFsr2Context</i></c> is created and the\n precise contents of <c><i>FfxFsr2DispatchParamters</i></c> each time a call\n is made to <c><i>ffxFsr2ContextDispatch</i></c>.\n\n @ingroup FSR2"]
537pub type Pass = ::std::os::raw::c_int;
538#[repr(i32)]
539#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
540pub enum MsgType {
541 FFX_FSR2_MESSAGE_TYPE_ERROR = 0,
542 FFX_FSR2_MESSAGE_TYPE_WARNING = 1,
543 FFX_FSR2_MESSAGE_TYPE_COUNT = 2,
544}
545#[doc = " Create and initialize the backend context.\n\n The callback function sets up the backend context for rendering.\n It will create or reference the device and create required internal data structures.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] device The FfxDevice obtained by ffxGetDevice(DX12/VK/...).\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
546pub type CreateBackendContextFunc = ::std::option::Option<
547 unsafe extern "C" fn(backendInterface: *mut Interface, device: Device) -> ErrorCode,
548>;
549#[doc = " Get a list of capabilities of the device.\n\n When creating an <c><i>FfxFsr2Context</i></c> it is desirable for the FSR2\n core implementation to be aware of certain characteristics of the platform\n that is being targetted. This is because some optimizations which FSR2\n attempts to perform are more effective on certain classes of hardware than\n others, or are not supported by older hardware. In order to avoid cases\n where optimizations actually have the effect of decreasing performance, or\n reduce the breadth of support provided by FSR2, FSR2 queries the\n capabilities of the device to make such decisions.\n\n For target platforms with fixed hardware support you need not implement\n this callback function by querying the device, but instead may hardcore\n what features are available on the platform.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [out] outDeviceCapabilities The device capabilities structure to fill out.\n @param [in] device The device to query for capabilities.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
550pub type GetDeviceCapabilitiesFunc = ::std::option::Option<
551 unsafe extern "C" fn(
552 backendInterface: *mut Interface,
553 outDeviceCapabilities: *mut DeviceCapabilities,
554 device: Device,
555 ) -> ErrorCode,
556>;
557#[doc = " Destroy the backend context and dereference the device.\n\n This function is called when the <c><i>FfxFsr2Context</i></c> is destroyed.\n\n @param [in] backendInterface A pointer to the backend interface.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
558pub type DestroyBackendContextFunc =
559 ::std::option::Option<unsafe extern "C" fn(backendInterface: *mut Interface) -> ErrorCode>;
560#[doc = " Create a resource.\n\n This callback is intended for the backend to create internal resources.\n\n Please note: It is also possible that the creation of resources might\n itself cause additional resources to be created by simply calling the\n <c><i>FfxFsr2CreateResourceFunc</i></c> function pointer again. This is\n useful when handling the initial creation of resources which must be\n initialized. The flow in such a case would be an initial call to create the\n CPU-side resource, another to create the GPU-side resource, and then a call\n to schedule a copy render job to move the data between the two. Typically\n this type of function call flow is only seen during the creation of an\n <c><i>FfxFsr2Context</i></c>.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] createResourceDescription A pointer to a <c><i>FfxCreateResourceDescription</i></c>.\n @param [out] outResource A pointer to a <c><i>FfxResource</i></c> object.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
561pub type CreateResourceFunc = ::std::option::Option<
562 unsafe extern "C" fn(
563 backendInterface: *mut Interface,
564 createResourceDescription: *const CreateResourceDescription,
565 outResource: *mut ResourceInternal,
566 ) -> ErrorCode,
567>;
568#[doc = " Register a resource in the backend for the current frame.\n\n Since FSR2 and the backend are not aware how many different\n resources will get passed to FSR2 over time, it's not safe\n to register all resources simultaneously in the backend.\n Also passed resources may not be valid after the dispatch call.\n As a result it's safest to register them as FfxResourceInternal\n and clear them at the end of the dispatch call.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] inResource A pointer to a <c><i>FfxResource</i></c>.\n @param [out] outResource A pointer to a <c><i>FfxResourceInternal</i></c> object.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
569pub type RegisterResourceFunc = ::std::option::Option<
570 unsafe extern "C" fn(
571 backendInterface: *mut Interface,
572 inResource: *const Resource,
573 outResource: *mut ResourceInternal,
574 ) -> ErrorCode,
575>;
576#[doc = " Unregister all temporary FfxResourceInternal from the backend.\n\n Unregister FfxResourceInternal referencing resources passed to\n a function as a parameter.\n\n @param [in] backendInterface A pointer to the backend interface.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
577pub type UnregisterResourcesFunc =
578 ::std::option::Option<unsafe extern "C" fn(backendInterface: *mut Interface) -> ErrorCode>;
579#[doc = " Retrieve a <c><i>FfxResourceDescription</i></c> matching a\n <c><i>FfxResource</i></c> structure.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] resource A pointer to a <c><i>FfxResource</i></c> object.\n\n @returns\n A description of the resource.\n\n @ingroup FSR2"]
580pub type GetResourceDescriptionFunc = ::std::option::Option<
581 unsafe extern "C" fn(
582 backendInterface: *mut Interface,
583 resource: ResourceInternal,
584 ) -> ResourceDescription,
585>;
586#[doc = " Destroy a resource\n\n This callback is intended for the backend to release an internal resource.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] resource A pointer to a <c><i>FfxResource</i></c> object.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
587pub type DestroyResourceFunc = ::std::option::Option<
588 unsafe extern "C" fn(backendInterface: *mut Interface, resource: ResourceInternal) -> ErrorCode,
589>;
590#[doc = " Create a render pipeline.\n\n A rendering pipeline contains the shader as well as resource bindpoints\n and samplers.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] pass The identifier for the pass.\n @param [in] pipelineDescription A pointer to a <c><i>FfxPipelineDescription</i></c> describing the pipeline to be created.\n @param [out] outPipeline A pointer to a <c><i>FfxPipelineState</i></c> structure which should be populated.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
591pub type CreatePipelineFunc = ::std::option::Option<
592 unsafe extern "C" fn(
593 backendInterface: *mut Interface,
594 pass: Pass,
595 pipelineDescription: *const PipelineDescription,
596 outPipeline: *mut PipelineState,
597 ) -> ErrorCode,
598>;
599#[doc = " Destroy a render pipeline.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [out] pipeline A pointer to a <c><i>FfxPipelineState</i></c> structure which should be released.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
600pub type DestroyPipelineFunc = ::std::option::Option<
601 unsafe extern "C" fn(
602 backendInterface: *mut Interface,
603 pipeline: *mut PipelineState,
604 ) -> ErrorCode,
605>;
606#[doc = " Schedule a render job to be executed on the next call of\n <c><i>FfxFsr2ExecuteGpuJobsFunc</i></c>.\n\n Render jobs can perform one of three different tasks: clear, copy or\n compute dispatches.\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] job A pointer to a <c><i>FfxGpuJobDescription</i></c> structure.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
607pub type ScheduleGpuJobFunc = ::std::option::Option<
608 unsafe extern "C" fn(
609 backendInterface: *mut Interface,
610 job: *const GpuJobDescription,
611 ) -> ErrorCode,
612>;
613#[doc = " Execute scheduled render jobs on the <c><i>comandList</i></c> provided.\n\n The recording of the graphics API commands should take place in this\n callback function, the render jobs which were previously enqueued (via\n callbacks made to <c><i>FfxFsr2ScheduleGpuJobFunc</i></c>) should be\n processed in the order they were received. Advanced users might choose to\n reorder the rendering jobs, but should do so with care to respect the\n resource dependencies.\n\n Depending on the precise contents of <c><i>FfxFsr2DispatchDescription</i></c> a\n different number of render jobs might have previously been enqueued (for\n example if sharpening is toggled on and off).\n\n @param [in] backendInterface A pointer to the backend interface.\n @param [in] commandList A pointer to a <c><i>FfxCommandList</i></c> structure.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n Anything else The operation failed.\n\n @ingroup FSR2"]
614pub type ExecuteGpuJobsFunc = ::std::option::Option<
615 unsafe extern "C" fn(backendInterface: *mut Interface, commandList: CommandList) -> ErrorCode,
616>;
617#[doc = " Pass a string message\n\n Used for debug messages.\n\n @param [in] type The type of message.\n @param [in] message A string message to pass.\n\n\n @ingroup FSR2"]
618pub type Message =
619 ::std::option::Option<unsafe extern "C" fn(type_: MsgType, message: *const widechar)>;
620#[doc = " A structure encapsulating the interface between the core implentation of\n the FSR2 algorithm and any graphics API that it should ultimately call.\n\n This set of functions serves as an abstraction layer between FSR2 and the\n API used to implement it. While FSR2 ships with backends for DirectX12 and\n Vulkan, it is possible to implement your own backend for other platforms or\n which sits ontop of your engine's own abstraction layer. For details on the\n expectations of what each function should do you should refer the\n description of the following function pointer types:\n\n <c><i>FfxFsr2CreateDeviceFunc</i></c>\n <c><i>FfxFsr2GetDeviceCapabilitiesFunc</i></c>\n <c><i>FfxFsr2DestroyDeviceFunc</i></c>\n <c><i>FfxFsr2CreateResourceFunc</i></c>\n <c><i>FfxFsr2GetResourceDescriptionFunc</i></c>\n <c><i>FfxFsr2DestroyResourceFunc</i></c>\n <c><i>FfxFsr2CreatePipelineFunc</i></c>\n <c><i>FfxFsr2DestroyPipelineFunc</i></c>\n <c><i>FfxFsr2ScheduleGpuJobFunc</i></c>\n <c><i>FfxFsr2ExecuteGpuJobsFunc</i></c>\n\n Depending on the graphics API that is abstracted by the backend, it may be\n required that the backend is to some extent stateful. To ensure that\n applications retain full control to manage the memory used by FSR2, the\n <c><i>scratchBuffer</i></c> and <c><i>scratchBufferSize</i></c> fields are\n provided. A backend should provide a means of specifying how much scratch\n memory is required for its internal implementation (e.g: via a function\n or constant value). The application is that responsible for allocating that\n memory and providing it when setting up the FSR2 backend. Backends provided\n with FSR2 do not perform dynamic memory allocations, and instead\n suballocate all memory from the scratch buffers provided.\n\n The <c><i>scratchBuffer</i></c> and <c><i>scratchBufferSize</i></c> fields\n should be populated according to the requirements of each backend. For\n example, if using the DirectX 12 backend you should call the\n <c><i>ffxFsr2GetScratchMemorySizeDX12</i></c> function. It is not required\n that custom backend implementations use a scratch buffer.\n\n @ingroup FSR2"]
621#[repr(C)]
622#[derive(Debug, Copy, Clone)]
623pub struct Interface {
624 #[doc = "< A callback function to create and initialize the backend context."]
625 pub fpCreateBackendContext: CreateBackendContextFunc,
626 #[doc = "< A callback function to query device capabilites."]
627 pub fpGetDeviceCapabilities: GetDeviceCapabilitiesFunc,
628 #[doc = "< A callback function to destroy the backendcontext. This also dereferences the device."]
629 pub fpDestroyBackendContext: DestroyBackendContextFunc,
630 #[doc = "< A callback function to create a resource."]
631 pub fpCreateResource: CreateResourceFunc,
632 #[doc = "< A callback function to register an external resource."]
633 pub fpRegisterResource: RegisterResourceFunc,
634 #[doc = "< A callback function to unregister external resource."]
635 pub fpUnregisterResources: UnregisterResourcesFunc,
636 #[doc = "< A callback function to retrieve a resource description."]
637 pub fpGetResourceDescription: GetResourceDescriptionFunc,
638 #[doc = "< A callback function to destroy a resource."]
639 pub fpDestroyResource: DestroyResourceFunc,
640 #[doc = "< A callback function to create a render or compute pipeline."]
641 pub fpCreatePipeline: CreatePipelineFunc,
642 #[doc = "< A callback function to destroy a render or compute pipeline."]
643 pub fpDestroyPipeline: DestroyPipelineFunc,
644 #[doc = "< A callback function to schedule a render job."]
645 pub fpScheduleGpuJob: ScheduleGpuJobFunc,
646 #[doc = "< A callback function to execute all queued render jobs."]
647 pub fpExecuteGpuJobs: ExecuteGpuJobsFunc,
648 #[doc = "< A preallocated buffer for memory utilized internally by the backend."]
649 pub scratchBuffer: *mut ::std::os::raw::c_void,
650 #[doc = "< Size of the buffer pointed to by <c><i>scratchBuffer</i></c>."]
651 pub scratchBufferSize: usize,
652}
653impl Default for Interface {
654 fn default() -> Self {
655 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
656 unsafe {
657 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
658 s.assume_init()
659 }
660 }
661}
662#[doc = "< Perform upscaling with a per-dimension upscaling ratio of 1.5x."]
663pub const FFX_FSR2_QUALITY_MODE_QUALITY: QualityMode = 1;
664#[doc = "< Perform upscaling with a per-dimension upscaling ratio of 1.7x."]
665pub const FFX_FSR2_QUALITY_MODE_BALANCED: QualityMode = 2;
666#[doc = "< Perform upscaling with a per-dimension upscaling ratio of 2.0x."]
667pub const FFX_FSR2_QUALITY_MODE_PERFORMANCE: QualityMode = 3;
668#[doc = "< Perform upscaling with a per-dimension upscaling ratio of 3.0x."]
669pub const FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE: QualityMode = 4;
670#[doc = " An enumeration of all the quality modes supported by FidelityFX Super\n Resolution 2 upscaling.\n\n In order to provide a consistent user experience across multiple\n applications which implement FSR2. It is strongly recommended that the\n following preset scaling factors are made available through your\n application's user interface.\n\n If your application does not expose the notion of preset scaling factors\n for upscaling algorithms (perhaps instead implementing a fixed ratio which\n is immutable) or implementing a more dynamic scaling scheme (such as\n dynamic resolution scaling), then there is no need to use these presets.\n\n Please note that <c><i>FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> is\n an optional mode which may introduce significant quality degradation in the\n final image. As such it is recommended that you evaluate the final results\n of using this scaling mode before deciding if you should include it in your\n application.\n\n @ingroup FSR2"]
671pub type QualityMode = ::std::os::raw::c_int;
672#[doc = "< A bit indicating if the input color data provided is using a high-dynamic range."]
673pub const FFX_FSR2_ENABLE_HIGH_DYNAMIC_RANGE: InitializationFlagBits = 1;
674#[doc = "< A bit indicating if the motion vectors are rendered at display resolution."]
675pub const FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS: InitializationFlagBits = 2;
676#[doc = "< A bit indicating that the motion vectors have the jittering pattern applied to them."]
677pub const FFX_FSR2_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION: InitializationFlagBits = 4;
678#[doc = "< A bit indicating that the input depth buffer data provided is inverted [1..0]."]
679pub const FFX_FSR2_ENABLE_DEPTH_INVERTED: InitializationFlagBits = 8;
680#[doc = "< A bit indicating that the input depth buffer data provided is using an infinite far plane."]
681pub const FFX_FSR2_ENABLE_DEPTH_INFINITE: InitializationFlagBits = 16;
682#[doc = "< A bit indicating if automatic exposure should be applied to input color data."]
683pub const FFX_FSR2_ENABLE_AUTO_EXPOSURE: InitializationFlagBits = 32;
684#[doc = "< A bit indicating that the application uses dynamic resolution scaling."]
685pub const FFX_FSR2_ENABLE_DYNAMIC_RESOLUTION: InitializationFlagBits = 64;
686#[doc = "< A bit indicating that the backend should use 1D textures."]
687pub const FFX_FSR2_ENABLE_TEXTURE1D_USAGE: InitializationFlagBits = 128;
688#[doc = "< A bit indicating that the runtime should check some API values and report issues."]
689pub const FFX_FSR2_ENABLE_DEBUG_CHECKING: InitializationFlagBits = 256;
690#[doc = " An enumeration of bit flags used when creating a\n <c><i>FfxFsr2Context</i></c>. See <c><i>FfxFsr2ContextDescription</i></c>.\n\n @ingroup FSR2"]
691pub type InitializationFlagBits = ::std::os::raw::c_int;
692#[doc = " A structure encapsulating the parameters required to initialize FidelityFX\n Super Resolution 2 upscaling.\n\n @ingroup FSR2"]
693#[repr(C)]
694#[derive(Debug, Copy, Clone)]
695pub struct ContextDescription {
696 #[doc = "< A collection of <c><i>FfxFsr2InitializationFlagBits</i></c>."]
697 pub flags: u32,
698 #[doc = "< The maximum size that rendering will be performed at."]
699 pub maxRenderSize: Dimensions2D,
700 #[doc = "< The size of the presentation resolution targeted by the upscaling process."]
701 pub displaySize: Dimensions2D,
702 #[doc = "< A set of pointers to the backend implementation for FSR 2.0."]
703 pub callbacks: Interface,
704 #[doc = "< The abstracted device which is passed to some callback functions."]
705 pub device: Device,
706 #[doc = "< A pointer to a function that can recieve messages from the runtime."]
707 pub fpMessage: Message,
708}
709impl Default for ContextDescription {
710 fn default() -> Self {
711 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
712 unsafe {
713 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
714 s.assume_init()
715 }
716 }
717}
718#[doc = " A structure encapsulating the parameters for dispatching the various passes\n of FidelityFX Super Resolution 2.\n\n @ingroup FSR2"]
719#[repr(C)]
720pub struct DispatchDescription {
721 #[doc = "< The <c><i>FfxCommandList</i></c> to record FSR2 rendering commands into."]
722 pub commandList: CommandList,
723 #[doc = "< A <c><i>FfxResource</i></c> containing the color buffer for the current frame (at render resolution)."]
724 pub color: Resource,
725 #[doc = "< A <c><i>FfxResource</i></c> containing 32bit depth values for the current frame (at render resolution)."]
726 pub depth: Resource,
727 #[doc = "< A <c><i>FfxResource</i></c> containing 2-dimensional motion vectors (at render resolution if <c><i>FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS</i></c> is not set)."]
728 pub motionVectors: Resource,
729 #[doc = "< A optional <c><i>FfxResource</i></c> containing a 1x1 exposure value."]
730 pub exposure: Resource,
731 #[doc = "< A optional <c><i>FfxResource</i></c> containing alpha value of reactive objects in the scene."]
732 pub reactive: Resource,
733 #[doc = "< A optional <c><i>FfxResource</i></c> containing alpha value of special objects in the scene."]
734 pub transparencyAndComposition: Resource,
735 #[doc = "< A <c><i>FfxResource</i></c> containing the output color buffer for the current frame (at presentation resolution)."]
736 pub output: Resource,
737 #[doc = "< The subpixel jitter offset applied to the camera."]
738 pub jitterOffset: FloatCoords2D,
739 #[doc = "< The scale factor to apply to motion vectors."]
740 pub motionVectorScale: FloatCoords2D,
741 #[doc = "< The resolution that was used for rendering the input resources."]
742 pub renderSize: Dimensions2D,
743 #[doc = "< Enable an additional sharpening pass."]
744 pub enableSharpening: bool,
745 #[doc = "< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness."]
746 pub sharpness: f32,
747 #[doc = "< The time elapsed since the last frame (expressed in milliseconds)."]
748 pub frameTimeDelta: f32,
749 #[doc = "< The pre exposure value (must be > 0.0f)"]
750 pub preExposure: f32,
751 #[doc = "< A boolean value which when set to true, indicates the camera has moved discontinuously."]
752 pub reset: bool,
753 #[doc = "< The distance to the near plane of the camera."]
754 pub cameraNear: f32,
755 #[doc = "< The distance to the far plane of the camera. This is used only used in case of non infinite depth."]
756 pub cameraFar: f32,
757 #[doc = "< The camera angle field of view in the vertical direction (expressed in radians)."]
758 pub cameraFovAngleVertical: f32,
759 #[doc = "< The scale factor to convert view space units to meters"]
760 pub viewSpaceToMetersFactor: f32,
761 #[doc = "< A boolean value to indicate internal reactive autogeneration should be used"]
762 pub enableAutoReactive: bool,
763 #[doc = "< A <c><i>FfxResource</i></c> containing the opaque only color buffer for the current frame (at render resolution)."]
764 pub colorOpaqueOnly: Resource,
765 #[doc = "< Cutoff value for TC"]
766 pub autoTcThreshold: f32,
767 #[doc = "< A value to scale the transparency and composition mask"]
768 pub autoTcScale: f32,
769 #[doc = "< A value to scale the reactive mask"]
770 pub autoReactiveScale: f32,
771 #[doc = "< A value to clamp the reactive mask"]
772 pub autoReactiveMax: f32,
773}
774impl Default for DispatchDescription {
775 fn default() -> Self {
776 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
777 unsafe {
778 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
779 s.assume_init()
780 }
781 }
782}
783#[doc = " A structure encapsulating the parameters for automatic generation of a reactive mask\n\n @ingroup FSR2"]
784#[repr(C)]
785pub struct GenerateReactiveDescription {
786 #[doc = "< The <c><i>FfxCommandList</i></c> to record FSR2 rendering commands into."]
787 pub commandList: CommandList,
788 #[doc = "< A <c><i>FfxResource</i></c> containing the opaque only color buffer for the current frame (at render resolution)."]
789 pub colorOpaqueOnly: Resource,
790 #[doc = "< A <c><i>FfxResource</i></c> containing the opaque+translucent color buffer for the current frame (at render resolution)."]
791 pub colorPreUpscale: Resource,
792 #[doc = "< A <c><i>FfxResource</i></c> containing the surface to generate the reactive mask into."]
793 pub outReactive: Resource,
794 #[doc = "< The resolution that was used for rendering the input resources."]
795 pub renderSize: Dimensions2D,
796 #[doc = "< A value to scale the output"]
797 pub scale: f32,
798 #[doc = "< A threshold value to generate a binary reactive mask"]
799 pub cutoffThreshold: f32,
800 #[doc = "< A value to set for the binary reactive mask"]
801 pub binaryValue: f32,
802 #[doc = "< Flags to determine how to generate the reactive mask"]
803 pub flags: u32,
804}
805impl Default for GenerateReactiveDescription {
806 fn default() -> Self {
807 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
808 unsafe {
809 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
810 s.assume_init()
811 }
812 }
813}
814#[doc = " A structure encapsulating the FidelityFX Super Resolution 2 context.\n\n This sets up an object which contains all persistent internal data and\n resources that are required by FSR2.\n\n The <c><i>FfxFsr2Context</i></c> object should have a lifetime matching\n your use of FSR2. Before destroying the FSR2 context care should be taken\n to ensure the GPU is not accessing the resources created or used by FSR2.\n It is therefore recommended that the GPU is idle before destroying the\n FSR2 context.\n\n @ingroup FSR2"]
815#[repr(C)]
816#[derive(Debug, Copy, Clone)]
817pub struct Context {
818 #[doc = "< An opaque set of <c>uint32_t</c> which contain the data for the context."]
819 pub data: [u32; 16536usize],
820}
821impl Default for Context {
822 fn default() -> Self {
823 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
824 unsafe {
825 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
826 s.assume_init()
827 }
828 }
829}
830extern "C" {
831 #[doc = " Create a FidelityFX Super Resolution 2 context from the parameters\n programmed to the <c><i>FfxFsr2CreateParams</i></c> structure.\n\n The context structure is the main object used to interact with the FSR2\n API, and is responsible for the management of the internal resources used\n by the FSR2 algorithm. When this API is called, multiple calls will be\n made via the pointers contained in the <c><i>callbacks</i></c> structure.\n These callbacks will attempt to retreive the device capabilities, and\n create the internal resources, and pipelines required by FSR2's\n frame-to-frame function. Depending on the precise configuration used when\n creating the <c><i>FfxFsr2Context</i></c> a different set of resources and\n pipelines might be requested via the callback functions.\n\n The flags included in the <c><i>flags</i></c> field of\n <c><i>FfxFsr2Context</i></c> how match the configuration of your\n application as well as the intended use of FSR2. It is important that these\n flags are set correctly (as well as a correct programmed\n <c><i>FfxFsr2DispatchDescription</i></c>) to ensure correct operation. It is\n recommended to consult the overview documentation for further details on\n how FSR2 should be integerated into an application.\n\n When the <c><i>FfxFsr2Context</i></c> is created, you should use the\n <c><i>ffxFsr2ContextDispatch</i></c> function each frame where FSR2\n upscaling should be applied. See the documentation of\n <c><i>ffxFsr2ContextDispatch</i></c> for more details.\n\n The <c><i>FfxFsr2Context</i></c> should be destroyed when use of it is\n completed, typically when an application is unloaded or FSR2 upscaling is\n disabled by a user. To destroy the FSR2 context you should call\n <c><i>ffxFsr2ContextDestroy</i></c>.\n\n @param [out] context A pointer to a <c><i>FfxFsr2Context</i></c> structure to populate.\n @param [in] contextDescription A pointer to a <c><i>FfxFsr2ContextDescription</i></c> structure.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>contextDescription</i></c> was <c><i>NULL</i></c>.\n @retval\n FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the <c><i>FfxFsr2ContextDescription.callbacks</i></c> was not fully specified.\n @retval\n FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.\n\n @ingroup FSR2"]
832 #[link_name = "ffxFsr2ContextCreate"]
833 pub fn ContextCreate(
834 context: *mut Context,
835 contextDescription: *const ContextDescription,
836 ) -> ErrorCode;
837}
838extern "C" {
839 #[doc = " Dispatch the various passes that constitute FidelityFX Super Resolution 2.\n\n FSR2 is a composite effect, meaning that it is compromised of multiple\n constituent passes (implemented as one or more clears, copies and compute\n dispatches). The <c><i>ffxFsr2ContextDispatch</i></c> function is the\n function which (via the use of the functions contained in the\n <c><i>callbacks</i></c> field of the <c><i>FfxFsr2Context</i></c>\n structure) utlimately generates the sequence of graphics API calls required\n each frame.\n\n As with the creation of the <c><i>FfxFsr2Context</i></c> correctly\n programming the <c><i>FfxFsr2DispatchDescription</i></c> is key to ensuring\n the correct operation of FSR2. It is particularly important to ensure that\n camera jitter is correctly applied to your application's projection matrix\n (or camera origin for raytraced applications). FSR2 provides the\n <c><i>ffxFsr2GetJitterPhaseCount</i></c> and\n <c><i>ffxFsr2GetJitterOffset</i></c> entry points to help applications\n correctly compute the camera jitter. Whatever jitter pattern is used by the\n application it should be correctly programmed to the\n <c><i>jitterOffset</i></c> field of the <c><i>dispatchDescription</i></c>\n structure. For more guidance on camera jitter please consult the\n documentation for <c><i>ffxFsr2GetJitterOffset</i></c> as well as the\n accompanying overview documentation for FSR2.\n\n @param [in] context A pointer to a <c><i>FfxFsr2Context</i></c> structure.\n @param [in] dispatchDescription A pointer to a <c><i>FfxFsr2DispatchDescription</i></c> structure.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>dispatchDescription</i></c> was <c><i>NULL</i></c>.\n @retval\n FFX_ERROR_OUT_OF_RANGE The operation failed because <c><i>dispatchDescription.renderSize</i></c> was larger than the maximum render resolution.\n @retval\n FFX_ERROR_NULL_DEVICE The operation failed because the device inside the context was <c><i>NULL</i></c>.\n @retval\n FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.\n\n @ingroup FSR2"]
840 #[link_name = "ffxFsr2ContextDispatch"]
841 pub fn ContextDispatch(
842 context: *mut Context,
843 dispatchDescription: *const DispatchDescription,
844 ) -> ErrorCode;
845}
846extern "C" {
847 #[doc = " A helper function generate a Reactive mask from an opaque only texure and one containing translucent objects.\n\n @param [in] context A pointer to a <c><i>FfxFsr2Context</i></c> structure.\n @param [in] params A pointer to a <c><i>FfxFsr2GenerateReactiveDescription</i></c> structure\n\n @retval\n FFX_OK The operation completed successfully.\n\n @ingroup FSR2"]
848 #[link_name = "ffxFsr2ContextGenerateReactiveMask"]
849 pub fn ContextGenerateReactiveMask(
850 context: *mut Context,
851 params: *const GenerateReactiveDescription,
852 ) -> ErrorCode;
853}
854extern "C" {
855 #[doc = " Destroy the FidelityFX Super Resolution context.\n\n @param [out] context A pointer to a <c><i>FfxFsr2Context</i></c> structure to destroy.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> was <c><i>NULL</i></c>.\n\n @ingroup FSR2"]
856 #[link_name = "ffxFsr2ContextDestroy"]
857 pub fn ContextDestroy(context: *mut Context) -> ErrorCode;
858}
859extern "C" {
860 #[doc = " Get the upscale ratio from the quality mode.\n\n The following table enumerates the mapping of the quality modes to\n per-dimension scaling ratios.\n\n Quality preset | Scale factor\n ----------------------------------------------------- | -------------\n <c><i>FFX_FSR2_QUALITY_MODE_QUALITY</i></c> | 1.5x\n <c><i>FFX_FSR2_QUALITY_MODE_BALANCED</i></c> | 1.7x\n <c><i>FFX_FSR2_QUALITY_MODE_PERFORMANCE</i></c> | 2.0x\n <c><i>FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> | 3.0x\n\n Passing an invalid <c><i>qualityMode</i></c> will return 0.0f.\n\n @param [in] qualityMode The quality mode preset.\n\n @returns\n The upscaling the per-dimension upscaling ratio for\n <c><i>qualityMode</i></c> according to the table above.\n\n @ingroup FSR2"]
861 #[link_name = "ffxFsr2GetUpscaleRatioFromQualityMode"]
862 pub fn GetUpscaleRatioFromQualityMode(qualityMode: QualityMode) -> f32;
863}
864extern "C" {
865 #[doc = " A helper function to calculate the rendering resolution from a target\n resolution and desired quality level.\n\n This function applies the scaling factor returned by\n <c><i>ffxFsr2GetUpscaleRatioFromQualityMode</i></c> to each dimension.\n\n @param [out] renderWidth A pointer to a <c>uint32_t</c> which will hold the calculated render resolution width.\n @param [out] renderHeight A pointer to a <c>uint32_t</c> which will hold the calculated render resolution height.\n @param [in] displayWidth The target display resolution width.\n @param [in] displayHeight The target display resolution height.\n @param [in] qualityMode The desired quality mode for FSR 2 upscaling.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n FFX_ERROR_INVALID_POINTER Either <c><i>renderWidth</i></c> or <c><i>renderHeight</i></c> was <c>NULL</c>.\n @retval\n FFX_ERROR_INVALID_ENUM An invalid quality mode was specified.\n\n @ingroup FSR2"]
866 #[link_name = "ffxFsr2GetRenderResolutionFromQualityMode"]
867 pub fn GetRenderResolutionFromQualityMode(
868 renderWidth: *mut u32,
869 renderHeight: *mut u32,
870 displayWidth: u32,
871 displayHeight: u32,
872 qualityMode: QualityMode,
873 ) -> ErrorCode;
874}
875extern "C" {
876 #[doc = " A helper function to calculate the jitter phase count from display\n resolution.\n\n For more detailed information about the application of camera jitter to\n your application's rendering please refer to the\n <c><i>ffxFsr2GetJitterOffset</i></c> function.\n\n The table below shows the jitter phase count which this function\n would return for each of the quality presets.\n\n Quality preset | Scale factor | Phase count\n ----------------------------------------------------- | ------------- | ---------------\n <c><i>FFX_FSR2_QUALITY_MODE_QUALITY</i></c> | 1.5x | 18\n <c><i>FFX_FSR2_QUALITY_MODE_BALANCED</i></c> | 1.7x | 23\n <c><i>FFX_FSR2_QUALITY_MODE_PERFORMANCE</i></c> | 2.0x | 32\n <c><i>FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> | 3.0x | 72\n Custom | [1..n]x | ceil(8*n^2)\n\n @param [in] renderWidth The render resolution width.\n @param [in] displayWidth The display resolution width.\n\n @returns\n The jitter phase count for the scaling factor between <c><i>renderWidth</i></c> and <c><i>displayWidth</i></c>.\n\n @ingroup FSR2"]
877 #[link_name = "ffxFsr2GetJitterPhaseCount"]
878 pub fn GetJitterPhaseCount(renderWidth: i32, displayWidth: i32) -> i32;
879}
880extern "C" {
881 #[doc = " A helper function to calculate the subpixel jitter offset.\n\n FSR2 relies on the application to apply sub-pixel jittering while rendering.\n This is typically included in the projection matrix of the camera. To make\n the application of camera jitter simple, the FSR2 API provides a small set\n of utility function which computes the sub-pixel jitter offset for a\n particular frame within a sequence of separate jitter offsets. To begin, the\n index within the jitter phase must be computed. To calculate the\n sequence's length, you can call the <c><i>ffxFsr2GetJitterPhaseCount</i></c>\n function. The index should be a value which is incremented each frame modulo\n the length of the sequence computed by <c><i>ffxFsr2GetJitterPhaseCount</i></c>.\n The index within the jitter phase is passed to\n <c><i>ffxFsr2GetJitterOffset</i></c> via the <c><i>index</i></c> parameter.\n\n This function uses a Halton(2,3) sequence to compute the jitter offset.\n The ultimate index used for the sequence is <c><i>index</i></c> %\n <c><i>phaseCount</i></c>.\n\n It is important to understand that the values returned from the\n <c><i>ffxFsr2GetJitterOffset</i></c> function are in unit pixel space, and\n in order to composite this correctly into a projection matrix we must\n convert them into projection offsets. This is done as per the pseudo code\n listing which is shown below.\n\n const int32_t jitterPhaseCount = ffxFsr2GetJitterPhaseCount(renderWidth, displayWidth);\n\n float jitterX = 0;\n float jitterY = 0;\n ffxFsr2GetJitterOffset(&jitterX, &jitterY, index, jitterPhaseCount);\n\n const float jitterX = 2.0f * jitterX / (float)renderWidth;\n const float jitterY = -2.0f * jitterY / (float)renderHeight;\n const Matrix4 jitterTranslationMatrix = translateMatrix(Matrix3::identity, Vector3(jitterX, jitterY, 0));\n const Matrix4 jitteredProjectionMatrix = jitterTranslationMatrix * projectionMatrix;\n\n Jitter should be applied to all rendering. This includes opaque, alpha\n transparent, and raytraced objects. For rasterized objects, the sub-pixel\n jittering values calculated by the <c><i>iffxFsr2GetJitterOffset</i></c>\n function can be applied to the camera projection matrix which is ultimately\n used to perform transformations during vertex shading. For raytraced\n rendering, the sub-pixel jitter should be applied to the ray's origin,\n often the camera's position.\n\n Whether you elect to use the <c><i>ffxFsr2GetJitterOffset</i></c> function\n or your own sequence generator, you must program the\n <c><i>jitterOffset</i></c> field of the\n <c><i>FfxFsr2DispatchParameters</i></c> structure in order to inform FSR2\n of the jitter offset that has been applied in order to render each frame.\n\n If not using the recommended <c><i>ffxFsr2GetJitterOffset</i></c> function,\n care should be taken that your jitter sequence never generates a null vector;\n that is value of 0 in both the X and Y dimensions.\n\n @param [out] outX A pointer to a <c>float</c> which will contain the subpixel jitter offset for the x dimension.\n @param [out] outY A pointer to a <c>float</c> which will contain the subpixel jitter offset for the y dimension.\n @param [in] index The index within the jitter sequence.\n @param [in] phaseCount The length of jitter phase. See <c><i>ffxFsr2GetJitterPhaseCount</i></c>.\n\n @retval\n FFX_OK The operation completed successfully.\n @retval\n FFX_ERROR_INVALID_POINTER Either <c><i>outX</i></c> or <c><i>outY</i></c> was <c>NULL</c>.\n @retval\n FFX_ERROR_INVALID_ARGUMENT Argument <c><i>phaseCount</i></c> must be greater than 0.\n\n @ingroup FSR2"]
882 #[link_name = "ffxFsr2GetJitterOffset"]
883 pub fn GetJitterOffset(
884 outX: *mut f32,
885 outY: *mut f32,
886 index: i32,
887 phaseCount: i32,
888 ) -> ErrorCode;
889}
890extern "C" {
891 #[doc = " A helper function to check if a resource is\n <c><i>FFX_FSR2_RESOURCE_IDENTIFIER_NULL</i></c>.\n\n @param [in] resource A <c><i>FfxResource</i></c>.\n\n @returns\n true The <c><i>resource</i></c> was not <c><i>FFX_FSR2_RESOURCE_IDENTIFIER_NULL</i></c>.\n @returns\n false The <c><i>resource</i></c> was <c><i>FFX_FSR2_RESOURCE_IDENTIFIER_NULL</i></c>.\n\n @ingroup FSR2"]
892 #[link_name = "ffxFsr2ResourceIsNull"]
893 pub fn ResourceIsNull(resource: Resource) -> bool;
894}