public static Entity ConvertGameObjectHierarchy(GameObject root, GameObjectConversionSettings settings) { using (s_ConvertScene.Auto()) { Entity convertedEntity; using (var conversionWorld = CreateConversionWorld(settings)) using (var conversion = new Conversion(conversionWorld)) { using (s_CreateEntitiesForGameObjects.Auto()) conversion.MappingSystem.AddGameObjectOrPrefab(root); Convert(conversionWorld); convertedEntity = conversion.MappingSystem.GetPrimaryEntity(root); settings.ConversionWorldPreDispose?.Invoke(conversionWorld); s_DestroyConversionWorld.Begin(); } s_DestroyConversionWorld.End(); return(convertedEntity); } }
public void PullFullData() { // Once the data has been pulled, it will have to be cleared when the profiler is ProfilerDriver.profileCleared += ClearData; int firstFrameIndex = ProfilerDriver.firstFrameIndex; int lastFrameIndex = ProfilerDriver.lastFrameIndex; s_PullData.Begin(); PullDataStatic(ref m_CaptureData, m_Markers, ref m_MarkerToIDMap, firstFrameIndex, lastFrameIndex); s_PullData.End(); DataPulled = true; }
public void Simulate() { if (doPhysics) { PhysXLib.StepPhysics(scene, Time.fixedDeltaTime, scratchMem, scratchKilobytes * 1024); foreach (PhysXBody body in bodies.Values) { body.UpdatePositionAndVelocity(); } collisionCallbackMarker.Begin(); foreach (PhysXCollision collision in PhysXSceneManager.ongoingCollisions) { collision.PopulateWithUnityObjects(bodies); PhysXBody body = null; if (bodies.TryGetValue(collision.self.ToInt64(), out body)) { try { body.FireCollisionEvents(collision); } catch (Exception e) { Debug.LogError("Exception: " + e.Message + "\n" + e.StackTrace); } } PhysXCollision.ReleaseCollision(collision); } PhysXSceneManager.ongoingCollisions.Clear(); foreach (PhysXTrigger trigger in PhysXSceneManager.ongoingTriggers) { trigger.PopulateWithUnityObjects(bodies); PhysXBody body = null; if (bodies.TryGetValue(trigger.self.ToInt64(), out body)) { try { body.FireTriggerEvents(trigger); } catch (Exception e) { Debug.LogError("Exception: " + e.Message + "\n" + e.StackTrace); } } PhysXTrigger.ReleaseTrigger(trigger); } PhysXSceneManager.ongoingTriggers.Clear(); collisionCallbackMarker.End(); PhysXLib.StepGhostPhysics(scene, Time.fixedDeltaTime, scratchMem, scratchKilobytes * 1024); } }
private void RetracePath(Node currNode) { _pathRetractingPerfMarker.Begin(); Node current = currNode; while (current != null) { _path.Add(current.marker); current = current.parentNode; } _path.Reverse(); _pathRetractingPerfMarker.End(); }
internal static World CreateConversionWorld(World dstEntityWorld, Hash128 sceneGUID, ConversionFlags conversionFlags) { m_CreateConversionWorld.Begin(); var gameObjectWorld = new World("GameObject World"); gameObjectWorld.CreateSystem <GameObjectConversionMappingSystem>(dstEntityWorld, sceneGUID, conversionFlags); AddConversionSystems(gameObjectWorld); m_CreateConversionWorld.End(); return(gameObjectWorld); }
internal static void HandleDestroyObject(ulong clientId, Stream stream) { #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleDestroyObject.Begin(); #endif using (var reader = PooledNetworkReader.Get(stream)) { ulong networkId = reader.ReadUInt64Packed(); NetworkSpawnManager.OnDestroyObject(networkId, true); } #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleDestroyObject.End(); #endif }
static void Internal_CallUpdateFunctions() { if (update != null) { var invocationList = update.GetInvocationList(); foreach (var cb in invocationList) { var marker = new ProfilerMarker(cb.Method.Name); marker.Begin(); cb.DynamicInvoke(); marker.End(); } } }
public static void BurstedProfilerMethods(ref ProfilerMarker marker) { EnsureBurstedOrThrow(); // These API calls actually prove out a LOT of internal API burst-ability marker.Begin(); marker.End(); using (marker.Auto()) { } ProfilerProtocolThread.SendNewFrame(); }
internal static void HandleTimeSync(ulong clientId, Stream stream, float receiveTime) { #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleTimeSync.Begin(); #endif using (var reader = PooledNetworkReader.Get(stream)) { float netTime = reader.ReadSinglePacked(); NetworkManager.Singleton.UpdateNetworkTime(clientId, netTime, receiveTime); } #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleTimeSync.End(); #endif }
/// <summary> /// ProcessReceiveQueue /// Public facing interface method to start processing all RPCs in the current inbound frame /// </summary> public void ProcessReceiveQueue(NetworkUpdateStage currentStage) { bool advanceFrameHistory = false; var rpcQueueContainer = NetworkManager.Singleton.RpcQueueContainer; if (rpcQueueContainer != null) { #if DEVELOPMENT_BUILD || UNITY_EDITOR s_ProcessReceiveQueue.Begin(); #endif var currentFrame = rpcQueueContainer.GetQueueHistoryFrame(RpcQueueHistoryFrame.QueueFrameType.Inbound, currentStage); var nextFrame = rpcQueueContainer.GetQueueHistoryFrame(RpcQueueHistoryFrame.QueueFrameType.Inbound, currentStage, true); if (nextFrame.IsDirty && nextFrame.HasLoopbackData) { advanceFrameHistory = true; } if (currentFrame != null && currentFrame.IsDirty) { var currentQueueItem = currentFrame.GetFirstQueueItem(); while (currentQueueItem.QueueItemType != RpcQueueContainer.QueueItemType.None) { advanceFrameHistory = true; if (rpcQueueContainer.IsTesting()) { Debug.Log($"RPC invoked during the {currentStage} update stage."); } NetworkManager.InvokeRpc(currentQueueItem); ProfilerStatManager.RpcsQueueProc.Record(); PerformanceDataManager.Increment(ProfilerConstants.NumberOfRPCQueueProcessed); currentQueueItem = currentFrame.GetNextQueueItem(); } //We call this to dispose of the shared stream writer and stream currentFrame.CloseQueue(); } if (advanceFrameHistory) { rpcQueueContainer.AdvanceFrameHistory(RpcQueueHistoryFrame.QueueFrameType.Inbound); } #if DEVELOPMENT_BUILD || UNITY_EDITOR s_ProcessReceiveQueue.End(); #endif } }
public static void Create(EntityManager entityManager, out NativeHashMap <Entity, bool> itemsColliding) { PerfMarkerTotal.Begin(); var player = Object.FindObjectOfType <Player>(); var playfieldComponent = player.GetComponentInChildren <PlayfieldComponent>(); var itemApis = player.ColliderGenerators.ToArray(); // 1. generate colliders PerfMarkerGenerateColliders.Begin(); var colliderList = new List <ICollider>(); var(playfieldCollider, glassCollider) = player.PlayfieldApi.CreateColliders(); itemsColliding = new NativeHashMap <Entity, bool>(itemApis.Length, Allocator.Persistent); foreach (var itemApi in itemApis) { PerfMarkerCreateColliders.Begin(); if (itemApi.ColliderEntity != Entity.Null) { itemsColliding.Add(itemApi.ColliderEntity, itemApi.IsColliderEnabled); } itemApi.CreateColliders(colliderList, 0); PerfMarkerCreateColliders.End(); } PerfMarkerGenerateColliders.End(); // 2. allocate created colliders PerfMarkerCreateBlobAsset.Begin(); var allocateColliderJob = new ColliderAllocationJob(colliderList, playfieldCollider, glassCollider); allocateColliderJob.Run(); // retrieve result and dispose var colliderBlobAssetRef = allocateColliderJob.BlobAsset[0]; allocateColliderJob.Dispose(); PerfMarkerCreateBlobAsset.End(); // 3. Create quadtree blob (BlobAssetReference<QuadTreeBlob>) from AABBs PerfMarkerCreateQuadTree.Begin(); BlobAssetReference <QuadTreeBlob> quadTreeBlobAssetRef; using (var builder = new BlobBuilder(Allocator.Temp)) { ref var rootQuadTree = ref builder.ConstructRoot <QuadTreeBlob>(); QuadTree.Create(builder, ref colliderBlobAssetRef.Value.Colliders, ref rootQuadTree.QuadTree, playfieldComponent.BoundingBox.ToAabb()); quadTreeBlobAssetRef = builder.CreateBlobAssetReference <QuadTreeBlob>(Allocator.Persistent); }
public void HandleAllClientsSwitchSceneCompleted(ulong clientId, Stream stream) { #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleAllClientsSwitchSceneCompleted.Begin(); #endif using (var reader = PooledNetworkReader.Get(stream)) { var clientIds = reader.ReadULongArray(); var timedOutClientIds = reader.ReadULongArray(); NetworkManager.SceneManager.AllClientsReady(clientIds, timedOutClientIds); } #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleAllClientsSwitchSceneCompleted.End(); #endif }
public static void RepaintOverlayPanels() { UIElementsUtility.GetAllPanels(panelsIteration); foreach (var panel in panelsIteration) { // at the moment, all runtime panels who do not use a rendertexure are rendered as overlays. // later on, they'll be filtered based on render mode if (panel.contextType == ContextType.Player && (panel as RuntimePanel).targetTexture == null) { s_RepaintProfilerMarker.Begin(); panel.Repaint(Event.current); s_RepaintProfilerMarker.End(); } } }
private void RemoveConnection(GravNode gn1, GravNode gn2) { s_RemoveLinkCreateIP.Begin(); int indexResult = gn1.FindLinkIndex(gn2); if (indexResult == -1) { Debug.LogError("Link not found"); return; } s_RemoveLinkCreateIP.End(); connections[indexResult].BreakLink(m_GravMesh); availableConnectionIndex.Enqueue(indexResult); }
public static void UpdateOpacityId(VisualElement ve, RenderChain renderChain) { k_UpdateOpacityIdMarker.Begin(); if (ve.renderChainData.data != null) { DoUpdateOpacityId(ve, renderChain, ve.renderChainData.data); } if (ve.renderChainData.closingData != null) { DoUpdateOpacityId(ve, renderChain, ve.renderChainData.closingData); } k_UpdateOpacityIdMarker.End(); }
public IEnumerator EnvironmentCoroutine() { while (true) { if (Dirty) { yield return(EnvironmentThrottle.PerformanceThrottle()); Dirty = false; s_EnvironmentCoroutine_p.Begin(); PerformEnvironmentFlow(); s_EnvironmentCoroutine_p.End(); } yield return(new WaitForSeconds(EnvironmentInterval * OwningTile.TimeMultiplier)); } }
/// <summary> /// ProcessReceiveQueue /// Public facing interface method to start processing all RPCs in the current inbound frame /// </summary> public void ProcessReceiveQueue(NetworkUpdateStage currentStage, bool isTesting) { bool advanceFrameHistory = false; if (!ReferenceEquals(m_RpcQueueContainer, null)) { #if DEVELOPMENT_BUILD || UNITY_EDITOR s_ProcessReceiveQueue.Begin(); #endif var currentFrame = m_RpcQueueContainer.GetQueueHistoryFrame(RpcQueueHistoryFrame.QueueFrameType.Inbound, currentStage); var nextFrame = m_RpcQueueContainer.GetQueueHistoryFrame(RpcQueueHistoryFrame.QueueFrameType.Inbound, currentStage, true); if (nextFrame.IsDirty && nextFrame.HasLoopbackData) { advanceFrameHistory = true; } if (currentFrame != null && currentFrame.IsDirty) { var currentQueueItem = currentFrame.GetFirstQueueItem(); while (currentQueueItem.QueueItemType != RpcQueueContainer.QueueItemType.None) { advanceFrameHistory = true; if (!isTesting) { m_NetworkManager.InvokeRpc(currentQueueItem); } ProfilerStatManager.RpcsQueueProc.Record(); PerformanceDataManager.Increment(ProfilerConstants.RpcQueueProcessed); currentQueueItem = currentFrame.GetNextQueueItem(); } //We call this to dispose of the shared stream writer and stream currentFrame.CloseQueue(); } if (advanceFrameHistory) { m_RpcQueueContainer.AdvanceFrameHistory(RpcQueueHistoryFrame.QueueFrameType.Inbound); } #if DEVELOPMENT_BUILD || UNITY_EDITOR s_ProcessReceiveQueue.End(); #endif } }
static int WriteEntityScene(EntityManager scene, Entities.Hash128 sceneGUID, string subsection, NativeArray <EntityRemapUtility.EntityRemapInfo> entityRemapInfos = default(NativeArray <EntityRemapUtility.EntityRemapInfo>)) { k_ProfileEntitiesSceneSave.Begin(); var entitiesBinaryPath = EntityScenesPaths.GetPathAndCreateDirectory(sceneGUID, EntityScenesPaths.PathType.EntitiesBinary, subsection); var sharedDataPath = EntityScenesPaths.GetPathAndCreateDirectory(sceneGUID, EntityScenesPaths.PathType.EntitiesSharedComponents, subsection); GameObject sharedComponents; // Write binary entity file int entitySceneFileSize = 0; using (var writer = new StreamBinaryWriter(entitiesBinaryPath)) { if (entityRemapInfos.IsCreated) { SerializeUtilityHybrid.Serialize(scene, writer, out sharedComponents, entityRemapInfos); } else { SerializeUtilityHybrid.Serialize(scene, writer, out sharedComponents); } entitySceneFileSize = (int)writer.Length; } // Write shared component data prefab k_ProfileEntitiesSceneCreatePrefab.Begin(); //var oldPrefab = AssetDatabase.LoadMainAssetAtPath(sharedDataPath); //if (oldPrefab == null) // PrefabUtility.CreatePrefab(sharedDataPath, sharedComponents, ReplacePrefabOptions.ReplaceNameBased); if (sharedComponents != null) { PrefabUtility.SaveAsPrefabAsset(sharedComponents, sharedDataPath); } //else // PrefabUtility.Save //PrefabUtility.ReplacePrefab(sharedComponents, oldPrefab, ReplacePrefabOptions.ReplaceNameBased); Object.DestroyImmediate(sharedComponents); k_ProfileEntitiesSceneCreatePrefab.End(); k_ProfileEntitiesSceneSave.End(); return(entitySceneFileSize); }
internal static void HandleNamedMessage(ulong clientId, Stream stream) { PerformanceDataManager.Increment(ProfilerConstants.NumberOfNamedMessages); ProfilerStatManager.NamedMessage.Record(); #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleNamedMessage.Begin(); #endif using (var reader = PooledNetworkReader.Get(stream)) { ulong hash = reader.ReadUInt64Packed(); CustomMessagingManager.InvokeNamedMessage(hash, clientId, stream); } #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleNamedMessage.End(); #endif }
public override void OnVisualize(Visualizer visualizer) { VisualizeMarker.Begin(); if (updated) { PointCloudBuffer.SetData(Points); } var lidarToWorld = Compensated ? Matrix4x4.identity : transform.localToWorldMatrix; PointCloudMaterial.SetMatrix("_LocalToWorld", lidarToWorld); PointCloudMaterial.SetFloat("_Size", PointSize * Utility.GetDpiScale()); PointCloudMaterial.SetColor("_Color", PointColor); Graphics.DrawProcedural(PointCloudMaterial, new Bounds(transform.position, MaxDistance * Vector3.one), MeshTopology.Points, PointCloudBuffer.count, layer: LayerMask.NameToLayer("Sensor")); VisualizeMarker.End(); }
public virtual void ClearBehaviour() { s_ClearBehavior_p.Begin(); if (LastBehaviourOrigin == null || LastBehaviourOrigin != mAgent.CurrentTile) { if (RegisteredTiles != null) { for (int t = 0; t < RegisteredTiles.Length; t++) { RegisteredTiles[t] = null; } } LastBehaviourOrigin = mAgent.CurrentTile; } BehaviourEvaluation = 0; s_ClearBehavior_p.End(); }
public void Execute(IActionProvider provider, IContext context) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } m_marker.Begin(); OnExecute(provider, context); m_marker.End(); }
private void ProcessTextRegen(bool timeSliced) { if ((timeSliced && m_DirtyTextRemaining == 0) || m_TextElementCount == 0) { return; } s_MarkerTextRegen.Begin(); if (m_TextUpdatePainter == null) { m_TextUpdatePainter = new Implementation.UIRTextUpdatePainter(); } var dirty = m_FirstTextElement; m_DirtyTextStartIndex = timeSliced ? m_DirtyTextStartIndex % m_TextElementCount : 0; for (int i = 0; i < m_DirtyTextStartIndex; i++) { dirty = dirty.renderChainData.nextText; } if (dirty == null) { dirty = m_FirstTextElement; } int maxCount = timeSliced ? Math.Min(50, m_DirtyTextRemaining) : m_TextElementCount; for (int i = 0; i < maxCount; i++) { Implementation.RenderEvents.ProcessRegenText(this, dirty, m_TextUpdatePainter, device, ref m_Stats); dirty = dirty.renderChainData.nextText; m_DirtyTextStartIndex++; if (dirty == null) { dirty = m_FirstTextElement; m_DirtyTextStartIndex = 0; } } m_DirtyTextRemaining = Math.Max(0, m_DirtyTextRemaining - maxCount); if (m_DirtyTextRemaining > 0) { (panel as BaseVisualElementPanel)?.OnVersionChanged(m_FirstTextElement, VersionChangeType.Transform); // Force a window refresh } s_MarkerTextRegen.End(); }
protected override void OnUpdate() { // create kdtree PerfMarker1.Begin(); var ballEntities = _ballQuery.ToEntityArray(Allocator.TempJob); var balls = GetComponentDataFromEntity <BallData>(true); var kdRoot = new KdRoot(); Job.WithCode(() => { var ballBounds = new NativeArray <Aabb>(ballEntities.Length, Allocator.Temp); for (var i = 0; i < ballEntities.Length; i++) { ballBounds[i] = balls[ballEntities[i]].GetAabb(ballEntities[i]); } kdRoot.Init(ballBounds, Allocator.TempJob); }).Run(); ballEntities.Dispose(); PerfMarker1.End(); var overlappingEntities = GetBufferFromEntity <OverlappingDynamicBufferElement>(); var marker = PerfMarker2; Entities .WithName("StaticBroadPhaseJob") .WithNativeDisableParallelForRestriction(overlappingEntities) .ForEach((Entity entity, in BallData ball) => { // don't play with frozen balls if (ball.IsFrozen) { return; } marker.Begin(); var colliderEntities = overlappingEntities[entity]; colliderEntities.Clear(); kdRoot.GetAabbOverlaps(in entity, in ball, ref colliderEntities); marker.End(); }).Run(); kdRoot.Dispose(); }
public unsafe void TestUnityEngineProfiler() { ProfilerProtocolThread.Stream.buffer->m_BufferList->RecycleStreamAndFreeExtra(); // for compatibility UnityEngine.Profiling.Profiler.BeginSample("SomeMethod.Test"); UnityEngine.Profiling.Profiler.EndSample(); var profileMemA = ProfilerProtocolThread.Stream.buffer->m_BufferList->ToByteArray(0, ProfilerProtocolThread.Stream.buffer->m_BufferList->TotalBytes); ProfilerProtocolThread.Stream.buffer->m_BufferList->RecycleStreamAndFreeExtra(); ProfilerMarker marker = new ProfilerMarker("SomeMethod.Test"); marker.Begin(); marker.End(); var profileMemB = ProfilerProtocolThread.Stream.buffer->m_BufferList->ToByteArray(0, ProfilerProtocolThread.Stream.buffer->m_BufferList->TotalBytes); ProfilerProtocolThread.Stream.buffer->m_BufferList->RecycleStreamAndFreeExtra(); const int k_BlockIndexCurr_1 = 28; const int k_Time_1 = 56; const int k_BlockIndexNext_1 = 64; const int k_BlockIndexCurr_2 = 100; const int k_Time_2 = 128; const int k_BlockIndexNext_2 = 136; Assert.NotZero(profileMemA.Length); Assert.NotZero(profileMemB.Length); Assert.AreEqual(profileMemA.Length, profileMemB.Length); for (int i = 0; i < profileMemA.Length; i++) { if (i != k_BlockIndexCurr_1 && i != k_BlockIndexNext_1 && i != k_BlockIndexCurr_2 && i != k_BlockIndexNext_2 && !(i >= k_Time_1 && i < k_Time_1 + 8) && !(i >= k_Time_2 && i < k_Time_2 + 8)) { Assert.AreEqual(profileMemA[i], profileMemB[i]); } } Assert.True(profileMemA[k_BlockIndexNext_1] == profileMemA[k_BlockIndexCurr_1] + 1); Assert.True(profileMemA[k_BlockIndexCurr_2] == profileMemA[k_BlockIndexNext_1]); Assert.True(profileMemA[k_BlockIndexNext_2] == profileMemA[k_BlockIndexCurr_2] + 1); Assert.True(profileMemB[k_BlockIndexCurr_1] == profileMemA[k_BlockIndexCurr_1] + 2); Assert.True(profileMemB[k_BlockIndexNext_1] == profileMemA[k_BlockIndexNext_1] + 2); Assert.True(profileMemB[k_BlockIndexCurr_2] == profileMemA[k_BlockIndexCurr_2] + 2); Assert.True(profileMemB[k_BlockIndexNext_2] == profileMemA[k_BlockIndexNext_2] + 2); }
//Contact is for saying what KIND of check - only when trying to do something that REQUIRES a contact // A contact is done for checks that require sharing a tile with another entity // "Roughly things that are roughly in-reach" public override float TileEvaluateCheck(UrbTile Target, bool Contact = false) { if (Target?.Occupants == null) { return(0); } s_UrbMergeTileEvalCheck_p.Begin(this); //Evaluation tells us to what degree the current behavior of the entity cares //about the Target tile. float Evaluation = 0; for (int c = 0; c < Target.Occupants.Count; c++) { if (MergeProduct.TemplatesMatch(Target.Occupants[c])) { logger.Log("Attempting to merge into target", this); MergeIntoTarget(Target.Occupants[c]); break; } UrbMerge[] MergeComponents = Target.Occupants[c].GetComponents <UrbMerge>(); for (int i = 0; i < MergeComponents.Length; i++) { var mergeComp = MergeComponents[i]; if (mergeComp.WasDestroyed) { logger.Log("A potential mergeComponent was destroyed", this); continue; } if (mergeComp == this || !MergeProduct.TemplatesMatch(mergeComp.MergeProduct)) { continue; } if (mAgent.Mass >= Target.Occupants[c].Mass) { Evaluation += Target.Occupants[c].Mass; } } } s_UrbMergeTileEvalCheck_p.End(); return(Evaluation); }
public void Render() { s_MarkerRender.Begin(); if (BeforeDrawChain != null) { BeforeDrawChain(this); } Exception immediateException = null; if (m_FirstCommand != null) { if (!m_DrawInCameras) { var viewport = panel.visualTree.layout; Material standardMaterial = GetStandardMaterial(); standardMaterial?.SetPass(0); var projection = ProjectionUtils.Ortho(viewport.xMin, viewport.xMax, viewport.yMax, viewport.yMin, -0.001f, 1.001f); GL.LoadProjectionMatrix(projection); GL.modelview = Matrix4x4.identity; //TODO: Reactivate this guard check once InspectorWindow is fixed to stop adding VEs during OnGUI //m_BlockDirtyRegistration = true; device.EvaluateChain(m_FirstCommand, standardMaterial, standardMaterial, atlasManager?.atlas, vectorImageManager?.atlas, shaderInfoAllocator.atlas, (panel as BaseVisualElementPanel).scaledPixelsPerPoint, shaderInfoAllocator.transformConstants, shaderInfoAllocator.clipRectConstants, m_RenderNodesData[0].matPropBlock, true, ref immediateException); //m_BlockDirtyRegistration = false; } } s_MarkerRender.End(); if (immediateException != null) { throw immediateException; } if (drawStats) { DrawStats(); } }
internal static void HandleDestroyObjects(ulong clientId, Stream stream) { #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleDestroyObjects.Begin(); #endif using (var reader = PooledNetworkReader.Get(stream)) { ushort objectCount = reader.ReadUInt16Packed(); for (int i = 0; i < objectCount; i++) { HandleDestroyObject(clientId, stream); } } #if DEVELOPMENT_BUILD || UNITY_EDITOR s_HandleDestroyObjects.End(); #endif }
public void RenderDrawLists(CommandBuffer cmd, ImDrawDataPtr drawData) { Vector2 fbSize = drawData.DisplaySize * drawData.FramebufferScale; if (fbSize.x <= 0f || fbSize.y <= 0f || drawData.TotalVtxCount == 0) { return; // avoid rendering when minimized } s_updateBuffersPerfMarker.Begin(); UpdateBuffers(drawData); s_updateBuffersPerfMarker.End(); cmd.BeginSample("DearImGui.ExecuteDrawCommands"); s_createDrawComandsPerfMarker.Begin(); CreateDrawCommands(cmd, drawData, fbSize); s_createDrawComandsPerfMarker.End(); cmd.EndSample("DearImGui.ExecuteDrawCommands"); }
public override void ValidateLayout() { // Reentrancy proofing: ValidateLayout() could be in the code path of updaters. // Actual case: TransformClip update phase recomputes elements under mouse, which does a pick, which validates layout. // Updaters use version numbers for early exit, but it may happen that an updater invalidates a subsequent updater. if (!m_ValidatingLayout) { m_ValidatingLayout = true; m_MarkerLayout.Begin(); m_VisualTreeUpdater.UpdateVisualTreePhase(VisualTreeUpdatePhase.Styles); m_VisualTreeUpdater.UpdateVisualTreePhase(VisualTreeUpdatePhase.Layout); m_VisualTreeUpdater.UpdateVisualTreePhase(VisualTreeUpdatePhase.TransformClip); m_MarkerLayout.End(); m_ValidatingLayout = false; } }