9 #include "vulkan/vulkan_handles.hpp"
14 const std::shared_ptr<Context>& context) {
18 vk::StructureChain<vk::SemaphoreCreateInfo, vk::ExportSemaphoreCreateInfoKHR>
21 info.get<vk::ExportSemaphoreCreateInfoKHR>().handleTypes =
22 vk::ExternalSemaphoreHandleTypeFlagBits::eSyncFd;
25 auto [result, semaphore] =
26 context_vk.GetDevice().createSemaphoreUnique(info.get());
27 if (result != vk::Result::eSuccess) {
29 << vk::to_string(result);
33 context_vk.SetDebugName(semaphore.get(),
"ExternalSemaphoreSyncFD");
48 vk::SemaphoreGetFdInfoKHR info;
49 info.semaphore = semaphore_->Get();
50 info.handleType = vk::ExternalSemaphoreHandleTypeFlagBits::eSyncFd;
52 semaphore_->GetUniqueWrapper().getOwner().getSemaphoreFdKHR(info);
53 if (result != vk::Result::eSuccess) {
55 << vk::to_string(result);
58 return fml::UniqueFD{fd};
62 return semaphore_->Get();
static ContextVK & Cast(Context &base)
const vk::Semaphore & GetHandle() const
const SharedHandleVK< vk::Semaphore > & GetSharedHandle() const
fml::UniqueFD CreateFD() const
Create a new sync file descriptor for the underlying semaphore.
bool IsValid() const
If a valid fence could be created.
ExternalSemaphoreVK(const std::shared_ptr< Context > &context)
Create a new un-signaled semaphore that can be exported as a sync file descriptor.
std::shared_ptr< SharedObjectVKT< T > > SharedHandleVK
auto MakeSharedVK(vk::UniqueHandle< T, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE > handle)