protected override JobHandle OnUpdate(JobHandle inputDeps) { var job = new SelectionJob { commandBuffer = m_EntityCommandBufferSystem.CreateCommandBuffer().ToConcurrent(), }.Schedule(this, inputDeps); m_EntityCommandBufferSystem.AddJobHandleForProducer(job); return(job); }
public IEnumerator TestPerformanceOnLargeGraphBudget10() { var planGraph = PlanGraphUtility.BuildLattice(midLatticeDepth: 10); var nodeCount = planGraph.Size; var depthMap = new NativeHashMap <int, int>(nodeCount, Allocator.TempJob); var queue = new NativeQueue <StateHorizonPair <int> >(Allocator.TempJob); planGraph.GetExpandedDepthMap(0, depthMap, queue); var selectedUnexpandedStates = new NativeList <int>(1, Allocator.Persistent); var allExpandedStates = new NativeMultiHashMap <int, int>(1, Allocator.Persistent); yield return(null); // Set up performance test Measure.Method(() => { var selectJob = new SelectionJob <int, int>() { StateExpansionBudget = 10, RootStateKey = 0, StateDepthLookup = depthMap, StateInfoLookup = planGraph.StateInfoLookup, ActionLookup = planGraph.ActionLookup, ActionInfoLookup = planGraph.ActionInfoLookup, ResultingStateLookup = planGraph.ResultingStateLookup, StateTransitionInfoLookup = planGraph.StateTransitionInfoLookup, SelectedUnexpandedStates = selectedUnexpandedStates, AllSelectedStates = allExpandedStates }; selectJob.Schedule().Complete(); }).WarmupCount(1).MeasurementCount(1).IterationsPerMeasurement(1).CleanUp(() => { depthMap.Clear(); queue.Clear(); planGraph.GetExpandedDepthMap(0, depthMap, queue); selectedUnexpandedStates.Clear(); allExpandedStates.Clear(); }).Run(); queue.Dispose(); depthMap.Dispose(); planGraph.Dispose(); selectedUnexpandedStates.Dispose(); allExpandedStates.Dispose(); // Check performance times PerformanceUtility.AssertRange(0.00, 5); }
//----------------------------------------------------------------------------- protected override JobHandle OnUpdate(JobHandle inputDeps) { // select all key? var status = m_Input.Buttons[0].Values["SelectAll"].Status; if (status == ECSInput.InputButtons.UP) { var selectionJob = new SelectAllJob { AgentSelection = m_AgentSelection }; return(selectionJob.Schedule(m_AgentSelection.Length, 64, inputDeps)); } status = m_Input.Buttons[0].Values["SelectAgents"].Status; if (status == ECSInput.InputButtons.NONE) { return(inputDeps); } // select by rectangle? if (status == ECSInput.InputButtons.DOWN) { m_Start = m_Input.MousePos[0].Value; m_Selection.Start = m_Start; m_Selection.Stop = m_Stop; m_Selection.enabled = true; } m_Stop = m_Input.MousePos[0].Value; m_Selection.Stop = m_Stop; if (status == ECSInput.InputButtons.UP) { m_Selection.enabled = false; } if (m_Selection.enabled) { var job = new SelectionJob { Start = Normalize(math.min(m_Start, m_Stop), Screen.width, Screen.height), Stop = Normalize(math.max(m_Start, m_Stop), Screen.width, Screen.height), World2Clip = Camera.main.projectionMatrix * Camera.main.GetComponent <Transform>().worldToLocalMatrix, AgentSelection = m_AgentSelection }; return(job.Schedule(m_AgentSelection.Length, 64, inputDeps)); } return(inputDeps); }
void SelectSequential() { var selectJob = new SelectionJob <int, int>() { StateExpansionBudget = 1, RootStateKey = rootState, StateDepthLookup = m_DepthMap, StateInfoLookup = m_PlanGraph.StateInfoLookup, ActionLookup = m_PlanGraph.ActionLookup, ActionInfoLookup = m_PlanGraph.ActionInfoLookup, ResultingStateLookup = m_PlanGraph.ResultingStateLookup, StateTransitionInfoLookup = m_PlanGraph.StateTransitionInfoLookup, SelectedUnexpandedStates = m_SelectedUnexpandedStates, AllSelectedStates = m_SelectedStateHorizons }; selectJob.Schedule().Complete(); }
protected override JobHandle OnUpdate(JobHandle inputDependencies) { var handleSchedule = HandleInput(inputDependencies); if (selection && SelectionEnded()) { var job = new SelectionJob() { physicsWorld = physicsWorldSystem.PhysicsWorld, collisionWorld = physicsWorldSystem.PhysicsWorld.CollisionWorld, entityCommandBuffer = endSimulationEntityCommandBuffer.CreateCommandBuffer().ToConcurrent(), lowerLeftPosition = lowerLeftPosition, upperRightPosition = upperRightPosition, startPosition = startPosition, endPosition = endPosition, selectionAreaSize = selectionAreaSize }; var schedule = job.Schedule(1, handleSchedule); schedule.Complete(); endSimulationEntityCommandBuffer.AddJobHandleForProducer(schedule); return(schedule); } return(handleSchedule); }