zed-industries/zed · error

frame instance data exceeds the {}-byte maximum

Error message

frame instance data exceeds the {}-byte maximum

What it means

Second guard in `grow_instance_data` after capacity computation: even at the clamped maximum capacity the buffer cannot satisfy `required` bytes, so the frame's instance data exceeds the renderer's hard cap. Same root cause as the companion error — an oversized instance batch.

Source

Thrown at crates/gpui_wgpu/src/wgpu_renderer.rs:1939

                    width: 1,
                    height: 1,
                    depth_or_array_layers: 1,
                },
            );
            break;
        }
    }

    fn grow_instance_data(&mut self, required: u64) -> Result<()> {
        let capacity = (self.instance_data_capacity * 2)
            .max(required.next_power_of_two())
            .min(self.max_instance_data_size);
        anyhow::ensure!(
            capacity >= required,
            "instance data needs {required} bytes, above the maximum of {}",
            self.max_instance_data_size
        );
        anyhow::ensure!(
            capacity > self.instance_data_capacity,
            "frame instance data exceeds the {}-byte maximum",
            self.max_instance_data_size
        );
        log::debug!(
            "instance data grown from {} to {capacity}",
            self.instance_data_capacity
        );
        // Bind groups created earlier in the frame keep the previous buffer or
        // texture alive, so allocations written before the grow remain valid;
        // only subsequent writes land in the new allocation.
        let uses_webgl_instance_data = self.uses_webgl_instance_data;
        let resources = self.resources_mut();
        if uses_webgl_instance_data {
            let max_texture_dimension = resources.device.limits().max_texture_dimension_2d;
            let (instance_data, actual_capacity) =
                Self::create_instance_texture(&resources.device, capacity, max_texture_dimension);
            resources.instance_data = instance_data;

View on GitHub (pinned to f4178619ac)

Solutions

  1. Batch the draw calls so each frame stays under the maximum instance data size.
  2. Increase the configured maximum if workload requirements are legitimate.
  3. Profile scene content producing the oversized batch (large path sets, huge text runs).
  4. Return the error to the caller instead of allocating past the cap.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/gpui_wgpu/src/wgpu_renderer.rs:1939 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/4b71eb2528ec5ed3. Report an issue: GitHub.