getShaderParameter use too much time!



I use chrome dev tool to profile my game, and found the function getshaderParameter function use too much time, this makes my game slow。

This is the picture from chrome dev tool,
and the call trace:

Obviously, this is related to render stuff, but I would like to know more about this function, why it takes so long time to execute, which exactly object in my scene cause this problem? which shader ?
Maybe related to show some more other object ? cause right after the timeline, the game about show another object.

I would like to hear from you guys


WebGLRenderingContext.getShaderParameter() is only called when a shader program is compiled. This normally happens when a material is used for the first time. three.js uses getShaderParameter() to verify the compilation status of shaders. If it was not successful, an error message is logged.


If you’re seeing it called frequently (e.g. after the scene has started rendering), are you setting material.needsUpdate = true or creating materials during the render loop? Try to avoid both of those.


Yes, it is. so I make my preload object render once, so it will not consume much time when it shows again.
It will be great if the FBXLoader has the feature to preload material


WebGLRenderer.compile() might be the method you are looking for.