KEMBAR78
Add support for frame rate voting by svastven · Pull Request #2205 · JetBrains/compose-multiplatform-core · GitHub
Skip to content

Conversation

@svastven
Copy link

In this PR:

  • Create interface for platform adoption of frame rate voting modifier.
  • Add support for frame rate voting for iOS platform.

Fixes - https://youtrack.jetbrains.com/issue/CMP-7802

Testing

This should be tested by QA

Release Notes

Features - iOS

  • Add support for frame rate voting

@svastven svastven requested review from ASalavei and MatkovIvan June 30, 2025 08:21
@svastven svastven requested review from ASalavei and MatkovIvan June 30, 2025 12:51
Copy link
Member

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

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

LGTM in general, just a few nitpicks/polishing/missing tests

if (frameRate.isNaN() || frameRate < currentFrameRateCategory) {
currentFrameRateCategory = frameRate
}
} else if (frameRate < currentFrameRateCategory || (frameRate.isNaN() && isCurrentFrameRateCategoryUnset)) {
Copy link
Member

Choose a reason for hiding this comment

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

isNaN check should be done before comparison

Copy link
Author

@svastven svastven Jul 2, 2025

Choose a reason for hiding this comment

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

I thought that the comparison would return false is frameRate.isNaN() == true or is that a convention?

Copy link
Member

Choose a reason for hiding this comment

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

NaN is considered greater than any other element including POSITIVE_INFINITY

Found that statement, but it needs to be checked. Anyway, checking NaN before is safer anyway

Copy link
Author

Choose a reason for hiding this comment

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

I didn't know that. Thanks!

@ASalavei
Copy link

ASalavei commented Jul 2, 2025

LGTM, waiting for tests

@svastven svastven force-pushed the svastven/frame-rate-voting branch 2 times, most recently from cffa3e7 to b9e59d9 Compare July 7, 2025 11:59
)
}

protected open val platformContext: PlatformContext get() = TestContext()
Copy link
Member

Choose a reason for hiding this comment

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

Note: It's public APIs for users. I'm not sure that we really want to expose it (even as experimental)

cc @m-sasha as owner of this API

@Test
fun testNoVotedFrameRate() = runTest {
val surface = Surface.makeRasterN32Premul(100, 100)
val owner = RootNodeOwner(
Copy link
Member

Choose a reason for hiding this comment

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

As alternative: Use scene to test integration with public modifiers API. Since finding nodes/"clicking" is problematic, changes can be done via direct setting state values and re-drawing scene.
Not blocking because of it.

@svastven svastven force-pushed the svastven/frame-rate-voting branch from 0c1a786 to e1bdda7 Compare July 10, 2025 07:07
@svastven svastven merged commit 542217e into jb-main Jul 10, 2025
10 checks passed
@svastven svastven deleted the svastven/frame-rate-voting branch July 10, 2025 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants