Skip to content

Commit c757aae

Browse files
authored
Merge pull request #8115 from Unity-Technologies/internal/2022.3/staging
Internal/2022.3/staging
2 parents 40a072c + 22ca795 commit c757aae

File tree

24 files changed

+699
-27
lines changed

24 files changed

+699
-27
lines changed

Packages/com.unity.render-pipelines.core/Documentation~/custom-material-inspector.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Custom Material Inspectors enable you to define how Unity displays properties in
66

77
The implementation for custom Material Inspectors differs between URP and HDRP. For example, for compatibility purposes, every custom Material Inspector in HDRP must inherit from `HDShaderGUI` which does not exist in URP. For information on how to create custom Material Inspectors for the respective render pipelines, see:
88

9-
- **HDRP**: [HDRP custom Material Inspectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/hdrp-custom-material-inspector.html).
9+
- **HDRP**: [HDRP custom Material Inspectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/custom-material-inspectors.html).
1010
- **URP**: [Unity Custom Shader GUI](https://docs.unity3d.com/Manual/SL-CustomShaderGUI.html).
1111

1212
## Assigning a custom Material Inspector

Packages/com.unity.render-pipelines.core/Documentation~/render-graph-writing-a-render-pipeline.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class MyRenderPipeline : RenderPipeline
1515

1616
void InitializeRenderGraph()
1717
{
18-
m_RenderGraph = new RenderGraph(MyRenderGraph);
18+
m_RenderGraph = new RenderGraph("MyRenderGraph");
1919
}
2020

2121
void CleanupRenderGraph()

Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blitter.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ static private void DrawTriangle(CommandBuffer cmd, Material material, int shade
190190
cmd.DrawMesh(s_TriangleMesh, Matrix4x4.identity, material, 0, shaderPass, s_PropertyBlock);
191191
else
192192
cmd.DrawProcedural(Matrix4x4.identity, material, shaderPass, MeshTopology.Triangles, 3, 1, s_PropertyBlock);
193-
s_PropertyBlock.Clear();
194193
}
195194

196195
static internal void DrawQuad(CommandBuffer cmd, Material material, int shaderPass)
@@ -199,7 +198,6 @@ static internal void DrawQuad(CommandBuffer cmd, Material material, int shaderPa
199198
cmd.DrawMesh(s_QuadMesh, Matrix4x4.identity, material, 0, shaderPass, s_PropertyBlock);
200199
else
201200
cmd.DrawProcedural(Matrix4x4.identity, material, shaderPass, MeshTopology.Quads, 4, 1, s_PropertyBlock);
202-
s_PropertyBlock.Clear();
203201
}
204202

205203
/// <summary>
@@ -274,6 +272,7 @@ public static void BlitTexture(CommandBuffer cmd, RTHandle source, Vector4 scale
274272
/// <param name="pass">Pass idx within the material to invoke.</param>
275273
public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, Vector4 scaleBias, Material material, int pass)
276274
{
275+
s_PropertyBlock.Clear();
277276
s_PropertyBlock.SetVector(BlitShaderIDs._BlitScaleBias, scaleBias);
278277
// Unfortunately there is no function bind a RenderTargetIdentifier with a property block so we have to bind it globally.
279278
cmd.SetGlobalTexture(BlitShaderIDs._BlitTexture, source);
@@ -290,6 +289,8 @@ public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source,
290289
/// <param name="pass">Pass idx within the material to invoke.</param>
291290
public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, int pass)
292291
{
292+
s_PropertyBlock.Clear();
293+
s_PropertyBlock.SetVector(BlitShaderIDs._BlitScaleBias, Vector2.one);
293294
// Unfortunately there is no function bind a RenderTargetIdentifier with a property block so we have to bind it globally.
294295
cmd.SetGlobalTexture(BlitShaderIDs._BlitTexture, source);
295296
cmd.SetRenderTarget(destination);
@@ -308,6 +309,8 @@ public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source,
308309
/// <param name="pass">Pass idx within the material to invoke.</param>
309310
public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, Material material, int pass)
310311
{
312+
s_PropertyBlock.Clear();
313+
s_PropertyBlock.SetVector(BlitShaderIDs._BlitScaleBias, Vector2.one);
311314
// Unfortunately there is no function bind a RenderTargetIdentifier with a property block so we have to bind it globally.
312315
cmd.SetGlobalTexture(BlitShaderIDs._BlitTexture, source);
313316
cmd.SetRenderTarget(destination, loadAction, storeAction);

Packages/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Finally, access the Frame Settings structure itself. This controls the actual va
4444
- **Camera**: `HDAdditionalCameraData.renderingPathCustomFrameSettings`
4545
- **Reflection Probe**: `HDAdditionalReflectionData.frameSettings`
4646

47-
For information on the API available for `FrameSettings`, including how to edit the value of a Frame Setting, see [FrameSettings Scripting API](framesettings-scripting-api).
47+
For information on the API available for `FrameSettings`, including how to edit the value of a Frame Setting, see [FrameSettings Scripting API](#framesettings-scripting-api).
4848

4949
## Frame Setting enumerations
5050

Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
<td><strong>Shadow Matte</strong></td>
33
<td></td>
44
<td></td>
5-
<td>Indicates whether or not the Shader receives shadows. Shadow matte only supports shadow maps. It does not support Screen Space Shadows, <a href="Ray-Traced-Shadows.md">Ray-Traced Shadows</a>, or <a href="Override-Contact-Shadows.md">Contact Shadows</a>.</td>
5+
<td>Indicates whether the shader receives shadows. Shadow matte only supports shadow maps.
6+
It doesn't support screen-space shadows, <a href="Ray-Traced-Shadows.md">ray-traced Shadows</a>, or <a href="Override-Contact-Shadows.md">contact shadows</a>.<br>
7+
Enable **Shadow Matte** if you add a custom Node that samples shadow maps, otherwise shadows might not render correctly.
8+
</td>
69
</tr>

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,8 @@ TextureHandle RenderTransparentUI(RenderGraph renderGraph, HDCamera hdCamera)
966966
context.cmd.ClearRenderTarget(false, true, Color.clear);
967967
context.renderContext.ExecuteCommandBuffer(context.cmd);
968968
context.cmd.Clear();
969-
context.renderContext.DrawUIOverlay(data.camera);
969+
if (data.camera.targetTexture == null)
970+
context.renderContext.DrawUIOverlay(data.camera);
970971
});
971972
}
972973
}

