[dawn][metal] ArgBufs: fix refcounting in BindGroupLayoutMTL
- [NSArray arrayWithObjects] allocates an autoreleased array (per docs),
so we don't need to acquire it. Since it's a local object, we also
don't need an NSRef. Also add an @autoreleasepool to make it get freed
immediately (instead of using whatever autoreleasepool is currently on
the stack).
- Note: LLDB and ASan were useless in debugging this. I found the
environment variable NSZombieEnabled=YES which helped figure out
which object it was:
-[__NSSingleObjectArrayI release]: message sent to deallocated instance
- [MTLDevice newArgumentEncoderWithArguments] was leaking because of a
missing AcquireNSPRef. ("new" apparently means it's not autoreleased.)
- Debugged this using an ASan build and ASAN_OPTIONS=detect_leaks=1
Test: MultithreadCachingTests.RefAndReleaseCachedBindGroupLayoutsInParallel
Bug: 363031535
Change-Id: Id70f3bab4c239f4008e7fa031910addede22df48
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/292656
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Dawn is an open-source and cross-platform implementation of the WebGPU standard. More precisely it implements webgpu.h that is a one-to-one mapping with the WebGPU IDL. Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium.
Dawn provides several WebGPU building blocks:
webgpu.h version that Dawn implements.webgpu.h.Helpful links:
Developer documentation:
User documentation: (TODO, figure out what overlaps with the webgpu.h docs)
BSD 3-Clause License, please see LICENSE.
This is not an officially supported Google product.