|
|
@ -21,6 +21,8 @@ namespace FidelityFX |
|
|
|
|
|
|
|
|
[SerializeField] private bool enableFP16 = false; |
|
|
[SerializeField] private bool enableFP16 = false; |
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] private bool generateReactiveMask = false; |
|
|
|
|
|
|
|
|
private Fsr2Context _context; |
|
|
private Fsr2Context _context; |
|
|
private Vector2Int _renderSize; |
|
|
private Vector2Int _renderSize; |
|
|
private Vector2Int _displaySize; |
|
|
private Vector2Int _displaySize; |
|
|
@ -135,12 +137,6 @@ namespace FidelityFX |
|
|
_renderCamera.aspect = (Screen.width * _originalRect.width) / (Screen.height * _originalRect.height); |
|
|
_renderCamera.aspect = (Screen.width * _originalRect.width) / (Screen.height * _originalRect.height); |
|
|
_renderCamera.rect = new Rect(0, 0, _originalRect.width * _renderSize.x / _displaySize.x, _originalRect.height * _renderSize.y / _displaySize.y); |
|
|
_renderCamera.rect = new Rect(0, 0, _originalRect.width * _renderSize.x / _displaySize.x, _originalRect.height * _renderSize.y / _displaySize.y); |
|
|
|
|
|
|
|
|
_genReactiveDescription.RenderSize = _renderSize; |
|
|
|
|
|
_genReactiveDescription.Scale = 1.0f; |
|
|
|
|
|
_genReactiveDescription.CutoffThreshold = 0.2f; |
|
|
|
|
|
_genReactiveDescription.BinaryValue = 0.9f; |
|
|
|
|
|
_genReactiveDescription.Flags = 0; // ApplyTonemap, ApplyInverseTonemap, ApplyThreshold, UseComponentsMax
|
|
|
|
|
|
|
|
|
|
|
|
_dispatchDescription.Color = null; |
|
|
_dispatchDescription.Color = null; |
|
|
_dispatchDescription.Depth = null; |
|
|
_dispatchDescription.Depth = null; |
|
|
_dispatchDescription.MotionVectors = null; |
|
|
_dispatchDescription.MotionVectors = null; |
|
|
@ -181,10 +177,16 @@ namespace FidelityFX |
|
|
_renderCamera.ResetProjectionMatrix(); |
|
|
_renderCamera.ResetProjectionMatrix(); |
|
|
|
|
|
|
|
|
_dispatchCommandBuffer.Clear(); |
|
|
_dispatchCommandBuffer.Clear(); |
|
|
|
|
|
|
|
|
// UpscaleReactive: width, height, VK_FORMAT_R8_UNORM
|
|
|
|
|
|
//Context.GenerateReactiveMask();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (generateReactiveMask) |
|
|
|
|
|
{ |
|
|
|
|
|
_genReactiveDescription.RenderSize = _renderSize; |
|
|
|
|
|
_dispatchCommandBuffer.GetTemporaryRT(Fsr2Pipeline.UavAutoReactive, _renderSize.x, _renderSize.y, 0, default, GraphicsFormat.R8_UNorm, 1, true); |
|
|
|
|
|
_context.GenerateReactiveMask(_genReactiveDescription, _dispatchCommandBuffer); |
|
|
|
|
|
|
|
|
|
|
|
_dispatchDescription.Reactive = Fsr2Pipeline.UavAutoReactive; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
_dispatchDescription.InputResourceSize = new Vector2Int(src.width, src.height); |
|
|
_dispatchDescription.InputResourceSize = new Vector2Int(src.width, src.height); |
|
|
|
|
|
|
|
|
if (dest != null) |
|
|
if (dest != null) |
|
|
@ -210,6 +212,11 @@ namespace FidelityFX |
|
|
_dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2Pipeline.UavUpscaledOutput); |
|
|
_dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2Pipeline.UavUpscaledOutput); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (generateReactiveMask) |
|
|
|
|
|
{ |
|
|
|
|
|
_dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2Pipeline.UavAutoReactive); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Graphics.ExecuteCommandBuffer(_dispatchCommandBuffer); |
|
|
Graphics.ExecuteCommandBuffer(_dispatchCommandBuffer); |
|
|
|
|
|
|
|
|
// Shut up the Unity warning about not writing to the destination texture
|
|
|
// Shut up the Unity warning about not writing to the destination texture
|
|
|
|