-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VK_KHR_timeline_semaphore
extension support
#276
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this useful? KhrTimelineSemaphoreFn
does not have any interesting functions itself.
The things that are of particular interest are (right now at least) defined on DeviceFnV1_2
, like get_semaphore_counter_value
. I believe these should be provided by your ash::extensions::TimelineSemaphore
to be useful.
Either way, thank you for the effort, I just used the 1.2 versions myself.
@farnoy I tested on my side, functions related to timeline semaphores defined in unsafe { device.wait_semaphores(device.handle(), &semaphore_wait_info, std::u64::MAX).unwrap(); } so you don't have to grab function pointers by yourself anymore. |
Have you tested on a 1.0/1.1 application with this? I don't think that would work since the functions have a |
@farnoy I tried this on API 1.1, and it doesn't work. As I understand, that happens because of |
@farnoy I misread your comment at first, sorry. Yes, it will not work because of the |
The point is, the extension should provide access to the |
So expected implementation is that Vulkan 1.2 users call functions like device.wait_semaphores(device.handle(), &semaphore_wait_info, timeout)?; and Vulkan 1.1 users call functions like timeline_semaphore_loader.wait_semaphores(&semaphore_wait_info, timeout)?; right? |
I would summarize it as: 1.2 users don't use this and call 1.0/1.1 users need to enable the device extension and call I think the suffix is usually preserved in ash, and the interface should be the same (because it is the same in the spec between the extension and 1.2 core) |
BTW, |
…th timeline semaphores.
I added the timeline_semaphore_loader.get_semaphore_counter_value_khr(device.handle(), semaphore)?;
timeline_semaphore_loader.wait_semaphores_khr(device.handle(), &semaphore_wait_info, timeout)?;
timeline_semaphore_loader.signal_semaphore_khr(device.handle(), &semaphore_signal_info, timeout)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hey thanks for the PR. Sorry for not responding sooner. I made a PR to include function aliases in extensions #279 pub struct KhrTimelineSemaphoreFn {
pub get_semaphore_counter_value:
extern "system" fn(device: Device, semaphore: Semaphore, p_value: *mut u64) -> Result,
pub wait_semaphores: extern "system" fn(
device: Device,
p_wait_info: *const SemaphoreWaitInfo,
timeout: u64,
) -> Result,
pub signal_semaphore:
extern "system" fn(device: Device, p_signal_info: *const SemaphoreSignalInfo) -> Result,
} No need to fetch those function pointers yourself and we should update this PR when this is merged in. |
That would be great! Waiting for #279. |
*_khr postfix removed from TimelineSemaphore functions to follow the same code style as in other extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! LGTM
* TimelineSemaphore struct added presenting `VK_KHR_timeline_semaphore` extension. * Unused import removed. * Empty newline added. * TimelineSemaphore extension object now provides functions for work with timeline semaphores. * Function pointers removed from TimelineSemaphore as no longer needed. *_khr postfix removed from TimelineSemaphore functions to follow the same code style as in other extensions. * Tiny code reformatting to fit Rustfmt requirements. * Another attempt to fit Rustfmt requirements.
Introduced
ash::extensions::khr::TimelineSemaphore
structure written by analogy withkhr::Swapchain
(except the fact that it does not hold any special functions besides those ones that are needed for extension loading).Enabling timeline semaphore support in the application now: