From d4764a8b3c2e958fc9780677e6226c1ee896c898 Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Thu, 24 Oct 2024 02:37:21 -0700 Subject: [PATCH] update dawn patch --- cmake/patches/dawn/dawn.patch | 45 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/cmake/patches/dawn/dawn.patch b/cmake/patches/dawn/dawn.patch index d696d386452e8..7a2a01d55be46 100644 --- a/cmake/patches/dawn/dawn.patch +++ b/cmake/patches/dawn/dawn.patch @@ -15,40 +15,55 @@ index 9c0bd6fa4e..bf8a57aeac 100644 ############################################################################### # Do the 'complete_lib' build. diff --git a/src/dawn/native/Surface_metal.mm b/src/dawn/native/Surface_metal.mm -index ce55acbd43..baa4835362 100644 +index ce55acbd43..2cfd363479 100644 --- a/src/dawn/native/Surface_metal.mm +++ b/src/dawn/native/Surface_metal.mm -@@ -36,7 +36,13 @@ +@@ -33,10 +33,18 @@ + + #import + ++#include "dawn/common/Platform.h" ++ namespace dawn::native { bool InheritsFromCAMetalLayer(void* obj) { - id object = static_cast(obj); + id object = -+#if TARGET_OS_IOS ++#if DAWN_PLATFORM_IS(IOS) + (__bridge id)obj; -+#else ++#else // DAWN_PLATFORM_IS(IOS) + static_cast(obj); -+#endif ++#endif // DAWN_PLATFORM_IS(IOS) + return [object isKindOfClass:[CAMetalLayer class]]; } diff --git a/src/dawn/native/metal/SharedFenceMTL.mm b/src/dawn/native/metal/SharedFenceMTL.mm -index bde8bfea07..f2f6459e91 100644 +index bde8bfea07..8906185d6f 100644 --- a/src/dawn/native/metal/SharedFenceMTL.mm +++ b/src/dawn/native/metal/SharedFenceMTL.mm -@@ -40,7 +40,13 @@ ResultOrError> SharedFence::Create( +@@ -25,6 +25,8 @@ + // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ++#include "dawn/common/Platform.h" ++ + #include "dawn/native/metal/SharedFenceMTL.h" + + #include "dawn/native/ChainUtils.h" +@@ -39,8 +41,13 @@ ResultOrError> SharedFence::Create( + const SharedFenceMTLSharedEventDescriptor* descriptor) { DAWN_INVALID_IF(descriptor->sharedEvent == nullptr, "MTLSharedEvent is missing."); if (@available(macOS 10.14, iOS 12.0, *)) { - return AcquireRef(new SharedFence( +- return AcquireRef(new SharedFence( - device, label, static_cast>(descriptor->sharedEvent))); -+ device, label, -+#if TARGET_OS_IOS -+ (__bridge id)(descriptor->sharedEvent) -+#else -+ static_cast>(descriptor->sharedEvent) -+#endif -+ )); ++ return AcquireRef(new SharedFence(device, label, ++#if DAWN_PLATFORM_IS(IOS) ++ (__bridge id)(descriptor->sharedEvent) ++#else // DAWN_PLATFORM_IS(IOS) ++ static_cast>(descriptor->sharedEvent) ++#endif // DAWN_PLATFORM_IS(IOS) ++ )); } else { return DAWN_INTERNAL_ERROR("MTLSharedEvent not supported."); }