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/6000.0/staging #8111

Merged
merged 39 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f02b78b
[Port] [6000.0] [HDRP] Fix shaders warning in console when building
svc-reach-platform-support Nov 2, 2024
390f197
[Port] [6000.0] Minor docs fixes from feedback tickets
svc-reach-platform-support Nov 2, 2024
ae28f6a
[Port] [6000.0] Remove #if preprocessor wrapping the UniversalRenderP…
svc-reach-platform-support Nov 5, 2024
9b1adee
[Port] [6000.0] [UUM-84431] Fix Lens Flare not rendering properly in …
svc-reach-platform-support Nov 6, 2024
a76c212
[Port] [6000.0] [HDRP] Improve water decal workflow for older shapes …
svc-reach-platform-support Nov 6, 2024
7ddc45a
[Port] [6000.0] [VFX] Two Custom hlsl bug fixes
svc-reach-platform-support Nov 6, 2024
89d1bb1
[Port] [6000.0] Prevent eviction of light with preserveCachedShadow f…
svc-reach-platform-support Nov 6, 2024
13a0ba1
[Port] [6000.0] [Fix] Fix the GBuffer pass to write in RT4 in Render …
svc-reach-platform-support Nov 7, 2024
a384e3a
[Port] [6000.0] Fix for HDRP entity water excluders
svc-reach-platform-support Nov 8, 2024
648df8f
[6000.0] Fix for glclientwaitsync errors in PowerVR devices
Nov 11, 2024
3652a13
[UUM-85648] Disabling test 270 for 6000.0
christian-sasseville Nov 11, 2024
bfc0cf4
[Port] [6000.0] [WebGPU] Test Updates and Bugfixes
svc-reach-platform-support Nov 11, 2024
82f6123
[Port] [6000.0] [VFX] Custom attribute with same name as built-in att…
svc-reach-platform-support Nov 12, 2024
4322132
[Port] [6000.0] Add dynamic resolution / upscaling docs page
svc-reach-platform-support Nov 12, 2024
ac3054e
[Port] [6000.0] [HDRP] Assertion printed when Maximum Reflection Prob…
svc-reach-platform-support Nov 13, 2024
f629d18
[Port] [6000.0] RenderGraph.AddBlitPass doesn't work correctly with t…
svc-reach-platform-support Nov 13, 2024
4c766ed
[Port] [6000.0] Fix Vulkan URP 2D crash on some android devices
svc-reach-platform-support Nov 13, 2024
455c43d
[Port] [6000.0] [HDRP] Better material creation for PBR Sky Custom Ma…
svc-reach-platform-support Nov 13, 2024
155b9d5
[Unity 6.0][URP] Fixing an issue where Transparent Receive Shadows to…
ellioman Nov 13, 2024
ef49573
[Port] [6000.0] [HDRP] Empty template starts with incorrect Physicall…
svc-reach-platform-support Nov 13, 2024
a003347
[6000.0] Fix picking and outline for all BatchRendererGroup draw types
JussiKnuuttila Nov 15, 2024
e0776ba
[Port] [6000.0] [VFX] Fix subgraph block nesting
svc-reach-platform-support Nov 18, 2024
0121c5d
[Port] [6000.0] Graphics/SRP/RPF - [UUM-87121] - STP is disabled when…
svc-reach-platform-support Nov 19, 2024
fd33269
[Port] [6000.0] UUM-86959: Fix environement lighting not updated when…
svc-reach-platform-support Nov 20, 2024
57c45aa
[Port] [6000.0] Added custom render texture documentation
svc-reach-platform-support Nov 20, 2024
fe6722c
[Port] [6000.0] [HDRP] Fix decal projector material creation
svc-reach-platform-support Nov 21, 2024
f92c6ae
[6000.0] Fix Depth attachment texture for DX11
Nov 21, 2024
75aeba7
[Port] [6000.0] Bind dummy depth texture for MRT in Volumetric Clouds…
svc-reach-platform-support Nov 21, 2024
31a26ae
[Port] [6000.0] [HDRP] Fix errors when building XR player with Water …
svc-reach-platform-support Nov 21, 2024
cca6426
[Port] [6000.0] Graphics/SRP/RPF - [UUM-87865] Make SetViewAndProject…
svc-reach-platform-support Nov 21, 2024
12c69f5
[Port] [6000.0] Add documentation for shadow matte interaction with s…
svc-reach-platform-support Nov 22, 2024
90e1f1c
[Port] [6000.0] [Render Graph Viewer]Minor fixes on side panels
svc-reach-platform-support Nov 22, 2024
93d354e
Nov 25, 2024
40deb52
[Port] [6000.0] Fixed compute shader for baking probe volumes
svc-reach-platform-support Nov 25, 2024
474a9a1
[Port] [6000.0] [VFX] Label are not visible when node is collapsed
svc-reach-platform-support Nov 25, 2024
67946e9
[Port] [6000.0] [Render Graph Viewer]Properly show the values for cle…
svc-reach-platform-support Nov 26, 2024
a7fe74d
[Port] [6000.0] Fix Final Depth Copy Parameters & Unnecessary Scene V…
svc-reach-platform-support Nov 26, 2024
bfe6926
[Backport 6000.0] Revert Changes from UUM-29958
RoseHirigoyen Nov 28, 2024
bff5f11
[6.0/editor] Fixed scene filtering with rendergraph not working on metal
alexey-unity Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Custom Material Inspectors enable you to define how Unity displays properties in

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:

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

