diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/Plugins/Win64/XeSSUnityPlugin.dll b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/Plugins/Win64/XeSSUnityPlugin.dll index 56c3e943..09ac2d33 100644 Binary files a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/Plugins/Win64/XeSSUnityPlugin.dll and b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/Plugins/Win64/XeSSUnityPlugin.dll differ diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/XeSSUpscalerPlugin.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/XeSSUpscalerPlugin.cs index 6b64d01a..b24e8119 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/XeSSUpscalerPlugin.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/XeSSUpscalerPlugin.cs @@ -76,6 +76,8 @@ namespace UnityEngine.Rendering.HighDefinition.AMD.XeSS if (initSettings.GetFlag(FfxFsr2InitializationFlags.EnableAutoExposure)) initFlags |= XeSSLibrary.InitFlags.EnableAutoExposure; // TODO: use NDC velocity? I think motion vectors might be in normalized device coordinates... + Debug.Log($"Setting up XeSS with input size: {initSettings.maxRenderSizeWidth}x{initSettings.maxRenderSizeHeight}, output size: {initSettings.displaySizeWidth}x{initSettings.displaySizeHeight}, flags: {initFlags}"); + _contextHandle = XeSSLibrary.CreateContext(outputResolution, XeSSLibrary.QualitySetting.Quality, initFlags); _paramsBuffer = Marshal.AllocHGlobal(Marshal.SizeOf()); } @@ -110,7 +112,11 @@ namespace UnityEngine.Rendering.HighDefinition.AMD.XeSS _executeParams.pExposureScaleTexture = textures.exposureTexture.ToNativePtr(); _executeParams.pResponsivePixelMaskTexture = textures.biasColorMask.ToNativePtr(); _executeParams.pOutputTexture = textures.colorOutput.ToNativePtr(); - + + _executeParams.velocityScaleX = executeData.MVScaleX; + _executeParams.velocityScaleY = executeData.MVScaleY; + _executeParams.jitterScaleX = 1f; + _executeParams.jitterScaleY = -1f; _executeParams.jitterOffsetX = executeData.jitterOffsetX; _executeParams.jitterOffsetY = executeData.jitterOffsetY; _executeParams.exposureScale = executeData.preExposure; @@ -197,35 +203,54 @@ namespace UnityEngine.Rendering.HighDefinition.AMD.XeSS public struct ExecuteParams { public IntPtr contextHandle; - + /** Input color texture. Must be in NON_PIXEL_SHADER_RESOURCE state.*/ public IntPtr pColorTexture; + /** Input motion vector texture. Must be in NON_PIXEL_SHADER_RESOURCE state.*/ public IntPtr pVelocityTexture; + /** Optional depth texture. Required if XESS_INIT_FLAG_HIGH_RES_MV has not been specified. * Must be in NON_PIXEL_SHADER_RESOURCE state.*/ public IntPtr pDepthTexture; + /** Optional 1x1 exposure scale texture. Required if XESS_INIT_FLAG_EXPOSURE_TEXTURE has been * specified. Must be in NON_PIXEL_SHADER_RESOURCE state */ public IntPtr pExposureScaleTexture; + /** Optional responsive pixel mask texture. Required if XESS_INIT_FLAG_RESPONSIVE_PIXEL_MASK * has been specified. Must be in NON_PIXEL_SHADER_RESOURCE state */ public IntPtr pResponsivePixelMaskTexture; + /** Output texture in target resolution. Must be in UNORDERED_ACCESS state.*/ public IntPtr pOutputTexture; + public float jitterScaleX; + public float jitterScaleY; + public float velocityScaleX; + public float velocityScaleY; + /** Jitter X coordinate in the range [-0.5, 0.5]. */ public float jitterOffsetX; + /** Jitter Y coordinate in the range [-0.5, 0.5]. */ public float jitterOffsetY; + /** Optional input color scaling. Default is 1. */ public float exposureScale; + + public float dummy0; + /** Resets the history accumulation in this frame. */ public uint resetHistory; + /** Input color width. */ public uint inputWidth; + /** Input color height. */ public uint inputHeight; + + public uint dummy1; } public static QualitySetting ConvertQuality(FSR2Quality quality)