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/2022.3/staging #8038

Merged
merged 27 commits into from
Feb 27, 2024
Merged

Internal/2022.3/staging #8038

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

ellioman and others added 27 commits February 9, 2024 11:50
Backport of #42373 and #39818

Users have complained about performance issues on some platforms due to a change in SH Evaluation mode causing them to use PerPixel instead of PerVertex. This PR makes sure those platform use PerVertex when set to Auto.

This PR does the following: 
- Adds a few platforms to ShAutoDetect to use PerVertex when Auto is selected.
- Renames `XRPlatformBuildTimeDetect` to `PlatformBuildTimeDetect` as it's now used for more than XR.
- Fixes a few typos and indentation.
- Adds missing ScreenSpace Decals keyword when unused variants should be included in builds.
… read

On HDRP, without HDR output, the screen space overlay UI is rendered by a pass after `SetFinalTarget` directly on the camera target (as opposed to offscreen when HDR output is enabled). If that camera target is a render texture and the UI is reading from it while it is bound as a render target, there were issues on DX12 (flickering) and PS5 (artefacts).

This didn't happen on 2023.2+ since the overlay UI support was extended and fixed in #29279. This PR grafts only the required change, that says to not render overlay UI on offscreen camera. This has been the behaviour on BiRP (since the engine rendered the UI on the backbuffer directly only at the end of frame) and is the behaviour in URP.
…s active

This PR makes it a bit more obvious in UI and tooltips that the light culling mask doesn't work in Forward+.

If all active renderers are Forward+, then the culling mask setting in the light inspector is greyed out with the following tooltip:

![image](https://media.github.cds.internal.unity3d.com/user/2726/files/5ae12d18-0cc9-494f-abe1-12c419b61909)

If even one of the active renderers is something other than Forward+, then the setting is enabled again. But the tooltip also mentions that Forward+ doesn't support the setting:

![image](https://media.github.cds.internal.unity3d.com/user/2726/files/c799444c-c9d4-4814-be48-f987bafe466e)
Fixes highlighting on HLSL code samples in URP Docs
BatchRendererGroup have a dedicated gfx test scene in HDRP runtime tests in trunk for a while. This PR is backporting this scene into 2022.3 to improve test coverage. Also we could catch any BatchRendererGroup regression (esp on console) easily.
…e configuration.

Backport of https://github.cds.internal.unity3d.com/unity/unity/pull/43172 for UUM-57001

Fixed texture 2D creation failure due to invalid slice configuration. The slice is misconfigured to 2 when creating Texture2D, causing internal failures.

Bug: UUM-57001
Port: UUM-58019
…ertex is selected (UUM-63822)

Fixes UUM-63822.
This PR prevents shaders used in the SDF Baker to compile on OpenGLES3. They were not supported nor tested on this platform. This avoid getting warnings like `Shader warning in 'GenSdfRayMap': HLSLcc: The resource 'rayMap' uses an unsupported type/format for read/write access at kernel RayMapScanX (on gles3)`.

Warnings on **other platforms**, mentionned in this bug (https://jira.unity3d.com/browse/UUM-53994) are already fixed.
Warnings on GLES3 about buffer count are not fixed, and will not be fixed.
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.
We need to disable native render pass with DX12 on 2022.3, because it is not ready for use on this version. Specifically, this PR

- updates the document,
- disables native render pass on C# level, due to a texture clear issue. (This is fixed on trunk and the latest 2023.2).

The original issue is here https://jira.unity3d.com/browse/UUM-41530
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
*[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.
Fix corner case (and minor) issue of pCache Exporter. It was ignoring the initial color space of texture.
Backport of https://github.cds.internal.unity3d.com/unity/unity/pull/43815 for UUM-62870

Some months ago we set the BRG visibility cbuffer declaration to 256 elements in the shader (instead of 4096). Even when reading out of bounds it worked on PC, PlayStation & Xbox. But recently (maybe some Xbox driver change?) we should clamp to 256 instances max.
This PR is fixing this.

Bug: UUM-62870
Backport: UUM-62872
Remove shader warnings:

- Shader warning in '...': use of potentially uninitialized variable (GetParticleIndex) at kernel CSMain

- Shader warning in 'Sort': use of potentially uninitialized variable (CompareKVP) at kernel MergePass at Sort.compute

The fixes were originally part of a larger PR that is not being backported: https://github.cds.internal.unity3d.com/unity/unity/pull/37417
…e Mask during normal rendering

Fixes UUM-63214
Descriptions of blit operations in the URP package samples
This is a backport of https://github.cds.internal.unity3d.com/unity/unity/pull/44365 andhttps://github.cds.internal.unity3d.com/unity/unity/pull/24079
…y when using Alpha Clipping

This modification addresses an issue where certain alpha-to-coverage specific logic was unintentionally overwriting the alpha value utilized by transparent surfaces that also employed alpha-clipping. The resolution for this issue involves incorporating the alpha overwrite logic directly into the calculations specific to alpha-to-coverage.

Bug: https://jira.unity3d.com/browse/UUM-56601
Backport: https://jira.unity3d.com/browse/UUM-57488
…and add link from 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
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)
Fix Broken Links in URP Docs on the **Install URP into an existing project** page
…ctors

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.
…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.
@UnityAljosha UnityAljosha requested review from a team as code owners February 27, 2024 12:59
@UnityAljosha UnityAljosha merged commit c84d615 into 2022.3/staging Feb 27, 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.