Skip to content

Commit f1c6afa

Browse files
[Fogbugz # 1398085] Fixing flicker when toggling hardware DRS (#6868)
* Fixing hardware drs one frame flicker * Changelog Co-authored-by: sebastienlagarde <[email protected]>
1 parent 6b0999b commit f1c6afa

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7777
- Fixed warning when an APV baking set is renamed.
7878
- Fixed issue where scene list was not refreshed upon deleting an APV baking set.
7979
- Fixed a null ref exception in Volume Explorer
80+
- Fixed one frame flicker on hardware DRS - (case 1398085)
8081

8182
## [14.0.0] - 2021-11-17
8283

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,16 +1300,26 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c
13001300
HDAdditionalCameraData hdCam = null;
13011301
var drsSettings = m_Asset.currentPlatformRenderPipelineSettings.dynamicResolutionSettings;
13021302

1303+
#region DRS Setup
1304+
////////////////////////////////
1305+
// setup of DRS in the camera //
1306+
////////////////////////////////
1307+
// First step we tell the DRS handler that we will be using the scaler set by the user. Note DLSS can set a system slot in case it wants to provide
1308+
// the scale.
13031309
DynamicResolutionHandler.SetActiveDynamicScalerSlot(DynamicResScalerSlot.User);
13041310
if (camera.TryGetComponent<HDAdditionalCameraData>(out hdCam))
13051311
{
13061312
cameraRequestedDynamicRes = hdCam.allowDynamicResolution && camera.cameraType == CameraType.Game;
13071313
}
13081314

1315+
// We now setup DLSS if its enabled. DLSS can override the drsSettings (i.e. setting a System scaler slot, and providing quality settings).
13091316
SetupDLSSForCameraDataAndDynamicResHandler(hdCam, camera, xrPass, cameraRequestedDynamicRes, ref drsSettings);
1310-
DynamicResolutionHandler.UpdateAndUseCamera(camera, drsSettings);
13111317

1318+
// only select the current instance for this camera. We dont pass the settings set to prevent an update.
1319+
// This will set a new instance in DynamicResolutionHandler.instance that is specific to this camera.
1320+
DynamicResolutionHandler.UpdateAndUseCamera(camera);
13121321
var dynResHandler = DynamicResolutionHandler.instance;
1322+
13131323
if (hdCam != null)
13141324
{
13151325
// We are in a case where the platform does not support hw dynamic resolution, so we force the software fallback.
@@ -1321,11 +1331,16 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c
13211331
}
13221332
}
13231333

1334+
// Notify the hanlder if this camera requests DRS.
13241335
dynResHandler.SetCurrentCameraRequest(cameraRequestedDynamicRes);
13251336
dynResHandler.runUpscalerFilterOnFullResolution = (hdCam != null && hdCam.cameraCanRenderDLSS) || DynamicResolutionHandler.instance.filter == DynamicResUpscaleFilter.TAAU;
13261337

1338+
// Finally, our configuration is prepared. Push it to the drs handler
1339+
dynResHandler.Update(drsSettings);
1340+
13271341
RTHandles.SetHardwareDynamicResolutionState(dynResHandler.HardwareDynamicResIsEnabled());
13281342

1343+
#endregion
13291344
// Reset pooled variables
13301345
cameraSettings.Clear();
13311346
cameraPositionSettings.Clear();

0 commit comments

Comments
 (0)