Commit 8a91a355 by Hernan Liatis

Add stubs for Native Buffer implementation

Bug: b/122837237 Change-Id: Ic9d306e11ff5dd64f6ba0f0f6cb3a1e9a882411a Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30189 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarHernan Liatis <hliatis@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 04c0eacd
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#ifdef __ANDROID__ #ifdef __ANDROID__
#include <cerrno> #include <cerrno>
#include <hardware/hwvulkan.h> #include <hardware/hwvulkan.h>
#include <vulkan/vk_android_native_buffer.h>
#endif #endif
namespace vk namespace vk
...@@ -266,6 +267,11 @@ static const std::unordered_map<std::string, PFN_vkVoidFunction> deviceFunctionP ...@@ -266,6 +267,11 @@ static const std::unordered_map<std::string, PFN_vkVoidFunction> deviceFunctionP
MAKE_VULKAN_DEVICE_ENTRY(vkQueuePresentKHR), MAKE_VULKAN_DEVICE_ENTRY(vkQueuePresentKHR),
MAKE_VULKAN_DEVICE_ENTRY(vkGetDeviceGroupPresentCapabilitiesKHR), MAKE_VULKAN_DEVICE_ENTRY(vkGetDeviceGroupPresentCapabilitiesKHR),
MAKE_VULKAN_DEVICE_ENTRY(vkGetDeviceGroupSurfacePresentModesKHR), MAKE_VULKAN_DEVICE_ENTRY(vkGetDeviceGroupSurfacePresentModesKHR),
#else
MAKE_VULKAN_DEVICE_ENTRY(vkGetSwapchainGrallocUsageANDROID),
MAKE_VULKAN_DEVICE_ENTRY(vkGetSwapchainGrallocUsage2ANDROID),
MAKE_VULKAN_DEVICE_ENTRY(vkAcquireImageANDROID),
MAKE_VULKAN_DEVICE_ENTRY(vkQueueSignalReleaseImageANDROID),
#endif #endif
}; };
#undef MAKE_VULKAN_DEVICE_ENTRY #undef MAKE_VULKAN_DEVICE_ENTRY
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
#include "WSI/XlibSurfaceKHR.hpp" #include "WSI/XlibSurfaceKHR.hpp"
#endif #endif
#ifdef __ANDROID__
#include <vulkan/vk_android_native_buffer.h>
#endif
#include "WSI/VkSwapchainKHR.hpp" #include "WSI/VkSwapchainKHR.hpp"
#include <algorithm> #include <algorithm>
...@@ -122,6 +126,8 @@ static const VkExtensionProperties deviceExtensionProperties[] = ...@@ -122,6 +126,8 @@ static const VkExtensionProperties deviceExtensionProperties[] =
{ VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION }, { VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION },
#ifndef __ANDROID__ #ifndef __ANDROID__
{ VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION }, { VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION },
#else
{ VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME, VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION },
#endif #endif
}; };
...@@ -2503,4 +2509,39 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR(VkDevice d ...@@ -2503,4 +2509,39 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR(VkDevice d
#endif // ! __ANDROID__ #endif // ! __ANDROID__
#ifdef __ANDROID__
VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainUsage, uint64_t* grallocConsumerUsage, uint64_t* grallocProducerUsage)
{
TRACE("(VkDevice device = 0x%X, VkFormat format = 0x%X, VkImageUsageFlags imageUsage = 0x%X, VkSwapchainImageUsageFlagsANDROID swapchainUsage = 0x%X, uint64_t* grallocConsumerUsage = 0x%X, uin64_t* grallocProducerUsage = 0x%X)",
device, format, imageUsage, swapchainUsage, grallocConsumerUsage, grallocProducerUsage);
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage)
{
TRACE("(VkDevice device = 0x%X, VkFormat format = 0x%X, VkImageUsageFlags imageUsage = 0x%X, int* grallocUsage = 0x%X)",
device, format, imageUsage, grallocUsage);
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence)
{
TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, int nativeFenceFd = 0x%X, VkSemaphore semaphore = 0x%X, VkFence fence = 0x%X)",
device, image, nativeFenceFd, semaphore, fence);
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd)
{
TRACE("(VkQueue queue = 0x%X, uint32_t waitSemaphoreCount = 0x%X, const VkSemaphore* pWaitSemaphores = 0x%X, VkImage image = 0x%X, int* pNativeFenceFd = 0x%X)",
queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd);
return VK_SUCCESS;
}
#endif // __ANDROID__
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment