Skip to content

Commit 6173e4d

Browse files
RSlyszsebastienlagarde
authored andcommitted
Update the scripting API for FrameSettings, FrameSettingsOverrideMask and IBitArray (#110)
1 parent 7894820 commit 6173e4d

File tree

2 files changed

+32
-35
lines changed
  • com.unity.render-pipelines.core/Runtime/Utilities
  • com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings

2 files changed

+32
-35
lines changed

com.unity.render-pipelines.core/Runtime/Utilities/BitArray.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,35 @@ namespace UnityEngine.Rendering
99
/// </summary>
1010
public interface IBitArray
1111
{
12-
/// <summary>Number of elements in the bit array.</summary>
12+
/// <summary>Gets the capacity of this BitArray. This is the number of bits that are usable.</summary>
1313
uint capacity { get; }
14-
/// <summary>True if all bits are 0.</summary>
14+
/// <summary>Return `true` if all the bits of this BitArray are set to 0. Returns `false` otherwise.</summary>
1515
bool allFalse { get; }
16-
/// <summary>True if all bits are 1.</summary>
16+
/// <summary>Return `true` if all the bits of this BitArray are set to 1. Returns `false` otherwise.</summary>
1717
bool allTrue { get; }
1818
/// <summary>
19-
/// Returns the state of the bit at a specific index.
19+
/// An indexer that allows access to the bit at a given index. This provides both read and write access.
2020
/// </summary>
2121
/// <param name="index">Index of the bit.</param>
2222
/// <returns>State of the bit at the provided index.</returns>
2323
bool this[uint index] { get; set; }
24-
/// <summary>Returns the bit array in a human readable form.</summary>
24+
/// <summary>Writes the bits in the array in a human-readable form. This is as a string of 0s and 1s packed by 8 bits. This is useful for debugging.</summary>
2525
string humanizedData { get; }
2626

2727
/// <summary>
28-
/// Bit-wise And operation.
28+
/// Perform an AND bitwise operation between this BitArray and the one you pass into the function and return the result. Both BitArrays must have the same capacity. This will not change current BitArray values.
2929
/// </summary>
30-
/// <param name="other">Bit array with which to the And operation.</param>
30+
/// <param name="other">BitArray with which to the And operation.</param>
3131
/// <returns>The resulting bit array.</returns>
3232
IBitArray BitAnd(IBitArray other);
3333
/// <summary>
34-
/// Bit-wise Or operation.
34+
/// Perform an OR bitwise operation between this BitArray and the one you pass into the function and return the result. Both BitArrays must have the same capacity. This will not change current BitArray values.
3535
/// </summary>
36-
/// <param name="other">Bit array with which to the Or operation.</param>
36+
/// <param name="other">BitArray with which to the Or operation.</param>
3737
/// <returns>The resulting bit array.</returns>
3838
IBitArray BitOr(IBitArray other);
3939
/// <summary>
40-
/// Invert the bit array.
40+
/// Return the BitArray with every bit inverted.
4141
/// </summary>
4242
/// <returns></returns>
4343
IBitArray BitNot();

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ public enum FrameSettingsField
318318
[DebuggerDisplay("{mask.humanizedData}")]
319319
public struct FrameSettingsOverrideMask
320320
{
321-
/// <summary>Mask of overridden values.</summary>
321+
/// <summary>Gets the underlying BitArray HDRP uses to store the override mask and thus specific which field is overridden or not.
322+
/// Note: BitArray128 is implements IBitArray and therefore has the scripting API described below. It is recomended to use the interface as the exact BitArray con evolve from one version of the package to another as the we need more capacity here.
323+
/// </summary>
322324
[SerializeField]
323325
public BitArray128 mask;
324326
}
@@ -501,59 +503,54 @@ partial struct FrameSettings
501503
BitArray128 bitDatas;
502504

503505
/// <summary>
504-
/// if <c>lodBiasMode == LODBiasMode.Fixed</c>, then this value will overwrite <c>QualitySettings.lodBias</c>
505-
/// if <c>lodBiasMode == LODBiasMode.ScaleQualitySettings</c>, then this value will scale <c>QualitySettings.lodBias</c>
506+
/// If <c>lodBiasMode</c> is <c>LODBiasMode.Fixed</c>, then this value overwrites <c>QualitySettings.lodBias</c>.
507+
/// If <c>lodBiasMode</c> is <c>LODBiasMode.ScaleQualitySettings</c>, then this value scales <c>QualitySettings.lodBias</c>.
506508
/// </summary>
507509
[SerializeField]
508510
public float lodBias;
509-
/// <summary>Define how the <c>QualitySettings.lodBias</c> value is set.</summary>
511+
/// <summary>Specifies how HDRP calculates <c>QualitySettings.lodBias</c>.</summary>
510512
[SerializeField]
511513
public LODBiasMode lodBiasMode;
512-
/// <summary>The quality level to use when fetching the quality setting value.</summary>
514+
/// <summary>The quality level the rendering component uses when it fetches the quality setting value.</summary>
513515
[SerializeField]
514516
public int lodBiasQualityLevel;
515517
/// <summary>
516-
/// if <c>maximumLODLevelMode == MaximumLODLevelMode.FromQualitySettings</c>, then this value will overwrite <c>QualitySettings.maximumLODLevel</c>
517-
/// if <c>maximumLODLevelMode == MaximumLODLevelMode.OffsetQualitySettings</c>, then this value will offset <c>QualitySettings.maximumLODLevel</c>
518+
/// If <c>maximumLODLevelMode</c> is <c>MaximumLODLevelMode.FromQualitySettings</c>, then this value overwrites <c>QualitySettings.maximumLODLevel</c>
519+
/// If <c>maximumLODLevelMode</c> is <c>MaximumLODLevelMode.OffsetQualitySettings</c>, then this value offsets <c>QualitySettings.maximumLODLevel</c>
518520
/// </summary>
519521
[SerializeField]
520522
public int maximumLODLevel;
521-
/// <summary>Define how the <c>QualitySettings.maximumLODLevel</c> value is set.</summary>
523+
/// <summary>Specifies how HDRP calculates <c>QualitySettings.maximumLODLevel</c>.</summary>
522524
[SerializeField]
523525
public MaximumLODLevelMode maximumLODLevelMode;
524-
/// <summary>The quality level to use when fetching the quality setting value.</summary>
526+
/// <summary>The maximum quality level the rendering component uses when it fetches the quality setting value.</summary>
525527
[SerializeField]
526528
public int maximumLODLevelQualityLevel;
527529

528530
/// <summary>
529-
/// The material quality level to use for this rendering.
530-
/// if <c>materialQuality == 0</c>, then the material quality from the current quality settings
531-
/// (in HDRP Asset) will be used.
531+
/// The material quality level this rendering component uses.
532+
/// If <c>materialQuality == 0</c>, the rendering component uses the material quality from the current quality settings in the HDRP Asset.
532533
/// </summary>
533534
public MaterialQuality materialQuality;
534535

535-
/// <summary>Helper to see binary saved data on LitShaderMode as a LitShaderMode enum.</summary>
536+
/// <summary>Specifies the rendering path this rendering component uses. Here you can use the <c>LitShaderMode</c> enum to specify whether the rendering component uses forward or deferred rendering.</summary>
536537
public LitShaderMode litShaderMode
537538
{
538539
get => bitDatas[(uint)FrameSettingsField.LitShaderMode] ? LitShaderMode.Deferred : LitShaderMode.Forward;
539540
set => bitDatas[(uint)FrameSettingsField.LitShaderMode] = value == LitShaderMode.Deferred;
540541
}
541542

542-
/// <summary>
543-
/// <summary>Get stored data for this field.</summary>
544-
/// </summary>
543+
/// <summary>Gets the stored override value for the passed in Frame Setting. Use this to access boolean values.</summary>
545544
/// <param name="field">Requested field.</param>
546545
/// <returns>True if the field is enabled.</returns>
547546
public bool IsEnabled(FrameSettingsField field) => bitDatas[(uint)field];
548-
/// <summary>
549-
/// <summary>Set stored data for this field.</summary>
550-
/// </summary>
547+
/// <summary>Sets the stored override value for the passed in Frame Setting. Use this to access boolean values.</summary>
551548
/// <param name="field">Requested field.</param>
552549
/// <param name="value">State to set to the field.</param>
553550
public void SetEnabled(FrameSettingsField field, bool value) => bitDatas[(uint)field] = value;
554551

555552
/// <summary>
556-
/// Compute the LOD bias value to use
553+
/// Calculates the LOD bias value to use.
557554
/// </summary>
558555
/// <param name="hdrp">The HDRP Assets to use</param>
559556
/// <returns>The LOD Bias to use</returns>
@@ -570,7 +567,7 @@ public float GetResolvedLODBias(HDRenderPipelineAsset hdrp)
570567
}
571568

572569
/// <summary>
573-
/// Compute the Maximum LOD level to use
570+
/// Calculates the Maximum LOD level to use.
574571
/// </summary>
575572
/// <param name="hdrp">The HDRP Asset to use</param>
576573
/// <returns>The Maximum LOD level to use.</returns>
@@ -732,7 +729,7 @@ internal static void AggregateFrameSettings(ref FrameSettings aggregatedFrameSet
732729
}
733730

734731
/// <summary>
735-
/// Equality operator.
732+
/// Equality operator between two FrameSettings. Return `true` if equivalent. (comparison of content).
736733
/// </summary>
737734
/// <param name="a">First frame settings.</param>
738735
/// <param name="b">Second frame settings.</param>
@@ -748,7 +745,7 @@ internal static void AggregateFrameSettings(ref FrameSettings aggregatedFrameSet
748745
&& a.materialQuality == b.materialQuality;
749746

750747
/// <summary>
751-
/// Inequality operator.
748+
/// Inequality operator between two FrameSettings. Return `true` if different. (comparison of content).
752749
/// </summary>
753750
/// <param name="a">First frame settings.</param>
754751
/// <param name="b">Second frame settings.</param>
@@ -764,7 +761,7 @@ internal static void AggregateFrameSettings(ref FrameSettings aggregatedFrameSet
764761
|| a.materialQuality != b.materialQuality;
765762

766763
/// <summary>
767-
/// Equality operator.
764+
/// Equality operator between two FrameSettings. Return `true` if equivalent. (comparison of content).
768765
/// </summary>
769766
/// <param name="obj">Frame Settings to compare to.</param>
770767
/// <returns>True if both settings are equal.</returns>
@@ -780,7 +777,7 @@ public override bool Equals(object obj)
780777
&& materialQuality.Equals(((FrameSettings)obj).materialQuality);
781778

782779
/// <summary>
783-
/// Returns the hash code of the frame settings.
780+
/// Returns the hash code of this object.
784781
/// </summary>
785782
/// <returns>Hash code of the frame settings.</returns>
786783
public override int GetHashCode()

0 commit comments

Comments
 (0)