Skip to content

Commit

Permalink
Update vulkan semaphore extension
Browse files Browse the repository at this point in the history
Use fuchsia specific extension to avoid casting handles as fds.
  • Loading branch information
cdotstout committed Sep 26, 2017
1 parent ccf9859 commit 9c518cb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions content_handler/vulkan_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ vulkan::VulkanHandle<VkSemaphore> VulkanSurface::SemaphoreFromEvent(
return vulkan::VulkanHandle<VkSemaphore>();
}

VkImportSemaphoreFdInfoKHR import_info = {
.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR,
VkImportSemaphoreFuchsiaHandleInfoKHR import_info = {
.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FUCHSIA_HANDLE_INFO_KHR,
.pNext = nullptr,
.semaphore = semaphore,
.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR,
.fd = semaphore_event.release()};
.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR,
.handle = static_cast<uint32_t>(semaphore_event.release())};

result = VK_CALL_LOG_ERROR(
vk_.ImportSemaphoreFdKHR(backend_context_->fDevice, &import_info));
result = VK_CALL_LOG_ERROR(vk_.ImportSemaphoreFuchsiaHandleKHR(
backend_context_->fDevice, &import_info));
if (result != VK_SUCCESS) {
return vulkan::VulkanHandle<VkSemaphore>();
}
Expand Down
2 changes: 1 addition & 1 deletion vulkan/vulkan_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk,
#if OS_FUCHSIA
VK_GOOGLE_EXTERNAL_MEMORY_MAGMA_EXTENSION_NAME,
VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_EXTENSION_NAME,
#endif
};

Expand Down
4 changes: 2 additions & 2 deletions vulkan/vulkan_proc_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ bool VulkanProcTable::SetupInstanceProcAddresses(
ACQUIRE_PROC(CreateMagmaSurfaceKHR, handle);
ACQUIRE_PROC(ExportDeviceMemoryMAGMA, handle);
ACQUIRE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR, handle);
ACQUIRE_PROC(ImportSemaphoreFdKHR, handle);
ACQUIRE_PROC(ImportSemaphoreFuchsiaHandleKHR, handle);
return true;
}();
#endif // OS_FUCHSIA
Expand Down Expand Up @@ -147,7 +147,7 @@ bool VulkanProcTable::SetupDeviceProcAddresses(
ACQUIRE_PROC(WaitForFences, handle);
#if OS_FUCHSIA
ACQUIRE_PROC(ExportDeviceMemoryMAGMA, handle);
ACQUIRE_PROC(ImportSemaphoreFdKHR, handle);
ACQUIRE_PROC(ImportSemaphoreFuchsiaHandleKHR, handle);
#endif // OS_FUCHSIA
device_ = {handle, nullptr};
return true;
Expand Down
2 changes: 1 addition & 1 deletion vulkan/vulkan_proc_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class VulkanProcTable : public fxl::RefCountedThreadSafe<VulkanProcTable> {
DEFINE_PROC(CreateMagmaSurfaceKHR);
DEFINE_PROC(ExportDeviceMemoryMAGMA);
DEFINE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR);
DEFINE_PROC(ImportSemaphoreFdKHR);
DEFINE_PROC(ImportSemaphoreFuchsiaHandleKHR);
#endif // OS_FUCHSIA

#undef DEFINE_PROC
Expand Down

0 comments on commit 9c518cb

Please sign in to comment.