移除不用的脚本
This commit is contained in:
@@ -1,18 +1,14 @@
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
|
||||
namespace SRDebugger.Profiler
|
||||
namespace SRDebugger.Profiler
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using SRDebugger.Services;
|
||||
using SRF;
|
||||
using SRF.Service;
|
||||
using UnityEngine;
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
using UnityEngine.Rendering;
|
||||
#else
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
#endif
|
||||
|
||||
public class SRPProfilerService : SRServiceBase<IProfilerService>, IProfilerService
|
||||
{
|
||||
@@ -35,6 +31,8 @@ namespace SRDebugger.Profiler
|
||||
// Time that render pipeline starts
|
||||
private double _renderStartTime;
|
||||
|
||||
private long _renderStartTimeFrame;
|
||||
|
||||
// Time between scripted render pipeline starts + EndOfFrame
|
||||
private double _renderDuration;
|
||||
|
||||
@@ -49,12 +47,7 @@ namespace SRDebugger.Profiler
|
||||
CachedGameObject.hideFlags = HideFlags.NotEditable;
|
||||
CachedTransform.SetParent(Hierarchy.Get("SRDebugger"), true);
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
RenderPipelineManager.beginFrameRendering += RenderPipelineOnBeginFrameRendering;
|
||||
#else
|
||||
RenderPipeline.beginFrameRendering += RenderPipelineOnBeginFrameRendering;
|
||||
#endif
|
||||
|
||||
RenderPipelineManager.beginContextRendering += RenderPipelineOnBeginContextRendering;
|
||||
StartCoroutine(EndOfFrameCoroutine());
|
||||
}
|
||||
|
||||
@@ -113,12 +106,15 @@ namespace SRDebugger.Profiler
|
||||
_updateDuration = _stopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
private void RenderPipelineOnBeginFrameRendering(ScriptableRenderContext context, Camera[] cameras)
|
||||
#else
|
||||
private void RenderPipelineOnBeginFrameRendering(Camera[] obj)
|
||||
#endif
|
||||
private void RenderPipelineOnBeginContextRendering(ScriptableRenderContext context, List<Camera> list)
|
||||
{
|
||||
// Account for if there are multiple render contexts per frame. We only want to know when the first rendering is started on the frame.
|
||||
if(_renderStartTimeFrame == Time.renderedFrameCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_renderStartTimeFrame = Time.renderedFrameCount;
|
||||
_renderStartTime = _stopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
|
||||
@@ -136,4 +132,3 @@ namespace SRDebugger.Profiler
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user