{"record":{"id":"b5e742b2fe06ae1f","repo":"gfx-rs/wgpu","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"naga/src/back/msl/mod.rs","lineNumber":688,"sourceCode":"                    Bi::SampleMask => \"sample_mask\",\n                    // compute\n                    Bi::GlobalInvocationId => \"thread_position_in_grid\",\n                    Bi::LocalInvocationId => \"thread_position_in_threadgroup\",\n                    Bi::LocalInvocationIndex => \"thread_index_in_threadgroup\",\n                    Bi::WorkGroupId => \"threadgroup_position_in_grid\",\n                    Bi::WorkGroupSize => \"dispatch_threads_per_threadgroup\",\n                    Bi::NumWorkGroups => \"threadgroups_per_grid\",\n                    // subgroup\n                    Bi::NumSubgroups => \"simdgroups_per_threadgroup\",\n                    Bi::SubgroupId => \"simdgroup_index_in_threadgroup\",\n                    Bi::SubgroupSize => \"threads_per_simdgroup\",\n                    Bi::SubgroupInvocationId => \"thread_index_in_simdgroup\",\n                    Bi::CullDistance | Bi::DrawIndex => {\n                        return Err(Error::UnsupportedBuiltIn(built_in))\n                    }\n                    Bi::CullPrimitive => \"primitive_culled\",\n                    // TODO: figure out how to make this written as a function call\n                    Bi::PointIndex | Bi::LineIndices | Bi::TriangleIndices => unimplemented!(),\n                    // These aren't real builtins passed into MSL. They are extracted by the\n                    // wrapper function which actually sets the outputs.\n                    Bi::MeshTaskSize\n                    | Bi::VertexCount\n                    | Bi::PrimitiveCount\n                    | Bi::Vertices\n                    | Bi::Primitives\n                    | Bi::RayInvocationId\n                    | Bi::NumRayInvocations\n                    | Bi::InstanceCustomData\n                    | Bi::GeometryIndex\n                    | Bi::WorldRayOrigin\n                    | Bi::WorldRayDirection\n                    | Bi::ObjectRayOrigin\n                    | Bi::ObjectRayDirection\n                    | Bi::RayTmin\n                    | Bi::RayTCurrentMax\n                    | Bi::ObjectToWorld","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/naga/src/back/msl/mod.rs#L670-L706","documentation":"The MSL backend's built-in writer hits `unimplemented!()` for the `PointIndex`, `LineIndices`, and `TriangleIndices` built-ins, meaning naga cannot yet translate a shader that references these vertex-stage built-ins to Metal Shading Language. This is an unimplemented-feature panic in the backend, not a validation error in the shader.","triggerScenarios":"Compiling (via naga or wgpu on Metal) a WGSL/GLSL vertex shader that reads `builtin(point_index)`, `builtin(line_indices)`, or `builtin(triangle_indices)` — i.e. using non-indexed point/line-list topology inputs in the vertex stage.","commonSituations":"Porting a Vulkan/GL renderer that uses gl_VertexID-style point rendering or primitive-restart line/triangle indices directly in the vertex shader to Metal via wgpu; the TODO notes MSL has no direct builtin for these and they would need wrapper-function extraction that is not yet implemented.","solutions":["Restructure the shader to avoid these built-ins — pass point/primitive indices via vertex attributes or a storage buffer instead","Use `draw_indexed` with an index buffer so the vertex stage only needs `vertex_index`/`instance_index`","Track/file an issue on naga for MSL support of PointIndex/LineIndices/TriangleIndices and use another backend (Vulkan/DX12) meanwhile"],"exampleFix":"// before (WGSL vertex shader)\nfn vs(@builtin(point_index) pi: u32) -> VSOut { ... }\n// after\nstruct VSIn { @location(0) point_id: u32 }\nfn vs(in_: VSIn, @builtin(vertex_index) vi: u32) -> VSOut { ... } // pass index as attribute/buffer","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match naga::msl::compile_string(..., options) {\n    Err(naga::Error::...) | panic-prone unimplemented => fall back to another backend or shader variant,\n}","preventionTips":["Avoid point_index/line_indices/triangle_indices built-ins in shaders that must run on Metal","Use indexed drawing (draw_indexed) instead of relying on primitive indices in the vertex stage","Test shader compilation per target backend in CI to catch unimplemented features early","Track naga MSL support matrix before adopting new vertex built-ins"],"tags":["naga","msl","metal","unimplemented","vertex-builtin"],"backgroundTag":"unimplemented-shader-feature","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}