Packages/com.unity.render-pipelines.universal/Documentation~/InstallURPIntoAProject.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ When you upgrade a project from the Built-in Render Pipeline (BiRP) to the Unive
6161
* [Render Pipeline Converter](features/rp-converter.md)
6262
* [Upgrade custom shaders for URP compatibility](urp-shaders/birp-urp-custom-shader-upgrade-guide.md)
6363
* [Find graphics quality settings in URP](birp-onboarding/quality-settings-location.md)
64-
* [Update graphics quality levels for URP](quality-presets.md)
64+
* [Update graphics quality levels for URP](birp-onboarding/quality-presets.md)
65+

Packages/com.unity.render-pipelines.universal/Documentation~/features/rendering-layers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,4 @@ This section contains information related to the impact of Rendering Layers on p
140140

141141
* When using Rendering Layers only for Lights in the Forward Rendering Path, the performance impact is insignificant.
142142

143-
* Performance impact grows more significantly when the Rendering Layer count exceeds a multiple of 8. For example: increasing the layer count from 8 to 9 layers has a bigger relative impact than increasing the layer count from 9 to 10 layers.
143+
* Performance impact grows more significantly when the Rendering Layer count exceeds a multiple of 8. For example: increasing the layer count from 8 to 9 layers has a bigger relative impact than increasing the layer count from 9 to 10 layers. The same consideration applies to increasing the count from 16 to 17, from 24 to 25 and so on.

Packages/com.unity.render-pipelines.universal/Documentation~/integration-with-post-processing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ To configure post-processing in a new Scene:
4949
Now you can use the Volume Override to enable and adjust the settings for the post-processing effect.
5050

