godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Add viewport/camera names to the Visual Profiler #9969

Open minstrel1 opened 3 months ago

minstrel1 commented 3 months ago

Describe the project you are working on

Add the node name of the viewport / camera to the visual profiler instead of just "Viewport N"

Describe the problem or limitation you are having in your project

The visual profiler is extremely difficult to work with, especially when working with multiple viewports. Having each viewport listed in the profiler as just "Viewport 2" does not tell me which viewport it actually is so I can identify it.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Replace the names of the viewport with the actual name of the node.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

mockup

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, as the visual profiler is part of the core.

Is there a reason why this should be core and not an add-on in the asset library?

No, as the visual profiler is part of the core.

Calinou commented 4 days ago

Unfortunately, I'm not sure if this is technically feasible. The low-level Viewport/Camera APIs that are part of RenderingServer have no knowledge of the nodes being used (you can create viewports and cameras without ever using nodes).

What you're seeing in the profiler is a representation of the RenderingServer visual timestamps, which works at a lower level than the node system.

tetrapod00 commented 4 days ago

Does the visual profiler have enough info to map RIDs to nodes, though? You might be able to accomplish this without any RenderingServer API changes, at least for the viewports created by nodes.

clayjohn commented 4 days ago

We should register high level names (or nodepaths) for many resources when in debug builds. We already do that for textures, meshes, and shaders, but we need to extend it to other resources.

See mesh_set_path() for example: https://github.com/godotengine/godot/blob/99a7a9ccd60fbe4030e067b3c36d54b67737446d/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp#L771

Importantly, we should limit this to debug builds as we want to keep that bloat out of the servers at runtime as much as possible.

Ideally, users should be able to click on entries in the Visual Profiler and quickly find out what nodes they correspond to