{"record":{"id":"b5add45343c6492b","repo":"neovide/neovide","slug":"failed-to-create-query-readback-buffer","errorCode":null,"errorMessage":"Failed to create query readback buffer.","messagePattern":"Failed to create query readback buffer\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/profiling/d3d.rs","lineNumber":197,"sourceCode":"        let readback_heap_props = D3D12_HEAP_PROPERTIES {\n            Type: D3D12_HEAP_TYPE_READBACK,\n            CPUPageProperty: D3D12_CPU_PAGE_PROPERTY_UNKNOWN,\n            MemoryPoolPreference: D3D12_MEMORY_POOL_UNKNOWN,\n            CreationNodeMask: 0,\n            VisibleNodeMask: 0, // TODO: Support multiple adapters.\n        };\n\n        let mut readback_buffer: Option<ID3D12Resource> = None;\n        device\n            .CreateCommittedResource(\n                &readback_heap_props,\n                D3D12_HEAP_FLAG_NONE,\n                &readback_buffer_desc,\n                D3D12_RESOURCE_STATE_COPY_DEST,\n                None,\n                &mut readback_buffer,\n            )\n            .expect(\"Failed to create query readback buffer.\");\n\n        let payload_fence: ID3D12Fence =\n            device.CreateFence(0, D3D12_FENCE_FLAG_NONE).expect(\"Failed to create payload fence.\");\n\n        let command_allocator: ID3D12CommandAllocator = device\n            .CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT)\n            .expect(\"Failed to create command allocator\");\n\n        let command_list: ID3D12GraphicsCommandList = device\n            .CreateCommandList(\n                0,\n                D3D12_COMMAND_LIST_TYPE_DIRECT,\n                &command_allocator,\n                &ID3D12PipelineState::from_raw(null_mut()),\n            )\n            .expect(\"Failed to create command list\");\n\n        (","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/neovide/neovide/blob/ade2d9cda777879975b1852f77dc672f5ff43b78/src/profiling/d3d.rs#L179-L215","documentation":"In `create_d3d_gpu_context` (src/profiling/d3d.rs:197), the Tracy GPU profiling context creates a readback buffer in a default heap to pull query results back to the CPU. `ID3D12Device::CreateCommittedResource` returned a failure HRESULT, so the code panics via `.expect()`. Typical causes are out of memory, an invalid device, or unsupported heap/resource parameters.","triggerScenarios":"Calling `tracy_create_gpu_context` (which invokes `create_d3d_gpu_context`) when `CreateCommittedResource` for the readback buffer fails — e.g. device removed, E_OUTOFMEMORY, or the D3D12 device was created with debug-layer-detected invalid state.","commonSituations":"GPU driver crash / device-removed state; running out of VRAM; enabling gpu_profiling on systems with broken or outdated D3D12 drivers; creating the profiling context after the device was already destroyed.","solutions":["Update GPU drivers and verify the D3D12 device is healthy (no D3D12_ERROR_DEVICE_REMOVED / DXGI_ERROR_DEVICE_REMOVED).","Check free memory; the readback buffer allocation can fail under VRAM/system memory pressure.","Disable the gpu_profiling feature if Tracy GPU profiling is not needed.","Enable the D3D12 debug layer to get the precise HRESULT reason from the debug output."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before enabling GPU profiling\nif !device.is_valid() || device_removed { /* skip tracy_create_gpu_context */ }","typeGuard":null,"tryCatchPattern":"// keep profiling optional\nlet result = std::panic::catch_unwind(|| tracy_create_gpu_context(...));\nif result.is_err() { eprintln!(\"GPU profiling unavailable\"); }","preventionTips":["Keep gpu_profiling as an opt-in feature and disable it in production builds.","Check device health / device-removed HRESULTs before creating profiling resources.","Keep GPU drivers updated on profiling machines."],"tags":["d3d12","gpu-profiling","tracy","windows"],"backgroundTag":"resource-not-found","analyzedSha":"ade2d9cda777879975b1852f77dc672f5ff43b78","analyzedAt":"2026-09-06T04:14:57.389Z","contentChangedAt":"2026-09-06T04:14:57.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}