5151
> [!NOTE]
52-
> The GameObject which contains the volume and the camera you wish to apply post-processing to must be on the same Layer.
52+
> Post-processing effects from a volume apply to a camera only if a value in the **Volume Mask** property of the camera contains the layer that the volume belongs to.
5353
5454
Refer to [Understand Volumes](Volumes.md) for more information.
5555

Packages/com.unity.render-pipelines.universal/Documentation~/renderer-feature-decal.md

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ The maximum distance from the Camera at which Unity renders decals.
9595

9696
Select this check box to enable the [Rendering Layers](features/rendering-layers.md) functionality.
9797

98+
For more information, refer to [How to use Rendering Layers with Decals](features/rendering-layers#how-to-rendering-layers-decals).
99+
98100
If you enable **Use Rendering Layers**, URP creates a DepthNormal prepass. This makes decals less efficient on GPUs that implement tile-based rendering.
99101

100102
## Decal Projector component

Packages/com.unity.render-pipelines.universal/Documentation~/renderer-features/scriptable-renderer-features/inject-a-pass-using-a-scriptable-renderer-feature.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ This section uses the example `RedTintRenderPass` Scriptable Render Pass from th
9999
material = CoreUtils.CreateEngineMaterial(shader);
100100
redTintRenderPass = new RedTintRenderPass(material);
101101

102-
renderPassEvent = RenderPassEvent.AfterRenderingSkybox;
102+
redTintRenderPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox;
103103
}
104104
```
105105

@@ -136,6 +136,7 @@ public class MyRendererFeature : ScriptableRendererFeature
136136
{
137137
if (shader == null)
138138
{
139+
Debug.LogError("Ensure that you've set a shader in the Scriptable Renderer Feature.");
139140
return;
140141
}
141142
material = CoreUtils.CreateEngineMaterial(shader);
@@ -147,12 +148,13 @@ public class MyRendererFeature : ScriptableRendererFeature
147148
public override void AddRenderPasses(ScriptableRenderer renderer,
148149
ref RenderingData renderingData)
149150
{
150-
if (renderingData.cameraData.cameraType == CameraType.Game)
151+
if (redTintRenderPass != null &&
152+
renderingData.cameraData.cameraType == CameraType.Game)
151153
{
152154
renderer.EnqueuePass(redTintRenderPass);
153155
}
154156
}
155-
public override void Dispose(bool disposing)
157+
protected override void Dispose(bool disposing)
156158
{
157159
CoreUtils.Destroy(material);
158160
}

Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using UnityEngine.Profiling;
3+
using UnityEngine.Experimental.Rendering.Universal;
34

45
namespace UnityEngine.Rendering.Universal
56
{
@@ -368,6 +369,15 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData
368369
LayerUtility.InitializeBudget(m_Renderer2DData.lightRenderTextureMemoryBudget);
369370
ShadowRendering.InitializeBudget(m_Renderer2DData.shadowRenderTextureMemoryBudget);
370371

372+
// Set screenParams when pixel perfect camera is used with the reference resolution
373+
camera.TryGetComponent(out PixelPerfectCamera pixelPerfectCamera);
374+
if (pixelPerfectCamera != null && pixelPerfectCamera.enabled && pixelPerfectCamera.offscreenRTSize != Vector2Int.zero)
375+
{
376+
var cameraWidth = pixelPerfectCamera.offscreenRTSize.x;
377+
var cameraHeight = pixelPerfectCamera.offscreenRTSize.y;
378+
renderingData.commandBuffer.SetGlobalVector(ShaderPropertyId.screenParams, new Vector4(cameraWidth, cameraHeight, 1.0f + 1.0f / cameraWidth, 1.0f + 1.0f / cameraHeight));
379+
}
380+
371381
var isSceneLit = m_Renderer2DData.lightCullResult.IsSceneLit();
372382
if (isSceneLit)
373383
{

Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,7 @@ bool SetupForEmptyRendering(ref RenderingData renderingData)
860860
/// <inheritdoc/>
861861
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
862862
{
863-
// UUM-63146 - 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
864-
// Resetting of target would clean up the color attachment buffers and depth attachment buffers, which inturn is preventing the leak in the said platform. This is likely a symptomatic fix, but is solving the problem for now.
865-
if (Application.platform == RuntimePlatform.Android && PlatformAutoDetect.isRunningOnPowerVRGPU)
866-
ResetTarget();
863+
867864
if (m_CreateEmptyShadowmap)
868865
{
869866
// Reset pass RTs to null

Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,7 @@ bool SetupForEmptyRendering(ref RenderingData renderingData)
171171
/// <inheritdoc />
172172
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
173173
{
174-
// UUM-63146 - 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
175-
// Resetting of target would clean up the color attachment buffers and depth attachment buffers, which inturn is preventing the leak in the said platform. This is likely a symptomatic fix, but is solving the problem for now.
176-
if (Application.platform == RuntimePlatform.Android && PlatformAutoDetect.isRunningOnPowerVRGPU)
177-
ResetTarget();
174+
178175
if (m_CreateEmptyShadowmap)
179176
{
180177
// Reset pass RTs to null

Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public override int SupportedCameraStackingTypes()
128128
internal RTHandle m_ActiveCameraDepthAttachment;
129129
internal RTHandle m_CameraDepthAttachment;
130130
RTHandle m_XRTargetHandleAlias;
131+
internal RTHandle m_CameraDepthAttachment_D3d_11;
131132
internal RTHandle m_DepthTexture;
132133
RTHandle m_NormalsTexture;
133134
RTHandle m_DecalLayersTexture;
@@ -392,6 +393,7 @@ internal override void ReleaseRenderTargets()
392393
m_AdditionalLightsShadowCasterPass?.Dispose();
393394

394395
m_CameraDepthAttachment?.Release();
396+
m_CameraDepthAttachment_D3d_11?.Release();
395397
m_DepthTexture?.Release();
396398
m_NormalsTexture?.Release();
397399
m_DecalLayersTexture?.Release();
@@ -806,7 +808,11 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re
806808

807809
// Doesn't create texture for Overlay cameras as they are already overlaying on top of created textures.
808810
if (intermediateRenderTexture)
811+
{
809812
CreateCameraRenderTarget(context, ref cameraTargetDescriptor, useDepthPriming, cmd, ref cameraData);
813+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11)
814+
cmd.CopyTexture(m_CameraDepthAttachment, m_CameraDepthAttachment_D3d_11);
815+
}
810816

811817
m_RenderOpaqueForwardPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture;
812818
m_RenderTransparentForwardPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture;
@@ -1532,7 +1538,14 @@ void CreateCameraRenderTarget(ScriptableRenderContext context, ref RenderTexture
15321538
depthDescriptor.graphicsFormat = GraphicsFormat.None;
15331539
depthDescriptor.depthStencilFormat = k_DepthStencilFormat;
15341540
RenderingUtils.ReAllocateIfNeeded(ref m_CameraDepthAttachment, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepthAttachment");
1535-
cmd.SetGlobalTexture(m_CameraDepthAttachment.name, m_CameraDepthAttachment.nameID);
1541+
1542+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11)
1543+
{
1544+
RenderingUtils.ReAllocateIfNeeded(ref m_CameraDepthAttachment_D3d_11, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepthAttachment_Temp");
1545+
cmd.SetGlobalTexture(m_CameraDepthAttachment.name, m_CameraDepthAttachment_D3d_11.nameID);
1546+
}
1547+
else
1548+
cmd.SetGlobalTexture(m_CameraDepthAttachment.name, m_CameraDepthAttachment.nameID);
15361549

15371550
// update the descriptor to match the depth attachment
15381551
descriptor.depthStencilFormat = depthDescriptor.depthStencilFormat;

Packages/com.unity.shadergraph/Editor/Data/Graphs/GroupData.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace UnityEditor.ShaderGraph
66
{
77
[Serializable]
8-
public class GroupData : JsonObject
8+
public class GroupData : JsonObject, IRectInterface
99
{
1010
[SerializeField]
1111
string m_Title;
@@ -16,6 +16,7 @@ public string title
1616
set { m_Title = value; }
1717
}
1818

19+
1920
[SerializeField]
2021
Vector2 m_Position;
2122

@@ -25,6 +26,16 @@ public Vector2 position
2526
set { m_Position = value; }
2627
}
2728

29+
Rect IRectInterface.rect
30+
{
31+
get => new Rect(position, Vector2.one);
32+
set
33+
{
34+
position = value.position;
35+
}
36+
}
37+
38+
2839
public GroupData() : base() { }
2940

3041
public GroupData(string title, Vector2 position)

Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,12 @@ internal static void InsertCopyPasteGraph(this MaterialGraphView graphView, Copy
14821482
{
14831483
var nodeList = copyGraph.GetNodes<AbstractMaterialNode>();
14841484

1485-
ClampNodesWithinView(graphView, new List<IRectInterface>().Union(nodeList).Union(copyGraph.stickyNotes));
1485+
ClampNodesWithinView(graphView,
1486+
new List<IRectInterface>()
1487+
.Union(nodeList)
1488+
.Union(copyGraph.stickyNotes)
1489+
.Union(copyGraph.groups)
1490+
);
14861491

14871492
graphView.graph.PasteGraph(copyGraph, remappedNodes, remappedEdges);
14881493

Packages/com.unity.shadergraph/Editor/Drawing/Views/ShaderGroup.cs

+8
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,13 @@ public override bool AcceptsElement(GraphElement element, ref string reasonWhyNo
5353

5454
return true;
5555
}
56+
57+
protected override void SetScopePositionOnly(Rect newPos)
58+
{
59+
base.SetScopePositionOnly(newPos);
60+
61+
userData.position = newPos.position;
62+
}
63+
5664
}
5765
}

Packages/com.unity.visualeffectgraph/Documentation~/ComponentAPI.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ If you want to manage multiple Visual Effect instances in the same Scene and wan
179179
VisualEffect visualEffect;
180180
VFXEventAttribute eventAttribute;
181181

182-
static readonly ExposedProperty positionAttribute = "Position"
182+
static readonly ExposedProperty positionAttribute = "position"
183183
static readonly ExposedProperty enteredTriggerEvent = "EnteredTrigger"
184184

185185
void Start()

Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Assets/HDRPSettings/HDRenderPipelineAsset.asset

+7-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ MonoBehaviour:
5151
decalNormalBufferHP: 0
5252
msaaSampleCount: 1
5353
supportMotionVectors: 1
54+
supportDataDrivenLensFlare: 1
5455
supportRuntimeAOVAPI: 0
5556
supportDitheringCrossFade: 1
5657
supportTerrainHole: 0
@@ -72,7 +73,7 @@ MonoBehaviour:
7273
maxEnvLightsOnScreen: 64
7374
reflectionCacheCompressed: 0
7475
reflectionProbeFormat: 74
75-
reflectionProbeTexCacheSize: 1073750016
76+
reflectionProbeTexCacheSize: 2048
7677
reflectionProbeTexLastValidCubeMip: 3
7778
reflectionProbeTexLastValidPlanarMip: 0
7879
reflectionProbeDecreaseResToFit: 1
@@ -151,6 +152,8 @@ MonoBehaviour:
151152
forcedPercentage: 100
152153
lowResTransparencyMinimumThreshold: 0
153154
rayTracingHalfResThreshold: 50
155+
lowResSSGIMinimumThreshold: 0
156+
lowResVolumetricCloudsMinimumThreshold: 50
154157
lowresTransparentSettings:
155158
enabled: 1
156159
checkerboardDepthBuffer: 1
@@ -182,7 +185,7 @@ MonoBehaviour:
182185
ChromaticAberrationMaxSamples: 03000000060000000c000000
183186
lightSettings:
184187
useContactShadow:
185-
m_Values:
188+
m_Values: 000000
186189
m_SchemaId:
187190
m_Id:
188191
maximumLODLevel:
@@ -293,6 +296,8 @@ MonoBehaviour:
293296
diffusionProfileSettings: {fileID: 0}
294297
virtualTexturingSettings:
295298
streamingCpuCacheSizeInMegaBytes: 256
299+
streamingMipPreloadTexturesPerFrame: 0
300+
streamingPreloadMipCount: 1
296301
streamingGpuCacheSettings:
297302
- format: 0
298303
sizeInMegaBytes: 128

0 commit comments

Comments
 (0)