rework how dynamic resolution scaling is specified

- now the DynamicResolutionOptions don't specify the target frame rate,
  they only specify how to scale this given view

- there is a new FrameRateOptions setting on Renderer, which is used
  to specify the desired target frame rate for the whole Renderer

- the frame rate is now specified as a "frame interval" in units of
  the display frame period.

- the display frame period is (indirectly) set via DisplayInfo.

In other words, the use must set (and update) DisplayInfo properly
(the default are reasonable, but assume 60 Hz). They must also set the
desired interval (default is 1, which is probably what you want).
Finally they must enable dynamic scaling per View, the defaults are
also reasonable.

Currently Renderer doesn't attempt (yet) to actually target the
requested frame rate, so it's up to the caller to push frames at the
desired speed. however, dynamic resolution, like before, will attempt
to shrink work to fit the target.
This commit is contained in:
Pixelflinger
2020-04-01 16:42:34 -07:00
committed by Mathias Agopian
parent b2dd6683be
commit 746e273336
13 changed files with 317 additions and 158 deletions

View File

@@ -159,20 +159,15 @@ Java_com_google_android_filament_View_nGetDithering(JNIEnv*, jclass,
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetDynamicResolutionOptions(JNIEnv*,
jclass, jlong nativeView, jboolean enabled, jboolean homogeneousScaling,
jfloat targetFrameTimeMilli, jfloat headRoomRatio, jfloat scaleRate,
jfloat minScale, jfloat maxScale, jint history, jint quality) {
Java_com_google_android_filament_View_nSetDynamicResolutionOptions(JNIEnv*, jclass, jlong nativeView,
jboolean enabled, jboolean homogeneousScaling,
jfloat minScale, jfloat maxScale, jint quality) {
View* view = (View*)nativeView;
View::DynamicResolutionOptions options;
options.enabled = enabled;
options.homogeneousScaling = homogeneousScaling;
options.targetFrameTimeMilli = targetFrameTimeMilli;
options.headRoomRatio = headRoomRatio;
options.scaleRate = scaleRate;
options.minScale = filament::math::float2{ minScale };
options.maxScale = filament::math::float2{ maxScale };
options.history = (uint8_t)history;
options.quality = (View::QualityLevel)quality;
view->setDynamicResolutionOptions(options);
}