Glslang.js and twsl.js

When using webgpu, these two scripts execute for a long time. Can I extract and execute these two scripts when initializing the webgpu engine?

Unfortunately this is not possible, they are used to compile shaders at runtime.

However, you shouldn’t really see these functions in a snapshot, because compiling shaders should happen very rarely (basically, only at startup): are you sure you don’t create shaders at every frame?

1 Like

Just like on PG, when I click, the selected mesh will be added to the HighlightLayer, and the shader will be compiled multiple times at this time

Yes, but that will happen only a single time, when you first click the objects.