Jump to content

Track shaders compilation trigger


royibernthal
 Share

Recommended Posts

Is there a way to know when any shader compilation is triggered on bjs, what instance it's related to, and what properties it has? (e.g. point light, bones support...)

That way I'll be able to know if I missed precompiling any shaders if I see any shader compilations during the gameplay after initialization.

It'd be best if I could log such a thing to the console.

Link to comment
Share on other sites

Hi Royi.  I'm not qualified to help with this, but I try goofy things anyway, as you well-know.  :)

http://www.babylonjs-playground.com/#1AAQUN#28

Here I have hijacked engine.createShaderProgram(), and also re-defined engine's compileShader() function.  Both are being called in this simple playground... twice.

My hijacked code comes from https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/babylon.2.5.max.js but was originally found in engine.ts... while searching for the word 'program'.   :)  Playground lines 18-22 ... attaching, linking, getProgramParameter() stuff.  Might work.

I did some experiments in lines 60-61, too... wondering if engine._compiledEffects was something observable.  Nothing learned there.  Sorry for interrupting thread flow.  Calling all helpers - issue still open.  :)

Link to comment
Share on other sites

As @Wingnut stated this is deep inside the engine :)

There is no observable so far but I'm not opposed to add one either here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.engine.ts#L3

Or perhaps there:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/babylon.effect.ts#L401

 

Second option seems better as we have more info regarding uniforms and defines

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...