Interface

Struct Interface 

Source
#[repr(C)]
pub struct Interface {
Show 14 fields pub fpCreateBackendContext: CreateBackendContextFunc, pub fpGetDeviceCapabilities: GetDeviceCapabilitiesFunc, pub fpDestroyBackendContext: DestroyBackendContextFunc, pub fpCreateResource: CreateResourceFunc, pub fpRegisterResource: RegisterResourceFunc, pub fpUnregisterResources: UnregisterResourcesFunc, pub fpGetResourceDescription: GetResourceDescriptionFunc, pub fpDestroyResource: DestroyResourceFunc, pub fpCreatePipeline: CreatePipelineFunc, pub fpDestroyPipeline: DestroyPipelineFunc, pub fpScheduleGpuJob: ScheduleGpuJobFunc, pub fpExecuteGpuJobs: ExecuteGpuJobsFunc, pub scratchBuffer: *mut c_void, pub scratchBufferSize: usize,
}
Expand description

A structure encapsulating the interface between the core implentation of the FSR2 algorithm and any graphics API that it should ultimately call.

This set of functions serves as an abstraction layer between FSR2 and the API used to implement it. While FSR2 ships with backends for DirectX12 and Vulkan, it is possible to implement your own backend for other platforms or which sits ontop 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>FfxFsr2CreateDeviceFunc</i></c>
<c><i>FfxFsr2GetDeviceCapabilitiesFunc</i></c>
<c><i>FfxFsr2DestroyDeviceFunc</i></c>
<c><i>FfxFsr2CreateResourceFunc</i></c>
<c><i>FfxFsr2GetResourceDescriptionFunc</i></c>
<c><i>FfxFsr2DestroyResourceFunc</i></c>
<c><i>FfxFsr2CreatePipelineFunc</i></c>
<c><i>FfxFsr2DestroyPipelineFunc</i></c>
<c><i>FfxFsr2ScheduleGpuJobFunc</i></c>
<c><i>FfxFsr2ExecuteGpuJobsFunc</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 FSR2, the scratchBuffer and scratchBufferSize 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 that responsible for allocating that memory and providing it when setting up the FSR2 backend. Backends provided with FSR2 do not perform dynamic memory allocations, and instead suballocate all memory from the scratch buffers provided.

The scratchBuffer and scratchBufferSize fields should be populated according to the requirements of each backend. For example, if using the DirectX 12 backend you should call the ffxFsr2GetScratchMemorySizeDX12 function. It is not required that custom backend implementations use a scratch buffer.

@ingroup FSR2

Fields§

§fpCreateBackendContext: CreateBackendContextFunc

< A callback function to create and initialize the backend context.

§fpGetDeviceCapabilities: GetDeviceCapabilitiesFunc

< A callback function to query device capabilites.

§fpDestroyBackendContext: DestroyBackendContextFunc

< A callback function to destroy the backendcontext. This also dereferences the device.

§fpCreateResource: CreateResourceFunc

< A callback function to create a resource.

§fpRegisterResource: RegisterResourceFunc

< A callback function to register an external resource.

§fpUnregisterResources: UnregisterResourcesFunc

< A callback function to unregister external resource.

§fpGetResourceDescription: GetResourceDescriptionFunc

< A callback function to retrieve a resource description.

§fpDestroyResource: DestroyResourceFunc

< A callback function to destroy a resource.

§fpCreatePipeline: CreatePipelineFunc

< A callback function to create a render or compute pipeline.

§fpDestroyPipeline: DestroyPipelineFunc

< A callback function to destroy a render or compute pipeline.

§fpScheduleGpuJob: ScheduleGpuJobFunc

< A callback function to schedule a render job.

§fpExecuteGpuJobs: ExecuteGpuJobsFunc

< A callback function to execute all queued render jobs.

§scratchBuffer: *mut c_void

< A preallocated buffer for memory utilized internally by the backend.

§scratchBufferSize: usize

< Size of the buffer pointed to by scratchBuffer.

Trait Implementations§

Source§

impl Clone for Interface

Source§

fn clone(&self) -> Interface

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Interface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Interface

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for Interface

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.