Skip to content

Commit

Permalink
[vulkan] Remove magma native surface
Browse files Browse the repository at this point in the history
The Vulkan surface extension as used here is meant for testing only.
Since this isn't used, remove it so we don't have to maintain it.
Also remove the attempt to locate all related Vulkan entry points.

Test:
pixelbook:build topaz, launch a spinning cube
  • Loading branch information
cdotstout committed Dec 10, 2018
1 parent a8d5582 commit f3de9c9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 145 deletions.
2 changes: 0 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,6 @@ FILE: ../../../flutter/vulkan/vulkan_native_surface.cc
FILE: ../../../flutter/vulkan/vulkan_native_surface.h
FILE: ../../../flutter/vulkan/vulkan_native_surface_android.cc
FILE: ../../../flutter/vulkan/vulkan_native_surface_android.h
FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.cc
FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.h
FILE: ../../../flutter/vulkan/vulkan_proc_table.cc
FILE: ../../../flutter/vulkan/vulkan_proc_table.h
FILE: ../../../flutter/vulkan/vulkan_provider.cc
Expand Down
11 changes: 2 additions & 9 deletions vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ source_set("vulkan") {
"vulkan_proc_table.h",
"vulkan_surface.cc",
"vulkan_surface.h",
"vulkan_swapchain.cc",
"vulkan_swapchain.h",
"vulkan_utilities.cc",
"vulkan_utilities.h",
"vulkan_window.cc",
Expand All @@ -47,13 +45,8 @@ source_set("vulkan") {
sources += [
"vulkan_native_surface_android.cc",
"vulkan_native_surface_android.h",
]
}

if (is_fuchsia) {
sources += [
"vulkan_native_surface_magma.cc",
"vulkan_native_surface_magma.h",
"vulkan_swapchain.cc",
"vulkan_swapchain.h",
]
}

Expand Down
9 changes: 8 additions & 1 deletion vulkan/vulkan_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk,
};

const char* extensions[] = {
#if OS_ANDROID
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
#endif
#if OS_FUCHSIA
VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME,
VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME,
Expand Down Expand Up @@ -177,6 +179,7 @@ uint32_t VulkanDevice::GetGraphicsQueueIndex() const {
bool VulkanDevice::GetSurfaceCapabilities(
const VulkanSurface& surface,
VkSurfaceCapabilitiesKHR* capabilities) const {
#if OS_ANDROID
if (!surface.IsValid() || capabilities == nullptr) {
return false;
}
Expand Down Expand Up @@ -206,6 +209,9 @@ bool VulkanDevice::GetSurfaceCapabilities(
capabilities->currentExtent.width = size.width();
capabilities->currentExtent.height = size.height();
return true;
#else
return false;
#endif
}

bool VulkanDevice::GetPhysicalDeviceFeatures(
Expand Down Expand Up @@ -262,6 +268,7 @@ std::vector<VkQueueFamilyProperties> VulkanDevice::GetQueueFamilyProperties()
int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface,
std::vector<VkFormat> desired_formats,
VkSurfaceFormatKHR* format) const {
#if OS_ANDROID
if (!surface.IsValid() || format == nullptr) {
return -1;
}
Expand Down Expand Up @@ -297,7 +304,7 @@ int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface,
return static_cast<int>(i);
}
}

#endif
return -1;
}

Expand Down
66 changes: 0 additions & 66 deletions vulkan/vulkan_native_surface_magma.cc

This file was deleted.

43 changes: 0 additions & 43 deletions vulkan/vulkan_native_surface_magma.h

This file was deleted.

25 changes: 9 additions & 16 deletions vulkan/vulkan_proc_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,20 @@ bool VulkanProcTable::SetupInstanceProcAddresses(
ACQUIRE_PROC(CreateDevice, handle);
ACQUIRE_PROC(DestroyDevice, handle);
ACQUIRE_PROC(DestroyInstance, handle);
ACQUIRE_PROC(DestroySurfaceKHR, handle);
ACQUIRE_PROC(EnumerateDeviceLayerProperties, handle);
ACQUIRE_PROC(EnumeratePhysicalDevices, handle);
ACQUIRE_PROC(GetDeviceProcAddr, handle);
ACQUIRE_PROC(GetPhysicalDeviceFeatures, handle);
ACQUIRE_PROC(GetPhysicalDeviceQueueFamilyProperties, handle);
#if OS_ANDROID
ACQUIRE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR, handle);
ACQUIRE_PROC(GetPhysicalDeviceSurfaceFormatsKHR, handle);
ACQUIRE_PROC(GetPhysicalDeviceSurfacePresentModesKHR, handle);
ACQUIRE_PROC(GetPhysicalDeviceSurfaceSupportKHR, handle);

#if OS_ANDROID
ACQUIRE_PROC(DestroySurfaceKHR, handle);
ACQUIRE_PROC(CreateAndroidSurfaceKHR, handle);
#endif // OS_ANDROID

#if OS_FUCHSIA
[this, &handle]() -> bool {
ACQUIRE_PROC(CreateMagmaSurfaceKHR, handle);
ACQUIRE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR, handle);
return true;
}();
#endif // OS_FUCHSIA

