gfx-rs/wgpu · error
{:?} is not enabled for this backend
Error message
{:?} is not enabled for this backend What it means
DX12 only supports Fill and Wireframe fill modes. When a render pipeline is created with PolygonMode::Point, the backend's map_polygon_mode panics because there is no D3D12 equivalent. Normally wgpu-core rejects POLYGON_MODE_POINT unless the feature is enabled, so this panic means a point polygon mode reached the DX12 backend unvalidated.
Source
Thrown at wgpu-hal/src/dx12/conv.rs:254
Direct3D12::D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE,
Direct3D::D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
),
wgt::PrimitiveTopology::TriangleList => (
Direct3D12::D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,
Direct3D::D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
),
wgt::PrimitiveTopology::TriangleStrip => (
Direct3D12::D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,
Direct3D::D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
),
}
}
pub fn map_polygon_mode(mode: wgt::PolygonMode) -> Direct3D12::D3D12_FILL_MODE {
match mode {
wgt::PolygonMode::Fill => Direct3D12::D3D12_FILL_MODE_SOLID,
wgt::PolygonMode::Line => Direct3D12::D3D12_FILL_MODE_WIREFRAME,
wgt::PolygonMode::Point => panic!(
"{:?} is not enabled for this backend",
wgt::Features::POLYGON_MODE_POINT
),
}
}
/// D3D12 doesn't support passing factors ending in `_COLOR` for alpha blending
/// (see <https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_render_target_blend_desc>).
/// Therefore this function takes an additional `is_alpha` argument
/// which if set will return an equivalent `_ALPHA` factor.
fn map_blend_factor(factor: wgt::BlendFactor, is_alpha: bool) -> Direct3D12::D3D12_BLEND {
use wgt::BlendFactor as Bf;
match factor {
Bf::Zero => Direct3D12::D3D12_BLEND_ZERO,
Bf::One => Direct3D12::D3D12_BLEND_ONE,
Bf::Src if is_alpha => Direct3D12::D3D12_BLEND_SRC_ALPHA,
Bf::Src => Direct3D12::D3D12_BLEND_SRC_COLOR,
Bf::OneMinusSrc if is_alpha => Direct3D12::D3D12_BLEND_INV_SRC_ALPHA,View on GitHub (pinned to 3e11ff59bf)
Solutions
- Request Features::POLYGON_MODE_POINT in DeviceDescriptor::required_features — note many DX12 devices do not expose it; check adapter.features() first.
- Switch the pipeline to PolygonMode::Line or Fill and render points via point-list topology or instanced quads instead.
- Create a fallback pipeline for backends that lack POLYGON_MODE_POINT.
Example fix
// before
let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
primitive: PrimitiveState { polygon_mode: PolygonMode::Point, ..Default::default() },
..Default::default()
});
// after
let polygon_mode = if device.features().contains(wgpu::Features::POLYGON_MODE_POINT) {
PolygonMode::Point
} else {
PolygonMode::Line // fallback for DX12
};
let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
primitive: PrimitiveState { polygon_mode, ..Default::default() },
..Default::default()
}); Defensive patterns
Strategy: fallback
Validate before calling
let mode = if device.features().contains(wgpu::Features::POLYGON_MODE_POINT) {
PolygonMode::Point
} else { PolygonMode::Fill }; Type guard
fn supports_point_mode(d: &wgpu::Device) -> bool {
d.features().contains(wgpu::Features::POLYGON_MODE_POINT)
} Prevention
- Never hard-code PolygonMode::Point in shared pipeline-creation code.
- Query adapter capabilities per backend at startup and pick pipeline variants.
- Render point primitives with point-list topology or instanced billboards for portability.
When it happens
Trigger: Creating a RenderPipeline with primitive.polygon_mode = PolygonMode::Point on the DX12 backend without Features::POLYGON_MODE_POINT in required_features; porting Vulkan/desktop code that uses point rasterization directly to wgpu on DX12.
Common situations: Debug visualization pipelines that draw points via polygon mode; apps developed on Metal/Vulkan (where POLYGON_MODE_POINT exists) run on Windows/DX12 where the feature is unsupported.
Related errors
- Feature `MESH_SHADING` not enabled
- Attempted to create a static DXC shader compiler, but the st
- wgpu-hal invariant was violated (usage error): {txt}
- wgpu-hal ran into a preventable internal error: {txt}
- {:?} is not enabled for this backend
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/932304829300e1e2.
Report an issue: GitHub.