Skip to content

web: Improve software renderer detection#23534

Open
robinmiau wants to merge 2 commits intoruffle-rs:masterfrom
robinmiau:fix-software-renderer-detection
Open

web: Improve software renderer detection#23534
robinmiau wants to merge 2 commits intoruffle-rs:masterfrom
robinmiau:fix-software-renderer-detection

Conversation

@robinmiau
Copy link
Copy Markdown
Contributor

@robinmiau robinmiau commented Apr 25, 2026

Problem

Adapter Device Type: Cpu alone doesn't catch all software renderers. WebGL/ANGLE often reports the device type as Other even 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 driver
  • SwiftShader - Google's software renderer (headless Chrome, CI)
  • llvmpipe / softpipe - Mesa software rasterizers on Linux

The hardware acceleration warning now triggers reliably across all common software rendering scenarios.

@kjarosh kjarosh added A-web Area: Web & Extensions T-feature Type: New Feature (that Flash doesn't have) labels Apr 26, 2026
Comment thread web/packages/core/src/internal/player/inner.tsx Outdated
this.rendererDebugInfo.includes("SwiftShader") ||
this.rendererDebugInfo.includes("llvmpipe") ||
this.rendererDebugInfo.includes("softpipe");
if (isSoftwareRenderer) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Contributor

@danielhjacobs danielhjacobs Apr 27, 2026

Choose a reason for hiding this comment

The 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):

try {
if (localStorage === null) {
return false;
}
} catch (_e: unknown) {
return false;
}

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

if (isSoftwareRenderer) {
this.container.addEventListener(
"mouseover",
this.openHardwareAccelerationModal.bind(this),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

CC @danielhjacobs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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:

https://github.com/gfx-rs/wgpu/blob/868eb17098dadee1edaf9b04839262223bdf5a75/wgpu-hal/src/gles/adapter.rs#L144-L156

@n0samu was the one who suggested that a check for just Cpu may be sufficient:

image

@adrian17 did believe we'd get false negatives though:

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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"

Copy link
Copy Markdown
Member

@n0samu n0samu May 4, 2026

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kjarosh Only the Microsoft Basic Render Driver when hardware acceleration was disabled in Opera GX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-web Area: Web & Extensions T-feature Type: New Feature (that Flash doesn't have)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants