royibernthal Posted March 4, 2017 Share Posted March 4, 2017 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. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 5, 2017 Share Posted March 5, 2017 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. GameMonetize and royibernthal 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 6, 2017 Share Posted March 6, 2017 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 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted March 7, 2017 Author Share Posted March 7, 2017 Second option looks good, like you mentioned in the mail, the "defines" part is what I need, it'd be great to have an observable for that. (I don't mind having vertex and fragment as well) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.