diff --git a/third_party/skia/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp b/third_party/skia/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp index 3bcdcb6965c..d93a485f862 100644 --- a/third_party/skia/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp +++ b/third_party/skia/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp @@ -505,6 +505,9 @@ sk_sp DawnGraphicsPipeline::Make( // alive until the BindGroupLayoutDescriptor is created. So, store them outside of // the loop that iterates over each BindGroupLayoutEntry. skia_private::TArray staticSamplerLayouts; + // Interior pointers (&emplace_back()) are stored into entries[i].nextInChain + // below, so the TArray must never reallocate inside the loop. + staticSamplerLayouts.reserve_exact(numTexturesAndSamplers / 2); // Note that the number of samplers is equivalent to numTexturesAndSamplers / 2. So, // a sampler's index within any container that only pertains to sampler information