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

Merged
merged 30 commits into from
Sep 19, 2024
Merged

Internal/2021.3/staging #8098

merged 30 commits into from
Sep 19, 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.

kirill-titov-u and others added 30 commits June 28, 2024 19:34
RenderMode was never supported by URP. Maybe it was planned to be added but I couldn't find anyone who knows anything about.
Instead we hide the field and remove documentation for it.
…form by the wrong string

UI is adding included/excluded platforms in the UI by NamedBuildTarget.

So for instance, "Switch" is obtained from BuildTarget.Switch.ToString(), but if we do NamedBuildTarget(BuildTarget.Switch) it returns you "Nintendo Switch".

This was including/excluding RP assets that were not supposed to match the call to the API of BuiltTarget extension

https://jira.unity3d.com/browse/UUM-73363
Manual backport of [this PR](https://github.cds.internal.unity3d.com/unity/unity/pull/50412) + [this PR](https://github.cds.internal.unity3d.com/unity/unity/pull/25910).

Tested on D3D11 and Vulkan. Works well, the wireframe is now rendered.
It also fixes an issue with the DepthCopy, that is happening since 21.3 is not using the Blitter code introduced in 2022 + the changes for this pass.

![Fix_21_3_Wireframe](https://media.github.cds.internal.unity3d.com/user/1911/files/80ebf77a-4dee-4bec-96b5-e63032e60b1c)
Jira: UUM-65513

Reproduction steps:
1. Create a VFX Graph
2. Show the control panel or the blackboard (use the buttons in the toolbar)
3. Dock the “graph” Window to the bottom of the UI (for instance with the console)

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

![video](https://jira.unity3d.com/secure/attachment/1397173/IN-69565%20repro.mkv)
… when async

Backport of [49983](https://github.cds.internal.unity3d.com/unity/unity/pull/49983) for [UUM-70273](https://jira.unity3d.com/browse/UUM-70273)

From trunk PR:
"This PR applies multiple fixes to HDRP Screen Space Reflection:
- It removes the SSR lighting texture by reusing the SSR accumulation texture
- It adds a fence before async work, so they wait for resources to be cleared when it reuses pooled resources. This fixes flickering on some platform where graphics and async command buffer are more sensitive to missing fences.
- It changes the hit point texture and lighting texture clears to be async if the pass is async. Due to the new fence, it couldn't overlap with shadow rendering, but moving the clear to the same queue as the rest of the work, is more optimized and has no fence."

Port ticket: https://jira.unity3d.com/browse/UUM-71296
Bug ticket: https://jira.unity3d.com/browse/UUM-70273
Backport for UUM-19101

The shader utility function Linear01DepthFromNear does not work for APIs with reversed Z buffer (all of our APIs except OpenGL/GLES). I changed the function into one that works and updated some comments in shader code.

```
float Linear01DepthFromNear(float depth, float4 zBufferParam)
{
    // Old:
    // return 1.0 / (zBufferParam.x + zBufferParam.y / depth);

    // New:
    #if UNITY_REVERSED_Z
    return (1.0 - depth) / (zBufferParam.x * depth + zBufferParam.y);
    #else
    return depth / (zBufferParam.x * depth + zBufferParam.y);
    #endif
}
```

![image](https://media.github.cds.internal.unity3d.com/user/7119/files/beac76da-e6e4-4db1-8d3c-f4c6ef08b37d)
Fixed broken link, and updated API links to xref links.
Fixing broken link mentioned in DOCG-5041.
https://unity.slack.com/archives/C06UZ1MTRAL/p1720242149217419

The following three tests:
```
ShaderGraphGraphicsTests.LogicNodes
ShaderGraphGraphicsTests.NormalMapStressTests
ShaderGraphGraphicsTests.InstancedRendering
```
fail when running `ShaderGraph_iPhone_Metal_Standalone_il2cpp_Linear `. This PR disables them.


Jira ticket on failure: https://jira.unity3d.com/browse/UUM-75644
…n 1 time in the VolumeManager.

Avoid that the same volume can be registered more than 1 time in the VolumeManager.
… sizes

There is a graphical issue when resizing Reflection Probe box sizes on macOS. The issue comes from trying to draw in the Editor (either using `GL` commands or `DrawMeshNow`, for example) while the `Event.current.type != EventType.Repaint` causes graphical issues on Metal. This PR fixes that issue by guarding against this case when rendering the filled in box.

Jira: UUM-71467
… 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)
```
This change backports the FSR banding fixes from #49299 into 2021.3.
…der)

This PR backports the changes from #49172 to 2022.3
This backports the 2022.3 HDRP mipmap debug views fixes (https://github.cds.internal.unity3d.com/unity/unity/pull/50196) to 2021.3.
This PR is identical to the 2022.3 PR outside of 2 very minor elements:
- I've not backported [this commit](https://github.cds.internal.unity3d.com/unity/unity/pull/50196/commits/1a9fac5a131104805277e5a46de82c34130eaafc) from the 2022.3 PR because the behaviour of the `Terrain Texture` dropdown was, strangely enough, already correct in 2021.3.
- 1 conflict in `LitDataIndividualLayer.hlsl` and 1 conflict in `UnlitData.hlsl`: in summary, in both cases, the code to calculate the `alpha` is a bit different (simpler) in 2021.3, so we just make sure that the code moved into the `if (_DebugMipMapMode == DEBUGMIPMAPMODE_NONE)` block truly is from 2021.3 and not 2022.3...
Address a few issues with shader graph shader variant limit.
…om Function node's body field

This PR fixes https://jira.unity3d.com/browse/UUM-76270.

The Custom Function node's body field was difficult to use due to a combination of broken sizing and a lack of scrollbars. This fix prevents the body field from growing beyond the inspector width, ~~and enables horizontal/vertical scrollbars~~. **Note: TextField does not have scrolling support in 2021.3, so the scrollbar addition was not backported. Other ports are not affected**.

![image](https://media.github.cds.internal.unity3d.com/user/3965/files/053d0c59-a251-4484-b532-f72ab0f37eaf)
…o have kicked everything

This PR fixes Errors "glClientWaitSync: Expected application to have kicked everything until job: 96089 (possibly by calling glFlush)" are thrown in the Android Player on some devices with PowerVR Rogue GE8320 GPU.

* Parent : https://jira.unity3d.com/browse/UUM-59572
* Backport : https://jira.unity3d.com/browse/UUM-63149
…ode in Render Graph

The main issue goes to the hash method generation that was used for identifying Render Graph resources. We used the most performant way but it was too many collisions. After a bit of research the decision is to use FNV-1a implementation as it's the same performance but much more reliable. There's still a possibility for collision but a probability should be much smaller.
…ct feature UUM-76307

fix camera offset in the UI editor for the RenderObject feature UUM-76307
Backport of https://github.cds.internal.unity3d.com/unity/unity/pull/48921

This PR doesn't include SpeedTree9 changes as ST9 support is Unity6+.
It also doesn't include the SpeedTree shadergraph/subgraph improvements in the original PR to keep changes minimal and only fix the bugs.

| Shader | Leaf Facing | No-wind LOD Transition | 
| :-- | :-- |  :-- |
| BiRP | Fixed in PR | Already working |
| URP_hlsl | Fixed in PR | Already working |
| URP_sg | Already working for windy<br/>Fixed in PR no-wind | Fixed in PR |
| HDRP_sg | Already working for windy<br/>Fixed in PR no-wind | Fixed in PR |
This PR fixes an issue where some leftover shadow-rendering uniforms aren't properly cleared when using the `Unlit Draw Mode` in the scene-view, leading to some visible artifacts when sampling the empty shadow-map set for this mode.
… cbuffer

Shader Graph allows to declare properties in a global context. These properties can be set from script, globally to all shaders at the same time. (see [Shader.SetGlobalVector](https://docs.unity3d.com/ScriptReference/Shader.SetGlobalVector.html for instance)).
These global properties work fine when used with a regular ShaderGraph material, but not with VFX outputs that use ShaderGraph.
The reason is that we were grouping them in a structure with the other exposed properties, when these should be read directly from the constant buffer. Just changing the declaration in the shader makes it work fine.
… version upgrade.

This PR is intended to remove the VCS local checkout (due to `AssetDatabase.MakeEditable`) that happened on any reimport of SG assets.

Jira: https://jira.unity3d.com/browse/UUM-17912
…rrect shader code for 16-bit half precision.

JIRA: [UUM-72722](https://jira.unity3d.com/browse/UUM-72722)

This PR fixes a bug that Normal From Height node in a shader graph might return an invalid value when using 16-bit half precision.

<table><thead>
  <tr>
    <th><img src="https://media.github.cds.internal.unity3d.com/user/7006/files/2082dd6b-3b91-4f48-9c05-f440ccfea156" /></th>
    <th><img src="https://media.github.cds.internal.unity3d.com/user/7006/files/b31992b2-c6ae-45c9-989e-bacd86ac97c3" /></th>
  </tr></thead>
<tbody>
  <tr>
    <td>before</td>
    <td>after</td>
  </tr>
</tbody>
</table>
…Name.

Jira: https://jira.unity3d.com/browse/UUM-76081

Added a displayName to AbstractMaterialNode to use when displaying it in the Graph Inspector. displayName defaults to name, and is overridden by BlockNode to create it using shaderStage and displayName.
![image](https://media.github.cds.internal.unity3d.com/user/761/files/74c417ea-4dc5-43e9-8637-65ecb678eb63)

The changed name looks like this:
<table>
<tr><th>Before</th><th>After</th></tr>
<tr><td>VertexDescription.Position Node</td><td>Vertex Position Node</td></tr>
<tr><td>VertexDescription.Normal Node</td><td>Vertex Normal Node</td></tr>
<tr><td>VertexDescription.Tangent Node</td><td>Vertex Tangent Node</td></tr>
<tr><td>SurfaceDescription.BaseColor Node</td><td>Fragment Base Color Node</td></tr>
<tr><td>SurfaceDescription.NormalTS Node</td><td>Fragment Normal (Tangent Space) Node</td></tr>
<tr><td>SurfaceDescription.Metalilc Node</td><td>Fragment Metallic Node</td></tr>
<tr><td>SurfaceDescription.Smoothness Node</td><td>Fragment Smoothness Node</td></tr>
<tr><td>SurfaceDescription.Emission Node</td><td>Fragment Emissiton Node</td></tr>
<tr><td>SurfaceDescription.Occlusion Node</td><td>Fragment Ambient Occlusion Node</td></tr>
</table>
@UnityAljosha UnityAljosha requested review from a team as code owners September 19, 2024 09:05
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!

@UnityAljosha UnityAljosha merged commit 358299b into 2021.3/staging Sep 19, 2024
4 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.