{"record":{"id":"932304829300e1e2","repo":"gfx-rs/wgpu","slug":"is-not-enabled-for-this-backend","errorCode":null,"errorMessage":"{:?} is not enabled for this backend","messagePattern":"(.+?) is not enabled for this backend","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/dx12/conv.rs","lineNumber":254,"sourceCode":"            Direct3D12::D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE,\n            Direct3D::D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,\n        ),\n        wgt::PrimitiveTopology::TriangleList => (\n            Direct3D12::D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,\n            Direct3D::D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,\n        ),\n        wgt::PrimitiveTopology::TriangleStrip => (\n            Direct3D12::D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,\n            Direct3D::D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,\n        ),\n    }\n}\n\npub fn map_polygon_mode(mode: wgt::PolygonMode) -> Direct3D12::D3D12_FILL_MODE {\n    match mode {\n        wgt::PolygonMode::Fill => Direct3D12::D3D12_FILL_MODE_SOLID,\n        wgt::PolygonMode::Line => Direct3D12::D3D12_FILL_MODE_WIREFRAME,\n        wgt::PolygonMode::Point => panic!(\n            \"{:?} is not enabled for this backend\",\n            wgt::Features::POLYGON_MODE_POINT\n        ),\n    }\n}\n\n/// D3D12 doesn't support passing factors ending in `_COLOR` for alpha blending\n/// (see <https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_render_target_blend_desc>).\n/// Therefore this function takes an additional `is_alpha` argument\n/// which if set will return an equivalent `_ALPHA` factor.\nfn map_blend_factor(factor: wgt::BlendFactor, is_alpha: bool) -> Direct3D12::D3D12_BLEND {\n    use wgt::BlendFactor as Bf;\n    match factor {\n        Bf::Zero => Direct3D12::D3D12_BLEND_ZERO,\n        Bf::One => Direct3D12::D3D12_BLEND_ONE,\n        Bf::Src if is_alpha => Direct3D12::D3D12_BLEND_SRC_ALPHA,\n        Bf::Src => Direct3D12::D3D12_BLEND_SRC_COLOR,\n        Bf::OneMinusSrc if is_alpha => Direct3D12::D3D12_BLEND_INV_SRC_ALPHA,","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/dx12/conv.rs#L236-L272","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlet pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {\n    primitive: PrimitiveState { polygon_mode: PolygonMode::Point, ..Default::default() },\n    ..Default::default()\n});\n// after\nlet polygon_mode = if device.features().contains(wgpu::Features::POLYGON_MODE_POINT) {\n    PolygonMode::Point\n} else {\n    PolygonMode::Line // fallback for DX12\n};\nlet pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {\n    primitive: PrimitiveState { polygon_mode, ..Default::default() },\n    ..Default::default()\n});","handlingStrategy":"fallback","validationCode":"let mode = if device.features().contains(wgpu::Features::POLYGON_MODE_POINT) {\n    PolygonMode::Point\n} else { PolygonMode::Fill };","typeGuard":"fn supports_point_mode(d: &wgpu::Device) -> bool {\n    d.features().contains(wgpu::Features::POLYGON_MODE_POINT)\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["dx12","wgpu-hal","polygon-mode","panic"],"backgroundTag":"feature-not-enabled","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}