Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-swiftshader: Commit

external/swiftshader


Commit MetaInfo

Revision1d667d6a7b5152e97437bedb129399e8df619efe (tree)
Time2019-04-06 06:56:52
AuthorChris Forbes <chrisforbes@goog...>
CommiterChris Forbes

Log Message

Disable surface and swapchain support for Android

On Android we will expose ANDROID_native_buffer instead, and leave the
surface and swapchain support to the android loader.

Bug: b/122837488
Change-Id: I03f0fd617042f49c19227701bbdcd2ccda883c94
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28408
Tested-by: Chris Forbes <chrisforbes@google.com>
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>

Change Summary

Incremental Difference

--- a/src/Vulkan/VkGetProcAddress.cpp
+++ b/src/Vulkan/VkGetProcAddress.cpp
@@ -74,14 +74,18 @@ static const std::unordered_map<std::string, PFN_vkVoidFunction> instanceFunctio
7474 MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceQueueFamilyProperties2KHR),
7575 MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceMemoryProperties2KHR),
7676 MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceSparseImageFormatProperties2KHR),
77+#ifndef __ANDROID__
78+ // VK_KHR_surface
7779 MAKE_VULKAN_INSTANCE_ENTRY(vkDestroySurfaceKHR),
78-#ifdef VK_USE_PLATFORM_XLIB_KHR
79- MAKE_VULKAN_INSTANCE_ENTRY(vkCreateXlibSurfaceKHR),
80-#endif
8180 MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceSurfaceSupportKHR),
8281 MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceSurfaceCapabilitiesKHR),
8382 MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceSurfaceFormatsKHR),
8483 MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceSurfacePresentModesKHR),
84+#endif
85+#ifdef VK_USE_PLATFORM_XLIB_KHR
86+ // VK_KHR_xlib_surface
87+ MAKE_VULKAN_INSTANCE_ENTRY(vkCreateXlibSurfaceKHR),
88+#endif
8589 };
8690 #undef MAKE_VULKAN_INSTANCE_ENTRY
8791
@@ -248,11 +252,14 @@ static const std::unordered_map<std::string, PFN_vkVoidFunction> deviceFunctionP
248252 MAKE_VULKAN_DEVICE_ENTRY(vkGetImageSparseMemoryRequirements2KHR),
249253 // VK_KHR_maintenance3
250254 MAKE_VULKAN_DEVICE_ENTRY(vkGetDescriptorSetLayoutSupportKHR),
255+#ifndef __ANDROID__
256+ // VK_KHR_swapchain
251257 MAKE_VULKAN_DEVICE_ENTRY(vkCreateSwapchainKHR),
252258 MAKE_VULKAN_DEVICE_ENTRY(vkDestroySwapchainKHR),
253259 MAKE_VULKAN_DEVICE_ENTRY(vkGetSwapchainImagesKHR),
254260 MAKE_VULKAN_DEVICE_ENTRY(vkAcquireNextImageKHR),
255261 MAKE_VULKAN_DEVICE_ENTRY(vkQueuePresentKHR),
262+#endif
256263 };
257264 #undef MAKE_VULKAN_DEVICE_ENTRY
258265
--- a/src/Vulkan/VkQueue.cpp
+++ b/src/Vulkan/VkQueue.cpp
@@ -74,6 +74,7 @@ void Queue::waitIdle()
7474 // FIXME (b/117835459): implement once we have working fences
7575 }
7676
77+#ifndef __ANDROID__
7778 void Queue::present(const VkPresentInfoKHR* presentInfo)
7879 {
7980 for(uint32_t i = 0; i < presentInfo->waitSemaphoreCount; i++)
@@ -86,5 +87,6 @@ void Queue::present(const VkPresentInfoKHR* presentInfo)
8687 vk::Cast(presentInfo->pSwapchains[i])->present(presentInfo->pImageIndices[i]);
8788 }
8889 }
90+#endif
8991
90-} // namespace vk
\ No newline at end of file
92+} // namespace vk
--- a/src/Vulkan/VkQueue.hpp
+++ b/src/Vulkan/VkQueue.hpp
@@ -43,7 +43,9 @@ public:
4343 void destroy();
4444 void submit(uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
4545 void waitIdle();
46+#ifndef __ANDROID__
4647 void present(const VkPresentInfoKHR* presentInfo);
48+#endif
4749
4850 private:
4951 sw::Context* context = nullptr;
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -92,7 +92,9 @@ static const VkExtensionProperties instanceExtensionProperties[] =
9292 { VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION },
9393 { VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION },
9494 { VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION },
95+#ifndef __ANDROID__
9596 { VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION },
97+#endif
9698 #ifdef VK_USE_PLATFORM_XLIB_KHR
9799 { VK_KHR_XLIB_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_SPEC_VERSION },
98100 #endif
@@ -118,7 +120,9 @@ static const VkExtensionProperties deviceExtensionProperties[] =
118120 { VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION },
119121 { VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME, VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION },
120122 { VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION },
123+#ifndef __ANDROID__
121124 { VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION },
125+#endif
122126 };
123127
124128 VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
@@ -2233,14 +2237,6 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, cons
22332237 vk::Cast(device)->getDescriptorSetLayoutSupport(pCreateInfo, pSupport);
22342238 }
22352239
2236-VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator)
2237-{
2238- TRACE("(VkInstance instance = 0x%X, VkSurfaceKHR surface = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
2239- instance, surface, pAllocator);
2240-
2241- vk::destroy(surface, pAllocator);
2242-}
2243-
22442240 #ifdef VK_USE_PLATFORM_XLIB_KHR
22452241 VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
22462242 {
@@ -2251,6 +2247,15 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const
22512247 }
22522248 #endif
22532249
2250+#ifndef __ANDROID__
2251+VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator)
2252+{
2253+ TRACE("(VkInstance instance = 0x%X, VkSurfaceKHR surface = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
2254+ instance, surface, pAllocator);
2255+
2256+ vk::destroy(surface, pAllocator);
2257+}
2258+
22542259 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported)
22552260 {
22562261 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t queueFamilyIndex = 0x%X, VkSurface surface = 0x%X, VKBool32* pSupported = 0x%X)",
@@ -2372,5 +2377,6 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentI
23722377
23732378 return VK_SUCCESS;
23742379 }
2380+#endif // ! __ANDROID__
23752381
23762382 }
Show on old repository browser