Commit 83a3eb49 by Hernan Liatis

Implement Android shared image query so device creation can succeed

Bug: b/122837060 Change-Id: I8524a46d79e1327d494acc5ee494bad87bc9676b Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30190 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Tested-by: 's avatarHernan Liatis <hliatis@google.com>
parent 8a91a355
...@@ -328,6 +328,13 @@ void PhysicalDevice::getProperties(VkSamplerYcbcrConversionImageFormatProperties ...@@ -328,6 +328,13 @@ void PhysicalDevice::getProperties(VkSamplerYcbcrConversionImageFormatProperties
properties->combinedImageSamplerDescriptorCount = 0; properties->combinedImageSamplerDescriptorCount = 0;
} }
#ifdef __ANDROID__
void PhysicalDevice::getProperties(VkPhysicalDevicePresentationPropertiesANDROID* properties) const
{
properties->sharedImage = VK_FALSE;
}
#endif
void PhysicalDevice::getProperties(const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) const void PhysicalDevice::getProperties(const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) const
{ {
pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = 0; pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = 0;
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
#include "VkObject.hpp" #include "VkObject.hpp"
#ifdef VK_USE_PLATFORM_ANDROID_KHR
#include <vulkan/vk_android_native_buffer.h>
#endif
namespace vk namespace vk
{ {
...@@ -49,6 +53,9 @@ public: ...@@ -49,6 +53,9 @@ public:
void getProperties(VkPhysicalDeviceSubgroupProperties* properties) const; void getProperties(VkPhysicalDeviceSubgroupProperties* properties) const;
void getProperties(const VkExternalMemoryHandleTypeFlagBits* handleType, VkExternalImageFormatProperties* properties) const; void getProperties(const VkExternalMemoryHandleTypeFlagBits* handleType, VkExternalImageFormatProperties* properties) const;
void getProperties(VkSamplerYcbcrConversionImageFormatProperties* properties) const; void getProperties(VkSamplerYcbcrConversionImageFormatProperties* properties) const;
#ifdef __ANDROID__
void getProperties(VkPhysicalDevicePresentationPropertiesANDROID* properties) const;
#endif
void getProperties(const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) const; void getProperties(const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) const;
void getProperties(const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) const; void getProperties(const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) const;
void getProperties(const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) const; void getProperties(const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) const;
......
...@@ -2035,7 +2035,9 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physi ...@@ -2035,7 +2035,9 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physi
VkBaseOutStructure* extensionProperties = reinterpret_cast<VkBaseOutStructure*>(pProperties->pNext); VkBaseOutStructure* extensionProperties = reinterpret_cast<VkBaseOutStructure*>(pProperties->pNext);
while(extensionProperties) while(extensionProperties)
{ {
switch(extensionProperties->sType) // Casting to a long since some structures, such as VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID
// are not enumerated in the official Vulkan header
switch((long)(extensionProperties->sType))
{ {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES:
{ {
...@@ -2078,6 +2080,14 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physi ...@@ -2078,6 +2080,14 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physi
ASSERT(!HasExtensionProperty(VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, deviceExtensionProperties, ASSERT(!HasExtensionProperty(VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, deviceExtensionProperties,
sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0])));
break; break;
#ifdef __ANDROID__
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID:
{
auto& properties = *reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID*>(extensionProperties);
vk::Cast(physicalDevice)->getProperties(&properties);
}
break;
#endif
default: default:
// "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]" // "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]"
UNIMPLEMENTED("extensionProperties->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. UNIMPLEMENTED("extensionProperties->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
......
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