Hi, we’re testing our project and seem to be having an intermittent issue when loading builds. Often we end up with a long hang prior to the splash screen showing (approximately 10 seconds). Looking at the Performance tab in Developer Tools it looks like it’s a call to getContext from playcanvas-stable.min.js where it’s hanging. This shows up in chrome and edge but we haven’t seen it happen with firefox. After a quick search I couldn’t find any mentions of this but any suggestions on how to avoid this would be much appreciated.
Looks like it’s coming from the below in the minified code. Also appears in the standard debug from editor, seems to be line 11875 of playcanvas-stable.dbg.js in that case.
function t(t, i) {
var n, s;
(n = e.call(this) || this).canvas = t, n._enableAutoInstancing = !1, n.autoInstancingMaxObjects = 16384, n.defaultFramebuffer = null, n._maxPixelRatio = 1, n._width = 0, n._height = 0, n.updateClientRect(), n.shaders = [], n.buffers = [], n.textures = [], n.targets = [], n.contextLost = !1, n._contextLostHandler = function(e) {
e.preventDefault(), n.contextLost = !0, n.loseContext(), n.fire("devicelost")
}, n._contextRestoredHandler = function() {
n.restoreContext(), n.contextLost = !1, n.fire("devicerestored")
};
var r = !i || void 0 === i.preferWebGl2 || i.preferWebGl2,
a = r ? ["webgl2", "experimental-webgl2", "webgl", "experimental-webgl"] : ["webgl", "experimental-webgl"],
o = null;
for ((i = i || {}).stencil = !0, s = 0; s < a.length; s++) {
try {
o = t.getContext(a[s], i)
} catch (e) {}
if (o) {
n.webgl2 = r && s < 2;
break
}
}
Don’t seem to see it on the threejs projects. It does happen on the linked playcanvas project.
I have seen it on multiple machines. Specs for my machine below. It was first brought to my attention by the client and I confirmed with another dev that they’re seeing the same behaviour on their machine as well. I’ve attached a couple of screenshots in case that helps (dev tools with my project and the linked playcanvas animation blend project)
PC Specs
Windows 10.0.19042 Build 19042
i5-4690
16GB RAM
RTX 2070 GPU
I just tested on my Dell Precision 5550 running latest Win10 + Chrome. I don’t see a pause in getContext. Can you get the same behavior in both Chrome and Firefox? Can you confirm you have the latest Nvidia drivers installed? You say this is ‘intermittent’ - how many times out of 10 does this occur on load, say?
I’m at a loss as well. Chrome it is consistent (will see it 10 times out 10 with the blend example) but the seemore demo loads without issue. It seems like every once and a while chrome will figure itself out and it loads fine but quitting chrome and restarting it’ll start hanging again (can’t figure out any rhyme or reason to it). Newest Nvidia drivers (466.11). Wondering about a configuration issue on my machine but doesn’t explain why two others saw the same issue. Really appreciate the two of you taking the time to investigate.
@bolton Can you try with this version of the engine in the launch tab please?
It’s built off a branch that removes a non-possible context option and also console logs the context and timings that it is trying to get. If it hangs on this version, at least we will be able to know which once is taking the time.
Sorry for the delay in getting back to you (rushing to finish off the last of the functionality before this goes live). Tried out the custom engine version but still having the same issue. Screenshot attached.
Not sure if this matters but I just noticed that if I have a playcanvas project (including the editor) running in another tab there’s no hang. I think what I assumed was intermittent actually might have been consistent, I just had the editor or another project open in another window occasionally when testing this. With nothing else open, the hang seems to occur every time. Also, for what it’s worth I’m seeing the same behaviour in Edge.
Is the screenshot from the session that was slow? It looks like the application was able to grab webgl2 context in 0.01 ms, which is fine. If it is, then the issue is elsewhere…
No change on WebGL 1.0 or Canary. WebGL report attached.
Really appreciate the time on this. I’ll see if I can find anyone else who can replicate it but if it’s really rare or configuration related than that’s at least a silver lining.