## Assigning a custom Material Inspector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MyRenderPipeline : RenderPipeline

void InitializeRenderGraph()
{
m_RenderGraph = new RenderGraph(MyRenderGraph);
m_RenderGraph = new RenderGraph("MyRenderGraph");
}

void CleanupRenderGraph()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ public HeaderFoldout() : base()
m_HelpButton.SetEnabled(!string.IsNullOrEmpty(m_DocumentationURL));
line.Add(m_HelpButton);

m_ContextMenuButton = new Button(Background.FromTexture2D(CoreEditorStyles.paneOptionsIcon), () => ShowMenu());
m_ContextMenuButton =
new Button(Background.FromTexture2D(CoreEditorStyles.paneOptionsIcon), () => ShowMenu())
{
style =
{
paddingRight = 2
}
};

m_ContextMenuButton.SetEnabled(m_ContextMenuGenerator != null);
line.Add(m_ContextMenuButton);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal webgpu
#define UNIFIED_RT_GROUP_SIZE_X 64
#define UNIFIED_RT_GROUP_SIZE_Y 1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma kernel DilateCell

#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#pragma kernel VoxelizeProbeVolumeData
#pragma kernel Subdivide

#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch webgpu

// #pragma enable_d3d11_debug_symbols

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal webgpu switch
#define UNIFIED_RT_GROUP_SIZE_X 64
#define UNIFIED_RT_GROUP_SIZE_Y 1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using UnityEditor.UIElements;
using UnityEditorInternal;
Expand Down Expand Up @@ -122,7 +122,37 @@ bool IsSearchFilterMatch(string str, string searchString, out int startIndex, ou
return true;
}

private IVisualElementScheduledItem m_PreviousSearch;
private string m_PendingSearchString = string.Empty;
private const int k_SearchStringLimit = 15;
void OnSearchFilterChanged(Dictionary<VisualElement, List<TextElement>> elementCache, string searchString)
{
// Ensure the search string is within the allowed length limit (15 chars max)
if (searchString.Length > k_SearchStringLimit)
{
searchString = searchString[..k_SearchStringLimit]; // Trim to max 15 chars
Debug.LogWarning("[Render Graph Viewer] Search string limit exceeded: " + k_SearchStringLimit);
}

// If the search string hasn't changed, avoid repeating the same search
if (m_PendingSearchString == searchString)
return;

m_PendingSearchString = searchString;

if (m_PreviousSearch != null && m_PreviousSearch.isActive)
m_PreviousSearch.Pause();

m_PreviousSearch = rootVisualElement
.schedule
.Execute(() =>
{
PerformSearchAsync(elementCache, searchString);
})
.StartingIn(5); // Avoid spamming multiple search if the user types really fast
}