// The debug report functions are optional. We don't want proc acquisition to
// fail here because the optional methods were not present (since ACQUIRE_PROC
// returns false on failure). Wrap the optional proc acquisitions in an
Expand All @@ -114,7 +105,6 @@ bool VulkanProcTable::SetupInstanceProcAddresses(

bool VulkanProcTable::SetupDeviceProcAddresses(
const VulkanHandle<VkDevice>& handle) {
ACQUIRE_PROC(AcquireNextImageKHR, handle);
ACQUIRE_PROC(AllocateCommandBuffers, handle);
ACQUIRE_PROC(AllocateMemory, handle);
ACQUIRE_PROC(BeginCommandBuffer, handle);
Expand All @@ -124,25 +114,28 @@ bool VulkanProcTable::SetupDeviceProcAddresses(
ACQUIRE_PROC(CreateFence, handle);
ACQUIRE_PROC(CreateImage, handle);
ACQUIRE_PROC(CreateSemaphore, handle);
ACQUIRE_PROC(CreateSwapchainKHR, handle);
ACQUIRE_PROC(DestroyCommandPool, handle);
ACQUIRE_PROC(DestroyFence, handle);
ACQUIRE_PROC(DestroyImage, handle);
ACQUIRE_PROC(DestroySemaphore, handle);
ACQUIRE_PROC(DestroySwapchainKHR, handle);
ACQUIRE_PROC(DeviceWaitIdle, handle);
ACQUIRE_PROC(EndCommandBuffer, handle);
ACQUIRE_PROC(FreeCommandBuffers, handle);
ACQUIRE_PROC(FreeMemory, handle);
ACQUIRE_PROC(GetDeviceQueue, handle);
ACQUIRE_PROC(GetImageMemoryRequirements, handle);
ACQUIRE_PROC(GetSwapchainImagesKHR, handle);
ACQUIRE_PROC(QueuePresentKHR, handle);
ACQUIRE_PROC(QueueSubmit, handle);
ACQUIRE_PROC(QueueWaitIdle, handle);
ACQUIRE_PROC(ResetCommandBuffer, handle);
ACQUIRE_PROC(ResetFences, handle);
ACQUIRE_PROC(WaitForFences, handle);
#if OS_ANDROID
ACQUIRE_PROC(AcquireNextImageKHR, handle);
ACQUIRE_PROC(CreateSwapchainKHR, handle);
ACQUIRE_PROC(DestroySwapchainKHR, handle);
ACQUIRE_PROC(GetSwapchainImagesKHR, handle);
ACQUIRE_PROC(QueuePresentKHR, handle);
#endif // OS_ANDROID
#if OS_FUCHSIA
ACQUIRE_PROC(GetMemoryFuchsiaHandleKHR, handle);
ACQUIRE_PROC(ImportSemaphoreFuchsiaHandleKHR, handle);
Expand Down
14 changes: 6 additions & 8 deletions vulkan/vulkan_proc_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,22 @@ class VulkanProcTable : public fml::RefCountedThreadSafe<VulkanProcTable> {
DEFINE_PROC(GetInstanceProcAddr);
DEFINE_PROC(GetPhysicalDeviceFeatures);
DEFINE_PROC(GetPhysicalDeviceQueueFamilyProperties);
DEFINE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
DEFINE_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
DEFINE_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
DEFINE_PROC(GetPhysicalDeviceSurfaceSupportKHR);
DEFINE_PROC(GetSwapchainImagesKHR);
DEFINE_PROC(QueuePresentKHR);
DEFINE_PROC(QueueSubmit);
DEFINE_PROC(QueueWaitIdle);
DEFINE_PROC(ResetCommandBuffer);
DEFINE_PROC(ResetFences);
DEFINE_PROC(WaitForFences);
#if OS_ANDROID
DEFINE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
DEFINE_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
DEFINE_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
DEFINE_PROC(GetPhysicalDeviceSurfaceSupportKHR);
DEFINE_PROC(GetSwapchainImagesKHR);
DEFINE_PROC(QueuePresentKHR);
DEFINE_PROC(CreateAndroidSurfaceKHR);
#endif // OS_ANDROID
#if OS_FUCHSIA
DEFINE_PROC(CreateMagmaSurfaceKHR);
DEFINE_PROC(GetMemoryFuchsiaHandleKHR);
DEFINE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR);
DEFINE_PROC(ImportSemaphoreFuchsiaHandleKHR);
#endif // OS_FUCHSIA

Expand Down

0 comments on commit f3de9c9

Please sign in to comment.