Skip to content

Wrapper get_latency_timings of VK_NV_low_latency2 is incorrect #814

@VZout

Description

@VZout

The get_latency_timings for this extension (added in #802) is a bit odd. it takes a single VkGetLatencyMarkerInfoNV as a pointer. and that struct has a number of timings. the count variable returns the size of ptimings NOT the amount of VkGetLatencyMarkerInfoNV's to pass in.

currently in ash the function signature is this:

    pub unsafe fn get_latency_timings(
        &self,
        swapchain: vk::SwapchainKHR,
        latency_marker_info: &mut [vk::GetLatencyMarkerInfoNV<'_>],
    )

But it shouldn't take a slice of latency_marker_info but instead a slice of VkLatencyTimingsFrameReportNV that is put inside the ptimings variable of GetLatencyMarkerInfoNV

This is my manual impl i wrote for testing:

            // get ptimings count.
            let mut marker = vk::GetLatencyMarkerInfoNV::default();
            let mut count = 0;
            (self
                .device
                .extensions()
                .low_latency2
                .fp()
                .get_latency_timings_nv)(
                self.device.extensions().low_latency2.device(),
                self.swapchain,
                &mut count,
                (&mut marker) as *mut _,
            );

            // alloc ptimings array initialized to default.
            let mut timings = vec![vk::LatencyTimingsFrameReportNV::default(); count as usize];
            marker.p_timings = timings.as_mut_ptr();

            // actually get the timings.
            if count > 0 {
                (self
                    .device
                    .extensions()
                    .low_latency2
                    .fp()
                    .get_latency_timings_nv)(
                    self.device.extensions().low_latency2.device(),
                    self.swapchain,
                    &mut count,
                    (&mut marker) as *mut _,
                );
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions