From dcb82432fbc487cea4bd7980424cabf705529e3c Mon Sep 17 00:00:00 2001 From: James Price Date: Thu, 17 Jun 2021 08:08:58 +0000 Subject: [PATCH] Metal: Remap vertex buffers when using Tint Otherwise bindings with non-zero groups get through to the Tint MSL backend and break assumptions. Bug: tint:104, dawn:571 Change-Id: I8d95ba142a386ff0d992ffe5f88a7acf93057ce1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/54960 Auto-Submit: James Price Commit-Queue: Corentin Wallez Reviewed-by: Corentin Wallez --- src/dawn_native/metal/ShaderModuleMTL.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/dawn_native/metal/ShaderModuleMTL.mm b/src/dawn_native/metal/ShaderModuleMTL.mm index 80c7e88f77..82f7096a11 100644 --- a/src/dawn_native/metal/ShaderModuleMTL.mm +++ b/src/dawn_native/metal/ShaderModuleMTL.mm @@ -112,9 +112,14 @@ namespace dawn_native { namespace metal { for (VertexBufferSlot slot : IterateBitSet(renderPipeline->GetVertexBufferSlotsUsed())) { uint32_t metalIndex = renderPipeline->GetMtlVertexBufferIndex(slot); - DAWN_UNUSED(metalIndex); - // TODO(crbug.com/tint/104): Tell Tint to map (kPullingBufferBindingSet, slot) to - // this MSL buffer index. + + // Tell Tint to map (kPullingBufferBindingSet, slot) to this MSL buffer index. + BindingPoint srcBindingPoint{static_cast(kPullingBufferBindingSet), + static_cast(slot)}; + BindingPoint dstBindingPoint{0, metalIndex}; + if (srcBindingPoint != dstBindingPoint) { + bindingPoints.emplace(srcBindingPoint, dstBindingPoint); + } } } if (GetDevice()->IsRobustnessEnabled()) {