private void PerformSearchAsync(Dictionary<VisualElement, List<TextElement>> elementCache, string searchString)
{
// Display filter
foreach (var (foldout, descendants) in elementCache)
Expand Down Expand Up @@ -362,8 +392,12 @@ void CreateTextElement(VisualElement parent, string text, string className = nul
{
var attachmentFoldout = new Foldout();

string subResourceText = string.Empty;
if (attachmentInfo.attachment.mipLevel > 0) subResourceText += $" Mip:{attachmentInfo.attachment.mipLevel}";
if (attachmentInfo.attachment.depthSlice > 0) subResourceText += $" Slice:{attachmentInfo.attachment.depthSlice}";

// Abuse Foldout to allow two-line header (same as above)
attachmentFoldout.text = $"<b>{attachmentInfo.resourceName}</b><br>";
attachmentFoldout.text = $"<b>{attachmentInfo.resourceName + subResourceText}</b><br>";
Label attachmentIndexLabel = new Label($"<br>Attachment #{attachmentInfo.attachmentIndex}");
attachmentIndexLabel.AddToClassList(Classes.kInfoFoldoutSecondaryText);

Expand All @@ -384,13 +418,13 @@ void CreateTextElement(VisualElement parent, string text, string className = nul

attachmentFoldout.Add(new TextElement
{
text = $"<b>Load action:</b> {attachmentInfo.loadAction}\n- {attachmentInfo.loadReason}"
text = $"<b>Load action:</b> {attachmentInfo.attachment.loadAction}\n- {attachmentInfo.loadReason}"
});

bool addMsaaInfo = !string.IsNullOrEmpty(attachmentInfo.storeMsaaReason);
string resolvedTexturePrefix = addMsaaInfo ? "Resolved surface: " : "";

string storeActionText = $"<b>Store action:</b> {attachmentInfo.storeAction}" +
string storeActionText = $"<b>Store action:</b> {attachmentInfo.attachment.storeAction}" +
$"\n - {resolvedTexturePrefix}{attachmentInfo.storeReason}";

if (addMsaaInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ float GetCurrentExposureMultiplier()
return LOAD_TEXTURE2D(_ExposureTexture, int2(0, 0)).x;
}

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureXR.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/DecodeSH.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl"
Expand Down Expand Up @@ -267,6 +268,7 @@ bool ShouldCull(inout v2f o)
bool shouldCull = false;
if (distance(position.xyz + _APVWorldOffset, GetCurrentViewPosition()) > _CullDistance || brickSize > _MaxAllowedSubdiv || brickSize < _MinAllowedSubdiv)
{
ZERO_INITIALIZE(v2f, o);
DoCull(o);
shouldCull = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ private unsafe struct ProbesUpdateJob : IJobParallelForBatch
{
public const int k_BatchSize = 64;

[ReadOnly] public bool initialize;
[NativeDisableContainerSafetyRestriction, NoAlias][ReadOnly] public NativeArray<InstanceHandle> instances;
[NativeDisableParallelForRestriction][NativeDisableContainerSafetyRestriction, NoAlias] public CPUInstanceData instanceData;
[ReadOnly] public CPUSharedInstanceData sharedInstanceData;
Expand All @@ -403,11 +402,6 @@ public void Execute(int startIndex, int count)

int sharedInstanceIndex = sharedInstanceData.InstanceToIndex(instanceData, instance);
TransformUpdateFlags flags = sharedInstanceData.flags[sharedInstanceIndex].transformUpdateFlags;
bool isStaticObject = (flags & TransformUpdateFlags.IsPartOfStaticBatch) != 0;

if (!initialize && isStaticObject)
continue;

bool hasLightProbe = (flags & TransformUpdateFlags.HasLightProbeCombined) != 0;

if (!hasLightProbe)
Expand Down Expand Up @@ -976,7 +970,7 @@ public void Execute(int index)
instanceData.editorData.selectedBits.Set(instanceData.InstanceToIndex(instance), true);
}
}

#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ private unsafe void UpdateInstanceTransformsData(bool initialize, NativeArray<In

var probesJob = new ProbesUpdateJob()
{
initialize = initialize,
instances = instances,
instanceData = m_InstanceData,
sharedInstanceData = m_SharedInstanceData,
Expand Down Expand Up @@ -402,7 +401,6 @@ private unsafe void UpdateInstanceProbesData(NativeArray<InstanceHandle> instanc

new ProbesUpdateJob()
{
initialize = false,
instances = instances,
instanceData = m_InstanceData,
sharedInstanceData = m_SharedInstanceData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ static public void DoLensFlareDataDrivenCommon(Material lensFlareShader, Camera
Vector2 occlusionRadiusEdgeScreenPos1 = (Vector2)WorldToViewport(cam, !isDirLight, isCameraRelative, viewProjMatrix, positionWS + cam.transform.up * adjustedOcclusionRadius);
float occlusionRadius = (occlusionRadiusEdgeScreenPos1 - occlusionRadiusEdgeScreenPos0).magnitude;

if (comp.useOcclusion)
if (comp.useOcclusion && occlusionRT != null)
{
cmd.SetGlobalTexture(_FlareOcclusionTex, occlusionRT);
cmd.EnableShaderKeyword("FLARE_HAS_OCCLUSION");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ static RenderGraph.DebugData.PassData.NRPInfo.NativeRenderPassInfo.AttachmentInf
{
resourceName = pointTo.GetName(ctx, attachment.handle),
attachmentIndex = attachmentIndex,
loadAction = attachment.loadAction.ToString(),
loadReason = loadReason,
storeAction = attachment.storeAction.ToString(),
storeReason = storeReason,
storeMsaaReason = storeMsaaReason
storeMsaaReason = storeMsaaReason,
attachment = attachment
};
}

Expand Down Expand Up @@ -207,6 +206,8 @@ internal void GenerateNativeCompilerDebugData(ref RenderGraph.DebugData debugDat
debugResource.textureData.depth = resourceUnversioned.volumeDepth;
debugResource.textureData.samples = resourceUnversioned.msaaSamples;
debugResource.textureData.format = info.format;
debugResource.textureData.bindMS = resourceUnversioned.bindMS;
debugResource.textureData.clearBuffer = resourceUnversioned.clear;
debugResource.memoryless = resourceUnversioned.memoryLess;

debugResource.consumerList = new List<int>();
Expand Down Expand Up @@ -240,7 +241,7 @@ internal void GenerateNativeCompilerDebugData(ref RenderGraph.DebugData debugDat
debugPass.resourceReadLists = new List<int>[(int)RenderGraphResourceType.Count];
debugPass.resourceWriteLists = new List<int>[(int)RenderGraphResourceType.Count];

RenderGraph.DebugData.s_PassScriptMetadata.TryGetValue(passName, out debugPass.scriptInfo);
RenderGraph.DebugData.s_PassScriptMetadata.TryGetValue(graphPass, out debugPass.scriptInfo);

debugPass.syncFromPassIndex = -1; // TODO async compute support
debugPass.syncToPassIndex = -1; // TODO async compute support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ public override int GetHashCode()
return hash;
}

public static bool EqualForMerge(PassFragmentData x, PassFragmentData y)
// If you modify this, check if struct RenderPassSetup::Attachment in "GfxDevice\RenderPassSetup.h" also needs changes
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool SameSubResource(in PassFragmentData x, in PassFragmentData y)
{
// We ignore the version for now we assume if one pass writes version x and the next y they can
// be merged in the same native render pass
return x.resource.index == y.resource.index && x.accessFlags == y.accessFlags && x.mipLevel == y.mipLevel && x.depthSlice == y.depthSlice;
// We also do not look at the access flags as they get OR-ed together when adding subpasses to the native pass so the access flags
// will always cover the required access (and thus possibly more if required by other passes)
return x.resource.index == y.resource.index && x.mipLevel == y.mipLevel && x.depthSlice == y.depthSlice;
}
}

Expand Down Expand Up @@ -693,7 +697,7 @@ public static PassBreakAudit CanMerge(CompilerContextData contextData, int activ

for (int i = 0; i < nativePass.fragments.size; ++i)
{
if (nativePass.fragments[i].resource.index == fragment.resource.index)
if (PassFragmentData.SameSubResource(nativePass.fragments[i], fragment))
{
alreadyAttached = true;
break;
Expand Down Expand Up @@ -723,7 +727,7 @@ public static PassBreakAudit CanMerge(CompilerContextData contextData, int activ

for (int i = 0; i < nativePass.fragments.size; ++i)
{
if (nativePass.fragments[i].resource.index == fragmentInput.resource.index)
if (PassFragmentData.SameSubResource(nativePass.fragments[i], fragmentInput))
{
alreadyAttached = true;
break;
Expand Down Expand Up @@ -816,7 +820,7 @@ static bool CanMergeNativeSubPass(CompilerContextData contextData, NativePassDat
int colorAttachmentIdx = -1;
for (int fragmentId = 0; fragmentId < fragmentList.size; ++fragmentId)
{
if (fragmentList[fragmentId].resource.index == graphPassFragment.resource.index)
if (PassFragmentData.SameSubResource(fragmentList[fragmentId], graphPassFragment))
{
colorAttachmentIdx = fragmentId;
break;
Expand Down Expand Up @@ -849,7 +853,7 @@ static bool CanMergeNativeSubPass(CompilerContextData contextData, NativePassDat
int inputAttachmentIdx = -1;
for (int fragmentId = 0; fragmentId < fragmentList.size; ++fragmentId)
{
if (fragmentList[fragmentId].resource.index == graphFragmentInput.resource.index)
if (PassFragmentData.SameSubResource(fragmentList[fragmentId], graphFragmentInput))
{
inputAttachmentIdx = fragmentId;
break;
Expand Down Expand Up @@ -928,7 +932,7 @@ public static void TryMergeNativeSubPass(CompilerContextData contextData, ref Na
int colorAttachmentIdx = -1;
for (int fragmentId = 0; fragmentId < fragmentList.size; ++fragmentId)
{
if (fragmentList[fragmentId].resource.index == graphPassFragment.resource.index)
if (PassFragmentData.SameSubResource(fragmentList[fragmentId], graphPassFragment))
{
colorAttachmentIdx = fragmentId;
break;
Expand All @@ -955,7 +959,7 @@ public static void TryMergeNativeSubPass(CompilerContextData contextData, ref Na
int inputAttachmentIdx = -1;
for (int fragmentId = 0; fragmentId < fragmentList.size; ++fragmentId)
{
if (fragmentList[fragmentId].resource.index == fragmentInput.resource.index)
if (PassFragmentData.SameSubResource(fragmentList[fragmentId], fragmentInput))
{
inputAttachmentIdx = fragmentId;
break;
Expand Down Expand Up @@ -1118,7 +1122,7 @@ public static PassBreakAudit TryMerge(CompilerContextData contextData, int activ
for (int i = 0; i < nativePass.fragments.size; ++i)
{
ref var existingAttach = ref nativePass.fragments[i];
if (existingAttach.resource.index == newAttach.resource.index)
if (PassFragmentData.SameSubResource(existingAttach, newAttach))
{
// Update the attached version access flags and version
existingAttach.accessFlags |= newAttach.accessFlags;
Expand All @@ -1145,7 +1149,7 @@ public static PassBreakAudit TryMerge(CompilerContextData contextData, int activ
for (int i = 0; i < nativePass.fragments.size; ++i)
{
ref var existingAttach = ref nativePass.fragments[i];
if (existingAttach.resource.index == newAttach.resource.index)
if (PassFragmentData.SameSubResource(existingAttach, newAttach))
{
// Update the attached version access flags and version
existingAttach.accessFlags |= newAttach.accessFlags;
Expand Down
Loading