|
|
|
@ -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<XeSSLibrary.ExecuteParams>()); |
|
|
|
} |
|
|
|
@ -111,6 +113,10 @@ namespace UnityEngine.Rendering.HighDefinition.AMD.XeSS |
|
|
|
_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; |
|
|
|
@ -200,32 +206,51 @@ namespace UnityEngine.Rendering.HighDefinition.AMD.XeSS |
|
|
|
|
|
|
|
/** 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) |
|
|
|
|