Skip to content

Instantly share code, notes, and snippets.

@n-taku
Created December 22, 2019 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n-taku/5540386ebb3a7fdb074a0e4d806e6e64 to your computer and use it in GitHub Desktop.
Save n-taku/5540386ebb3a7fdb074a0e4d806e6e64 to your computer and use it in GitHub Desktop.
RenderingのProfilerデータ
[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