From 9e585bdd590a4a376bf16ceae68851b8cde3a54f Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Wed, 22 Apr 2026 11:45:35 -0700 Subject: [PATCH] fix(VR): skip kSAO_CAMERAZ RTV in depth pass kSAO_CAMERAZ is allocated at per-eye (half-stereo) resolution in VR but the fullscreen draw uses a full-stereo viewport, causing the PS to write garbage into the left-eye region. Pass nullptr for RTV slot 1 in VR to match the engine's own ISAOCameraZ pass behavior. Co-Authored-By: Claude Sonnet 4.6 --- src/Features/Upscaling.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Features/Upscaling.cpp b/src/Features/Upscaling.cpp index 0c2656d475..6e3c358f97 100644 --- a/src/Features/Upscaling.cpp +++ b/src/Features/Upscaling.cpp @@ -1931,8 +1931,11 @@ void Upscaling::UpscaleDepth() ID3D11ShaderResourceView* srvs[] = { refractionNormals.SRVCopy, depthCopy.depthSRV, depthCopy.stencilSRV }; context->PSSetShaderResources(0, ARRAYSIZE(srvs), srvs); - ID3D11RenderTargetView* rtvs[] = { refractionNormals.RTV, saoCameraZ.RTV }; - context->OMSetRenderTargets(ARRAYSIZE(rtvs), rtvs, depth.views[0]); + // kSAO_CAMERAZ is at quarter-stereo resolution in VR; the full-stereo viewport would + // corrupt only the top-left quarter. The engine's ISSAOCameraZ pass populates it correctly. + ID3D11RenderTargetView* rtvs[] = { refractionNormals.RTV, + globals::game::isVR ? nullptr : saoCameraZ.RTV }; + context->OMSetRenderTargets(2, rtvs, depth.views[0]); context->PSSetShader(depthUpscalePS, nullptr, 0); context->Draw(3, 0);