Limit texture uploads per frame?

Hey there,

Is there a way to limit the amount of textures or vertex data uploaded to the GPU per frame? I could do it myself by only manually pumping material.diffuseTexture = t with only a few per frame - but I wonder if there is a better way to do this? In Cryptovoxels, everything loads as the user explores, and we sometimes get big frame drops, which I think are due to a bunch of textures being uploaded in the same frame, or possibly many meshes.

Is there some internal place I could hack this in? Or is it best to do this in my own code, and not try and do it in the core Babylon code?


I’m afraid there’s nothing in the core to help with this matter, as it’s a specific need and only the app knows when to load textures / meshes.

Let’s see what @Deltakosh or @sebavan may have to say about this.

Nope @Evgeni_Popov is right we do not have a sequencer in the code but you may want to get inspired by:
Babylon.js/meshSimplification.ts at master · BabylonJS/Babylon.js · GitHub

I was thinking about this more yesterday, and it occurred to me that if I replaced texImage2d (WebGLRenderingContext.texImage2D() - Web APIs | MDN) with something that throttled uploads (eg only upload 0.5 million pixels / frame), that should work right? I could do the same with vertex arrays right using vertexAttrib3fv?

Is there a reason this wouldn’t work?