web: Improve software renderer detection#23534
web: Improve software renderer detection#23534robinmiau wants to merge 2 commits intoruffle-rs:masterfrom
Conversation
| this.rendererDebugInfo.includes("SwiftShader") || | ||
| this.rendererDebugInfo.includes("llvmpipe") || | ||
| this.rendererDebugInfo.includes("softpipe"); | ||
| if (isSoftwareRenderer) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Maybe a "Don't show again (for this website?)" option would be useful?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| if (isSoftwareRenderer) { | ||
| this.container.addEventListener( | ||
| "mouseover", | ||
| this.openHardwareAccelerationModal.bind(this), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
@kjarosh Only the Microsoft Basic Render Driver when hardware acceleration was disabled in Opera GX.
Problem
Adapter Device Type: Cpualone doesn't catch all software renderers. WebGL/ANGLE often reports the device type asOthereven when no hardware acceleration is active.Changes
Added checks for additional known software renderers alongside the existing check:
VirtualGpu- virtual GPU environments (VMs, cloud)Microsoft Basic Render Driver- WARP fallback driverSwiftShader- Google's software renderer (headless Chrome, CI)llvmpipe/softpipe- Mesa software rasterizers on LinuxThe hardware acceleration warning now triggers reliably across all common software rendering scenarios.