Performance Profiler For XR

This is to track a conversation to get the Performance Profiler to run inside a scene in XR. This was made to not clog up the announcement topic.

The first problem which was started in the announcement topic was getting the CanvasGraphService object to draw on the canvas of a DynamicTexture. The CGS is expecting a HTMLCanvasElement in the constructor. Rather than trying to refactor to also take a canvas2D context, seems just allowing a canvas is less work. Called with:

DynamicTexture.getContext().canvas

Other stuff like toolTips would not apply, but might be ignore-able. Just the last line in the constructor, the attachment of listeners would definitely need to be conditional on being a HTMLCanvasElement not a Canvas.


The next area is selecting a point on the X axis, so that the values at that point can be displayed. I see why there are no chart Y axis labels, because multiple things can graphed not having the same range. Is this what the tooltip stuff is for?

Inside of this, the mesh needs to be broken out vertically, so that the point in time can be determined. MeshBuilder does not do this, so I made it in Blender. It has 200 vertical areas that can be scene.picked, though that does not work in XR. Think there is an equivalent for XR. This is a snap in Blender of the 404 triangle mesh.

I generated an embedded BABYLON.Mesh subclass, which is now in the updated dev PG, so just a synchronous
new PERF_MESH.PerfMesh('results',scene); call without any callback crap to deal with.

The second fallout is that there needs to be dedicated controls to display the values, since tooltips are not going to work in XR. I plan on using my portal for XR. It is for providing UI for the user, which they can bring up at any time with a finger snap or controller ‘A’ button push. I can use it in the tool scene I am working on, putting the display mesh and value controls in one of the panes.


I also really need to track the amount of time done in beforeRenderers. I do not see that time broken out, so guess that means I have to add a strategy. That seems like something which should only be done, once it is got running.

3 Likes

I have started to make the known changes to the constructor of the inspector class, CanvasGraphService. Added an | any to the canvas arg. Using ICanvas errors, but I’ll worry about that later. The last line was also changed. It is now:

if (canvas instanceof HTMLCanvasElement) {
    this._attachEventListeners(canvas);
}

It has been a very long time since I did builds. I just deleted everything in tools/gulp/node_modules, and did another npm install.

Did a npm run build, and got my babylon.inspector.bundle.js file and matching d.ts in about 5 minutes. The thing kept going on and on finally error ed about 20 minutes later.

Question is, if I need more changes, is there a way to get them quicker? I am used to sub 5 second typescript builds. I see the build entry in package.json. Would making a new entry or changing be the way to go?

@RaananW is our build system guy, but yeah, currently the build takes quiiiiite a while :pensive: It’s going to be much better when the new build system is up, tho!

2 Likes

It’s going to be AMAZING!!! THe new system is mind blowing

3 Likes

I have already integrated the playground in the new system, and can tell you that if you are making modifications to the playground source code, the compile time is roughly 10-20 seconds to get the new version hosted. The same will apply to the inspector - if you are developing for the inspector it shouldn’t take longer than that. I have already integrated the inspector, but have no yet fully tested the entire process.
The new system is coming very soon (a beta version of it), and will be ready for the babylon 5.0 release for sure.

2 Likes