diff --git a/gfx/wr/webrender/src/batch.rs b/gfx/wr/webrender/src/batch.rs index 0b5ea89fd008..f8fb92bb4928 100644 --- a/gfx/wr/webrender/src/batch.rs +++ b/gfx/wr/webrender/src/batch.rs @@ -365,6 +365,11 @@ impl PrimitiveBatch { features: BatchFeatures::empty(), } } + + fn merge(&mut self, other: PrimitiveBatch) { + self.instances.extend(other.instances); + self.features |= other.features; + } } #[cfg_attr(feature = "capture", derive(Serialize))] @@ -407,7 +412,7 @@ impl AlphaBatchContainer { match batch_index { Some(batch_index) => { - self.opaque_batches[batch_index].instances.extend(other_batch.instances); + self.opaque_batches[batch_index].merge(other_batch); } None => { self.opaque_batches.push(other_batch); @@ -424,8 +429,7 @@ impl AlphaBatchContainer { match batch_index { Some(batch_index) => { - let batch_index = batch_index + min_batch_index; - self.alpha_batches[batch_index].instances.extend(other_batch.instances); + self.alpha_batches[batch_index + min_batch_index].merge(other_batch); min_batch_index = batch_index; } None => {