Created
December 22, 2019 07:39
-
-
Save n-taku/5540386ebb3a7fdb074a0e4d806e6e64 to your computer and use it in GitHub Desktop.
RenderingのProfilerデータ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Serializable] | |
public class RenderingFrameData | |
{ | |
public int batches; | |
public int setPassCall; | |
public int triangles; | |
public int vertices; | |
} | |
public static RenderingFrameData ProcessRenderingFrameData(int frame) | |
{ | |
var r = new RenderingFrameData(); | |
var statistics = ProfilerDriver.GetGraphStatisticsPropertiesForArea(ProfilerArea.Rendering); | |
foreach (var propertyName in statistics) | |
{ | |
var id = ProfilerDriver.GetStatisticsIdentifierForArea(ProfilerArea.Rendering, propertyName); | |
var buffer = new float[1]; | |
ProfilerDriver.GetStatisticsValues(id, frame, 1, buffer, out var maxValue); | |
if (propertyName == "Batches") r.batches = (int)buffer[0]; | |
else if (propertyName == "SetPass Calls") r.setPassCall = (int)buffer[0]; | |
else if (propertyName == "Triangles") r.triangles = (int)buffer[0]; | |
else if (propertyName == "Vertices") r.vertices = (int)buffer[0]; | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment