[macOS] Is it possible to implement “optimal devic...
# compose-desktop
o
[macOS] Is it possible to implement “optimal device for the view” as described in this document? https://developer.apple.com/documentation/metal/gpu_selection_in_macos/selecting_device_objects_for_graphics_rendering Currently CfD applications enable discrete GPU, which is suboptimal for battery life, and also causes some screen blinking when app is launching (pre M1 chips). I quickly looked through Skia’s Metal binding (they are complicated, so I’m not sure), but I couldn’t find any relevant code.
o
it is not correct, we usually select integrated card, unless current active adapter is discrete: https://github.com/JetBrains/skiko/blob/8999b92e2e28442b7c00fb2353e832cefc3545b8/skiko/src/jvmMain/objectiveC/macos/MetalRedrawer.mm#L143
o
Indeed I made a mistake in diagnostics, it doesn’t enable discrete GPU, but it keeps it forever if any other app enables it. I couldn’t find device switching event handling as described in the document in the code, but I’m not an expert 🙂
l
Wouldn't it be possible to not influence which GPU is used or is kept being used by default, but have an API to allow developers to change that dynamically, so it can be turned on for graphically intensive tasks or based on a user setting/choice?
o
Yes, it was implemented via JVM properties and will be available in upcomping Compose builds. See https://github.com/JetBrains/skiko/pull/106