zed-industries/zed · error
error locating vertex function
Error message
error locating vertex function
What it means
build_pipeline_state fetches the named vertex function from the compiled Metal library; the expect fires when the function name isn't found, meaning the shader library is stale, built from different source than the renderer expects, or the function was renamed.
Source
Thrown at crates/gpui_apple/src/metal_renderer.rs:1286
// Convert BGRA to RGBA (swap B and R channels)
for chunk in pixels.chunks_exact_mut(4) {
chunk.swap(0, 2);
}
RgbaImage::from_raw(width, height, pixels).context("failed to create RgbaImage from pixel data")
}
fn build_pipeline_state(
device: &metal::DeviceRef,
library: &metal::LibraryRef,
label: &str,
vertex_fn_name: &str,
fragment_fn_name: &str,
pixel_format: metal::MTLPixelFormat,
) -> metal::RenderPipelineState {
let vertex_fn = library
.get_function(vertex_fn_name, None)
.expect("error locating vertex function");
let fragment_fn = library
.get_function(fragment_fn_name, None)
.expect("error locating fragment function");
let descriptor = metal::RenderPipelineDescriptor::new();
descriptor.set_label(label);
descriptor.set_vertex_function(Some(vertex_fn.as_ref()));
descriptor.set_fragment_function(Some(fragment_fn.as_ref()));
let color_attachment = descriptor.color_attachments().object_at(0).unwrap();
color_attachment.set_pixel_format(pixel_format);
color_attachment.set_blending_enabled(true);
color_attachment.set_rgb_blend_operation(metal::MTLBlendOperation::Add);
color_attachment.set_alpha_blend_operation(metal::MTLBlendOperation::Add);
color_attachment.set_source_rgb_blend_factor(metal::MTLBlendFactor::SourceAlpha);
color_attachment.set_source_alpha_blend_factor(metal::MTLBlendFactor::One);
color_attachment.set_destination_rgb_blend_factor(metal::MTLBlendFactor::OneMinusSourceAlpha);
color_attachment.set_destination_alpha_blend_factor(metal::MTLBlendFactor::One);
View on GitHub (pinned to 9d272b0363)
Solutions
- Ensure the shader library and renderer are built from the same source revision
- Check vertex_fn_name against the functions actually present in the .metallib
- Rebuild/regenerate the metallib and clean stale build artifacts
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/gpui_apple/src/metal_renderer.rs:1279 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/9665a3a6791e5b59.
Report an issue: GitHub.