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 #8036

Merged
merged 45 commits into from
Feb 26, 2024
Merged

Internal/master #8036

merged 45 commits into from
Feb 26, 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.

JulienIgnace-Unity and others added 30 commits February 9, 2024 22:33
Collection of optimizations for Render Graph:
- Compiled out creation of ProfilingSampler in non-dev builds.
- Removed creation of RenderGraph passes for Profiling Scopes in non-dev builds.
- Optimized PreRenderPassSetRenderTargets
- Removed some safety checks from non-dev builds

Overall this gained around 0.5ms on base PS4 on an HDRP frame with ~90 passes.
The profiling sampler optimizations should benefit URP as well.
https://jira.unity3d.com/browse/UUM-58377

Some of the UI in HDRP have a special FixMe HelpBox when you enable feature on the scene but not in the settings.
It will show a button to help you navigate a settings that needs to be enabled.
After we switched to new Graphics/Global Settings it stopped working. We fix it in this PR.

Here's a gif of HelpBox for VolumetricClouds.
![HelpBoxForVolumetricClouds](https://media.github.cds.internal.unity3d.com/user/5932/files/947253d2-985c-4d9e-932c-eeec1b720c9a)

New OpenAndScrollTo api with IRenderPipelineGraphicsSettings use templates now.
the pixel coord to view dir, as well as the matrix used for reprojection were not taking XR into account
Added section in upgrade guide
Fixed very poor performance of speed tree wind GPU shader parameters computation in SpeedTreeWindManager. 

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

Performance test scene with 7600 SpeedTree trees in camera view with both st8 and st9 wind version.

**Trunk**
![Trunk Compute](https://media.github.cds.internal.unity3d.com/user/1206/files/e6c6ac62-dd0b-4700-ba95-f98ab5c00cba)

**Branch**
![New Compute](https://media.github.cds.internal.unity3d.com/user/1206/files/5fe1c74e-1888-4b96-84e2-fcb87c12f95e)

**Trunk**
ComputeWindParams: **31.72** ms
CPU Render Wall Time: **57.41** ms
GPUResident Drawer: 7.13 ms

**Branch**
ComputeWindParams: **0.31** ms
CPU Render Wall Time: **15.27** ms
GPUResident Drawer: 5.04 ms
- Images for test 9970 were generated with the settings `Constant Physical Size`.
- We should use `Constant Pixel Size`, so the OS scaling (e.g Windows scaling - screen DPI) doesn't impact the final result (e.g 125% locally vs 100% on VM).
- Images have been regenerated.
…relevant in API signature

Only one of ignoreDirectEnvironment and ignoreIndirectEnvironment is relevant in API signature.

https://jira.unity3d.com/browse/UUM-61355
Fix Depth of Field missing _CameraDepthTexture binding.
Fixes highlighting on HLSL code samples in URP Docs
Remove the physically based sky component from the BRGCullingFlags test scene, in order to match the existing test image.

This started failing after the merge of #43236, but is due to a bugfix related to the ambient mode when the physical sky is active.  Removing the physical sky sets the ambient lighting back to black as expected by the existing test images.
…aph Resource pooling system

Small adjustment focused on the resource pooling framework in the Render Graph:
- `RenderGraphResourcePool` has been moved from the interface `IRenderGraphResource` to the generic `RenderGraphResource`. By doing so, we don't have anymore a pool conversion everytime we create resources at Execute step.
- Better usage of polymorphism, `CreatePooledGraphicsResource()` and `ReleasePooledGraphicsResource()` have been moved to generic `RenderGraphResource` layer. `PurgeUnusedResources()` has been moved to generic `RenderGraphResourcePool`.

[POI-817](https://jira.unity3d.com/browse/POI-817)
[GFXRPF-214](https://jira.unity3d.com/browse/GFXRPF-214)
…ertex is selected (UUM-63822)

Fixes UUM-63822.
GPUdriven was updating object positions after rendering in some stand alone players. This is now fixed.

Before
![Screenshot 2024-02-13 at 11 33 27](https://media.github.cds.internal.unity3d.com/user/621/files/d01df4e2-06a2-4b20-857b-929906544397)

After
<img width="1345" alt="Screenshot 2024-02-13 at 14 52 20" src="https://media.github.cds.internal.unity3d.com/user/621/files/4c12c89d-18d9-4801-a53b-e4c27f892198">
Bump UTR to 1.28.1 and UTF to 1.43.0, in order to catch up with latest fixes and features. SRP Test projects only.
Fix usability issue [UUM-60585](https://jira.unity3d.com/browse/UUM-60585). In some context, it is require to display settings from 2 different container in the same category. This PR address this usability issue and ensure that when using the contextual menu Reset, all container in the category is reseted.

Side additional fixes:
- Fixed missing left offset for empty reorderable list label.
- Fixed alignment issue for LookDev profile field.

Additional UX request adressed:
- Fixed category order

Side additional modification:
- Reorder the attributes on all IRenderPipelineGraphicsSettings
- Use prefix for hidden one (for us, visible in devmode). It is just a convention for better see things
  - "H:" means hidden
  - "R:" means resource

Here is how the settings got updated:
- HDRP
    - Before
![image](https://media.github.cds.internal.unity3d.com/user/465/files/e67e3223-731a-4dd9-bb11-d1a5d9967a43)
    - After
![image](https://media.github.cds.internal.unity3d.com/user/465/files/7a4c59d8-bda9-4542-9e75-7475d6c324da)

- URP
    - Before
![image](https://media.github.cds.internal.unity3d.com/user/465/files/6db0a555-cabd-4a58-ba1b-8235fc5e153a)
    - After
![image](https://media.github.cds.internal.unity3d.com/user/465/files/01ca4ebf-d64f-4195-85b3-50c42c4dcc45)
*[See [this document](https://docs.google.com/document/d/1C4Vc7dOKgoZ2mNqMdugHDg-w6iN7iUYdlBQMGDmVS3E/edit) for details on what can land in 2023.3.]*

This PR fixes an issue where the correct textures set from the ShaderGraph shader are not properly updated for use in the TilemapRenderer.
reported here https://forum.unity.com/threads/adaptive-probe-volumes-apvs-experimental-release-for-hdrp-in-2021-2.1238824/page-17#post-9637637

When loading scenes additively, it's useful to be able to force which baking set should be loaded at a given point
The new API allows to do so:
```cs
ProbeReferenceVolume.instance.SetActiveBakingSet(bakingSet);
```
Disable a single test on a single platform (xbox one) until https://jira.unity3d.com/browse/UUM-63904 is resolved. Not a regression, was never working on that platform.
…e Mask during normal rendering

*[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.]*
The goal of this PR is to allow for graphics tests to run on the ErrorMaterial scene, despite shader errors that causes job failures in Yamato. The solution has 2 parts:

1 - Ignore failing messages using UTF LogAssert API (see GraphicsTests.cs)

2 - Disable scene in build profile when running the build job in Yamato (see hdrp-brg.metafile)

UTR does not allow to ignore failing messages (only compilation errors), this is why I opted to disable the scene in the BuildSettings.
This PR fixes a potential out-of-bounds buffer access in Forward+'s clustering code that caused a GPU crash on certain platforms, e.g. Metal on Apple Silicon.

There was an existing clamp that was logically incorrect. This PR corrects that clamp and adds a code comment for some reasoning behind the fix.
Some profile guids cannot be saved when float serializes to nan, recreate an asset if that's the case to avoid instabitities
Recreate an asset until it's valid to workaround the issue.
Add a code path to the compute shader for the color pyramid on compute prefered devices (k_PreferFragment = false)
On Switch, the pixel path is still a lot faster (2.5ms VS 4.5ms) so I left the pixel path for Switch.

Before:
![image](https://media.github.cds.internal.unity3d.com/user/745/files/41514b43-c430-4da3-ba8a-76186c462740)

After:
![image](https://media.github.cds.internal.unity3d.com/user/745/files/539bc0af-a9ca-4aed-87da-12cb9e7b4932)

Note that we still use a regular Blit for the copy of the first mip because on certain format like R11G11B10, the pixel shader is faster than a compute to output the texture data (fragments have HW export that can do the convertion).

I also removed one temporary render target that was used for the multi-pass blur and not pooled by RenderGraph.

I experimented merging of the compute passes like doing several mip generation in a single dispatch using LDS but it didn't make a big difference and the code was a lot less readable so I decided it was not worth it. Similar story with the merged gaussian blur pass (1 dispatch for all the mips) + it'd have decrease the quality of the downsample.
Adds a doc for creating a custom overlay with HDR Output enabled in URP
Adds some small notes to the HDR Output docs
Add a link from the URP upgrade page back to the main manual error shader page, and back.

Jira ticket: https://jira.unity3d.com/browse/DOCG-1012
…tation in Render Graph

This PR improves CPU performance of the BeginRenderPass implementations in the NRP Render Graph (URP) and in the C++ RenderingCommandBuffer layer:
- In NRP RG, BeginRenderPass function stores all the attachments in a native list before sending it to C++ engine layer. This list used to be local so we were allocating and deallocating it for every native render pass. New implementation stores it permanently in the NativePassCompiler instance to avoid this overhead. Due to this change, NativePassCompiler must inherit from IDisposable interface to avoid memory leaks.
- Some safety checks are now only triggered when validity checks are enabled.
- Sub pass names are passed to the engine layer only when validity checks are enabled, this allows us to avoid doing costly text encoding operations when checks are disabled.
- A warning message has been added to existing error messages in the BeginRenderPass() function of RenderingCommandBuffer to advice users to enable Validity checks when using the render graph with the native render pass.
- RenderPassContext constructor takes the numbers of attachments and sub passes as inputs to directly allocate the correct arrays when initializing a context instance.
This PR adds error message to Shadow Caster 2D (when used with Sprite Skin) when GPU Skinning is enabled. GPU Skinning is not supported, and the message is  to clarify why 2D shadows may not be working.
We are removing support for lightmap texture arrays when using the GPU Resident Drawer. 

Previously, using texture arrays for lightmaps was the default behavior, with an option to use "legacy" lightmap binding instead. 

From aleksei's comment:

> For the reference: we are removing this code because, otherwise we would need to properly support texture mip streaming which will add a lot more texture management logic and tech debt than we had. This additional tech debt is not great thing considering that lots of the users will not be using lightmaps so often in the future. If they still use lightmaps and GRD, we also should recommend through the documentation of GRD to increase lightmap texture size to maximum required up to maximum allowed 4K. To reduce number of batch splits due to lightmap texture switches.
sindharta-tanuwijaya and others added 15 commits February 20, 2024 06:17
Shaders: reduce Bloom shader variants in URP
This PR adds examples for RenderGraph in URP. The examples are added as separate code examples.
![image](https://media.github.cds.internal.unity3d.com/user/2017/files/7e5048b1-22a7-42b9-86f1-e8a33e2ed00a)
Addresses the work and issues from [DOCG-991](https://jira.unity3d.com/browse/DOCG-991)

Restructures the ToC for the Camera Docs in URP
Updates pages to be closer to the standards of the Unity Style Guide
Aligns the Camera Docs with the Unity Docs content model
Adds additional pages to the Camera Docs section

The following PR will be added to this one before merging with trunk:
- #44235
Our light masking is too complicated at the moment. Users, our own QA folks and our own engineers are confused by it. Here's quite a [highly voted feature request](https://issuetracker-mig.prd.it.unity3d.com/issues/urp-light-culling-mask-does-not-work-when-using-forward-plus-rendering-path) that asks for support in Forward+. The twist: This is already well-supported!

See below the pseudocode of how this actually works. All the complexity goes away when you ignore culling mask, which is more of a legacy concept, and always rely on the rendering layer mask, which is a newer and better feature.

```c
// Rendering the mesh
// ------------------

if (camera.cullingMask & meshRenderer.layer) {
    // Draw the mesh renderer in the game view
} else {
    // Skip drawing the mesh renderer in the game view
}

// Lighting the mesh
// -----------------

if (pipeline == Forward) {
    if (light.cullingMask & meshRenderer.layer) {
        if (light.renderingLayers && meshRenderer.renderingLayerMask) {
            // Light the mesh renderer with this light
        } else {
            // Skip lighting the mesh renderer with this light
        }
    } else {
        // Skip lighting the mesh renderer with this light
    }
} else {
    // pipeline == Deferred or pipeline == ForwardPlus
    if (light.renderingLayers && meshRenderer.renderingLayerMask) {
        // Light the mesh renderer with this light
    } else {
        // Skip lighting the mesh renderer with this light
    }
}
```

This PR makes the following changes:

1. It moves the Rendering Layers inspector field on top of the Culling Mask field. They used to be under completely different headers.
![image](https://media.github.cds.internal.unity3d.com/user/2726/files/23348727-2576-472d-ad9e-908790d97cbb)
2. It shows a greyed out Rendering Layers field even when the "Use Rendering Layers" setting is off on the URP asset. In this condition, the field was totally invsible. My change improves visibility of this feature substantially.
![image](https://media.github.cds.internal.unity3d.com/user/2726/files/bca528ae-91b8-4b68-ba05-ce62fd90c8a3)
3. If the culling mask is set to anything other than the default value of Everything, we now show a warning box advising the use of Rendering Layers instead. 
![image](https://media.github.cds.internal.unity3d.com/user/2726/files/a80c0275-5864-4a2d-a30a-87dc8bb9f8ea)
JIRA: UUM-61466

When motion vectors are required and a depth-less offscreen texture is used as the camera target, a default depth format should be provided to motion vectors.
…m shadows page

Improvements to screen space shadows page, and add link from shadows page

We have another ticket to improve shadow pages and structure (https://jira.unity3d.com/browse/DOCG-1026), so this is just a small ticket to tidy up the page, make mobile performance clearer, and link from the main shadows page.

Jira ticket: https://jira.unity3d.com/browse/DOCG-1025
… for forward plus

Error introduced in this PR: https://github.cds.internal.unity3d.com/unity/unity/pull/39057
Reflection probes are currently in the reverse order we need it for forward+ which this PR undo.
This PR also adds a test case for reflection probes and lights using the mobile light and reflection probe limit. To catch this error in the future as well as other issues.
Jira: UUM-62094

How to reproduce:
1. Create a new Unity project using 3D (URP) or 3D (HDRP) Template
2. Make sure that project has Visual Effect Graph package installed
3. Create a new VFX Asset using Minimal System
4. Open VFX asset
5. In Update Particles block add/create Set Age Attribute
6. Select entire Graph and delete it
7. Observe the Console window

Expected result: no errors are thrown when entire Graph is deleted
Actual result: "NullReferenceException" errors are thrown when entire Graph is deleted

Reproducible with: 17.0.0 (2023.3.0a7), 17.0.2 (2023.3.0b4)
Not reproducible with: 17.0.0 (2023.3.0a6)

Note: not reproducible with other blocks like Collision, Force, FlipBook

Error:

> NullReferenceException: Object reference not set to an instance of an object
UnityEditor.VFX.ReadWritableAttributeProvider.GetAvailableString (UnityEditor.VFX.VFXModel model) (at ./Library/PackageCache/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXAttributeParameter.cs:42)
UnityEditor.VFX.UI.StringPropertyRM+<>c__DisplayClass2_2.<FindStringProvider>b__1 () (at ./Library/PackageCache/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/StringPropertyRM.cs:84)
VFXSlotContainerEditor.DoInspectorGUI () (at ./Library/PackageCache/com.unity.visualeffectgraph/Editor/Inspector/VFXSlotContainerEditor.cs:59)
VFXSlotContainerEditor.OnInspectorGUI () (at ./Library/PackageCache/com.unity.visualeffectgraph/Editor/Inspector/VFXSlotContainerEditor.cs:315)
VFXBlockEditor.OnInspectorGUI () (at ./Library/PackageCache/com.unity.visualeffectgraph/Editor/Inspector/VFXBlockEditor.cs:23)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass74_0.<CreateInspectorElementUsingIMGUI>b__0 () (at /Users/bokken/build/output/unity/unity/Editor/Mono/UIElements/Inspector/InspectorElement.cs:729)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:219)
…UUM-64447)

Fixes UUM-64447.
The issue was that the `_ALPHATEST_ON` keyword needs to be available in both vertex and fragment shaders in order to check if UV (TEXCOORD1) is needed or not.
Fix Broken Links in URP Docs on the **Install URP into an existing project** page
Added an entry to the multiple cameras URP landing page table to show a missing page
Adds package publication jobs to unity CI for publishing internal packages.
https://jira.unity3d.com/browse/GSDET-2

This is in the context of creating performance testing CI for the demo projects such as the URP sample and Fantasy Kingdom.

We are adding these as part of publishing a particular package, but have made the recipes flexible enough to create pack/test/publish jobs for any package under the unity repository, simply by adding a path under `PackageCollection.cs`.

1. I have added `com.unity.render-pipelines.core` as a package dependency. This was necessary as the package was already depending on it, but only implicitly. It just happened that every project that this package was in ALSO included the core RP package. Publishing the package means testing it in isolation, so I had to include the dependency explicitly.
2. Adding the RP core package means locking in a version for it. Since we're working off trunk, I added the current version and matched the different metadata to be at the current trunk level. This means that if we want to publish this package for an earlier version, we can still do it.
3. The 'Package Validation' test suite for this package contains only a dummy test. It is outside the scope of this PR to test the package fully, we only intend to publish it at this point. https://jira.unity3d.com/browse/GSDET-7 is tracking this task as technical debt.
4. The `NDA Filename Validation` tests are ignored for the graphics-performance package. I have reviewed the files and they do not seem to contain any NDA information. The package is also only going to the internal registry, not anywhere further.
5. I have changed the package dependency version of `com.unity.shaderanalysis` from `10.0.0-preview.1` to `1.0.0`. I am not quite sure what had happened here, but I think the `10.0.0` version never existed and package manager was just implicitly using the local version and never emitting any errors.
6. I have added triggers for package publication to run automatically if the package is edited and the changes land in trunk, as well as for tests to run on open PRs with changes to package code.
Fix a typo that had propagated to a few places in the HDRP package doc. A corresponding docs redirect will be created to redirect from the old URL to the new one.
@UnityAljosha UnityAljosha requested review from a team as code owners February 26, 2024 14:55
@UnityAljosha UnityAljosha merged commit 715eae7 into master Feb 26, 2024
2 of 3 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.