Commit c670917c by Sergey Ulanov Committed by Angle LUCI CQ

[Fuchsia] Cleanup vulkan_fuchsia_ext.h

Removed defintions of fuchsia-specific vulkan types from vulkan_fuchsia_ext.h . Instead, the types provided by vulkan_fuchsia.h are used now. Also re-enabled vulkan validation on Fuchsia. Bug: chromium:1215736 Change-Id: I795347b7fb61d90033749533cefd42cf180730fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2934718Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 9b142b64
...@@ -166,12 +166,10 @@ declare_args() { ...@@ -166,12 +166,10 @@ declare_args() {
# TODO(anglebug.com/4082) enable validation layers on mac for swiftshader # TODO(anglebug.com/4082) enable validation layers on mac for swiftshader
# Vulkan Validation Layers require Android NDK API level 26, i.e. Oreo, due to # Vulkan Validation Layers require Android NDK API level 26, i.e. Oreo, due to
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714. # Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
# TODO(http://fxbug.dev/73208) Validation is temporarily disabled on Fuchsia.
# Re-enable once the issue is resolved.
angle_enable_vulkan_validation_layers = angle_enable_vulkan_validation_layers =
angle_enable_vulkan && !is_ubsan && !is_tsan && !is_asan && angle_enable_vulkan && !is_ubsan && !is_tsan && !is_asan &&
(is_debug || dcheck_always_on) && !is_mac && (is_debug || dcheck_always_on) && !is_mac &&
(!is_android || ndk_api_level_at_least_26) && !is_fuchsia (!is_android || ndk_api_level_at_least_26)
# ISpriteVisual windows cannot be validated and can lead to crashes if an invalid window is # ISpriteVisual windows cannot be validated and can lead to crashes if an invalid window is
# provided to ANGLE. Disable them for non-standalone ANGLE builds. crbug.com/1176118 # provided to ANGLE. Disable them for non-standalone ANGLE builds. crbug.com/1176118
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// vulkan_fuchsia_ext: // vulkan_fuchsia_ext:
// Defines Fuchsia-specific Vulkan extensions that haven't been // Defines Fuchsia-specific Vulkan extensions when compiling on other
// upstreamed to the official Vulkan headers. // platforms.
// //
#ifndef COMMON_VULKAN_FUCHSIA_EXT_H_ #ifndef COMMON_VULKAN_FUCHSIA_EXT_H_
...@@ -17,133 +17,15 @@ ...@@ -17,133 +17,15 @@
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#if defined(ANGLE_PLATFORM_FUCHSIA) // If this is not Fuchsia then define Fuchsia-specific types explicitly and include
# include <zircon/types.h> // vulkan_fuchsia.h to make it possible to compile the code on other platforms.
#else //
// TODO(https://anglebug.com/6040): Update all code to avoid dependencies on
// Fuchsia-specific types when compiling on other platforms. Then remove this header.
#if !defined(ANGLE_PLATFORM_FUCHSIA)
typedef uint32_t zx_handle_t; typedef uint32_t zx_handle_t;
# define ZX_HANDLE_INVALID ((zx_handle_t)0) # define ZX_HANDLE_INVALID ((zx_handle_t)0)
#endif # include <vulkan/vulkan_fuchsia.h>
#ifdef __cplusplus
extern "C" {
#endif
const VkStructureType VK_STRUCTURE_TYPE_TEMP_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA =
static_cast<VkStructureType>(1001005000);
const VkStructureType VK_STRUCTURE_TYPE_TEMP_MEMORY_ZIRCON_HANDLE_PROPERTIES_FUCHSIA =
static_cast<VkStructureType>(1001005001);
const VkStructureType VK_STRUCTURE_TYPE_TEMP_MEMORY_GET_ZIRCON_HANDLE_INFO_FUCHSIA =
static_cast<VkStructureType>(1001005002);
const VkStructureType VK_STRUCTURE_TYPE_TEMP_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA =
static_cast<VkStructureType>(1001006000);
const VkStructureType VK_STRUCTURE_TYPE_TEMP_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA =
static_cast<VkStructureType>(1001006001);
const VkExternalMemoryHandleTypeFlagBits
VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA =
static_cast<VkExternalMemoryHandleTypeFlagBits>(0x00100000);
const VkExternalSemaphoreHandleTypeFlagBits
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA =
static_cast<VkExternalSemaphoreHandleTypeFlagBits>(0x00100000);
#ifndef VK_FUCHSIA_external_memory
# define VK_FUCHSIA_external_memory 1
# define VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION 1
# define VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME "VK_FUCHSIA_external_memory"
typedef struct VkImportMemoryZirconHandleInfoFUCHSIA
{
VkStructureType sType;
const void *pNext;
VkExternalMemoryHandleTypeFlagBits handleType;
zx_handle_t handle;
} VkImportMemoryZirconHandleInfoFUCHSIA;
typedef struct VkMemoryZirconHandlePropertiesFUCHSIA
{
VkStructureType sType;
void *pNext;
zx_handle_t memoryTypeBits;
} VkMemoryZirconHandlePropertiesFUCHSIA;
typedef struct VkMemoryGetZirconHandleInfoFUCHSIA
{
VkStructureType sType;
const void *pNext;
VkDeviceMemory memory;
VkExternalMemoryHandleTypeFlagBits handleType;
} VkMemoryGetZirconHandleInfoFUCHSIA;
typedef VkResult(VKAPI_PTR *PFN_vkGetMemoryZirconHandleFUCHSIA)(
VkDevice device,
const VkMemoryGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
zx_handle_t *pZirconHandle);
typedef VkResult(VKAPI_PTR *PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)(
VkDevice device,
VkExternalMemoryHandleTypeFlagBits handleType,
zx_handle_t ZirconHandle,
VkMemoryZirconHandlePropertiesFUCHSIA *pMemoryZirconHandleProperties);
# ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL
vkGetMemoryZirconHandleFUCHSIA(VkDevice device,
const VkMemoryGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
zx_handle_t *pZirconHandle);
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA(
VkDevice device,
VkExternalMemoryHandleTypeFlagBits handleType,
zx_handle_t ZirconHandle,
VkMemoryZirconHandlePropertiesFUCHSIA *pMemoryZirconHandleProperties);
# endif
#endif
#ifndef VK_FUCHSIA_external_semaphore
# define VK_FUCHSIA_external_semaphore 1
# define VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION 1
# define VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_FUCHSIA_external_semaphore"
typedef struct VkImportSemaphoreZirconHandleInfoFUCHSIA
{
VkStructureType sType;
const void *pNext;
VkSemaphore semaphore;
VkSemaphoreImportFlags flags;
VkExternalSemaphoreHandleTypeFlagBits handleType;
zx_handle_t zirconHandle;
} VkImportSemaphoreZirconHandleInfoFUCHSIA;
typedef struct VkSemaphoreGetZirconHandleInfoFUCHSIA
{
VkStructureType sType;
const void *pNext;
VkSemaphore semaphore;
VkExternalSemaphoreHandleTypeFlagBits handleType;
} VkSemaphoreGetZirconHandleInfoFUCHSIA;
typedef VkResult(VKAPI_PTR *PFN_vkImportSemaphoreZirconHandleFUCHSIA)(
VkDevice device,
const VkImportSemaphoreZirconHandleInfoFUCHSIA *pImportSemaphoreZirconHandleInfo);
typedef VkResult(VKAPI_PTR *PFN_vkGetSemaphoreZirconHandleFUCHSIA)(
VkDevice device,
const VkSemaphoreGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
zx_handle_t *pZirconHandle);
# ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreZirconHandleFUCHSIA(
VkDevice device,
const VkImportSemaphoreZirconHandleInfoFUCHSIA *pImportSemaphoreZirconHandleInfo);
VKAPI_ATTR VkResult VKAPI_CALL
vkGetSemaphoreZirconHandleFUCHSIA(VkDevice device,
const VkSemaphoreGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
zx_handle_t *pZirconHandle);
# endif
#endif
#ifdef __cplusplus
}
#endif #endif
#endif // COMMON_VULKAN_FUCHSIA_EXT_H_ #endif // COMMON_VULKAN_FUCHSIA_EXT_H_
...@@ -66,7 +66,7 @@ VkExternalMemoryHandleTypeFlagBits ToVulkanHandleType(gl::HandleType handleType) ...@@ -66,7 +66,7 @@ VkExternalMemoryHandleTypeFlagBits ToVulkanHandleType(gl::HandleType handleType)
case gl::HandleType::OpaqueFd: case gl::HandleType::OpaqueFd:
return VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; return VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
case gl::HandleType::ZirconVmo: case gl::HandleType::ZirconVmo:
return VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA; return VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA;
default: default:
// Not a memory handle type. // Not a memory handle type.
UNREACHABLE(); UNREACHABLE();
...@@ -237,7 +237,7 @@ angle::Result MemoryObjectVk::createImage(ContextVk *contextVk, ...@@ -237,7 +237,7 @@ angle::Result MemoryObjectVk::createImage(ContextVk *contextVk,
case gl::HandleType::ZirconVmo: case gl::HandleType::ZirconVmo:
ASSERT(mZirconHandle != ZX_HANDLE_INVALID); ASSERT(mZirconHandle != ZX_HANDLE_INVALID);
importMemoryZirconHandleInfo.sType = importMemoryZirconHandleInfo.sType =
VK_STRUCTURE_TYPE_TEMP_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA; VK_STRUCTURE_TYPE_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA;
importMemoryZirconHandleInfo.pNext = importMemoryInfo; importMemoryZirconHandleInfo.pNext = importMemoryInfo;
importMemoryZirconHandleInfo.handleType = ToVulkanHandleType(mHandleType); importMemoryZirconHandleInfo.handleType = ToVulkanHandleType(mHandleType);
ANGLE_TRY( ANGLE_TRY(
......
...@@ -258,11 +258,11 @@ angle::Result SemaphoreVk::importZirconEvent(ContextVk *contextVk, GLuint handle ...@@ -258,11 +258,11 @@ angle::Result SemaphoreVk::importZirconEvent(ContextVk *contextVk, GLuint handle
VkImportSemaphoreZirconHandleInfoFUCHSIA importSemaphoreZirconHandleInfo = {}; VkImportSemaphoreZirconHandleInfoFUCHSIA importSemaphoreZirconHandleInfo = {};
importSemaphoreZirconHandleInfo.sType = importSemaphoreZirconHandleInfo.sType =
VK_STRUCTURE_TYPE_TEMP_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA; VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA;
importSemaphoreZirconHandleInfo.semaphore = mSemaphore.getHandle(); importSemaphoreZirconHandleInfo.semaphore = mSemaphore.getHandle();
importSemaphoreZirconHandleInfo.flags = 0; importSemaphoreZirconHandleInfo.flags = 0;
importSemaphoreZirconHandleInfo.handleType = importSemaphoreZirconHandleInfo.handleType =
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA; VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA;
importSemaphoreZirconHandleInfo.zirconHandle = handle; importSemaphoreZirconHandleInfo.zirconHandle = handle;
// TODO(spang): Add vkImportSemaphoreZirconHandleFUCHSIA to volk. // TODO(spang): Add vkImportSemaphoreZirconHandleFUCHSIA to volk.
......
...@@ -565,7 +565,7 @@ bool VulkanExternalHelper::canCreateImageZirconVmo(VkFormat format, ...@@ -565,7 +565,7 @@ bool VulkanExternalHelper::canCreateImageZirconVmo(VkFormat format,
} }
return canCreateImageExternal(format, type, tiling, createFlags, usageFlags, return canCreateImageExternal(format, type, tiling, createFlags, usageFlags,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA); VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA);
} }
VkResult VulkanExternalHelper::createImage2DZirconVmo(VkFormat format, VkResult VulkanExternalHelper::createImage2DZirconVmo(VkFormat format,
...@@ -577,17 +577,17 @@ VkResult VulkanExternalHelper::createImage2DZirconVmo(VkFormat format, ...@@ -577,17 +577,17 @@ VkResult VulkanExternalHelper::createImage2DZirconVmo(VkFormat format,
VkDeviceSize *deviceMemorySizeOut) VkDeviceSize *deviceMemorySizeOut)
{ {
return createImage2DExternal(format, createFlags, usageFlags, extent, return createImage2DExternal(format, createFlags, usageFlags, extent,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA, VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA, imageOut,
imageOut, deviceMemoryOut, deviceMemorySizeOut); deviceMemoryOut, deviceMemorySizeOut);
} }
VkResult VulkanExternalHelper::exportMemoryZirconVmo(VkDeviceMemory deviceMemory, zx_handle_t *vmo) VkResult VulkanExternalHelper::exportMemoryZirconVmo(VkDeviceMemory deviceMemory, zx_handle_t *vmo)
{ {
VkMemoryGetZirconHandleInfoFUCHSIA memoryGetZirconHandleInfo = { VkMemoryGetZirconHandleInfoFUCHSIA memoryGetZirconHandleInfo = {
/* .sType = */ VK_STRUCTURE_TYPE_TEMP_MEMORY_GET_ZIRCON_HANDLE_INFO_FUCHSIA, /* .sType = */ VK_STRUCTURE_TYPE_MEMORY_GET_ZIRCON_HANDLE_INFO_FUCHSIA,
/* .pNext = */ nullptr, /* .pNext = */ nullptr,
/* .memory = */ deviceMemory, /* .memory = */ deviceMemory,
/* .handleType = */ VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA, /* .handleType = */ VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA,
}; };
return vkGetMemoryZirconHandleFUCHSIA(mDevice, &memoryGetZirconHandleInfo, vmo); return vkGetMemoryZirconHandleFUCHSIA(mDevice, &memoryGetZirconHandleInfo, vmo);
...@@ -663,7 +663,7 @@ bool VulkanExternalHelper::canCreateSemaphoreZirconEvent() const ...@@ -663,7 +663,7 @@ bool VulkanExternalHelper::canCreateSemaphoreZirconEvent() const
VkPhysicalDeviceExternalSemaphoreInfo externalSemaphoreInfo = { VkPhysicalDeviceExternalSemaphoreInfo externalSemaphoreInfo = {
/* .sType = */ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, /* .sType = */ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO,
/* .pNext = */ nullptr, /* .pNext = */ nullptr,
/* .handleType = */ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA, /* .handleType = */ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA,
}; };
VkExternalSemaphoreProperties externalSemaphoreProperties = { VkExternalSemaphoreProperties externalSemaphoreProperties = {
...@@ -689,7 +689,7 @@ VkResult VulkanExternalHelper::createSemaphoreZirconEvent(VkSemaphore *semaphore ...@@ -689,7 +689,7 @@ VkResult VulkanExternalHelper::createSemaphoreZirconEvent(VkSemaphore *semaphore
VkExportSemaphoreCreateInfo exportSemaphoreCreateInfo = { VkExportSemaphoreCreateInfo exportSemaphoreCreateInfo = {
/* .sType = */ VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO, /* .sType = */ VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO,
/* .pNext = */ nullptr, /* .pNext = */ nullptr,
/* .handleTypes = */ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA, /* .handleTypes = */ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA,
}; };
VkSemaphoreCreateInfo semaphoreCreateInfo = { VkSemaphoreCreateInfo semaphoreCreateInfo = {
...@@ -704,10 +704,10 @@ VkResult VulkanExternalHelper::createSemaphoreZirconEvent(VkSemaphore *semaphore ...@@ -704,10 +704,10 @@ VkResult VulkanExternalHelper::createSemaphoreZirconEvent(VkSemaphore *semaphore
VkResult VulkanExternalHelper::exportSemaphoreZirconEvent(VkSemaphore semaphore, zx_handle_t *event) VkResult VulkanExternalHelper::exportSemaphoreZirconEvent(VkSemaphore semaphore, zx_handle_t *event)
{ {
VkSemaphoreGetZirconHandleInfoFUCHSIA semaphoreGetZirconHandleInfo = { VkSemaphoreGetZirconHandleInfoFUCHSIA semaphoreGetZirconHandleInfo = {
/* .sType = */ VK_STRUCTURE_TYPE_TEMP_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA, /* .sType = */ VK_STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA,
/* .pNext = */ nullptr, /* .pNext = */ nullptr,
/* .semaphore = */ semaphore, /* .semaphore = */ semaphore,
/* .handleType = */ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA, /* .handleType = */ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA,
}; };
return vkGetSemaphoreZirconHandleFUCHSIA(mDevice, &semaphoreGetZirconHandleInfo, event); return vkGetSemaphoreZirconHandleFUCHSIA(mDevice, &semaphoreGetZirconHandleInfo, event);
......
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