Skip to content

Commit 0a60eb8

Browse files
authored
Merge pull request #8275 from Unity-Technologies/internal/6000.3/staging
Mirror Internal/6000.3/staging
2 parents 4390ca9 + e82b08b commit 0a60eb8

File tree

104 files changed

+7477
-1683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+7477
-1683
lines changed

Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeComponentEditor.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ internal void SetVolumeProfile(VolumeProfile p)
196196

197197
static Dictionary<Type, VolumeParameterDrawer> s_ParameterDrawers;
198198
SupportedOnRenderPipelineAttribute m_SupportedOnRenderPipelineAttribute;
199-
Type[] m_LegacyPipelineTypes;
200199

201200
static VolumeComponentEditor()
202201
{
@@ -274,11 +273,6 @@ internal void Init()
274273

275274
var volumeComponentType = volumeComponent.GetType();
276275
m_SupportedOnRenderPipelineAttribute = volumeComponentType.GetCustomAttribute<SupportedOnRenderPipelineAttribute>();
277-
278-
#pragma warning disable CS0618
279-
var supportedOn = volumeComponentType.GetCustomAttribute<VolumeComponentMenuForRenderPipeline>();
280-
m_LegacyPipelineTypes = supportedOn != null ? supportedOn.pipelineTypes : Array.Empty<Type>();
281-
#pragma warning restore CS0618
282276
}
283277

284278
internal void DetermineVisibility(Type renderPipelineAssetType, Type renderPipelineType)
@@ -295,12 +289,6 @@ internal void DetermineVisibility(Type renderPipelineAssetType, Type renderPipel
295289
return;
296290
}
297291

298-
if (renderPipelineType != null && m_LegacyPipelineTypes.Length > 0)
299-
{
300-
visible = m_LegacyPipelineTypes.Contains(renderPipelineType);
301-
return;
302-
}
303-
304292
visible = true;
305293
}
306294

