[dawn][metal] ArgBufs: avoid creating zero-sized argbufs Also remove a TODO that was done in ccc243cd4a3bd33fdb2ae5da97bb7bc13ddf8369. Test: BindGroupTests.MultipleEntryPointsWithMultipleNonZeroGroups Bug: 363031535 Change-Id: I21b5124cb7c83a7456f49ae6d12d64f7534bf34f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/292615 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/native/metal/BindGroupMTL.mm b/src/dawn/native/metal/BindGroupMTL.mm index f9deb10..19a0fa2 100644 --- a/src/dawn/native/metal/BindGroupMTL.mm +++ b/src/dawn/native/metal/BindGroupMTL.mm
@@ -58,13 +58,17 @@ return {}; } - // TODO(crbug.com/363031535): The argument buffers should probably work in some kind of pool + // TODO(crbug.com/477311786): The argument buffers should probably work in some kind of pool // instead of being allocated here auto layout = ToBackend(GetLayout()); auto encoder = layout->GetArgumentEncoder(); NSUInteger argumentBufferLength = [*encoder encodedLength]; + // Avoid zero-sized buffers by rounding up the size. + if (argumentBufferLength == 0) { + argumentBufferLength = 8; + } mArgumentBuffer = AcquireNSPRef([device->GetMTLDevice() newBufferWithLength:argumentBufferLength options:0]); @@ -83,8 +87,6 @@ // Note, if a resource is destroyed, we will write nil to that slot. // Validation should ensure we never actually try to use it. - // TODO(crbug.com/363031535): The buffers, samplers and textures in the MatchVariant need to - // have resource usage tracking added. MatchVariant( bindingInfo.bindingLayout, [&](const BufferBindingInfo& layout) {