From f70fe821bc815c886488b7d2a282b7d154178b3c Mon Sep 17 00:00:00 2001 From: praydog Date: Thu, 3 Oct 2024 01:54:29 -0700 Subject: [PATCH] D3D12: Fix rare bug where spectator view could superimpose old image --- src/mods/vr/D3D12Component.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mods/vr/D3D12Component.cpp b/src/mods/vr/D3D12Component.cpp index add08453..6644a822 100644 --- a/src/mods/vr/D3D12Component.cpp +++ b/src/mods/vr/D3D12Component.cpp @@ -744,6 +744,10 @@ void D3D12Component::draw_spectator_view(ID3D12GraphicsCommandList* command_list D3D12_CPU_DESCRIPTOR_HANDLE rtv_heaps[] = { backbuffer_ctx.get_rtv() }; command_list->OMSetRenderTargets(1, rtv_heaps, FALSE, nullptr); + // Clear backbuffer + const float bb_clear_color[] = { 0.0f, 0.0f, 0.0f, 0.0f }; + command_list->ClearRenderTargetView(backbuffer_ctx.get_rtv(), bb_clear_color, 0, nullptr); + // Setup viewport and scissor rects command_list->RSSetViewports(1, &viewport); command_list->RSSetScissorRects(1, &scissor_rect);