diff --git a/Editor/CoreEditorUtils.cs b/Editor/CoreEditorUtils.cs index 91ccbff..db02353 100644 --- a/Editor/CoreEditorUtils.cs +++ b/Editor/CoreEditorUtils.cs @@ -550,7 +550,7 @@ public static bool DrawHeaderToggle(GUIContent title, SerializedProperty group, // Context menu var menuIcon = CoreEditorStyles.paneOptionsIcon; - var menuRect = new Rect(labelRect.xMax + 3f + 16 + 5 , labelRect.y + 1f, menuIcon.width, menuIcon.height); + var menuRect = new Rect(labelRect.xMax + 3f + 16 + 5, labelRect.y + 1f, menuIcon.width, menuIcon.height); if (contextAction != null) GUI.DrawTexture(menuRect, menuIcon); diff --git a/Editor/Debugging/DebugWindow.cs b/Editor/Debugging/DebugWindow.cs index 5e3f337..77a267d 100644 --- a/Editor/Debugging/DebugWindow.cs +++ b/Editor/Debugging/DebugWindow.cs @@ -11,7 +11,7 @@ namespace UnityEditor.Rendering { - #pragma warning disable 414 +#pragma warning disable 414 [Serializable] sealed class WidgetStateDictionary : SerializedDictionary {} @@ -580,5 +580,5 @@ public Styles() } } - #pragma warning restore 414 +#pragma warning restore 414 } diff --git a/Editor/Lighting/CoreLightEditorUtilities.cs b/Editor/Lighting/CoreLightEditorUtilities.cs index 67dd095..1feb37c 100644 --- a/Editor/Lighting/CoreLightEditorUtilities.cs +++ b/Editor/Lighting/CoreLightEditorUtilities.cs @@ -97,9 +97,9 @@ static void DrawPointHandlesAndLabels(Light light) var firstControl = GUIUtility.GetControlID(s_PointLightHandle.GetHashCode(), FocusType.Passive) - 6; // BoxBoundsHandle allocates 6 control IDs if (Event.current.type != EventType.Repaint) return; -// var firstControl = GUIUtility.GetControlID(k_RadiusHandleHash, FocusType.Passive) - 6; -// if (Event.current.type != EventType.Repaint) -// return; + // var firstControl = GUIUtility.GetControlID(k_RadiusHandleHash, FocusType.Passive) - 6; + // if (Event.current.type != EventType.Repaint) + // return; // Adding label ///////////////////////////////////// Vector3 labelPosition = Vector3.zero; @@ -312,7 +312,7 @@ static void DrawHandleLabel(Vector3 handlePosition, string labelText, float offs { Vector3 labelPosition = Vector3.zero; - var style = new GUIStyle {normal = {background = Texture2D.whiteTexture}}; + var style = new GUIStyle { normal = { background = Texture2D.whiteTexture } }; GUI.color = new Color(0.82f, 0.82f, 0.82f, 1); labelPosition = handlePosition + Handles.inverseMatrix.MultiplyVector(Vector3.up) * HandleUtility.GetHandleSize(handlePosition) * offsetFromHandle; diff --git a/Editor/LookDev/ComparisonGizmoController.cs b/Editor/LookDev/ComparisonGizmoController.cs index 9955fd6..9d8a9b5 100644 --- a/Editor/LookDev/ComparisonGizmoController.cs +++ b/Editor/LookDev/ComparisonGizmoController.cs @@ -129,11 +129,11 @@ void OnMouseDrag(MouseMoveEvent evt) switch (m_Selected) { - case Selected.PlaneSeparator: OnDragPlaneSeparator(evt); break; + case Selected.PlaneSeparator: OnDragPlaneSeparator(evt); break; case Selected.NodeFirstView: - case Selected.NodeSecondView: OnDragPlaneNodeExtremity(evt); break; - case Selected.Fader: OnDragFader(evt); break; - default: throw new ArgumentException("Unknown kind of Selected"); + case Selected.NodeSecondView: OnDragPlaneNodeExtremity(evt); break; + case Selected.Fader: OnDragFader(evt); break; + default: throw new ArgumentException("Unknown kind of Selected"); } } diff --git a/Editor/Volume/VolumeComponentEditor.cs b/Editor/Volume/VolumeComponentEditor.cs index 12d4c41..dc68ad7 100644 --- a/Editor/Volume/VolumeComponentEditor.cs +++ b/Editor/Volume/VolumeComponentEditor.cs @@ -249,7 +249,8 @@ public virtual void OnEnable() GetFields(target, fields); m_Parameters = fields - .Select(t => { + .Select(t => + { var name = ""; var order = 0; var attr = (DisplayInfoAttribute[])t.Item1.GetCustomAttributes(typeof(DisplayInfoAttribute), true); diff --git a/Editor/Volume/VolumeComponentProvider.cs b/Editor/Volume/VolumeComponentProvider.cs index 661d923..146cd9e 100644 --- a/Editor/Volume/VolumeComponentProvider.cs +++ b/Editor/Volume/VolumeComponentProvider.cs @@ -26,7 +26,7 @@ public VolumeComponentElement(int level, string label, Type type) class PathNode : IComparable { - public List nodes = new List(); + public List nodes = new List(); public string name; public Type type; diff --git a/Runtime/Camera/CameraSwitcher.cs b/Runtime/Camera/CameraSwitcher.cs index 8f8772b..7742e6d 100644 --- a/Runtime/Camera/CameraSwitcher.cs +++ b/Runtime/Camera/CameraSwitcher.cs @@ -19,8 +19,8 @@ public class CameraSwitcher : MonoBehaviour private Quaternion m_OriginalCameraRotation; private Camera m_CurrentCamera = null; - GUIContent[] m_CameraNames = null; - int[] m_CameraIndices = null; + GUIContent[] m_CameraNames = null; + int[] m_CameraIndices = null; DebugUI.EnumField m_DebugEntry; diff --git a/Runtime/Camera/FreeCamera.cs b/Runtime/Camera/FreeCamera.cs index 59dd13d..7a5afe0 100644 --- a/Runtime/Camera/FreeCamera.cs +++ b/Runtime/Camera/FreeCamera.cs @@ -1,5 +1,5 @@ #if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE - #define USE_INPUT_SYSTEM +#define USE_INPUT_SYSTEM using UnityEngine.InputSystem; #endif diff --git a/Runtime/Common/CommonStructs.cs b/Runtime/Common/CommonStructs.cs index 2b38f5f..430024a 100644 --- a/Runtime/Common/CommonStructs.cs +++ b/Runtime/Common/CommonStructs.cs @@ -9,7 +9,7 @@ namespace UnityEngine.Rendering public enum ClearFlag { /// Don't clear. - None = 0, + None = 0, /// Clear the color buffer. Color = 1, /// Clear the depth buffer. diff --git a/Runtime/Common/DynamicResolutionHandler.cs b/Runtime/Common/DynamicResolutionHandler.cs index f6723f5..b3055bb 100644 --- a/Runtime/Common/DynamicResolutionHandler.cs +++ b/Runtime/Common/DynamicResolutionHandler.cs @@ -31,7 +31,7 @@ public enum DynamicResScalePolicyType /// public class DynamicResolutionHandler { - private bool m_Enabled; + private bool m_Enabled; private float m_MinScreenFraction; private float m_MaxScreenFraction; private float m_CurrentFraction; @@ -348,7 +348,7 @@ public bool SoftwareDynamicResIsEnabled() /// True: Hardware dynamic resolution is enabled public bool HardwareDynamicResIsEnabled() { - return !m_ForceSoftwareFallback && m_CurrentCameraRequest && m_Enabled && type == DynamicResolutionType.Hardware; + return !m_ForceSoftwareFallback && m_CurrentCameraRequest && m_Enabled && type == DynamicResolutionType.Hardware; } /// diff --git a/Runtime/Common/ListBuffer.cs b/Runtime/Common/ListBuffer.cs index d43c915..08ee20e 100644 --- a/Runtime/Common/ListBuffer.cs +++ b/Runtime/Common/ListBuffer.cs @@ -99,7 +99,7 @@ public bool TryAdd(in T value) /// The number of item to copy. public unsafe void CopyTo(T* dstBuffer, int startDstIndex, int copyCount) { - UnsafeUtility.MemCpy(dstBuffer + startDstIndex, m_BufferPtr, + UnsafeUtility.MemCpy(dstBuffer + startDstIndex, m_BufferPtr, UnsafeUtility.SizeOf() * copyCount); } diff --git a/Runtime/Common/XRGraphics.cs b/Runtime/Common/XRGraphics.cs index 6c88186..3424740 100644 --- a/Runtime/Common/XRGraphics.cs +++ b/Runtime/Common/XRGraphics.cs @@ -74,11 +74,11 @@ public static bool tryEnable { get { - #if UNITY_2020_1_OR_NEWER +#if UNITY_2020_1_OR_NEWER return false; - #else +#else return UnityEditorInternal.VR.VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)); - #endif +#endif } } #endif diff --git a/Runtime/Debugging/DebugManager.Actions.cs b/Runtime/Debugging/DebugManager.Actions.cs index 8207f1b..2e1e422 100644 --- a/Runtime/Debugging/DebugManager.Actions.cs +++ b/Runtime/Debugging/DebugManager.Actions.cs @@ -1,5 +1,5 @@ #if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE - #define USE_INPUT_SYSTEM +#define USE_INPUT_SYSTEM using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; #endif @@ -30,17 +30,17 @@ enum DebugActionRepeatMode public sealed partial class DebugManager { - const string kEnableDebugBtn1 = "Enable Debug Button 1"; - const string kEnableDebugBtn2 = "Enable Debug Button 2"; + const string kEnableDebugBtn1 = "Enable Debug Button 1"; + const string kEnableDebugBtn2 = "Enable Debug Button 2"; const string kDebugPreviousBtn = "Debug Previous"; - const string kDebugNextBtn = "Debug Next"; - const string kValidateBtn = "Debug Validate"; - const string kPersistentBtn = "Debug Persistent"; - const string kDPadVertical = "Debug Vertical"; - const string kDPadHorizontal = "Debug Horizontal"; - const string kMultiplierBtn = "Debug Multiplier"; - const string kResetBtn = "Debug Reset"; - const string kEnableDebug = "Enable Debug"; + const string kDebugNextBtn = "Debug Next"; + const string kValidateBtn = "Debug Validate"; + const string kPersistentBtn = "Debug Persistent"; + const string kDPadVertical = "Debug Vertical"; + const string kDPadHorizontal = "Debug Horizontal"; + const string kMultiplierBtn = "Debug Multiplier"; + const string kResetBtn = "Debug Reset"; + const string kEnableDebug = "Enable Debug"; DebugActionDesc[] m_DebugActions; DebugActionState[] m_DebugActionStates; @@ -159,7 +159,7 @@ void SampleAction(int actionIndex) var desc = m_DebugActions[actionIndex]; var state = m_DebugActionStates[actionIndex]; -// Disable all input events if we're using the new input system + // Disable all input events if we're using the new input system #if USE_INPUT_SYSTEM if (state.runningAction == false) { diff --git a/Runtime/Debugging/DebugShapes.cs b/Runtime/Debugging/DebugShapes.cs index e140706..c3c97dc 100644 --- a/Runtime/Debugging/DebugShapes.cs +++ b/Runtime/Debugging/DebugShapes.cs @@ -248,7 +248,7 @@ void BuildCone(ref Mesh outputMesh, float height, float topRadius, float bottomR } // Top cap - vertices[vert++] = new Vector3(0f, 0f , height); + vertices[vert++] = new Vector3(0f, 0f, height); while (vert <= nbSides * 2 + 1) { float rad = (float)(vert - nbSides - 1) / nbSides * _2pi; diff --git a/Runtime/Debugging/DebugUI.cs b/Runtime/Debugging/DebugUI.cs index 0ec67ab..5a8bf66 100644 --- a/Runtime/Debugging/DebugUI.cs +++ b/Runtime/Debugging/DebugUI.cs @@ -17,11 +17,11 @@ public enum Flags /// /// None. /// - None = 0, + None = 0, /// /// This widget is Editor only. /// - EditorOnly = 1 << 1, + EditorOnly = 1 << 1, /// /// This widget is Runtime only. /// diff --git a/Runtime/Debugging/MousePositionDebug.cs b/Runtime/Debugging/MousePositionDebug.cs index 1870426..0461893 100644 --- a/Runtime/Debugging/MousePositionDebug.cs +++ b/Runtime/Debugging/MousePositionDebug.cs @@ -1,5 +1,5 @@ #if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE - #define USE_INPUT_SYSTEM +#define USE_INPUT_SYSTEM using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; #endif diff --git a/Runtime/RenderGraph/RenderGraph.cs b/Runtime/RenderGraph/RenderGraph.cs index 4058303..4b04af5 100644 --- a/Runtime/RenderGraph/RenderGraph.cs +++ b/Runtime/RenderGraph/RenderGraph.cs @@ -25,13 +25,13 @@ public enum DepthAccess public class RenderGraphContext { ///Scriptable Render Context used for rendering. - public ScriptableRenderContext renderContext; + public ScriptableRenderContext renderContext; ///Command Buffer used for rendering. - public CommandBuffer cmd; + public CommandBuffer cmd; ///Render Graph pooll used for temporary data. - public RenderGraphObjectPool renderGraphPool; + public RenderGraphObjectPool renderGraphPool; ///Render Graph default resources. - public RenderGraphDefaultResources defaultResources; + public RenderGraphDefaultResources defaultResources; } /// @@ -70,9 +70,9 @@ public void RegisterDebug(string name) action = () => { logFrameInformation = true; - #if UNITY_EDITOR +#if UNITY_EDITOR UnityEditor.SceneView.RepaintAll(); - #endif +#endif } }); list.Add(new DebugUI.Button @@ -81,9 +81,9 @@ public void RegisterDebug(string name) action = () => { logResources = true; - #if UNITY_EDITOR +#if UNITY_EDITOR UnityEditor.SceneView.RepaintAll(); - #endif +#endif } }); @@ -159,9 +159,9 @@ public class RenderGraph internal struct CompiledResourceInfo { - public List producers; - public List consumers; - public int refCount; + public List producers; + public List consumers; + public int refCount; public void Reset() { @@ -179,19 +179,19 @@ public void Reset() [DebuggerDisplay("RenderPass: {pass.name} (Index:{pass.index} Async:{enableAsyncCompute})")] internal struct CompiledPassInfo { - public RenderGraphPass pass; - public List[] resourceCreateList; - public List[] resourceReleaseList; - public int refCount; - public bool culled; - public bool hasSideEffect; - public int syncToPassIndex; // Index of the pass that needs to be waited for. - public int syncFromPassIndex; // Smaller pass index that waits for this pass. - public bool needGraphicsFence; - public GraphicsFence fence; + public RenderGraphPass pass; + public List[] resourceCreateList; + public List[] resourceReleaseList; + public int refCount; + public bool culled; + public bool hasSideEffect; + public int syncToPassIndex; // Index of the pass that needs to be waited for. + public int syncFromPassIndex; // Smaller pass index that waits for this pass. + public bool needGraphicsFence; + public GraphicsFence fence; - public bool enableAsyncCompute; - public bool allowPassCulling { get { return pass.allowPassCulling; } } + public bool enableAsyncCompute; + public bool allowPassCulling { get { return pass.allowPassCulling; } } #if DEVELOPMENT_BUILD || UNITY_EDITOR // This members are only here to ease debugging. @@ -248,32 +248,32 @@ public void Reset(RenderGraphPass pass) } } - RenderGraphResourceRegistry m_Resources; - RenderGraphObjectPool m_RenderGraphPool = new RenderGraphObjectPool(); - List m_RenderPasses = new List(64); - List m_RendererLists = new List(32); - RenderGraphDebugParams m_DebugParameters = new RenderGraphDebugParams(); - RenderGraphLogger m_Logger = new RenderGraphLogger(); - RenderGraphDefaultResources m_DefaultResources = new RenderGraphDefaultResources(); - Dictionary m_DefaultProfilingSamplers = new Dictionary(); - bool m_ExecutionExceptionWasRaised; - RenderGraphContext m_RenderGraphContext = new RenderGraphContext(); - CommandBuffer m_PreviousCommandBuffer; - int m_CurrentImmediatePassIndex; - List[] m_ImmediateModeResourceList = new List[(int)RenderGraphResourceType.Count]; + RenderGraphResourceRegistry m_Resources; + RenderGraphObjectPool m_RenderGraphPool = new RenderGraphObjectPool(); + List m_RenderPasses = new List(64); + List m_RendererLists = new List(32); + RenderGraphDebugParams m_DebugParameters = new RenderGraphDebugParams(); + RenderGraphLogger m_Logger = new RenderGraphLogger(); + RenderGraphDefaultResources m_DefaultResources = new RenderGraphDefaultResources(); + Dictionary m_DefaultProfilingSamplers = new Dictionary(); + bool m_ExecutionExceptionWasRaised; + RenderGraphContext m_RenderGraphContext = new RenderGraphContext(); + CommandBuffer m_PreviousCommandBuffer; + int m_CurrentImmediatePassIndex; + List[] m_ImmediateModeResourceList = new List[(int)RenderGraphResourceType.Count]; // Compiled Render Graph info. - DynamicArray[] m_CompiledResourcesInfos = new DynamicArray[(int)RenderGraphResourceType.Count]; - DynamicArray m_CompiledPassInfos = new DynamicArray(); - Stack m_CullingStack = new Stack(); + DynamicArray[] m_CompiledResourcesInfos = new DynamicArray[(int)RenderGraphResourceType.Count]; + DynamicArray m_CompiledPassInfos = new DynamicArray(); + Stack m_CullingStack = new Stack(); - int m_ExecutionCount; - int m_CurrentFrameIndex; - bool m_HasRenderGraphBegun; - RenderGraphDebugData m_RenderGraphDebugData = new RenderGraphDebugData(); + int m_ExecutionCount; + int m_CurrentFrameIndex; + bool m_HasRenderGraphBegun; + RenderGraphDebugData m_RenderGraphDebugData = new RenderGraphDebugData(); // Global list of living render graphs - static List s_RegisteredGraphs = new List(); + static List s_RegisteredGraphs = new List(); #region Public Interface /// Name of the Render Graph. @@ -657,7 +657,7 @@ public void EndProfilingSampler(ProfilingSampler sampler) #endregion #region Internal Interface - internal static List GetRegisteredRenderGraphs() + internal static List GetRegisteredRenderGraphs() { return s_RegisteredGraphs; } diff --git a/Runtime/RenderGraph/RenderGraphBuilder.cs b/Runtime/RenderGraph/RenderGraphBuilder.cs index 1c6bd48..72c18a2 100644 --- a/Runtime/RenderGraph/RenderGraphBuilder.cs +++ b/Runtime/RenderGraph/RenderGraphBuilder.cs @@ -9,10 +9,10 @@ namespace UnityEngine.Experimental.Rendering.RenderGraphModule /// public struct RenderGraphBuilder : IDisposable { - RenderGraphPass m_RenderPass; + RenderGraphPass m_RenderPass; RenderGraphResourceRegistry m_Resources; - RenderGraph m_RenderGraph; - bool m_Disposed; + RenderGraph m_RenderGraph; + bool m_Disposed; #region Public Interface /// diff --git a/Runtime/RenderGraph/RenderGraphLogger.cs b/Runtime/RenderGraph/RenderGraphLogger.cs index df946c9..985410c 100644 --- a/Runtime/RenderGraph/RenderGraphLogger.cs +++ b/Runtime/RenderGraph/RenderGraphLogger.cs @@ -5,9 +5,9 @@ namespace UnityEngine.Experimental.Rendering.RenderGraphModule { struct RenderGraphLogIndent : IDisposable { - int m_Indentation; - RenderGraphLogger m_Logger; - bool m_Disposed; + int m_Indentation; + RenderGraphLogger m_Logger; + bool m_Disposed; public RenderGraphLogIndent(RenderGraphLogger logger, int indentation = 1) { @@ -41,8 +41,8 @@ void Dispose(bool disposing) class RenderGraphLogger { - StringBuilder m_Builder = new StringBuilder(); - int m_CurrentIndentation; + StringBuilder m_Builder = new StringBuilder(); + int m_CurrentIndentation; public void Initialize() { diff --git a/Runtime/RenderGraph/RenderGraphObjectPool.cs b/Runtime/RenderGraph/RenderGraphObjectPool.cs index c30f391..312e99d 100644 --- a/Runtime/RenderGraph/RenderGraphObjectPool.cs +++ b/Runtime/RenderGraph/RenderGraphObjectPool.cs @@ -28,9 +28,9 @@ public void Release(T value) public static SharedObjectPool sharedPool => s_Instance.Value; } - Dictionary<(Type, int), Stack> m_ArrayPool = new Dictionary<(Type, int), Stack>(); - List<(object, (Type, int))> m_AllocatedArrays = new List<(object, (Type, int))>(); - List m_AllocatedMaterialPropertyBlocks = new List(); + Dictionary<(Type, int), Stack> m_ArrayPool = new Dictionary<(Type, int), Stack>(); + List<(object, (Type, int))> m_AllocatedArrays = new List<(object, (Type, int))>(); + List m_AllocatedMaterialPropertyBlocks = new List(); internal RenderGraphObjectPool() {} diff --git a/Runtime/RenderGraph/RenderGraphPass.cs b/Runtime/RenderGraph/RenderGraphPass.cs index 5ad920a..a81653a 100644 --- a/Runtime/RenderGraph/RenderGraphPass.cs +++ b/Runtime/RenderGraph/RenderGraphPass.cs @@ -15,17 +15,17 @@ public RenderFunc GetExecuteDelegate() public abstract void Release(RenderGraphObjectPool pool); public abstract bool HasRenderFunc(); - public string name { get; protected set; } - public int index { get; protected set; } + public string name { get; protected set; } + public int index { get; protected set; } public ProfilingSampler customSampler { get; protected set; } - public bool enableAsyncCompute { get; protected set; } - public bool allowPassCulling { get; protected set; } - - public TextureHandle depthBuffer { get; protected set; } - public TextureHandle[] colorBuffers { get; protected set; } = new TextureHandle[RenderGraph.kMaxMRTCount]; - public int colorBufferMaxIndex { get; protected set; } = -1; - public int refCount { get; protected set; } - public bool generateDebugData { get; protected set; } + public bool enableAsyncCompute { get; protected set; } + public bool allowPassCulling { get; protected set; } + + public TextureHandle depthBuffer { get; protected set; } + public TextureHandle[] colorBuffers { get; protected set; } = new TextureHandle[RenderGraph.kMaxMRTCount]; + public int colorBufferMaxIndex { get; protected set; } = -1; + public int refCount { get; protected set; } + public bool generateDebugData { get; protected set; } public List[] resourceReadLists = new List[(int)RenderGraphResourceType.Count]; public List[] resourceWriteLists = new List[(int)RenderGraphResourceType.Count]; diff --git a/Runtime/RenderGraph/RenderGraphResourcePool.cs b/Runtime/RenderGraph/RenderGraphResourcePool.cs index cf34b33..3d8fbe9 100644 --- a/Runtime/RenderGraph/RenderGraphResourcePool.cs +++ b/Runtime/RenderGraph/RenderGraphResourcePool.cs @@ -14,7 +14,7 @@ abstract class IRenderGraphResourcePool abstract class RenderGraphResourcePool : IRenderGraphResourcePool where Type : class { // Dictionary tracks resources by hash and stores resources with same hash in a List (list instead of a stack because we need to be able to remove stale allocations, potentially in the middle of the stack). - protected Dictionary> m_ResourcePool = new Dictionary>(); + protected Dictionary> m_ResourcePool = new Dictionary>(); // This list allows us to determine if all resources were correctly released in the frame. // This is useful to warn in case of user error or avoid leaks when a render graph execution errors occurs for example. diff --git a/Runtime/RenderGraph/RenderGraphResourceRegistry.cs b/Runtime/RenderGraph/RenderGraphResourceRegistry.cs index 4da2554..7dcbf73 100644 --- a/Runtime/RenderGraph/RenderGraphResourceRegistry.cs +++ b/Runtime/RenderGraph/RenderGraphResourceRegistry.cs @@ -33,11 +33,11 @@ internal static RenderGraphResourceRegistry current class RenderGraphResourcesData { - public DynamicArray resourceArray = new DynamicArray(); - public int sharedResourcesCount; - public IRenderGraphResourcePool pool; - public ResourceCallback createResourceCallback; - public ResourceCallback releaseResourceCallback; + public DynamicArray resourceArray = new DynamicArray(); + public int sharedResourcesCount; + public IRenderGraphResourcePool pool; + public ResourceCallback createResourceCallback; + public ResourceCallback releaseResourceCallback; public void Clear(bool onException, int frameIndex) { @@ -80,14 +80,14 @@ public int AddNewRenderGraphResource(out ResType outRes, bool pooledRes } } - RenderGraphResourcesData[] m_RenderGraphResources = new RenderGraphResourcesData[(int)RenderGraphResourceType.Count]; - DynamicArray m_RendererListResources = new DynamicArray(); - RenderGraphDebugParams m_RenderGraphDebug; - RenderGraphLogger m_Logger; - int m_CurrentFrameIndex; - int m_ExecutionCount; + RenderGraphResourcesData[] m_RenderGraphResources = new RenderGraphResourcesData[(int)RenderGraphResourceType.Count]; + DynamicArray m_RendererListResources = new DynamicArray(); + RenderGraphDebugParams m_RenderGraphDebug; + RenderGraphLogger m_Logger; + int m_CurrentFrameIndex; + int m_ExecutionCount; - RTHandle m_CurrentBackbuffer; + RTHandle m_CurrentBackbuffer; #region Internal Interface internal RTHandle GetTexture(in TextureHandle handle) diff --git a/Runtime/RendererList/RendererList.cs b/Runtime/RendererList/RendererList.cs index 9b45bdf..9cff642 100644 --- a/Runtime/RendererList/RendererList.cs +++ b/Runtime/RendererList/RendererList.cs @@ -20,23 +20,23 @@ public struct RendererList /// /// True if the renderer list is valid. /// - public bool isValid { get; private set; } + public bool isValid { get; private set; } /// /// CullingResults associated with the renderer list. /// - public CullingResults cullingResult; + public CullingResults cullingResult; /// /// DrawingSettings associated with the renderer list. /// - public DrawingSettings drawSettings; + public DrawingSettings drawSettings; /// /// FilteringSettings associated with the renderer list. /// - public FilteringSettings filteringSettings; + public FilteringSettings filteringSettings; /// /// Optional RenderStateBlock associated with the renderer list. /// - public RenderStateBlock? stateBlock; + public RenderStateBlock? stateBlock; /// /// Creates a new renderer list. diff --git a/Runtime/Textures/RTHandle.cs b/Runtime/Textures/RTHandle.cs index d9b3ea7..2bdd99a 100644 --- a/Runtime/Textures/RTHandle.cs +++ b/Runtime/Textures/RTHandle.cs @@ -10,14 +10,14 @@ namespace UnityEngine.Rendering /// public class RTHandle { - internal RTHandleSystem m_Owner; - internal RenderTexture m_RT; - internal Texture m_ExternalTexture; - internal RenderTargetIdentifier m_NameID; - internal bool m_EnableMSAA = false; - internal bool m_EnableRandomWrite = false; - internal bool m_EnableHWDynamicScale = false; - internal string m_Name; + internal RTHandleSystem m_Owner; + internal RenderTexture m_RT; + internal Texture m_ExternalTexture; + internal RenderTargetIdentifier m_NameID; + internal bool m_EnableMSAA = false; + internal bool m_EnableRandomWrite = false; + internal bool m_EnableHWDynamicScale = false; + internal string m_Name; /// /// Scale factor applied to the RTHandle reference size. @@ -28,15 +28,15 @@ public class RTHandle /// /// Returns true if the RTHandle uses automatic scaling. /// - public bool useScaling { get; internal set; } + public bool useScaling { get; internal set; } /// /// Reference size of the RTHandle System associated with the RTHandle /// - public Vector2Int referenceSize {get; internal set; } + public Vector2Int referenceSize { get; internal set; } /// /// Current properties of the RTHandle System /// - public RTHandleProperties rtHandleProperties { get { return m_Owner.rtHandleProperties; } } + public RTHandleProperties rtHandleProperties { get { return m_Owner.rtHandleProperties; } } /// /// RenderTexture associated with the RTHandle /// @@ -103,7 +103,7 @@ internal RTHandle(RTHandleSystem owner) internal void SetRenderTexture(RenderTexture rt) { - m_RT = rt; + m_RT = rt; m_ExternalTexture = null; m_NameID = new RenderTargetIdentifier(rt); } diff --git a/Runtime/Textures/RTHandleSystem.cs b/Runtime/Textures/RTHandleSystem.cs index 48ff4f9..2de8ced 100644 --- a/Runtime/Textures/RTHandleSystem.cs +++ b/Runtime/Textures/RTHandleSystem.cs @@ -52,13 +52,13 @@ internal enum ResizeMode } // Parameters for auto-scaled Render Textures - bool m_HardwareDynamicResRequested = false; - bool m_ScaledRTSupportsMSAA = false; - MSAASamples m_ScaledRTCurrentMSAASamples = MSAASamples.None; - HashSet m_AutoSizedRTs; - RTHandle[] m_AutoSizedRTsArray; // For fast iteration - HashSet m_ResizeOnDemandRTs; - RTHandleProperties m_RTHandleProperties; + bool m_HardwareDynamicResRequested = false; + bool m_ScaledRTSupportsMSAA = false; + MSAASamples m_ScaledRTCurrentMSAASamples = MSAASamples.None; + HashSet m_AutoSizedRTs; + RTHandle[] m_AutoSizedRTsArray; // For fast iteration + HashSet m_ResizeOnDemandRTs; + RTHandleProperties m_RTHandleProperties; /// /// Current properties of the RTHandle System. diff --git a/Runtime/Textures/TextureXR.cs b/Runtime/Textures/TextureXR.cs index eb84a24..ae1028a 100644 --- a/Runtime/Textures/TextureXR.cs +++ b/Runtime/Textures/TextureXR.cs @@ -62,42 +62,42 @@ public static TextureDimension dimension } // Need to keep both the Texture and the RTHandle in order to be able to track lifetime properly. - static Texture m_BlackUIntTexture2DArray; - static Texture m_BlackUIntTexture; - static RTHandle m_BlackUIntTexture2DArrayRTH; - static RTHandle m_BlackUIntTextureRTH; + static Texture m_BlackUIntTexture2DArray; + static Texture m_BlackUIntTexture; + static RTHandle m_BlackUIntTexture2DArrayRTH; + static RTHandle m_BlackUIntTextureRTH; /// /// Default black unsigned integer texture. /// /// The default black unsigned integer texture. - public static RTHandle GetBlackUIntTexture() { return useTexArray ? m_BlackUIntTexture2DArrayRTH : m_BlackUIntTextureRTH; } + public static RTHandle GetBlackUIntTexture() { return useTexArray ? m_BlackUIntTexture2DArrayRTH : m_BlackUIntTextureRTH; } - static Texture2DArray m_ClearTexture2DArray; - static Texture2D m_ClearTexture; - static RTHandle m_ClearTexture2DArrayRTH; - static RTHandle m_ClearTextureRTH; + static Texture2DArray m_ClearTexture2DArray; + static Texture2D m_ClearTexture; + static RTHandle m_ClearTexture2DArrayRTH; + static RTHandle m_ClearTextureRTH; /// /// Default clear color (0, 0, 0, 1) texture. /// /// The default clear color texture. public static RTHandle GetClearTexture() { return useTexArray ? m_ClearTexture2DArrayRTH : m_ClearTextureRTH; } - static Texture2DArray m_MagentaTexture2DArray; - static Texture2D m_MagentaTexture; - static RTHandle m_MagentaTexture2DArrayRTH; - static RTHandle m_MagentaTextureRTH; + static Texture2DArray m_MagentaTexture2DArray; + static Texture2D m_MagentaTexture; + static RTHandle m_MagentaTexture2DArrayRTH; + static RTHandle m_MagentaTextureRTH; /// /// Default magenta texture. /// /// The default magenta texture. public static RTHandle GetMagentaTexture() { return useTexArray ? m_MagentaTexture2DArrayRTH : m_MagentaTextureRTH; } - static Texture2D m_BlackTexture; - static Texture3D m_BlackTexture3D; - static Texture2DArray m_BlackTexture2DArray; - static RTHandle m_BlackTexture2DArrayRTH; - static RTHandle m_BlackTextureRTH; - static RTHandle m_BlackTexture3DRTH; + static Texture2D m_BlackTexture; + static Texture3D m_BlackTexture3D; + static Texture2DArray m_BlackTexture2DArray; + static RTHandle m_BlackTexture2DArrayRTH; + static RTHandle m_BlackTextureRTH; + static RTHandle m_BlackTexture3DRTH; /// /// Default black texture. /// @@ -114,9 +114,9 @@ public static TextureDimension dimension /// The default black texture 3D. public static RTHandle GetBlackTexture3D() { return m_BlackTexture3DRTH; } - static Texture2DArray m_WhiteTexture2DArray; - static RTHandle m_WhiteTexture2DArrayRTH; - static RTHandle m_WhiteTextureRTH; + static Texture2DArray m_WhiteTexture2DArray; + static RTHandle m_WhiteTexture2DArrayRTH; + static RTHandle m_WhiteTextureRTH; /// /// Default white texture. /// diff --git a/Runtime/Utilities/ColorUtils.cs b/Runtime/Utilities/ColorUtils.cs index 0512031..93cb78a 100644 --- a/Runtime/Utilities/ColorUtils.cs +++ b/Runtime/Utilities/ColorUtils.cs @@ -51,9 +51,9 @@ public static Vector3 CIExyToLMS(float x, float y) float X = Y * x / y; float Z = Y * (1f - x - y) / y; - float L = 0.7328f * X + 0.4296f * Y - 0.1624f * Z; + float L = 0.7328f * X + 0.4296f * Y - 0.1624f * Z; float M = -0.7036f * X + 1.6975f * Y + 0.0061f * Z; - float S = 0.0030f * X + 0.0136f * Y + 0.9834f * Z; + float S = 0.0030f * X + 0.0136f * Y + 0.9834f * Z; return new Vector3(L, M, S); } @@ -298,6 +298,6 @@ public static float ComputeEV100FromAvgLuminance(float avgLuminance) /// /// A 32-bit hexadecimal value. /// A color value. - public static Color ToRGBA(uint hex) => new Color(((hex >> 16) & 0xff) / 255f, ((hex >> 8) & 0xff) / 255f, (hex & 0xff) / 255f, ((hex >> 24) & 0xff) / 255f); + public static Color ToRGBA(uint hex) => new Color(((hex >> 16) & 0xff) / 255f, ((hex >> 8) & 0xff) / 255f, (hex & 0xff) / 255f, ((hex >> 24) & 0xff) / 255f); } } diff --git a/Runtime/Utilities/CoreUtils.cs b/Runtime/Utilities/CoreUtils.cs index 1eccbba..3bc2d85 100644 --- a/Runtime/Utilities/CoreUtils.cs +++ b/Runtime/Utilities/CoreUtils.cs @@ -1038,7 +1038,7 @@ public static bool ArePostProcessesEnabled(Camera camera) { bool enabled = true; - #if UNITY_EDITOR +#if UNITY_EDITOR if (camera.cameraType == CameraType.SceneView) { enabled = false; @@ -1058,7 +1058,7 @@ public static bool ArePostProcessesEnabled(Camera camera) } } } - #endif +#endif return enabled; } @@ -1072,7 +1072,7 @@ public static bool AreAnimatedMaterialsEnabled(Camera camera) { bool animateMaterials = true; - #if UNITY_EDITOR +#if UNITY_EDITOR animateMaterials = Application.isPlaying; // For Game and VR views; Reflection views pass the parent camera if (camera.cameraType == CameraType.SceneView) @@ -1083,11 +1083,11 @@ public static bool AreAnimatedMaterialsEnabled(Camera camera) for (int i = 0; i < UnityEditor.SceneView.sceneViews.Count; i++) // Using a foreach on an ArrayList generates garbage ... { var sv = UnityEditor.SceneView.sceneViews[i] as UnityEditor.SceneView; - #if UNITY_2020_2_OR_NEWER +#if UNITY_2020_2_OR_NEWER if (sv.camera == camera && sv.sceneViewState.alwaysRefreshEnabled) - #else +#else if (sv.camera == camera && sv.sceneViewState.materialUpdateEnabled) - #endif +#endif { animateMaterials = true; break; @@ -1117,7 +1117,7 @@ public static bool AreAnimatedMaterialsEnabled(Camera camera) // which simply amounts to a recursive call, and then the story repeats itself. // // TLDR: we need to know the caller and its status/properties to make decisions. - #endif +#endif return animateMaterials; } diff --git a/Tests/Editor/BitArrayTests.cs b/Tests/Editor/BitArrayTests.cs index 12785a2..d6d0cda 100644 --- a/Tests/Editor/BitArrayTests.cs +++ b/Tests/Editor/BitArrayTests.cs @@ -17,13 +17,13 @@ class BitArrayTests static readonly uint[] aIndexes = new uint[] { 300, 200, 198, 100, 98, 60, 58, 30, 28, 10, 8, 4, 2, 0, 0 }; //double 0 entry to test double entry static readonly uint[] bIndexes = new uint[] { 300, 200, 199, 100, 99, 60, 59, 30, 29, 10, 9, 8, 5, 1, 0 }; static readonly uint[] getSetTestedIndexes = new uint[] { 201, 200, 101, 100, 61, 60, 31, 30, 11, 10, 1, 0 }; // on a, odd value are false, even true - const string aHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.01000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00010100.00000000.00000000.00000000.00000000.00010100.00000000.00000000.00000000.01010000.00000000.00000101.00010101"; - const string bHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.10000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00011000.00000000.00000000.00000000.00000000.00011000.00000000.00000000.00000000.01100000.00000000.00000111.00100011"; - const string aAndBHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00010000.00000000.00000000.00000000.00000000.00010000.00000000.00000000.00000000.01000000.00000000.00000101.00000001"; - const string aOrBHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.11000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00011100.00000000.00000000.00000000.00000000.00011100.00000000.00000000.00000000.01110000.00000000.00000111.00110111"; - const string notAHumanized = "11111111.11111111.11111111.11111111.11111111.11111111.11111110.10111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11101011.11111111.11111111.11111111.11111111.11101011.11111111.11111111.11111111.10101111.11111111.11111010.11101010"; - const string zeroHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000"; - const string maxHumanized = "11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111"; + const string aHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.01000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00010100.00000000.00000000.00000000.00000000.00010100.00000000.00000000.00000000.01010000.00000000.00000101.00010101"; + const string bHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.10000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00011000.00000000.00000000.00000000.00000000.00011000.00000000.00000000.00000000.01100000.00000000.00000111.00100011"; + const string aAndBHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00010000.00000000.00000000.00000000.00000000.00010000.00000000.00000000.00000000.01000000.00000000.00000101.00000001"; + const string aOrBHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000001.11000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00011100.00000000.00000000.00000000.00000000.00011100.00000000.00000000.00000000.01110000.00000000.00000111.00110111"; + const string notAHumanized = "11111111.11111111.11111111.11111111.11111111.11111111.11111110.10111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11101011.11111111.11111111.11111111.11111111.11101011.11111111.11111111.11111111.10101111.11111111.11111010.11101010"; + const string zeroHumanized = "00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000"; + const string maxHumanized = "11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111"; [SetUp] public void SetUpBitArray() diff --git a/package.json b/package.json index 3e67737..9f5e758 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "SRP Core makes it easier to create or customize a Scriptable Render Pipeline (SRP). SRP Core contains reusable code, including boilerplate code for working with platform-specific graphics APIs, utility functions for common rendering operations, and shader libraries. The code in SRP Core is use by the High Definition Render Pipeline (HDRP) and Universal Render Pipeline (URP). If you are creating a custom SRP from scratch or customizing a prebuilt SRP, using SRP Core will save you time.", "version": "11.0.0", "unity": "2021.1", - "unityRelease": "0b10", + "unityRelease": "9f1", "displayName": "Core RP Library", "dependencies": { "com.unity.ugui": "1.0.0",