diff --git a/src/dawn/common/Platform.h b/src/dawn/common/Platform.h index dc8d79c01b..d0eeb779bf 100644 --- a/src/dawn/common/Platform.h +++ b/src/dawn/common/Platform.h @@ -51,9 +51,10 @@ #define DAWN_PLATFORM_IS_POSIX 1 #if defined(__ANDROID__) #define DAWN_PLATFORM_IS_ANDROID 1 -#endif -#if defined(DAWN_OS_CHROMEOS) +#elif defined(DAWN_OS_CHROMEOS) #define DAWN_PLATFORM_IS_CHROMEOS 1 +#else +#define DAWN_PLATFORM_IS_LINUX_DESKTOP 1 #endif #elif defined(__APPLE__) @@ -197,6 +198,9 @@ static_assert(sizeof(sizeof(char)) == 4, "Expect sizeof(size_t) == 4"); #if !defined(DAWN_PLATFORM_IS_CHROMEOS) #define DAWN_PLATFORM_IS_CHROMEOS 0 #endif +#if !defined(DAWN_PLATFORM_IS_LINUX_DESKTOP) +#define DAWN_PLATFORM_IS_LINUX_DESKTOP 0 +#endif #if !defined(DAWN_PLATFORM_IS_APPLE) #define DAWN_PLATFORM_IS_APPLE 0 diff --git a/src/dawn/native/vulkan/external_memory/MemoryService.cpp b/src/dawn/native/vulkan/external_memory/MemoryService.cpp index f751d75164..35491d3ad1 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryService.cpp +++ b/src/dawn/native/vulkan/external_memory/MemoryService.cpp @@ -17,10 +17,10 @@ #include "dawn/native/vulkan/DeviceVk.h" #include "dawn/native/vulkan/external_memory/MemoryService.h" -#if DAWN_PLATFORM_IS(LINUX) || DAWN_PLATFORM_IS(CHROMEOS) +#if DAWN_PLATFORM_IS(LINUX_DESKTOP) || DAWN_PLATFORM_IS(CHROMEOS) #include "dawn/native/vulkan/external_memory/MemoryServiceImplementationDmaBuf.h" #include "dawn/native/vulkan/external_memory/MemoryServiceImplementationOpaqueFD.h" -#endif // DAWN_PLATFORM_IS(LINUX) +#endif // DAWN_PLATFORM_IS(LINUX_DESKTOP) || DAWN_PLATFORM_IS(CHROMEOS) #if DAWN_PLATFORM_IS(ANDROID) #include "dawn/native/vulkan/external_memory/MemoryServiceImplementationAHardwareBuffer.h" @@ -37,7 +37,7 @@ bool Service::CheckSupport(const VulkanDeviceInfo& deviceInfo) { return CheckAHardwareBufferSupport(deviceInfo); #elif DAWN_PLATFORM_IS(FUCHSIA) return CheckZirconHandleSupport(deviceInfo); -#elif DAWN_PLATFORM_IS(LINUX) || DAWN_PLATFORM_IS(CHROMEOS) +#elif DAWN_PLATFORM_IS(LINUX_DESKTOP) || DAWN_PLATFORM_IS(CHROMEOS) return CheckOpaqueFDSupport(deviceInfo) || CheckDmaBufSupport(deviceInfo); #else return false; @@ -51,7 +51,13 @@ Service::Service(Device* device) { } #endif // DAWN_PLATFORM_IS(FUCHSIA) -#if DAWN_PLATFORM_IS(LINUX) || DAWN_PLATFORM_IS(CHROMEOS) +#if DAWN_PLATFORM_IS(ANDROID) + if (CheckAHardwareBufferSupport(device->GetDeviceInfo())) { + mServiceImpls[ExternalImageType::AHardwareBuffer] = CreateAHardwareBufferService(device); + } +#endif // DAWN_PLATFORM_IS(ANDROID) + +#if DAWN_PLATFORM_IS(LINUX_DESKTOP) || DAWN_PLATFORM_IS(CHROMEOS) if (CheckOpaqueFDSupport(device->GetDeviceInfo())) { mServiceImpls[ExternalImageType::OpaqueFD] = CreateOpaqueFDService(device); } @@ -59,13 +65,7 @@ Service::Service(Device* device) { if (CheckDmaBufSupport(device->GetDeviceInfo())) { mServiceImpls[ExternalImageType::DmaBuf] = CreateDmaBufService(device); } -#endif // DAWN_PLATFORM_IS(LINUX) || DAWN_PLATFORM_IS(CHROMEOS) - -#if DAWN_PLATFORM_IS(ANDROID) - if (CheckAHardwareBufferSupport(device->GetDeviceInfo())) { - mServiceImpls[ExternalImageType::AHardwareBuffer] = CreateAHardwareBufferService(device); - } -#endif // DAWN_PLATFORM_IS(ANDROID) +#endif // DAWN_PLATFORM_IS(LINUX_DESKTOP) || DAWN_PLATFORM_IS(CHROMEOS) } Service::~Service() = default;