gfx-rs/wgpu · error

{:?} is not enabled for this backend

Error message

{:?} is not enabled for this backend

What it means

Metal does not support the Point polygon fill mode, so when creating a render pipeline whose primitive state requests `PolygonMode::Point`, wgpu-hal's Metal backend panics with a message pointing at `Features::POLYGON_MODE_POINT`. This feature is only available on backends that implement point fill (e.g. Vulkan), and the panic fires because the pipeline creation reached the HAL without the mode being rejected earlier.

Source

Thrown at wgpu-hal/src/metal/device.rs:1683

                        ms_info = Some(super::PipelineStageInfo {
                            immediates: desc.layout.immediates_infos.ms,
                            sizes_slot: desc.layout.per_stage_map.ms.sizes_buffer,
                            sized_bindings: ms.sized_bindings,
                            vertex_buffer_mappings: vec![],
                            library: Some(ms.library),
                            raw_wg_size: ms.wg_size,
                            work_group_memory_sizes: ms.wg_memory_sizes,
                        });
                    }

                    MetalGenericRenderPipelineDescriptor::Mesh(descriptor)
                }
            };

            let raw_triangle_fill_mode = match desc.primitive.polygon_mode {
                wgt::PolygonMode::Fill => MTLTriangleFillMode::Fill,
                wgt::PolygonMode::Line => MTLTriangleFillMode::Lines,
                wgt::PolygonMode::Point => panic!(
                    "{:?} is not enabled for this backend",
                    wgt::Features::POLYGON_MODE_POINT
                ),
            };

            // Fragment shader
            let fs_info = match desc.fragment_stage {
                Some(ref stage) => {
                    let fs = self.load_shader(
                        stage,
                        &[],
                        desc.layout,
                        primitive_class,
                        naga::ShaderStage::Fragment,
                    )?;

                    unsafe { descriptor.setFragmentFunction(Some(&fs.function)) };
                    if supports_mutability {

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Use PolygonMode::Fill or PolygonMode::Line instead of Point on the Metal backend
  2. Gate the polygon mode by backend: select Point only when running on backends that support it
  3. Check adapter.get_info().backend at startup and adapt pipeline configuration
  4. If point rendering is needed, emulate with point-list topology (PrimitiveTopology::PointList) plus a fragment shader

Example fix

// before
let primitive = wgt::PrimitiveState { polygon_mode: wgt::PolygonMode::Point, ..Default::default() };
// after
let polygon_mode = if is_apple_gpu { wgt::PolygonMode::Fill } else { wgt::PolygonMode::Point };
let primitive = wgt::PrimitiveState { polygon_mode, ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

if cfg!(target_os = "macos") && desc.primitive.polygon_mode == wgt::PolygonMode::Point {
    return Err("POLYGON_MODE_POINT unsupported on Metal");
}

Try / catch

std::panic::catch_unwind(|| device.create_render_pipeline(&desc))

Prevention

When it happens

Trigger: Calling `device.create_render_pipeline` (or `create_render_bundle`) on the Metal backend with `primitive.polygon_mode == PolygonMode::Point` in the `PrimitiveState`, regardless of whether the feature was requested on the device.

Common situations: Porting an app from Vulkan/DX12 (where point fill works) to macOS/iOS; sharing pipeline descriptors across backends; enabling wireframe-style debugging via point rasterization on a Mac.

Related errors


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/86330d5fcfcca4aa. Report an issue: GitHub.