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/master #8058

Merged
merged 29 commits into from
Apr 11, 2024
Merged

Internal/master #8058

merged 29 commits into from
Apr 11, 2024

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.

adrien-de-tocqueville and others added 29 commits April 2, 2024 09:17
- Add missing APIs requested by users:
  - get baking set for scene
  - load baking set for scene
  - trigger APV bake from script
- Fix warning when baking dilation on URP
- Fix missing wait on opencl buffer upload
- Added Validity Based leak reduction mode to fix sampling artefacts
- Fixed blending section in rendering debugger

Update Documentation
- Renamed 'Probe Volume' -> 'Adaptive Probe Volumes'
- Added page for documenting the various APIs
Fixes the omission of depth buffer read declaration in the pass arguments for the URP Depth of Field post-processing effect.
https://jira.unity3d.com/browse/UUM-68096
https://jira.unity3d.com/browse/UUM-62739
https://jira.unity3d.com/browse/UUM-62751
https://jira.unity3d.com/browse/UUM-62981

UUM-62739 Fixes for the Volume Component. ⚠️ Only part 1 done. 2 and 3 should be ignored for the Testing
![image](https://media.github.cds.internal.unity3d.com/user/5932/files/4cb6d1e1-eb8b-4a50-8f7d-4e0579e8d049)

UUM-62751 Fixed a tooltip for the Material UI.
![image](https://media.github.cds.internal.unity3d.com/user/5932/files/95cff8b2-2d21-4f0f-bbbb-c5d30dd4183e)

UUM-62981
Removed not only 3 dots menu but also warning and error buttons which appear when there's an empty object field. Text box is still there and below the list.
When the sampling position was located exactly on the boundary of the last brick of the cell, we would sample the wrong cell due to floating point precision issue.
Fixed by clamping the brick index to the size of the cell.
Currently the intensity multiplier doesn't affect clouds, so that means, when trying to swap shadow maps on Sun/Moon directionnal light, even if both celestials bodies have an intensity multiplier at 0, we still see a pop ([video](https://gyazo.com/7bea0971a9e9e8a3e237c4a8bd3f1c2d)). 

This PR fixes it for both clouds and volumetric clouds. 

In the case we, one day, support multiple directionnal light with clouds (it has a cost), we'll need to remove this so that it works as the PBR sky (which supports multiple lights)
…anteed memory leak

This PR provides a fix for https://jira.unity3d.com/browse/UUM-66351. The bug is caused by a design flaw in the IDeviceContext API. For the OpenCL implementation, events allocate, and must be released when they are no longer needed. The result is an unavoidable memory leak. The API doesn't provide a way to do this, so I've added it. It's also useful for the other implementations - currently, we are forced to hold on to certain data associated with events indefinitely, since we don't know when the user might want to query it.

After discussing with team members, to keep the API symmetric, I've added a corresponding function to create events, and changed WriteBuffer() and ReadBuffer() to have the allocated event passed in, if the user wants to track completion. The result is that calling code which looked like this before:
```cs
var evt = ctx.WriteBuffer(slice, arr); // unavoidable leak on this line
```
Will now look like this:
```cs
var evt = ctx.CreateEvent(); // allocate event
ctx.WriteBuffer(slice, arr, evt); // bind event to write
ctx.DestroyEvent(evt); // clean up
```
Or optionally like this if the user just wants to fire-and-forget, and doesn't care about tracking completion:
```cs
ctx.WriteBuffer(slice, arr); // return type is void, no leak
```

For any viewers unaware: This is a very new API added early so the APV could use it. It doesn't exist in any non-techstream releases yet. The flaw is blocking APV and causes instabilities in our tests.
In the initial rendering of the preview in the inspector window, the ambient color of the default sky may not be ready (black ambient color), due to the lag of GPU readback of the SH coefficients. The ambient color is not updated until the preview is updated by some triggers like hovering the cursor over the inspector.
This PR fixes the issue by using the hard-coded value of the default sky's SH.
This PR updates the code owner and buginfo file to reflect changes in the graphics org. The code ownership is now assigned to @unity/material, which is a new GitHub team containing @apoorva-joshi, @mikkel-simonsen and @andresvalenciatellez.
This PR is adressing 3 tickets :
- Wrong sets of culled objects are rendered with OnDemand shadow rendering https://jira.unity3d.com/browse/UUM-60823
- Expensive Culling for Non-Rendered Shadow Cascades https://jira.unity3d.com/browse/UUM-60917
- Use-after-free causing a crash under certain conditions https://jira.unity3d.com/browse/UUM-68625

The first ticket is a bug. Some shadow casters are culled when they shouldn't.

The second ticket is a performance improvement. It allows some culling jobs not to be kicked at all when no shadow map update is needed for a given light. E.g when using OnDemand or OnEnable shadow rendering mode and no update was requested. 
It is also speeding up culling jobs by skipping receiver sphere culling for the shadow cascade which do not need an update.

Implementation keypoints:
- Fix the splitIndex not being passed to ShadowDrawingSettings. Simply store the splitIndex HDShadowCullingSplit and retrieve it when building the ShadowDrawingSettings
- Refactor shadow caching code so that we know at culling time if a shadow cache will need to be updated or not
- Discard culling jobs for the lights which have no shadow maps to update at all (and does not have the draw dynamic checkbox enabled)
- Add support for a new `splitExclusionMask` API which allows SRP code to tell if culling should be skipped for some cascades (e.g. because of shadow caching)
- Use the `splitExclusionMask` value internally to skip receiver sphere culling on C++ side
- Pass the `splitExclusionMask` value to BRG OnPerformCulling callback so that EG, GRD or any BRG user code can beneficiate from it
Jira: UUM-62433

Steps to reproduce:
- Start new project, import VFX graph
- Right click -> create new VFX graph to open Template window
- Without closing in, cause a domain reload (hit play, switch editor theme)
=> Observe window becomes empty

 💡Proposed solution: closing window would be the best option here
*[See [this document](https://docs.google.com/document/d/1C4Vc7dOKgoZ2mNqMdugHDg-w6iN7iUYdlBQMGDmVS3E/edit) for details on what can land in 2023.3.]*

*[Description of feature/change. Links to screenshots, design docs, user docs, etc. Link to Jira if applicable. Remember reviewers may be outside your team, and not know your feature/area that should be explained more.]*
Jira: UUM-65513

Reproduction steps:
1. Open the attached “VFX.zip” project
2. Open the “graph” asset from the Project Window
3. Dock the “graph” Window to the bottom of the UI

Expected result: Floating panel is visible
Actual result: Floating panel disappears

Reproducible with: 2021.3.35f1, 2022.3.21f1, 2023.2.0a23, 2023.2.13f1
Not reproducible with: 2023.3.0b10
Fixed in: 2023.3.0a2

Reproducible on: Windows 11
Not reproducible on: no other environment tested

Note:
The 2023.3.0a1 version does not exist therefore cannot be tested
Reproducible on any new project
Issue appears if the floating panel is placed in the bottom left corner
Downgrading from versions where it worked correctly, would usually fix the issue

![video](https://jira.unity3d.com/secure/attachment/1397173/IN-69565%20repro.mkv)
### Jira UUM-68044
Steps to reproduce:
1. Import (or reproduce) attached VFX
2. Observe first computed value in UX of Add
=> Expected intermediate status with `-`

Actual results
<img src="https://jira.unity3d.com/secure/attachment/1415346/1415346_image-2024-03-26-17-42-08-042.png" width="500" />
Expected results
<img src="https://jira.unity3d.com/secure/attachment/1415345/1415345_image-2024-03-26-17-42-55-937.png" width="500" />

### Jira UUM-68140
Steps to reproduce:
1. Open VFX
2. Create Update Context
3. Create block Set Axis X
4. Open Inspector change axis to Axis Z
5. Observe weird alignment of UI components

Actual results
<img src="https://jira.unity3d.com/secure/attachment/1416292/1416292_image-2024-03-27-17-28-31-096.png" width="500" />
Expected results
<img src="https://jira.unity3d.com/secure/attachment/1416298/1416298_image-2024-03-27-17-39-57-915.png" width="500" />

![Video](https://jira.unity3d.com/secure/attachment/1416293/_moving_alignement.mp4)

In this same bug another issue is raised:
When unlinking an edge on a collapsed port, the previously linked port is not hidden
![Unity_rcHEhtGQOe](https://media.github.cds.internal.unity3d.com/user/4003/files/4afec272-efce-4a83-8341-a5a6ddc7c323)
We have to disable native checks by default for the best burst jobs performance in GPU Resident Drawer. Additionally we never put NoAlias attribute along with native containers that required it which additionally allows compiler to improve performance.

Performance Comparison:

**Before:**
![CurrentCull](https://media.github.cds.internal.unity3d.com/user/1206/files/41e67802-3dc5-4a45-b877-c13ca9447422)
![CurrentInstanceData](https://media.github.cds.internal.unity3d.com/user/1206/files/39dbc9f4-898c-42fb-ac02-1c33e69ba240)

**After:**
![NewCull](https://media.github.cds.internal.unity3d.com/user/1206/files/04dd8982-bcd5-4ce7-85be-b30f2fc7133c)
![NewInstanceData](https://media.github.cds.internal.unity3d.com/user/1206/files/9d9253ea-5a59-4996-b688-b465e83d89d7)

50K Instances UpdateRendererData:
Before: 24.55ms
After: **19.34ms**

50K Instances Culling:
Before: 2.34ms + 0.42ms = 2.76ms
After: 1.31ms + 0.32ms = **1.63ms**
Set default projection orthographic for pixel perfect camera
… pass AfterRenderPostProcessing

fix [UUM-68261](https://jira.unity3d.com/browse/UUM-68261) URP ignores resourceData.cameraColor when set in a user pass AfterRenderPostProcessing

Update the RenderGraph blit with material sample to cover this scenario, and demonstrate how to use the ResourceData to avoid a copy blit back to the resource. This update also fixes bugs in the sample.
…from `LightingSpecular`

This PR fixes the compiler error, described in UUM-48035, when using `single` precision:

```
Shader error in 'Lights Receiver URP/LightsReceiver': Program 'frag', error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Incompatible min precision type for operand #3 of opcode #40 (counts are 1-based). Expected int or uint. at line 47 (on metal)
```
Address and batch various minor bugfixes.
https://jira.unity3d.com/browse/UUM-67982

The update logic in the reflection probe atlas was not taking into account the runtime intensity of non real-time probes
Update .buginfo for areas:
- SRP Workflow
- Graphics Tools
- SRP Architecture & API

Amending the Codeowner file with same informations using handles
- [unity/srp-workflows](https://github.cds.internal.unity3d.com/orgs/unity/teams/srp-workflows)
- [graphics-tools](https://github.cds.internal.unity3d.com/orgs/unity/teams/graphics-tools)
- [srp-architecture-api](https://github.cds.internal.unity3d.com/orgs/unity/teams/srp-architecture-api)
- Bumped SRP packages from 17.0.2 to 17.0.3.
- For consistency, added the urp-config package to the editor manifest (see [thread](https://unity.slack.com/archives/C89KFUUCT/p1712083056017469)).
Update buginfo and code owners for VFX.

- Visual Effects - Legacy area is merged with Visual Effects
- Code owner file is updated
https://jira.unity3d.com/browse/UUM-67156

Before this change when we switched from URP to HDRP or vice versa we set globalRenderPipeline for the Shader systems twice.

First we set `Shader.globalRenderPipeline = string.Empty` from destructor of the previous RP so we go from RP to BuiltIn. 
Then when we create RP we set `Shader.globalRenderPipeline = "RPName"` and we go from BuiltIn to RP.
Each set of the globalRenderPipeline tag call `void Shader::SetGlobalRenderPipeline(const core::string& name) {}` and reload shaders.

Now if we switch from any SRP to any SRP we will avoid intermediate step where we set an empty string to the `Shader.globalRenderPipeline` by checking `GraphicsSettings.currentRenderPipeline`
…ug panel why some settings are not applied.

Fix this issue:

https://jira.unity3d.com/browse/UUM-67130

Extracted the information why the GPU Resident drawer is not supported and added that feedback into the Rendering Debugger.

Also, now the panel shows the warning and hides modifiying the GPU Resident Drawer if it is not enabled.

The `RecreateIfNeeded`, is need to be handled per Render, as ther IsEnabled depends on settings that come directly from GraphicsSettings, and not from Render Pipeline Graphics settings, Therfore, when you changed something the GPU Resident drawer was not recreated.

Added capabilities to the debug message box, to display new message.
@UnityAljosha UnityAljosha requested a review from a team as a code owner April 11, 2024 06:48
@UnityAljosha UnityAljosha requested review from a team as code owners April 11, 2024 06:48
@UnityAljosha UnityAljosha merged commit 63c943b into master Apr 11, 2024
2 checks passed
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.