diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 19419826..e67f51b4 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1973,6 +1973,7 @@ Performance improvements - Nearby entity lookup caching per frame - Far-away entities do not spawn physics by default Lod emitter service checker function +Mesh profiling diff --git a/src/main/java/electrosphere/renderer/model/Mesh.java b/src/main/java/electrosphere/renderer/model/Mesh.java index 35c10076..f3b5192a 100644 --- a/src/main/java/electrosphere/renderer/model/Mesh.java +++ b/src/main/java/electrosphere/renderer/model/Mesh.java @@ -445,6 +445,7 @@ public class Mesh { } if(renderPipelineState.getUseLight()){ + Globals.profiler.beginAggregateCpuSample("Light"); //Until we switch to uniform buffer objects we will have to buffer lighting data here manually each time we draw //side note: :( if(Globals.renderingEngine.getLightManager() == null){ @@ -463,6 +464,7 @@ public class Mesh { } Globals.renderingEngine.checkError(); + Globals.profiler.endCpuSample(); } if(renderPipelineState.getUseMaterial() && textureMask == null){ @@ -483,6 +485,7 @@ public class Mesh { // //The texture masking logic if(textureMask != null){ + Globals.profiler.beginAggregateCpuSample("Texture mask"); // //path that uses already-defined texture objects if(textureMask.getTextures() != null){ @@ -507,6 +510,7 @@ public class Mesh { } } Globals.renderingEngine.checkError(); + Globals.profiler.endCpuSample(); } if(renderPipelineState.getUseShadowMap()){ @@ -574,15 +578,19 @@ public class Mesh { } if(renderPipelineState.getBufferNonStandardUniforms()){ + Globals.profiler.beginAggregateCpuSample("Nonstandard uniforms"); this.bufferAllUniforms(openGLState); Globals.renderingEngine.checkError(); + Globals.profiler.endCpuSample(); } if(renderPipelineState.getInstanced()){ + Globals.profiler.beginAggregateCpuSample("Instance logic"); if(renderPipelineState.getInstanceData()!=null){ InstanceData instanceData = renderPipelineState.getInstanceData(); instanceData.upload(openGLState, renderPipelineState); } + Globals.profiler.endCpuSample(); }