Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal/2021.3/staging #8075

Merged
merged 6 commits into from
May 17, 2024
Merged

Conversation

UnityAljosha
Copy link
Collaborator

Please read the Contributing guide before making a PR.

Checklist for PR maker

  • Have you added a backport label (if needed)? For example, the need-backport-* label. After you backport the PR, the label changes to backported-*.
  • Have you updated the changelog? Each package has a CHANGELOG.md file.
  • Have you updated or added the documentation for your PR? When you add a new feature, change a property name, or change the behavior of a feature, it's best practice to include related documentation changes in the same PR. If you do add documentation, make sure to add the relevant Graphics Docs team member as a reviewer of the PR. If you are not sure which person to add, see the Docs team contacts sheet.
  • Have you added a graphic test for your PR (if needed)? When you add a new feature, or discover a bug that tests don't cover, please add a graphic test.

Purpose of this PR

Why is this PR needed, what hard problem is it solving/fixing?


Testing status

Describe what manual/automated tests were performed for this PR


Comments to reviewers

Notes for the reviewers you have assigned.

gabrieldelacruz and others added 6 commits May 2, 2024 01:31
Backport trivial changes to shaders that were generating warnings due to returns inside conditionals.
In particular, these two:
`use of potentially uninitialized variable (GetParticleIndex)`
`use of potentially uninitialized variable (CompareKVP)`
Backports the following docs bug fix PRs to 2021.3 docs:

- #48382 
- #48425
…ering playmode and the panel count changes.

There are debug panels that only appear when the editor is in playmode. Such as Display Stats.

Display stats, always appears on top of the Rendering Debugger panels list. This makes the indexes shift. The editor debug window is storing the id of the selected panel, and not the name. Names do not change between entering/exiting playmode. So is safer to keep the display name, And retrieve the current panel index from the DebugManager when requested.
…with escape key

Jira: UUM-61583

Steps to repro:
- Create a new HDRP/URP project
- Create a new VFX Graph
- Create two operators that have incompatible slots (`Float` and `Sample Gradient` for instance)
- Drag `Float` connection out and hover it over gradient input slot
- Hit escape to cancel 
- Observe wrong type popup gets stuck and moves around with graph

![Unity_IrNrWdfUSY](https://media.github.cds.internal.unity3d.com/user/4003/files/2a6b8809-0eb9-4e74-bc33-dd4ed7e326b4)

![video](https://jira.unity3d.com/secure/attachment/1368545/WrontTypePopup.mp4)
…d is current target platform

This fix works around a shader miscompilation when targeting mobile. In practice this causes artifacts in code that uses octahedral encoding/decoding functions.

A bit of history is warranted here. In this PR https://github.cds.internal.unity3d.com/unity/unity/pull/46787 I fixed a similar issue, and the explanation in that PR still holds. That fix addressed a case where we call the octahedral encoding function, which expects a float as input, with a half on mobile. I 'fixed' it by making the function take half's on mobile. Unfortunately, that fix introduced a regression in cookie shading. The cookie issue is sort of the opposite - we are passing floats where the function expects half on mobile.

To make it completely clear, both of these setups _should_ work - half<->float conversion should be happening without issues. I'm convinced we are dealing with a miscompilation here. In order to make a fix that works for both kinds of inputs, both half and float, I drilled into the shadercode to find the minimal repro. The problematic instructions are a few calls to abs() which give incorrect outputs. When the abs() is present, instead of half<->float conversion, we seem to get something more akin to a direct bit-cast between the 2 datatypes, which results in reading uninitialized memory when converting half->float (hence why the repro in https://github.cds.internal.unity3d.com/unity/unity/pull/46787 is violently shaking), and truncation of bits when converting float->half (hence why the repro in the cookie bug is completely static, but corrupt looking).

**As a fix**, I've reverted the function back to its initial state of taking floats as input, and replaced the abs() calls with a manual sign check. This fixes both of the aforementioned issues.
Backports the following PRs to 2021.3 version of URP docs with any version appropriate changes:
- #44239 
- #44926 
- #45311 
- #45429
@UnityAljosha UnityAljosha requested review from a team as code owners May 17, 2024 14:36
@UnityAljosha UnityAljosha merged commit c3102a9 into 2021.3/staging May 17, 2024
4 checks passed
Copy link

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page).
See the PR template for more information.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants