Skip to content

Conversation

lukaschod
Copy link
Contributor

@lukaschod lukaschod commented May 6, 2020

Purpose of this PR

Adding adaptive performance as optional dependency and hooking up CameraData/RenderingData patching from AP settings.

Testing status

Manual Tests

Boat attack demo with adaptive performance enabled/disabled

Automated Tests

In adaptive performance repo for now. https://yamato.prd.cds.internal.unity3d.com/jobs/100-com.unity.adaptiveperformance/tree/indexer-api-tests/.yamato%252Fproject-test.yml%2523test_URP_Win_DX11_Playmode_2020.1

Links

Yamato: (Select your branch) https://yamato.prd.cds.internal.unity3d.com/jobs/902-Graphics

Any test projects or documents to go with this to help reviewers?

Comments to reviewers

This PR is currently preview and I created it in order to find out if it can be backported up to 7.x.x!
NO REVIEW IS NEEDED YET

@lukaschod lukaschod requested review from phi-lira and rjonaitis May 6, 2020 10:30
@lukaschod lukaschod requested a review from a team as a code owner May 6, 2020 10:30
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to the Unity SRP repo!
Please make sure to fill out the PR template as best you can to give reviewers as much information as possible.
If you have any questions (and you are a Unity employee) go to "#devs-renderpipe"

@lukaschod lukaschod removed request for phi-lira and rjonaitis May 6, 2020 11:14
@sophiaaar
Copy link
Contributor

Please use Draft PR if you don't need review, thank you

Copy link
Contributor

@phi-lira phi-lira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'd suggest to add a setting in the pipeline asset to enable/disable adaptive performance as well.
The UI for adaptive performance would appear if the package is installed.

if (!cameraData.isStereoEnabled)
{
cameraData.cameraTargetDescriptor.width = (int)(cameraData.camera.pixelWidth * cameraData.renderScale);
cameraData.cameraTargetDescriptor.height = (int)(cameraData.camera.pixelHeight * cameraData.renderScale);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to be careful with render scaling, as this kind of RT scale recreates render textures. The render scale in URP is meant to be done once to select your game resolution (720p, 1080p, 1440p... )

for something dynamic as adaptive performance is probably better to have a different scaling system.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know! For GLES I'd have though that might be the case, it this also on Vulcan? It's currently used as fall-back if dynamic resolution would not be available.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's for all platforms. I'm not sure this is a valid fallback for dynamic resolution, HDRP and XR has a system to scale based on viewport, that would be a suitable fallback but sadly URP doesn't support it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to not use this render scale with adaptive performance, it will possibly allocate textures per-frame and cause issues.

Comment on lines 24 to 25
"expression": "2.1.0-preview.1",
"define": "ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 2.0.0-preview.x (7 imho) (as we will land the feature as 2.0.0 feature)
Which would put the define as ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER

@rjonaitis rjonaitis requested a review from phi-lira May 15, 2020 15:26
@rjonaitis rjonaitis changed the title [Preview] Adding adaptive performance as optional dependency Adding adaptive performance as optional dependency May 15, 2020
@odbb odbb self-requested a review May 15, 2020 17:57
Copy link
Contributor

@phi-lira phi-lira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add changelog.md entry and xml doc for the new public API.

set { m_ColorGradingLutSize = Mathf.Clamp(value, k_MinLutSize, k_MaxLutSize); }
}

public bool useAdaptivePerformance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!cameraData.isStereoEnabled)
{
cameraData.cameraTargetDescriptor.width = (int)(cameraData.camera.pixelWidth * cameraData.renderScale);
cameraData.cameraTargetDescriptor.height = (int)(cameraData.camera.pixelHeight * cameraData.renderScale);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to not use this render scale with adaptive performance, it will possibly allocate textures per-frame and cause issues.

@phi-lira phi-lira merged commit 3c1d786 into master May 28, 2020
@phi-lira phi-lira deleted the add-adaptive-performance branch May 28, 2020 15:22
phi-lira pushed a commit that referenced this pull request May 28, 2020
…#513)

* Adding adaptive performance as optional dependency

* Update adaptive performance package version and defines

* Add enable flag for adaptive performance in URP asset

* Add Adaptive performance reference to URP Editor asmdef

* Revert "Add Adaptive performance reference to URP Editor asmdef"

This reverts commit 28e2f21.

* Enable adaptive performance by default if available

* Add adaptive performance documentation

* Update changelog.md

Co-authored-by: Lukas Chodosevicius <lukasc@unity3d.com>
ellioman added a commit that referenced this pull request Jun 12, 2020
…#658)

* Adding adaptive performance as optional dependency

* Add enable flag for adaptive performance in URP asset

* Enable adaptive performance by default if available

* Add adaptive performance documentation

* Update changelog.md

* Fix spelling error

Co-authored-by: Lukas Chodosevicius <lukasc@unity3d.com>
Co-authored-by: Elvar Örn Unnþórsson <ellioman@ellioman.com>
ellioman pushed a commit that referenced this pull request Jun 12, 2020
…#514)

* Adding adaptive performance as optional dependency

* Fix adaptive performance version and defines

* Add enable flag for adaptive performance in URP asset

* Add adaptive performance documentation

* Update changelog.md

* Fix spelling error

Co-authored-by: Lukas Chodosevicius <lukasc@unity3d.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants