BabylonJS / Spector.js

Explore and Troubleshoot your WebGL scenes with ease.

Home Page:http://spector.babylonjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option to capture only if a specific term would appear in the arguments / call names

JannikGM opened this issue · comments

I'm proposing another solution to #293 (comment) and some other use-cases.

I think there should be some capture option which does captures, but discards each frame until a condition was met.
The condition could be a regex which matches the call name / argument list.

For example, a filter could be:

  • "Only capture frame if trace contains draw[a-zA-Z]*" (wait for drawElements / drawInstanced etc.)
  • "Only capture frame if trace contains ONE_MINUS_SRC_ALPHA" (wait for a specific argument)
  • "Only capture frame if trace contains material[0-9]+-shader" (wait for a specific shader name)

So spector would capture frames, but discard the frame info at the end.
It would only stop capturing (and show the captured frame) if the condition was met.

Obviously it would be even more helpful if one could specify the content in which would be searched (arguments, callnames, resource names, debug metadata, ...). But even a basic implementation would be very nice-to-have.

I also realize this might be very slow while capturing, but I think this could still be a very useful feature.
For example, you could set up a trigger for a feature you want to debug - either by waiting for a shader to be used, or by waiting for a specific GL feature to be used.

This is too specific in my opinion and users can already capture manually with code.

I will close it for now but not opposed if somebody really wants it and do a PR for it :-)