Hi all, here is an issue that is confusing me. I am getting a
“Violation] ‘requestAnimationFrame’ handler took ms”
as well as a ‘pointerdown’ handler took 250ms
With a noticeable hitch and drop in framerate.
Obviously something is interfering with requestAnimationFrame and I bet I am doing something bad with async await and promices.
Ive boiled it down to what i think is causing it…code that I have set up to pre-load an array of textures. simple stuff that uses BaseTexture.WhenAllReady.
If I do not pre-load textures (eg: just return new Texture(url,scene) without waiting for the result, I do not see this issue.)
I have not been able to repro this in the playground but here is the code:
//loads textures given a list of urls
function loadTexturesAsync(texturelist) {
return new Promise((resolve, reject) => {
var textures = ;
for (let url in texturelist) {
textures.push(new Texture(url, scene));
}
BaseTexture.WhenAllReady(textures, () => {
resolve(textures);
})
});
}
//caller
async function loadTextures(texturelist)
{
const items = ;
items.push(renderer.loadTexturesAsync(texturelist));
const values = await Promise.all(items);
//store texture in dictionary keyed by the URL
var i = 0;
const obj = {};
for (let url in texturelist) {
obj[url] = values[0][1];
i += 1;
}
return obj;
}
which in turn gets called this way:
async function loadAsset() {
const values = await Promise.all([
loadModels(modellist),
loadShaders(shaderlist),
loadTextures(texturelist),
]);
const models = values[0];
const shaders = values[1];
const textures = values[2];
}