Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What version of BJS are you referring to?



Latest.

Here's the string concatenation to set the active texture unit. (By the way the fastest way to do it is "gl.TEXTURE0 + channel" instead of creating the string to index in the proper constant).

https://github.com/BabylonJS/Babylon.js/blob/master/src/baby...

As for the broken cache, I think it was Engine._activeTexturesCache; sometimes its indexed by texture channel other times by GL enum values (this makes the cache array explode to 30k elements and causes cache misses in half the code paths.)

From what I remember, lots of caches are needlessly trashed many times per frame.

There's also noticeable overhead to all of those "private static <constant> = value;" with public getters.


Just pushed an update to remove the string concat. No evidence of broken cache as all references to activeTextureCache use texture channel index.


You won't see it in the code. Run it through the debugger; the value of "channel" is sometimes the value of the GL enum rather than the index of the texture unit.

It could've been fixed since as well.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: