diff --git a/src/FidelityFX.cpp b/src/FidelityFX.cpp index 9748a80bb..19b9127dd 100644 --- a/src/FidelityFX.cpp +++ b/src/FidelityFX.cpp @@ -68,6 +68,8 @@ void FidelityFX::Upscale(Texture2D* a_color, Texture2D* a_alphaMask, float2 a_ji static auto gameViewport = RE::BSGraphics::State::GetSingleton(); static auto context = reinterpret_cast(renderer->GetRuntimeData().context); + auto state = State::GetSingleton(); + { FfxFsr3DispatchUpscaleDescription dispatchParameters{}; @@ -80,10 +82,10 @@ void FidelityFX::Upscale(Texture2D* a_color, Texture2D* a_alphaMask, float2 a_ji dispatchParameters.reactive = ffxGetResource(a_alphaMask->resource.get(), L"FSR3_InputReactiveMap", FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ); dispatchParameters.transparencyAndComposition = ffxGetResource(nullptr, L"FSR3_TransparencyAndCompositionMap", FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ); - dispatchParameters.motionVectorScale.x = (float)gameViewport->screenWidth; - dispatchParameters.motionVectorScale.y = (float)gameViewport->screenHeight; - dispatchParameters.renderSize.width = gameViewport->screenWidth; - dispatchParameters.renderSize.height = gameViewport->screenHeight; + dispatchParameters.motionVectorScale.x = state->isVR ? state->screenSize.x / 2 : state->screenSize.x; + dispatchParameters.motionVectorScale.y = state->screenSize.y; + dispatchParameters.renderSize.width = (uint)state->screenSize.x; + dispatchParameters.renderSize.height = (uint)state->screenSize.y; dispatchParameters.jitterOffset.x = -a_jitter.x; dispatchParameters.jitterOffset.y = -a_jitter.y; diff --git a/src/Streamline.cpp b/src/Streamline.cpp index 67b839551..ea76fd3b6 100644 --- a/src/Streamline.cpp +++ b/src/Streamline.cpp @@ -518,7 +518,12 @@ void Streamline::UpdateConstants() prevCameraToCamera.Invert(); sl::Constants slConstants = {}; - slConstants.cameraAspectRatio = state->screenSize.x / state->screenSize.y; + + if (state->isVR) { + slConstants.cameraAspectRatio = (state->screenSize.x * 0.5f) / state->screenSize.y; + } else { + slConstants.cameraAspectRatio = state->screenSize.x / state->screenSize.y; + } slConstants.cameraFOV = Util::GetVerticalFOVRad(); static auto& cameraNear = (*(float*)(REL::RelocationID(517032, 403540).address() + 0x40)); diff --git a/src/Upscaling.cpp b/src/Upscaling.cpp index 98e3a929f..4bfd03a05 100644 --- a/src/Upscaling.cpp +++ b/src/Upscaling.cpp @@ -154,11 +154,16 @@ void Upscaling::UpdateJitter() auto upscaleMethod = GetUpscaleMethod(); if (upscaleMethod != UpscaleMethod::kTAA) { static auto gameViewport = RE::BSGraphics::State::GetSingleton(); + auto state = State::GetSingleton(); ffxFsr3UpscalerGetJitterOffset(&jitter.x, &jitter.y, gameViewport->frameCount, 8); - gameViewport->projectionPosScaleX = -2.0f * jitter.x / (float)gameViewport->screenWidth; - gameViewport->projectionPosScaleY = 2.0f * jitter.y / (float)gameViewport->screenHeight; + if (state->isVR) + gameViewport->projectionPosScaleX = -jitter.x / state->screenSize.x; + else + gameViewport->projectionPosScaleX = -2.0f * jitter.x / state->screenSize.x; + + gameViewport->projectionPosScaleY = 2.0f * jitter.y / state->screenSize.y; } }