Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion web/packages/core/src/internal/player/inner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,21 @@ 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 softwareRendererIndicators = [
"Adapter Device Type: Cpu",
"Adapter Device Type: VirtualGpu",
"Microsoft Basic Render Driver",
"SwiftShader",
"llvmpipe",
"softpipe",
];
const isSoftwareRenderer = softwareRendererIndicators.some(
(indicator) => this.rendererDebugInfo.includes(indicator),
);
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.

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.

Expand Down
Loading