-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
line chart: introduce onContextLost renderer callback #5237
Conversation
f6fc428
to
c2ececa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure lgtm.
What thing is not clear to me: what do you think the app should do when the context lost happens?
Upon losing webgl context, my intention is to have the LineChartComponent listen for that renderer event and tell its parent component that a "fatal renderer error" has occurred. In that scenario, a ScalarCardComponent, which owns a LineChartComponent, can decide to destroy and re-create the LineChartComponent upon a fatal error. Sorry, I realize it wasn't simple to view the followup PR's changes independently. I will rebase the followup before requesting review, and remember to use branches in the main repo for easier diffing in the future. |
The line chart's internal `ChartImpl` notifies the line chart when it is a WebGL renderer that loses its context due to the page having too many active WebGL contexts at once (>30 for my device). This change adds logic to treat those errors as fatal when the line chart needs to be updated. Scalar cards now handle the fatal error by destroying and recreating the entire line chart component, fixing the blank chart issue. Manually checked that charts are not blank after scrolling through lots of line charts (used the tagFilter to view 2x the line charts, since elements are duplicated). Alternatives considered: calling restoreContext() [1] on the context does not consistently fix the blank charts. When it does, it appears to lose the original context configuration (antialias: true, precision: 'highp', alpha: true), leading to low quality visuals [2]. Googlers, see b/196294346. [1] https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context/restoreContext [2] https://imgur.com/a/kKnhqYJ Diffbase: #5237
Each line chart component in the Time Series dashboard gets its own canvas and webgl rendering context. After scrolling through too many line charts (for my device after ~30), the page issues warnings in the console like "Too many active WebGL contexts. Oldest context will be lost". When the browser decides there are too many contexts, it disposes old ones causing blank line charts. This change adds an event dispatched by the line chart's internal `ChartImpl` to notify clients when the rendering context is lost. This only applies to the WebGL renderer for now. A followup change addresses the remediation of blank scalar cards. Googlers, see b/196294346. Followup: tensorflow#5239
The line chart's internal `ChartImpl` notifies the line chart when it is a WebGL renderer that loses its context due to the page having too many active WebGL contexts at once (>30 for my device). This change adds logic to treat those errors as fatal when the line chart needs to be updated. Scalar cards now handle the fatal error by destroying and recreating the entire line chart component, fixing the blank chart issue. Manually checked that charts are not blank after scrolling through lots of line charts (used the tagFilter to view 2x the line charts, since elements are duplicated). Alternatives considered: calling restoreContext() [1] on the context does not consistently fix the blank charts. When it does, it appears to lose the original context configuration (antialias: true, precision: 'highp', alpha: true), leading to low quality visuals [2]. Googlers, see b/196294346. [1] https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context/restoreContext [2] https://imgur.com/a/kKnhqYJ Diffbase: tensorflow#5237
Each line chart component in the Time Series dashboard gets its own canvas and webgl rendering context. After scrolling through too many line charts (for my device after ~30), the page issues warnings in the console like "Too many active WebGL contexts. Oldest context will be lost". When the browser decides there are too many contexts, it disposes old ones causing blank line charts. This change adds an event dispatched by the line chart's internal `ChartImpl` to notify clients when the rendering context is lost. This only applies to the WebGL renderer for now. A followup change addresses the remediation of blank scalar cards. Googlers, see b/196294346. Followup: tensorflow#5239
The line chart's internal `ChartImpl` notifies the line chart when it is a WebGL renderer that loses its context due to the page having too many active WebGL contexts at once (>30 for my device). This change adds logic to treat those errors as fatal when the line chart needs to be updated. Scalar cards now handle the fatal error by destroying and recreating the entire line chart component, fixing the blank chart issue. Manually checked that charts are not blank after scrolling through lots of line charts (used the tagFilter to view 2x the line charts, since elements are duplicated). Alternatives considered: calling restoreContext() [1] on the context does not consistently fix the blank charts. When it does, it appears to lose the original context configuration (antialias: true, precision: 'highp', alpha: true), leading to low quality visuals [2]. Googlers, see b/196294346. [1] https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context/restoreContext [2] https://imgur.com/a/kKnhqYJ Diffbase: tensorflow#5237
Each line chart component in the Time Series dashboard gets its own canvas and
webgl rendering context. After scrolling through too many line charts (for my
device after ~30), the page issues warnings in the console like "Too many active
WebGL contexts. Oldest context will be lost".
When the browser decides there are too many contexts, it disposes old ones
causing blank line charts. This change adds an event dispatched by the line chart's
internal
ChartImpl
to notify clients when the rendering context is lost.This only applies to the WebGL renderer for now. A followup change addresses the
remediation of blank scalar cards.
Googlers, see b/196294346.
Diffbase: none.
Followup: #5239