@@ -451,12 +439,12 @@ public virtual GUIContent GetDisplayTitle()
451439
var displayInfo = volumeComponentType.GetCustomAttribute<DisplayInfoAttribute>();
452440
if (displayInfo != null && !string.IsNullOrWhiteSpace(displayInfo.name))
453441
return EditorGUIUtility.TrTextContent(displayInfo.name, string.Empty);
454-
442+
455443
#pragma warning disable CS0618
456444
if (!string.IsNullOrWhiteSpace(volumeComponent.displayName))
457445
return EditorGUIUtility.TrTextContent(volumeComponent.displayName, string.Empty);
458446
#pragma warning restore CS0618
459-
447+
460448
return EditorGUIUtility.TrTextContent(ObjectNames.NicifyVariableName(volumeComponentType.Name) , string.Empty);
461449
}
462450

Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileUtils.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ static VolumeComponent GetVolumeComponentOfTypeOrDefault(this VolumeProfile prof
140140
static List<Type> GetTypesMissingFromDefaultProfile(VolumeProfile profile)
141141
{
142142
List<Type> missingTypes = new List<Type>();
143-
var volumeComponentTypes = VolumeManager.instance.baseComponentTypeArray;
143+
144+
var volumeComponentTypes = VolumeManager.instance.isInitialized ?
145+
VolumeManager.instance.baseComponentTypeArray : VolumeManager.instance.LoadBaseTypesByReflection(GraphicsSettings.currentRenderPipelineAssetType);
144146
foreach (var type in volumeComponentTypes)
145147
{
146148
if (profile.components.Find(c => c.GetType() == type) == null)
147149
{
148-
if (type.IsDefined(typeof(ObsoleteAttribute), false) ||
149-
type.IsDefined(typeof(HideInInspector), false))
150+
if (type.IsDefined(typeof(ObsoleteAttribute), false))
150151
continue;
151152

152153
missingTypes.Add(type);
153154
}
154155
}
155-
156156
return missingTypes;
157157
}
158158

@@ -163,13 +163,14 @@ static List<Type> GetTypesMissingFromDefaultProfile(VolumeProfile profile)
163163
/// <param name="profile">VolumeProfile to use.</param>
164164
/// <param name="defaultValueSource">An optional VolumeProfile asset containing default values to use for
165165
/// any components that are added to <see cref="profile"/>.</param>
166-
public static void EnsureAllOverridesForDefaultProfile(VolumeProfile profile, VolumeProfile defaultValueSource = null)
166+
public static void EnsureAllOverridesForDefaultProfile(VolumeProfile profile, VolumeProfile defaultValueSource = null) => TryEnsureAllOverridesForDefaultProfile(profile, defaultValueSource);
167+
internal static bool TryEnsureAllOverridesForDefaultProfile(VolumeProfile profile, VolumeProfile defaultValueSource = null)
167168
{
168169
// It's possible that the volume profile is assigned to the default asset inside the HDRP package. In
169170
// this case it cannot be modified. User is expected to use HDRP Wizard "Fix" to create a local profile.
170171
var path = AssetDatabase.GetAssetPath(profile);
171172
if (CoreEditorUtils.IsAssetInReadOnlyPackage(path))
172-
return;
173+
return false;
173174

174175
bool changed = false;
175176
int numComponentsBefore = profile.components.Count;
@@ -241,6 +242,8 @@ public static void EnsureAllOverridesForDefaultProfile(VolumeProfile profile, Vo
241242
VolumeManager.instance.OnVolumeProfileChanged(profile);
242243
EditorUtility.SetDirty(profile);
243244
}
245+
246+
return changed;
244247
}
245248

246249
/// <summary>

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceTexture.cs

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ internal enum TextureUVOriginSelection
9797
/// </summary>
9898
[DebuggerDisplay("Texture ({handle.index})")]
9999
[MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")]
100-
public readonly struct TextureHandle
100+
public readonly struct TextureHandle : IEquatable<TextureHandle>
101101
{
102102
private static TextureHandle s_NullHandle = new TextureHandle();
103103

@@ -151,6 +151,52 @@ internal TextureHandle(int handle, bool shared = false, bool builtin = false)
151151
/// <returns>Resource as a RTHandle.</returns>
152152
public static implicit operator RTHandle(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;
153153

154+
/// <summary>
155+
/// Determines whether this instance and another specified <see cref="TextureHandle"/> object have the same underlying resource handle.
156+
/// </summary>
157+
/// <param name="other">The texture handle to compare with the current instance.</param>
158+
/// <returns>
159+
/// True if both texture handles reference the same underlying resource; otherwise, false.
160+
/// </returns>
161+
public bool Equals(TextureHandle other) => handle.Equals(other.handle);
162+
163+
/// <summary>
164+
/// Determines whether the specified object is equal to the current <see cref="TextureHandle"/>.
165+
/// </summary>
166+
/// <param name="obj">The object to compare with the current instance.</param>
167+
/// <returns>
168+
/// True if the specified object is a <see cref="TextureHandle"/> and references the same underlying resource; otherwise, false.
169+
/// </returns>
170+
public override bool Equals(object obj) => obj is TextureHandle other && Equals(other);
171+
172+
/// <summary>
173+
/// Returns the hash code for this <see cref="TextureHandle"/>.
174+
/// </summary>
175+
/// <returns>
176+
/// The hash code of the current <see cref="TextureHandle"/>.
177+
/// </returns>
178+
public override int GetHashCode() => handle.GetHashCode();
179+
180+
/// <summary>
181+
/// Determines whether two <see cref="TextureHandle"/> instances reference the same underlying resource.
182+
/// </summary>
183+
/// <param name="lhs">The first texture handle to compare.</param>
184+
/// <param name="rhs">The second texture handle to compare.</param>
185+
/// <returns>
186+
/// True if both handles reference the same underlying resource; otherwise, false.
187+
/// </returns>
188+
public static bool operator ==(TextureHandle lhs, TextureHandle rhs) => lhs.handle.Equals(rhs.handle);
189+
190+
/// <summary>
191+
/// Determines whether two <see cref="TextureHandle"/> instances reference different underlying resources.
192+
/// </summary>
193+
/// <param name="lhs">The first texture handle to compare.</param>
194+
/// <param name="rhs">The second texture handle to compare.</param>
195+
/// <returns>
196+
/// True if the handles reference different underlying resources; otherwise, false.
197+
/// </returns>
198+
public static bool operator !=(TextureHandle lhs, TextureHandle rhs) => !lhs.handle.Equals(rhs.handle);
199+
154200
/// <summary>
155201
/// Return true if the handle is valid.
156202
/// </summary>

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@ public bool Equals(ResourceHandle hdl)
123123
{
124124
return hdl.m_Value == this.m_Value && hdl.m_Version == this.m_Version && hdl.type == this.type;
125125
}
126+
127+
public static bool operator ==(ResourceHandle lhs, ResourceHandle rhs) => lhs.Equals(rhs);
128+
129+
public static bool operator !=(ResourceHandle lhs, ResourceHandle rhs) => !lhs.Equals(rhs);
130+
131+
public override bool Equals(object obj) => obj is ResourceHandle other && Equals(other);
132+
133+
public override int GetHashCode()
134+
{
135+
var hashCode = HashFNV1A32.Create();
136+
hashCode.Append(m_Value);
137+
hashCode.Append(m_Version);
138+
hashCode.Append(m_Type);
139+
return hashCode.value;
140+
}
126141
}
127142

128143
class IRenderGraphResource

Packages/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public VolumeComponentMenu(string menu)
4545
/// This attribute allows you to add commands to the <b>Add Override</b> popup menu on Volumes,
4646
/// while also specifying the render pipeline(s) for which the command will be supported.
4747
/// </summary>
48-
[Obsolete(@"VolumeComponentMenuForRenderPipelineAttribute is deprecated. Use VolumeComponentMenu with SupportedOnRenderPipeline instead. #from(2023.1)")]
48+
[Obsolete(@"VolumeComponentMenuForRenderPipelineAttribute is deprecated. Use VolumeComponentMenu with SupportedOnRenderPipeline instead. #from(2023.1)", true)]
4949
public class VolumeComponentMenuForRenderPipeline : VolumeComponentMenu
5050
{
5151
/// <summary>
@@ -126,7 +126,7 @@ public sealed class VolumeComponentDeprecated : Attribute
126126
/// <para>
127127
/// In the example above, the custom component `ExampleComponent` extends `VolumeComponent` and defines a parameter
128128
/// (`intensity`) that can be manipulated within the volume framework. The `ClampedFloatParameter` is a type of
129-
/// <see cref="VolumeParameter{T}"/> that ensures the value remains within a specified range.
129+
/// <see cref="VolumeParameter{T}"/> that ensures the value remains within a specified range.
130130
/// </para>
131131
/// </example>
132132
[Serializable]
@@ -164,7 +164,7 @@ public Indent(int relativeAmount = 1)
164164
/// The backing storage of <see cref="parameters"/>. Use this for performance-critical work.
165165
/// </summary>
166166
internal VolumeParameter[] parameterList;
167-
167+
168168
ReadOnlyCollection<VolumeParameter> m_ParameterReadOnlyCollection;
169169

170170
/// <summary>
@@ -355,7 +355,7 @@ public bool AnyPropertiesIsOverridden()
355355
{
356356
for (int i = 0; i < parameterList.Length; ++i)
357357
{
358-
if (parameterList[i].overrideState)
358+
if (parameterList[i].overrideState)
359359
return true;
360360
}
361361
return false;

0 commit comments

Comments
 (0)