itwinjs-core
itwinjs-core copied to clipboard
Set antialiasSamples=4 crashes on Mac
Describe the bug
This is an issue that @ezmobivietnam is experiencing with our civil views using his Macbook Pro 2019. Whenever the antialiasSamples is set, the WebGL context is lost and nothing works anymore.
To Reproduce Please refer to the following sandbox: https://www.itwinjs.org/sandboxes/gagnon-a/webgl_context_macos_binh
Loading the sandbox should be sufficient to reproduce the issue. The crux of the problem is the following lines:
const onViewportRef = (vp: ScreenViewport) => {
vp.antialiasSamples = 4;
console.log('Adjusted to 4 antialias samples');
}
Expected behavior Changing a setting that is not supported by the user's browser/WebGL capabilities should not crash the app. Ideally, it should just ignore it.
Screenshots
Desktop (please complete the applicable information):
Macbook Pro 2019
- Processor: 2.6 GHz 6-Core Intel Core i7
- Graphics: AMD Radeon Pro 5300M 4 GB Intel UHD Graphics 630 1536 MB
- Memory: 16 GB 2667 MHz DDR4
- macOS: Ventura 13.5.2 (22G91)
- Getting the same results with Chrome, Edge and Firefox
- iTwin.js Version: 3.7.7 (sandbox), 4.x (deployed pineapple)
Please send to the compatibility checker and report back with the number of antialias samples reported and all of the system information.
Then please find out how to configure the MacBook/browser to use the GPU. It is currently using software rendering, which is inappropriate for any 3D application.
Hi @pmconne ,
here is the screenshot of the compatibility checker.
here is the screenshot of the compatibility checker.
Did you change your browser to use your GPU? Because @a-gagnon's screenshot shows software rendering and "major performance caveat", while your screenshot shows hardware rendering an no such caveat.
here is the screenshot of the compatibility checker.
Did you change your browser to use your GPU? Because @a-gagnon's screenshot shows software rendering and "major performance caveat", while your screenshot shows hardware rendering an no such caveat.
I took the screen caps from an earlier conversion to create this bug report, perhaps some of it is out of context (?) @ezmobivietnam were you getting the same errors using the sandbox and the civil model from infrastructure cloud?
here is the screenshot of the compatibility checker.
Did you change your browser to use your GPU? Because @a-gagnon's screenshot shows software rendering and "major performance caveat", while your screenshot shows hardware rendering an no such caveat.
No, I change nothing. I use the default browser settings. Regarding the performance caveat, it happens randomly. I just got it two times.
here is the screenshot of the compatibility checker.
Did you change your browser to use your GPU? Because @a-gagnon's screenshot shows software rendering and "major performance caveat", while your screenshot shows hardware rendering an no such caveat.
I took the screen caps from an earlier conversion to create this bug report, perhaps some of it is out of context (?) @ezmobivietnam were you getting the same errors using the sandbox and the civil model from infrastructure cloud?
I got the same error. Below is the screenshots on infrastructure cloud
Note: I have tried with different browsers like Chome, Ms Edge and Firefox and got the same error.
@markschlosseratbentley @iTwin/itwinjs-core-display
@a-gagnon @ezmobivietnam
Are you saying that your browser randomly goes from using a GPU to not using a GPU every time you run the compatibility checker? If so, that sounds like a configuration problem.
@markschlosseratbentley , Finally, I could reproduce the issue of showing the error and the performance warning. Below are the steps:
- Step 1. Open the imodel https://qa-infrastructurecloud.bentley.com/db4c11e6-25c8-4e08-8733-ddc1ca3b779d/manage-imodel/unified-viewer/c23aab84-8eb7-4038-acc5-1477ef89a8ca/a8a14b1db8dd913469d3291c7120d4f8742a3d0e
- Step 2. Open the Civil frontstage and draw 2-Point cross-section
- Step 3. Noticed an alert "Oops, something went wrong please reload the page" is displayed
- Step 4: Reload the imodel, repeat the two steps 2 - 3 several times until the loading time of the imodel is increased significantly then go to step 5.
- Step 5: After the iModel is loaded, check and notice that the Compatibility Warning was displayed.
- Step 6: Open the Civil frontstage and draw 2-Point cross-section again
- Step 7: Confirm that the 2-Point cross-section works successfully as designed this time.
I have a video recording demonstrating these steps. I will send it to you privately via Ms Team if it helps.
Thanks, Binh
@a-gagnon the original description states that setting the viewport's antialiasSamples to 4 causes the WebGL context loss. However, based on the description above, it seems to me that the browser is going back and forth from from supporting it to not supporting it. Is this a larger issue at play with system configuration?
@ezmobivietnam's latest repro steps make no mention of antialiasing.
Somebody please put together a single coherent set of repro steps and put them in the issue description.
@pmconne , I have no idea how the antialiasSamples is set/managed in Pineapple. But I did some tests with Alex's sandbox then had the result as below:
- Case 1: set
vp.antialiasSamples= to 4 then got the error: - Case 2: don't set
vp.antialiasSamples, the sample works well :
@pmconne @markschlosseratbentley Any updates on this? Do you need something else to complete this investigation? He gets the error consistently using the Sandbox Alex provided.
I fail to repro in Chrome and Firefox on Windows 11 and Ubuntu 22.04. This includes setting vp.antialiasSamples to a definitely unsupported value like 192.
I have no access to a macbook to figure out why your WebGL implementation is failing when you set the number of antialias samples to a value it claims it supports.
@markschlosseratbentley, do you?
@pmconne @simnorm @ezmobivietnam I tried on a M1 MacBook Air and cannot reproduce, using Safari or Chrome. I edited vp.antialiasSamples to be a definitely unsupported value like 192 as well.
From earlier discussion on this issue, this particular MacBook has a GPU and integrated graphics. I am still unclear whether the issue happens only when integrated graphics are enabled. If so, I recommend configuring the device to use the GPU with the browser(s).
Also please make sure all browsers are up to date and all macOS system updates are installed.
Hi @markschlosseratbentley ,
I have changed Chrome settings to enable/disable hardware acceleration, and tested the sandbox that Alex provided then got the result below:
- Use hardware acceleration when available = ON (default setting): the issue consistently happens
- Use hardware acceleration when available = OFF: the issue disappears.
Thanks so much for your help! Binh