|
|
|
@ -80,7 +80,9 @@ namespace FidelityFX |
|
|
|
|
|
|
|
// Set up the original camera to output all of the required FSR2 input resources at the desired resolution
|
|
|
|
_renderCamera = GetComponent<Camera>(); |
|
|
|
_originalRenderTarget = _renderCamera.targetTexture; |
|
|
|
_originalDepthTextureMode = _renderCamera.depthTextureMode; |
|
|
|
_renderCamera.targetTexture = null; // Clear the camera's target texture so we can fully control how the output gets written
|
|
|
|
_renderCamera.depthTextureMode = _originalDepthTextureMode | DepthTextureMode.Depth | DepthTextureMode.MotionVectors; |
|
|
|
|
|
|
|
// Initialize FSR2 context
|
|
|
|
@ -134,6 +136,7 @@ namespace FidelityFX |
|
|
|
} |
|
|
|
|
|
|
|
_renderCamera.depthTextureMode = _originalDepthTextureMode; |
|
|
|
_renderCamera.targetTexture = _originalRenderTarget; |
|
|
|
|
|
|
|
if (_context != null) |
|
|
|
{ |
|
|
|
@ -250,7 +253,7 @@ namespace FidelityFX |
|
|
|
_renderCamera.rect = _originalRect; |
|
|
|
_renderCamera.ResetProjectionMatrix(); |
|
|
|
|
|
|
|
if (dest != null && _renderCamera.targetTexture == null) |
|
|
|
if (dest != null && _originalRenderTarget == null) |
|
|
|
{ |
|
|
|
Debug.LogError("FSR2 is not set to output directly to the backbuffer! Please ensure that FSR2 is the final pass in the image effects chain."); |
|
|
|
Graphics.Blit(src, dest); |
|
|
|
@ -281,7 +284,7 @@ namespace FidelityFX |
|
|
|
_context.Dispatch(_dispatchDescription, _dispatchCommandBuffer); |
|
|
|
|
|
|
|
// Output the upscaled image to the backbuffer
|
|
|
|
_dispatchCommandBuffer.Blit(Fsr2ShaderIDs.UavUpscaledOutput, _renderCamera.targetTexture != null ? _renderCamera.targetTexture : dest); |
|
|
|
_dispatchCommandBuffer.Blit(Fsr2ShaderIDs.UavUpscaledOutput, _originalRenderTarget != null ? _originalRenderTarget : dest); |
|
|
|
_dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavUpscaledOutput); |
|
|
|
|
|
|
|
if (autoGenerateReactiveMask) |
|
|
|
|