zed-industries/zed · error

buffer needs bytes, above the maximum of

Error message

{} buffer needs {required_size} bytes, above the maximum of {MAX_INSTANCE_BUFFER_SIZE}

What it means

Validation in `update_buffer`: the instance buffer would need to grow to `required_size` bytes (data.len() * size_of::<T>()) which exceeds MAX_INSTANCE_BUFFER_SIZE, so the resize is refused. Fires when a draw batch's per-instance data is larger than the fixed maximum instance buffer.

Solutions

  1. Split the instance batch into multiple draw calls within the buffer limit.
  2. Raise MAX_INSTANCE_BUFFER_SIZE if legitimate workloads exceed it.
  3. Clamp or tessellate the upstream data producing the oversized batch.
  4. Log element count and struct size to identify the pathological batch type.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/gpui_windows/src/directx_renderer.rs:1042 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20). Data as JSON: /api/errors/6dd7d950818f0aeb. Report an issue: GitHub.

Appendix: source

Thrown at crates/gpui_windows/src/directx_renderer.rs:1042

            self.comp_target.SetRoot(&self.comp_visual)?;
            self.comp_device.Commit()?;
        }
        Ok(())
    }
}

impl DirectXGlobalElements {
    pub fn new(device: &ID3D11Device) -> Result<Self> {
        let global_params_buffer = create_constant_buffer::<GlobalParams>(device)?;
        let batch_params_buffer = create_constant_buffer::<BatchParams>(device)?;

        let sampler = unsafe {
            let desc = D3D11_SAMPLER_DESC {
                Filter: D3D11_FILTER_MIN_MAG_MIP_LINEAR,
                AddressU: D3D11_TEXTURE_ADDRESS_WRAP,
                AddressV: D3D11_TEXTURE_ADDRESS_WRAP,
                AddressW: D3D11_TEXTURE_ADDRESS_WRAP,
                MipLODBias: 0.0,
                MaxAnisotropy: 1,
                ComparisonFunc: D3D11_COMPARISON_ALWAYS,
                BorderColor: [0.0; 4],
                MinLOD: 0.0,
                MaxLOD: D3D11_FLOAT32_MAX,
            };
            let mut output = None;
            device.CreateSamplerState(&desc, Some(&mut output))?;
            output
        };

        Ok(Self {
            global_params_buffer,
            batch_params_buffer,
            sampler,
        })
    }
}

View on GitHub (pinned to 916fc2b8cb)