{"record":{"id":"6dd7d950818f0aeb","repo":"zed-industries/zed","slug":"buffer-needs-required-size-bytes-above-the-m","errorCode":null,"errorMessage":"{} buffer needs {required_size} bytes, above the maximum of {MAX_INSTANCE_BUFFER_SIZE}","messagePattern":"(.+?) buffer needs (.+?) bytes, above the maximum of (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_windows/src/directx_renderer.rs","lineNumber":1042,"sourceCode":"            self.comp_target.SetRoot(&self.comp_visual)?;\n            self.comp_device.Commit()?;\n        }\n        Ok(())\n    }\n}\n\nimpl DirectXGlobalElements {\n    pub fn new(device: &ID3D11Device) -> Result<Self> {\n        let global_params_buffer = create_constant_buffer::<GlobalParams>(device)?;\n        let batch_params_buffer = create_constant_buffer::<BatchParams>(device)?;\n\n        let sampler = unsafe {\n            let desc = D3D11_SAMPLER_DESC {\n                Filter: D3D11_FILTER_MIN_MAG_MIP_LINEAR,\n                AddressU: D3D11_TEXTURE_ADDRESS_WRAP,\n                AddressV: D3D11_TEXTURE_ADDRESS_WRAP,\n                AddressW: D3D11_TEXTURE_ADDRESS_WRAP,\n                MipLODBias: 0.0,\n                MaxAnisotropy: 1,\n                ComparisonFunc: D3D11_COMPARISON_ALWAYS,\n                BorderColor: [0.0; 4],\n                MinLOD: 0.0,\n                MaxLOD: D3D11_FLOAT32_MAX,\n            };\n            let mut output = None;\n            device.CreateSamplerState(&desc, Some(&mut output))?;\n            output\n        };\n\n        Ok(Self {\n            global_params_buffer,\n            batch_params_buffer,\n            sampler,\n        })\n    }\n}","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/gpui_windows/src/directx_renderer.rs#L1024-L1060","documentation":"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.","triggerScenarios":"Thrown at crates/gpui_windows/src/directx_renderer.rs:1042 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split the instance batch into multiple draw calls within the buffer limit.","Raise MAX_INSTANCE_BUFFER_SIZE if legitimate workloads exceed it.","Clamp or tessellate the upstream data producing the oversized batch.","Log element count and struct size to identify the pathological batch type."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}