-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
10x shader compilation time regression from r132 to r133 (Windows) #22758
Comments
Indeed, I'm doing a roll-back of model-viewer v1.9 right now because of this regression. Thanks @toji for the detailed repro! |
It seems this is a duplicate of #22631. |
Would be great if you could bump: https://bugs.chromium.org/p/chromium/issues/detail?id=1256340 |
I don't believe that's true, as r134 has the same behavior as r133 here. Unless that issue hasn't been completely fixed yet? Edit, now I see it was closed not as fixed. |
Is it? While the end result seems similar that one seemed to focus on stalls when uploading textures, while this issue is pretty clearly showing that stalls are coming from program compilation. |
No, it isn't. The issue has been closed because it needs to be fixed on the browser side. The only option to fix this in
If the regression disappears by using |
Ah, I see that this IS a very direct duplicate of #22700, and in that thread they do point out that removing I'm not sure why that would be showing up in |
When loading an asset via |
Yeah, and we remove the |
Confirmed this against webgl_animation_keyframes.html. If I go into r133's code and change WebGLTextures.js:169 from if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( encoding === sRGBEncoding ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8; to simply if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGBA8; Then load times are instantly better (though the scene is predictably washed out.) Which... is straight up baffling to me, honestly. 😵 |
Disabling Changing |
Hold on, think I've found something: Do you have any sense of how difficult it would be to make use of texStorage2D in this scenario? (WebGL2 only) I have an early indication that may be a workaround for the performance hit here. (And should be a best practice all around.) |
Left a comment on #22631 with more of my findings. |
Related issue: #21874 One reason I did not focus on the issue yet is #21874 (comment) and the fact that is requires a bit of refactoring in When I remember correctly you must know in advance the number of mips for a texture whereas with Math.log2( Math.max( width, height, depth ) ) |
TBH, I always fear refactorings in For a quick fix of this issue I would rather merge #22759 and plan more time for the introduction of |
The file in #22785 (closed as duplicate of this issue) exhibits slowdowns way beyond the 10x mark (going from "loads immediately" to "loads never and makes the entire browser unresponsive"). |
Probably best to wait a few weeks on https://bugs.chromium.org/p/chromium/issues/detail?id=1256340 but sounds like the best solution for this would be to disable |
That sounds like the best solution to me, too! |
Since #22759 has been merged, the performance regression should disappear with |
Describe the bug
This appears to be the core issue behind google/model-viewer#2915
It seems that something about a recent materials change has caused shader compilation on my PC to take ~10x(!) longer than it used to. If I were to guess at why I'd say that it's probably the DirectX shader compiler hitting a pathological case that wasn't there before and trying to do an insane loop unroll or something of that nature.
To Reproduce
Steps to reproduce the behavior:
With r132 I get the following recording from the performance tab in Chrome dev tools (though it's worth noting the same regression is also observable when using Firefox):
You can see that the largest block of work on the main thread takes ~500ms. It bottoms out at a bunch of getProgramInfoLog calls and a couple of texImage2D calls that all take about 20-50ms.
With r133 the recording looks significantly different. There are multiple calls to getProgramInfoLog that take ~150ms each and one particularly long one that takes 3+ seconds! In total, the block of work that represents to model's upload to the GPU takes nearly 5 seconds to complete, a 10x increase between versions (and consistent with what was seeing.)
Platform:
The text was updated successfully, but these errors were encountered: