Giter VIP home page Giter VIP logo

Comments (4)

jonahwilliams avatar jonahwilliams commented on September 22, 2024

The fragment shader execution is already "asynchronous" in that it runs on the GPU timeline, whereas the UI and raster threads are on the CPU timeline. however, if the execution of the shader workload is expensive enough you will find that it will essentially hog the GPU preventing the raster thread from being able to submit workloads, which in turn prevents the raster workload from finishing. This is the limit of splitting up work across threads: you can't increase access of shared resources like disk, network, GPU, et cetera.

Its also possible that certain laptops are falling back to Skia software rendering due to lack of hardware support. I couldn't tell you if this is the case from the information here, but if it was there would be little we could do.

So now I'm looking for alternative solutions. The first thing I tried is limiting the framerate of the background through the ShaderPainter.shouldRepaint method, but due to the high render time this had negligible impact.

That isn't what that method does. It only controls if the paint method is called. If that shader is used in a scene that is included in any part of a frame, whether or not the painter painted or the widgets rebuilt, it gets executed. The only way to limit how often it runs is to cache the rendered results to a texture (see SnapshotWidget for an example of how to do that).

In general, I would recommend designing your application to support the target hardware you want to support. If older laptops are important, then your app/game/et cetera needs to cut costs. You can do that by simplifying the shader, or reducing the amount of work done by reducing the size of the painter. Or find a mechanism to detect older hardware (Android API level?) and substitute a reduced quality effect.

from flutter.

jonahwilliams avatar jonahwilliams commented on September 22, 2024

Oh, if you're running with Skia - you're probably getting some of the SnapshotWidget behavior automatically via raster caching. But that will only get you so far, as once you have to repaint you'll drop the frame again (one of the reasons automatic raster caching is a bad idea)

from flutter.

andy98725 avatar andy98725 commented on September 22, 2024

This was informative. Thank you!

from flutter.

github-actions avatar github-actions commented on September 22, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.