Skip to content
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

Unable to Determine Active Rendering Mode at Runtime for Optimizing UX Animations #17760

Open
Shayko94 opened this issue Dec 12, 2024 · 3 comments

Comments

@Shayko94
Copy link

Is your feature request related to a problem? Please describe.

I'm using Avalonia 11 and configuring multiple rendering modes in the Win32PlatformOptions.RenderingMode property. For example:

appBuilder = appBuilder.With(new Win32PlatformOptions
{
    RenderingMode = new[]
    {
        Win32RenderingMode.Vulkan,
        Win32RenderingMode.AngleEgl,
        Win32RenderingMode.Software
    }
});

While this setup works for prioritizing the rendering backends, there seems to be no reliable way to determine which rendering mode is actually active at runtime. This is critical for applications that require runtime adaptation of animations and UI effects based on the rendering backend.

For instance, I need to scale down or disable certain animations if the Software rendering mode is active, as they are too demanding for software rendering and degrade the user experience. On the other hand, I want to keep full animations for Vulkan.

None of the currently available APIs (RenderingSubsystemName, RendererDiagnostics, or log outputs) provide the necessary information about the active rendering backend. The application cannot adapt animations dynamically, leading to performance issues when using demanding animations on less capable rendering backends.

Describe the solution you'd like

Introduce an API or property to expose the active rendering mode at runtime, such as:

string activeRenderingMode = Avalonia.Rendering.GetActiveRenderingMode(); // Returns "Vulkan", "AngleEgl", or "Software"

Alternatively, make the information available via RendererDiagnostics or RenderingSubsystemName for more detailed insights into the rendering backend.

Describe alternatives you've considered

No response

Additional context

No response

@maxkatz6
Copy link
Member

It makes sense to have diagnostic log output or add current renderer information overlay.
It's also already possible to detect GPU features by using GPU interop APIs, making it possible to write Vulkan integration or DirectX integration.

But not sure about idea of "reduce animations on software renderer". Software renderer is not necessarily slow.

Having accessibility preferences is more important, if user simply prefers less animations, even on GPU. Something like https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion, which is completely independent from the rendering mode.

@Shayko94
Copy link
Author

Thank you for your response.
I completely agree that the software renderer is not inherently slow, and in many cases, it performs exceptionally well. However, in my experience, certain scenarios—especially involving elements with complex shadows or layered effects—tend to exhibit noticeably better performance with Vulkan compared to the software renderer.
This difference can directly impact the smoothness of the UI.
It would be nice to have this information available, even if not primarily for functional purposes, but at least as an informative feature.

@kekekeks
Copy link
Member

WPF exposes graphics rendering tiers instead of fine-grained details.

I think we should go with that route as well.

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

No branches or pull requests

3 participants