|
|
@ -93,8 +93,6 @@ namespace FidelityFX |
|
|
|
|
|
|
|
|
private Material _copyWithDepthMaterial; |
|
|
private Material _copyWithDepthMaterial; |
|
|
|
|
|
|
|
|
private RenderTextureFormat DefaultFormat => _renderCamera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default; |
|
|
|
|
|
|
|
|
|
|
|
private void OnEnable() |
|
|
private void OnEnable() |
|
|
{ |
|
|
{ |
|
|
// Set up the original camera to output all of the required FSR2 input resources at the desired resolution
|
|
|
// Set up the original camera to output all of the required FSR2 input resources at the desired resolution
|
|
|
@ -134,7 +132,7 @@ namespace FidelityFX |
|
|
|
|
|
|
|
|
// Create command buffers to bind the camera's output at the right moments in the render loop
|
|
|
// Create command buffers to bind the camera's output at the right moments in the render loop
|
|
|
_opaqueInputCommandBuffer = new CommandBuffer { name = "FSR2 Opaque Input" }; |
|
|
_opaqueInputCommandBuffer = new CommandBuffer { name = "FSR2 Opaque Input" }; |
|
|
_opaqueInputCommandBuffer.GetTemporaryRT(Fsr2ShaderIDs.SrvOpaqueOnly, _renderSize.x, _renderSize.y, 0, default, DefaultFormat); |
|
|
|
|
|
|
|
|
_opaqueInputCommandBuffer.GetTemporaryRT(Fsr2ShaderIDs.SrvOpaqueOnly, _renderSize.x, _renderSize.y, 0, default, GetDefaultFormat()); |
|
|
_opaqueInputCommandBuffer.Blit(BuiltinRenderTextureType.CameraTarget, Fsr2ShaderIDs.SrvOpaqueOnly); |
|
|
_opaqueInputCommandBuffer.Blit(BuiltinRenderTextureType.CameraTarget, Fsr2ShaderIDs.SrvOpaqueOnly); |
|
|
|
|
|
|
|
|
if (autoGenerateReactiveMask) |
|
|
if (autoGenerateReactiveMask) |
|
|
@ -320,7 +318,7 @@ namespace FidelityFX |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// We are rendering to the backbuffer, so we need a temporary render texture for FSR2 to output to
|
|
|
// We are rendering to the backbuffer, so we need a temporary render texture for FSR2 to output to
|
|
|
_dispatchCommandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavUpscaledOutput, _displaySize.x, _displaySize.y, 0, default, DefaultFormat, default, 1, true); |
|
|
|
|
|
|
|
|
_dispatchCommandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavUpscaledOutput, _displaySize.x, _displaySize.y, 0, default, GetDefaultFormat(), default, 1, true); |
|
|
|
|
|
|
|
|
_context.Dispatch(_dispatchDescription, _dispatchCommandBuffer); |
|
|
_context.Dispatch(_dispatchDescription, _dispatchCommandBuffer); |
|
|
|
|
|
|
|
|
@ -355,6 +353,8 @@ namespace FidelityFX |
|
|
|
|
|
|
|
|
private RenderTexture GetOutputTexture() => outputColorDepth != null ? outputColorDepth : _originalRenderTarget; |
|
|
private RenderTexture GetOutputTexture() => outputColorDepth != null ? outputColorDepth : _originalRenderTarget; |
|
|
|
|
|
|
|
|
|
|
|
private RenderTextureFormat GetDefaultFormat() => _renderCamera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default; |
|
|
|
|
|
|
|
|
private Vector2Int GetDisplaySize() |
|
|
private Vector2Int GetDisplaySize() |
|
|
{ |
|
|
{ |
|
|
var outputTexture = GetOutputTexture(); |
|
|
var outputTexture = GetOutputTexture(); |
|
|
|