diff --git a/features/Upscaling/Shaders/Upscaling/EncodeTexturesCS.hlsl b/features/Upscaling/Shaders/Upscaling/EncodeTexturesCS.hlsl index ffee3441b5..06351373f7 100644 --- a/features/Upscaling/Shaders/Upscaling/EncodeTexturesCS.hlsl +++ b/features/Upscaling/Shaders/Upscaling/EncodeTexturesCS.hlsl @@ -15,27 +15,16 @@ RWTexture2D MotionVectorOutput : register(u2); [numthreads(8, 8, 1)] void main(uint3 dispatchID : SV_DispatchThreadID) { float2 taaMask = TAAMask[dispatchID.xy]; - - float reactiveMask = taaMask.x * 0.1 + taaMask.y; float transparencyCompositionMask = NormalsWaterMask[dispatchID.xy].z; -#if defined(DLSS) - ReactiveMask[dispatchID.xy] = reactiveMask; - TransparencyCompositionMask[dispatchID.xy] = transparencyCompositionMask; -#elif defined(FSR) - ReactiveMask[dispatchID.xy] = reactiveMask; - TransparencyCompositionMask[dispatchID.xy] = transparencyCompositionMask; -#else - ReactiveMask[dispatchID.xy] = reactiveMask + transparencyCompositionMask * 0.1; -#endif + float depth = DepthMask[dispatchID.xy]; #if defined(DLSS) || defined(XESS) - float depth = DepthMask[dispatchID.xy]; + // Find longest motion vector in 5x5 neighborhood float2 motionVector = MotionVectorMask[dispatchID.xy]; - - // Find longest motion vector in 3x3 neighborhood float2 longestMotionVector = motionVector; float maxMotionLengthSq = dot(motionVector, motionVector); +#endif [unroll] for (int y = -2; y <= 2; y++) { @@ -47,6 +36,9 @@ RWTexture2D MotionVectorOutput : register(u2); // Take neighbor if it's longer AND closer if (neighborDepth < depth){ + taaMask.x = min(taaMask.x, TAAMask[samplePos].x); + +#if defined(DLSS) || defined(XESS) float2 neighborMotionVector = MotionVectorMask[samplePos]; // Square motion vector for length @@ -56,10 +48,21 @@ RWTexture2D MotionVectorOutput : register(u2); maxMotionLengthSq = motionLengthSq; longestMotionVector = neighborMotionVector; } +#endif } } } +#if defined(DLSS) || defined(XESS) MotionVectorOutput[dispatchID.xy] = longestMotionVector; #endif + +#if defined(DLSS) || defined(FSR) + float reactiveMask = taaMask.x * 0.1 + taaMask.y; + ReactiveMask[dispatchID.xy] = reactiveMask; + TransparencyCompositionMask[dispatchID.xy] = transparencyCompositionMask; +#else + float reactiveMask = taaMask.x * 0.01 + taaMask.y; + ReactiveMask[dispatchID.xy] = reactiveMask + transparencyCompositionMask * 0.1; +#endif } \ No newline at end of file diff --git a/src/Features/Upscaling.cpp b/src/Features/Upscaling.cpp index 50aea542b1..a252d75816 100644 --- a/src/Features/Upscaling.cpp +++ b/src/Features/Upscaling.cpp @@ -956,7 +956,7 @@ void Upscaling::CreateSharedD3D12Device(IDXGIAdapter* a_dxgiAdapter) void Upscaling::UpdateSharedResources() { - logger::info("[Upscaling] Updating shared D3D12 resources"); + logger::debug("[Upscaling] Updating shared D3D12 resources"); auto currentMethod = GetUpscaleMethod(); @@ -1007,7 +1007,6 @@ void Upscaling::UpdateSharedResources() D3D11_TEXTURE2D_DESC texDesc{}; main.texture->GetDesc(&texDesc); - texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_NTHANDLE; // Upscaling-specific resources (FSR/XeSS) if (needsUpscalingResources) { @@ -1079,7 +1078,7 @@ void Upscaling::UpdateSharedResources() copyDepthToSharedBufferPS = nullptr; } - logger::info("[Upscaling] Shared resource update complete - Upscaling: {}, FSR: {}, FrameGen: {}", + logger::debug("[Upscaling] Shared resource update complete - Upscaling: {}, FSR: {}, FrameGen: {}", needsUpscalingResources, needsFSRSpecific, needsFrameGenResources); } diff --git a/src/Features/Upscaling.h b/src/Features/Upscaling.h index cdb634296c..f5ccbe8e2a 100644 --- a/src/Features/Upscaling.h +++ b/src/Features/Upscaling.h @@ -57,7 +57,7 @@ struct Upscaling : Feature uint frameGenerationForceEnable = 0; uint streamlineLogLevel = 0; // 0=Off, 1=Default, 2=Verbose uint enableNISSharpening = 1; // 0=Off, 1=On - float nisSharpness = 0.3f; // 0.0 to 1.0 + float nisSharpness = 0.15f; // 0.0 to 1.0 }; Settings settings; diff --git a/src/Features/Upscaling/DX12SwapChain.cpp b/src/Features/Upscaling/DX12SwapChain.cpp index 32b855a23f..b816fc145a 100644 --- a/src/Features/Upscaling/DX12SwapChain.cpp +++ b/src/Features/Upscaling/DX12SwapChain.cpp @@ -82,10 +82,7 @@ void DX12SwapChain::CreateInterop() texDesc11.Format = swapChainDesc.Format; texDesc11.SampleDesc.Count = 1; texDesc11.SampleDesc.Quality = 0; - texDesc11.Usage = D3D11_USAGE_DEFAULT; texDesc11.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; - texDesc11.CPUAccessFlags = 0; - texDesc11.MiscFlags = D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_NTHANDLE; swapChainBufferWrapped = new WrappedResource(texDesc11, d3d11Device.get(), upscaling.sharedD3D12Device.get());