|
|
@ -121,7 +121,10 @@ namespace FidelityFX |
|
|
|
|
|
|
|
|
// Apply a mipmap bias so that textures retain their sharpness
|
|
|
// Apply a mipmap bias so that textures retain their sharpness
|
|
|
float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _displaySize.x); |
|
|
float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _displaySize.x); |
|
|
Callbacks.ApplyMipmapBias(biasOffset); |
|
|
|
|
|
|
|
|
if (!float.IsNaN(biasOffset)) |
|
|
|
|
|
{ |
|
|
|
|
|
Callbacks.ApplyMipmapBias(biasOffset); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (!SystemInfo.supportsComputeShaders) |
|
|
if (!SystemInfo.supportsComputeShaders) |
|
|
{ |
|
|
{ |
|
|
@ -130,6 +133,13 @@ namespace FidelityFX |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (_renderSize.x == 0 || _renderSize.y == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
Debug.LogError($"FSR2 render size is invalid: {_renderSize.x}x{_renderSize.y}. Please check your screen resolution and camera viewport parameters."); |
|
|
|
|
|
enabled = false; |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
_helper = GetComponent<Fsr2ImageEffectHelper>(); |
|
|
_helper = GetComponent<Fsr2ImageEffectHelper>(); |
|
|
|
|
|
|
|
|
// Initialize FSR2 context
|
|
|
// Initialize FSR2 context
|
|
|
@ -163,7 +173,10 @@ namespace FidelityFX |
|
|
{ |
|
|
{ |
|
|
// Undo the current mipmap bias offset
|
|
|
// Undo the current mipmap bias offset
|
|
|
float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _prevDisplaySize.x); |
|
|
float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _prevDisplaySize.x); |
|
|
Callbacks.ApplyMipmapBias(-biasOffset); |
|
|
|
|
|
|
|
|
if (!float.IsNaN(biasOffset)) |
|
|
|
|
|
{ |
|
|
|
|
|
Callbacks.ApplyMipmapBias(-biasOffset); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Restore the camera's original state
|
|
|
// Restore the camera's original state
|
|
|
_renderCamera.depthTextureMode = _originalDepthTextureMode; |
|
|
_renderCamera.depthTextureMode = _originalDepthTextureMode; |
|
|
|