-
-
Notifications
You must be signed in to change notification settings - Fork 1k
web: Improve software renderer detection #23534
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -750,7 +750,19 @@ export class InnerPlayer { | |||||||||||||||
|
|
||||||||||||||||
| this.rendererDebugInfo = this.instance!.renderer_debug_info(); | ||||||||||||||||
|
|
||||||||||||||||
| if (this.rendererDebugInfo.includes("Adapter Device Type: Cpu")) { | ||||||||||||||||
| // Show a hardware acceleration warning when software rendering is detected. | ||||||||||||||||
| // The device type is unreliable through WebGL/ANGLE (always "Other"), so we | ||||||||||||||||
| // also match known software renderer names (WARP, SwiftShader, Mesa llvmpipe). | ||||||||||||||||
| const isSoftwareRenderer = | ||||||||||||||||
| this.rendererDebugInfo.includes("Adapter Device Type: Cpu") || | ||||||||||||||||
| this.rendererDebugInfo.includes( | ||||||||||||||||
| "Adapter Device Type: VirtualGpu", | ||||||||||||||||
| ) || | ||||||||||||||||
| this.rendererDebugInfo.includes("Microsoft Basic Render Driver") || | ||||||||||||||||
| this.rendererDebugInfo.includes("SwiftShader") || | ||||||||||||||||
| this.rendererDebugInfo.includes("llvmpipe") || | ||||||||||||||||
| this.rendererDebugInfo.includes("softpipe"); | ||||||||||||||||
| if (isSoftwareRenderer) { | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a partially preexisting issue, but let's say someone doesn't have a GPU, or they don't want to enable it for some reason. I will have to discard the dialog every single time I open the SWF right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a "Don't show again (for this website?)" option would be useful?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that could be reasonable, if we were to add it we could probably leverage localStorage for that (with a safety check that it's available, see the save manager check): ruffle/web/packages/core/src/internal/player/inner.tsx Lines 1274 to 1280 in f34576a
Maybe clicking "Don't show again (for this website)" can store a 1 with key ruffleDisableHardwareAccelationModal, and if a 1 is stored with that key don't show it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extension can theoretically use https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local to allow "Don't show again" to work for all websites, but I don't think the self-hosted build can do that. |
||||||||||||||||
| this.container.addEventListener( | ||||||||||||||||
| "mouseover", | ||||||||||||||||
| this.openHardwareAccelerationModal.bind(this), | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I see correctly, this modal was created for Chrome specifically. I'm not familiar with this code, but it looks like it was very targeted, and these changes expand its scope a bit.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's only targeted insofar as only Chrome seems to allow easily disabling hardware acceleration in a way that affects Ruffle. Safari does not allow disabling hardware acceleration whatsoever. Firefox allows disabling hardware acceleration, but for that browser, the behavior seems to differ in that disabling it only affects WebRender, not whether canvas rendering is hardware-backed. There may be some setting in about:config that affects whether canvas rendering is hardware-backed, but I've not been able to find it and so it's much more likely if this is showing up in Firefox the user for whom it shows is a power user who will know how to fix that. That said, curious about why we'd need some of these checks, though not familiar enough to definitely say we don't. If the renderer includes the phrase "swiftshader" or "llvmpipe" that should already be caught by the "Adapter Device Type: Cpu" check: @n0samu was the one who suggested that a check for just Cpu may be sufficient:
@adrian17 did believe we'd get false negatives though:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See also https://github.com/Modernizr/Modernizr/wiki/Undetectables#general-undetectables. We're just adding more duck-typing guesses, which may be fine, but overall hardware acceleration remains a "General undetectable"
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this modal was here to solve a very specific issue at a specific point in time. All the users we spoke to and got debug info from had the Cpu adapter device type listed, hence I figured it was enough to check for just that. I'm not against expanding the feature to account for other common scenarios where users have hardware acceleration disabled, but I don't know how common any of the additional cases covered by this PR actually are.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @robinmiau Did you have any specific cases of software renderers not being detected properly? If you could list those cases it would be great, because we could make the decision on real data instead of our assumptions.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kjarosh Only the |
||||||||||||||||
|
|
||||||||||||||||


Uh oh!
There was an error while loading. Please reload this page.