{"record":{"id":"ca9f0b9371cf3057","repo":"gfx-rs/wgpu","slug":"feature-mesh-shading-not-enabled","errorCode":null,"errorMessage":"Feature `MESH_SHADING` not enabled","messagePattern":"Feature `MESH_SHADING` not enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/dx12/command.rs","lineNumber":1624,"sourceCode":"                draw_count,\n                &buffer.resource,\n                offset,\n                None,\n                0,\n            )\n        }\n    }\n    unsafe fn draw_mesh_tasks_indirect(\n        &mut self,\n        buffer: &<Self::A as crate::Api>::Buffer,\n        offset: wgt::BufferAddress,\n        draw_count: u32,\n    ) {\n        self.prepare_dispatch([0; 3]);\n        let cmd_list6: Direct3D12::ID3D12GraphicsCommandList6 =\n            self.list.as_ref().unwrap().cast().unwrap();\n        let Some(cmd_signature) = &self.shared.cmd_signatures.draw_mesh else {\n            panic!(\"Feature `MESH_SHADING` not enabled\");\n        };\n        unsafe {\n            cmd_list6.ExecuteIndirect(cmd_signature, draw_count, &buffer.resource, offset, None, 0);\n        }\n    }\n    unsafe fn draw_indirect_count(\n        &mut self,\n        buffer: &super::Buffer,\n        offset: wgt::BufferAddress,\n        count_buffer: &super::Buffer,\n        count_offset: wgt::BufferAddress,\n        max_count: u32,\n    ) {\n        unsafe { self.prepare_draw(0, 0) };\n        unsafe {\n            self.list.as_ref().unwrap().ExecuteIndirect(\n                &self.shared.cmd_signatures.draw,\n                max_count,","sourceCodeStart":1606,"sourceCodeEnd":1642,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/dx12/command.rs#L1606-L1642","documentation":"ExecuteMeshIndirectCount on the DX12 backend requires a pre-created mesh command signature, which wgpu-hal only creates when the experimental MESH_SHADING feature is enabled. If the signature is absent the backend panics rather than silently doing nothing. This indicates a wgpu-core/hal invariant breach: a mesh draw was issued on a device without mesh shading enabled.","triggerScenarios":"Calling CommandEncoder::draw_mesh_indirect_count (or internal hal draw_mesh_indirect_count) on a device whose features do not include Features::MESH_SHADING; submitting a recorded encoder created before enabling mesh shading.","commonSituations":"Using the experimental mesh shading API without adding Features::MESH_SHADING to DeviceDescriptor::required_features; running on an adapter that lacks mesh shading support so the feature was not granted; DX12 backend where cmd_signatures.draw_mesh was never initialized.","solutions":["Request Features::MESH_SHADING in DeviceDescriptor::required_features when creating the device.","Verify the adapter supports mesh shading via adapter.features() before using mesh draw calls.","Guard mesh draw calls behind a runtime check of device.features().contains(Features::MESH_SHADING).","This is a usage error surfacing a wgpu bug if wgpu-core validation let it through; consider filing an issue after confirming feature requests."],"exampleFix":"// before\nencoder.draw_mesh_indirect_count(&mesh_buf, 0, &count_buf, 0, n);\n// after\nassert!(device.features().contains(wgpu::Features::MESH_SHADING));\nencoder.draw_mesh_indirect_count(&mesh_buf, 0, &count_buf, 0, n);","handlingStrategy":"validation","validationCode":"fn can_mesh_shading(device: &wgpu::Device) -> bool {\n    device.features().contains(wgpu::Features::MESH_SHADING)\n}","typeGuard":"fn require_mesh_shading(device: &wgpu::Device) -> Result<&wgpu::Device, String> {\n    if device.features().contains(wgpu::Features::MESH_SHADING) { Ok(device) }\n    else { Err(\"MESH_SHADING not enabled\".into()) }\n}","tryCatchPattern":null,"preventionTips":["Check adapter.features() before requesting experimental features.","Gate mesh draw calls behind a feature check at encode time.","Keep experimental mesh-shading usage isolated behind a capability flag."],"tags":["dx12","wgpu-hal","mesh-shading","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"}