From 127dc9afd1b2316e0952c0c8345ee0a17f6616ef Mon Sep 17 00:00:00 2001 From: Ralph Kuepper Date: Sat, 28 Nov 2026 09:12:30 +0100 Subject: [PATCH] fix(windows): GPU-driven submission off on DX12, where first_instance never reaches the shader GPU-driven draws find their draw record through @builtin(instance_index) and rely on the indirect command's first_instance. On DX12 (wgpu 29) that offset does not reach the shader, so every draw reads record 0: roads, car bodies, wheels and most props vanish or are drawn in the wrong place. When the chosen adapter is DX12 and BLOOM_GPU_DRIVEN is unset, set it to 0 before the renderer starts, so the classic submission path is used. An explicit BLOOM_GPU_DRIVEN still wins. #162 is the fuller fix. --- native/windows/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/native/windows/src/lib.rs b/native/windows/src/lib.rs index b4b06b19..f0177e64 100644 --- a/native/windows/src/lib.rs +++ b/native/windows/src/lib.rs @@ -768,6 +768,17 @@ unsafe fn init_engine_for_hwnd( // features that silently reshape the frame (HW ray query for // GI, timestamps for the profiler) are available on it. let info = adapter.get_info(); + // GPU-driven submission reads its draw record through + // @builtin(instance_index) and relies on the indirect draw's + // first_instance. On DX12 (wgpu 29) that offset does not reach the + // shader, so every draw reads record 0: roads, car bodies, wheels + // and most props vanish or land in the wrong place. Use the classic + // path there unless BLOOM_GPU_DRIVEN is set explicitly. #162 is the + // fuller fix (bounded multi-draw fallback on DX12). + if info.backend == wgpu::Backend::Dx12 && std::env::var_os("BLOOM_GPU_DRIVEN").is_none() { + std::env::set_var("BLOOM_GPU_DRIVEN", "0"); + eprintln!("bloom: DX12: GPU-driven submission off (first_instance does not reach the shader)"); + } eprintln!( "bloom: adapter '{}' ({:?}), ray_query={}, timestamps={}, tex_arrays={}", info.name,