|
|
|
|
|
|
|
|
|
|
public class MiniProfiler : MonoBehaviour { |
|
|
|
|
|
|
|
public bool m_Enable = false; |
|
|
|
public bool m_Enable = true; |
|
|
|
private bool m_UseNewBatcher = false; |
|
|
|
|
|
|
|
internal class RecorderEntry |
|
|
|
{ |
|
|
|
|
|
|
// new RecorderEntry() { name="BatchRenderer.Flush" },
|
|
|
|
new RecorderEntry() { name="Shadows.Draw" }, |
|
|
|
new RecorderEntry() { name="BatchRenderer.ApplyShaderPass" }, |
|
|
|
new RecorderEntry() { name="Batch.DrawStatic" }, |
|
|
|
// new RecorderEntry() { name="gDrawBatchPointers" },
|
|
|
|
new RecorderEntry() { name="DrawBuffersBatchMode" }, |
|
|
|
/* |
|
|
|
new RecorderEntry() { name="NewBatch.Instances" }, |
|
|
|
new RecorderEntry() { name="NewBatch.Elements" }, |
|
|
|
new RecorderEntry() { name="NewBatch.DrawRanges" }, |
|
|
|
new RecorderEntry() { name="NewBatch.S-Instances" }, |
|
|
|
new RecorderEntry() { name="NewBatch.S-Elements" }, |
|
|
|
new RecorderEntry() { name="NewBatch.S-DrawRanges" }, |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
new RecorderEntry() { name="gBatchGBufferObj" }, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
new RecorderEntry() { name="Camera.Render" }, |
|
|
|
new RecorderEntry() { name="GUI.Repaint" }, |
|
|
|
new RecorderEntry() { name="PrepareValues" }, |
|
|
|
new RecorderEntry() { name="ApplyGpuProgram" }, |
|
|
|
|
|
|
|
|
|
|
if (m_Enable) |
|
|
|
{ |
|
|
|
/* |
|
|
|
GUI.changed = false; |
|
|
|
if ( !Application.isEditor ) |
|
|
|
{ |
|
|
|
m_UseNewBatcher = GUI.Toggle(new Rect(10, 30, 200, 20), m_UseNewBatcher, "Use new render batch"); |
|
|
|
if (GUI.changed) |
|
|
|
{ |
|
|
|
UnityEngine.Experimental.Rendering.ScriptableRenderContext.UseNewBatchRenderer(m_UseNewBatcher); |
|
|
|
} |
|
|
|
} |
|
|
|
*/ |
|
|
|
float w = 500, h = 204; |
|
|
|
float w = 500, h = recordersList.Length * 18 + 24; |
|
|
|
GUILayout.BeginArea(new Rect(10, 150, w, h), "Mini Profiler", GUI.skin.window); |
|
|
|
GUILayout.BeginArea(new Rect(10, 50, w, h), "Mini Profiler", GUI.skin.window); |
|
|
|
string sLabel = System.String.Format("<b>{0:F2} FPS ({1:F2}ms)</b>\n", 1.0f / m_AvgDeltaTime, Time.deltaTime * 1000.0f); |
|
|
|
for (int i = 0; i < recordersList.Length; i++) |
|
|
|
{ |
|
|
|