Skip to content

Commit

Permalink
Fix Swappy sometimes not being found
Browse files Browse the repository at this point in the history
Change Swappy defaults in Android sample
  • Loading branch information
darksylinc committed Apr 12, 2024
1 parent 5e79187 commit ed11169
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMake/Packages/FindAndroidSwappy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use_pkgconfig(AndroidSwappy_PKGC AndroidSwappy)

findpkg_framework(AndroidSwappy)

find_path(AndroidSwappy_INCLUDE_DIR NAMES swappyVk.h HINTS ${AndroidSwappy_FRAMEWORK_INCLUDES} ${AndroidSwappy_INC_SEARCH_PATH} ${AndroidSwappy_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "swappy")
find_path(AndroidSwappy_INCLUDE_DIR NAMES swappyVk.h HINTS ${AndroidSwappy_FRAMEWORK_INCLUDES} ${AndroidSwappy_INC_SEARCH_PATH} ${AndroidSwappy_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "swappy" "swappy/swappy")
find_library(AndroidSwappy_LIBRARY NAMES swappy_static HINTS ${AndroidSwappy_LIB_SEARCH_PATH} ${AndroidSwappy_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel debug)

findpkg_finish(AndroidSwappy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ void android_main( struct android_app *app )
Demo::AndroidSystems::setAndroidApp( app );
Demo::AndroidSystems::setJniProvider( &g_demoJniProvider );

// !!! IMPORTANT !!!
//
// Swappy defaults to AutoVSyncInterval_AutoPipeline.
// But we change it to PipelineForcedOn because it's the behavior most users coming from PC
// expect (AutoVSyncInterval_AutoPipeline can be counter-intuitive because it can lock the
// pacing to lower framerates)
//
// What actual setting you wish to use (or expose to user) depends on how much love,
// testing & optimization you put into your Android app.
//
// !!! IMPORTANT !!!
Ogre::VulkanAndroidWindow::setFramePacingSwappyAutoMode(
Ogre::VulkanAndroidWindow::PipelineForcedOn );

// Used to poll the events in the main loop
int events;
android_poll_source *source;
Expand Down

0 comments on commit ed11169

Please sign in to comment.