Crate fsr

source ·
Expand description

Unsafe Rust bindings for FidelityFX Super Resolution 2

§Vulkan psuedo code

// Create the FSR interface
// The context created below should not out live the scratch buffer.
let mut scratch_buffer =
    vec![0u8; fsr::vk::get_scratch_memory_size(&vk_instance, vk_physical_device)];
let interface = fsr::vk::get_interface(
    &vk_entry,
    &vk_instance,
    vk_physical_device,
    &mut scratch_buffer,
).unwrap();

// Create the FSR context
let context_desc = fsr::ContextDescription {
    interface: fsr_interface,
    device: &fsr::vk::get_device(vk_device),
    display_size: [1920, 1080],
    max_render_size: [1280, 720],
    flags: fsr::InitializationFlagBits::ENABLE_HIGH_DYNAMIC_RANGE
    message_callback: None,
};
let context = fsr::Context::new(context_desc).unwrap();

// Dispatch gpu work
let desc = fsr::DispatchDescription::new(
    vk_command_list.into(),
    color,
    depth,
    velocity,
    output,
    delta_time_s,
    [1280, 720],
);
fsr_context.dispatch(desc).expect("Failed to dispatch fsr");

Re-exports§

Modules§

Structs§

Enums§

Type Aliases§

  • A typedef representing the graphics device.