const bitmap = await profiler.captureTexture({
framebuffer, width, height
});
postMessage(
{ type: 'texture', name, bitmap, width, height },
[bitmap]
);
worker.onmessage = (e) => {
if (e.data.type === 'texture') {
stats.setTextureBitmap(
e.data.name,
e.data.bitmap,
e.data.width,
e.data.height
);
}
};