diff --git a/src/dawn_native/metal/ShaderModuleMTL.mm b/src/dawn_native/metal/ShaderModuleMTL.mm index 82f7096a11..c7dda480a4 100644 --- a/src/dawn_native/metal/ShaderModuleMTL.mm +++ b/src/dawn_native/metal/ShaderModuleMTL.mm @@ -61,9 +61,6 @@ namespace dawn_native { namespace metal { const VertexState* vertexState, std::string* remappedEntryPointName, bool* needsStorageBufferLength) { - // TODO(crbug.com/tint/256): Set this accordingly if arrayLength(..) is used. - *needsStorageBufferLength = false; - ScopedTintICEHandler scopedICEHandler(GetDevice()); std::ostringstream errorStream; @@ -133,6 +130,8 @@ namespace dawn_native { namespace metal { std::move(accessControls), /* mayCollide */ true); + transformInputs.Add(kBufferLengthBufferSlot); + tint::Program program; tint::transform::DataMap transformOutputs; DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, GetTintProgram(), transformInputs, @@ -148,6 +147,12 @@ namespace dawn_native { namespace metal { return DAWN_VALIDATION_ERROR("Transform output missing renamer data."); } + if (auto* data = transformOutputs.Get()) { + *needsStorageBufferLength = data->needs_storage_buffer_sizes; + } else { + return DAWN_VALIDATION_ERROR("Transform output missing MSL data."); + } + tint::writer::msl::Generator generator(&program); if (!generator.Generate()) { errorStream << "Generator: " << generator.error() << std::endl;