Rename Swappy to SwappyGL.
Also splits C entry points of swappyVK to a new file.
Test: "./gradlew gamesdkZip"
Test: systrace sample app: cube
Test: systrace sample app: bouncyball
Change-Id: Ie869b67bed7e1b13c8125757f65c952c9a74f5b3
Fix: 132688627
diff --git a/include/swappy/swappy.h b/include/swappy/swappyGL.h
similarity index 71%
rename from include/swappy/swappy.h
rename to include/swappy/swappyGL.h
index 5a5bfa6..bb6c113 100644
--- a/include/swappy/swappy.h
+++ b/include/swappy/swappyGL.h
@@ -14,8 +14,12 @@
* limitations under the License.
*/
+// OpenGL part of swappy
+
#pragma once
+#include "swappy_common.h"
+
#include <stdint.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -25,35 +29,30 @@
extern "C" {
#endif
-// swap interval constant helpers
-#define SWAPPY_SWAP_60FPS (16666667L)
-#define SWAPPY_SWAP_30FPS (33333333L)
-#define SWAPPY_SWAP_20FPS (50000000L)
-
// Initialize Swappy, getting the required Android parameters from the display subsystem via JNI
-void Swappy_init(JNIEnv *env, jobject jactivity);
+void SwappyGL_init(JNIEnv *env, jobject jactivity);
// Returns true if Swappy was successfully initialized.
// Returns false if either the 'swappy.disable' system property is not 'false'
// or the required OpenGL extensions are not available for Swappy to work.
-bool Swappy_isEnabled();
+bool SwappyGL_isEnabled();
// Destroy resources and stop all threads that swappy has created
-void Swappy_destroy();
+void SwappyGL_destroy();
// Replace calls to eglSwapBuffers with this. Swappy will wait for the previous frame's
// buffer to be processed by the GPU before actually calling eglSwapBuffers.
-bool Swappy_swap(EGLDisplay display, EGLSurface surface);
+bool SwappyGL_swap(EGLDisplay display, EGLSurface surface);
// Parameter setters
-void Swappy_setRefreshPeriod(uint64_t period_ns);
-void Swappy_setUseAffinity(bool tf);
-void Swappy_setSwapIntervalNS(uint64_t swap_ns);
+void SwappyGL_setRefreshPeriod(uint64_t period_ns);
+void SwappyGL_setUseAffinity(bool tf);
+void SwappyGL_setSwapIntervalNS(uint64_t swap_ns);
// Parameter getters
-uint64_t Swappy_getRefreshPeriodNanos();
-uint64_t Swappy_getSwapIntervalNS();
-bool Swappy_getUseAffinity();
+uint64_t SwappyGL_getRefreshPeriodNanos();
+uint64_t SwappyGL_getSwapIntervalNS();
+bool SwappyGL_getUseAffinity();
#ifdef __cplusplus
};
diff --git a/include/swappy/swappy_extra.h b/include/swappy/swappyGL_extra.h
similarity index 91%
rename from include/swappy/swappy_extra.h
rename to include/swappy/swappyGL_extra.h
index 1b8e347..d66315f 100644
--- a/include/swappy/swappy_extra.h
+++ b/include/swappy/swappyGL_extra.h
@@ -23,7 +23,6 @@
#define MAX_FRAME_BUCKETS 6
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -32,7 +31,7 @@
// call the function below.
// This function *must* be called before the first Swappy_swap() call.
// Afterwards, call this function every choreographer tick.
-void Swappy_onChoreographer(int64_t frameTimeNanos);
+void SwappyGL_onChoreographer(int64_t frameTimeNanos);
// Pass callbacks to be called each frame to trace execution
struct SwappyTracer {
@@ -45,7 +44,7 @@
void (*swapIntervalChanged)(void*);
};
-void Swappy_injectTracer(const SwappyTracer *t);
+void SwappyGL_injectTracer(const SwappyTracer *t);
// Toggle auto-swap interval detection on/off
// By default, Swappy will adjust the swap interval based on actual frame rendering time.
@@ -53,12 +52,12 @@
// Swappy_setSwapIntervalNS. This will temporarily override Swappy's frame timings but, unless
// Swappy_setAutoSwapInterval(false) is called, the timings will continue to be be updated
// dynamically, so the swap interval may change.
-void Swappy_setAutoSwapInterval(bool enabled);
+void SwappyGL_setAutoSwapInterval(bool enabled);
// Toggle auto-pipeline mode on/off
// By default, if auto-swap interval is on, auto-pipelining is on and Swappy will try to reduce
// latency by scheduling cpu and gpu work in the same pipeline stage, if it fits.
-void Swappy_setAutoPipelineMode(bool enabled);
+void SwappyGL_setAutoPipelineMode(bool enabled);
// Toggle statistics collection on/off
// By default, stats collection is off and there is no overhead related to stats.
@@ -67,9 +66,9 @@
// do any CPU related work.
// Stats will be logged to logcat with a 'FrameStatistics' tag.
// An app can get the stats by calling Swappy_getStats.
-void Swappy_enableStats(bool enabled);
+void SwappyGL_enableStats(bool enabled);
-struct Swappy_Stats {
+struct SwappyStats {
// total frames swapped by swappy
uint64_t totalFrames;
@@ -100,9 +99,9 @@
uint64_t latencyFrames[MAX_FRAME_BUCKETS];
};
-void Swappy_recordFrameStart(EGLDisplay display, EGLSurface surface);
+void SwappyGL_recordFrameStart(EGLDisplay display, EGLSurface surface);
-void Swappy_getStats(Swappy_Stats *);
+void SwappyGL_getStats(SwappyStats *);
#ifdef __cplusplus
};
diff --git a/include/swappyVk/SwappyVk.h b/include/swappy/swappyVk.h
similarity index 96%
rename from include/swappyVk/SwappyVk.h
rename to include/swappy/swappyVk.h
index 94d0c15..189af62 100644
--- a/include/swappyVk/SwappyVk.h
+++ b/include/swappy/swappyVk.h
@@ -14,8 +14,11 @@
* limitations under the License.
*/
-#ifndef SWAPPYVK_H
-#define SWAPPYVK_H
+// Vulkan part of swappy
+
+#pragma once
+
+#include "swappy_common.h"
#if (defined ANDROID) && (defined SWAPPYVK_USE_WRAPPER)
#include <vulkan_wrapper.h>
@@ -27,12 +30,6 @@
extern "C" {
#endif
-// TODO: merge with the constants at include/swappy.h
-// Swap interval constant helpers:
-#define SWAPPY_SWAP_60FPS (16666667L)
-#define SWAPPY_SWAP_30FPS (33333333L)
-#define SWAPPY_SWAP_20FPS (50000000L)
-
/**
* Determine any Vulkan device extensions that must be enabled for a new
* VkDevice.
@@ -196,5 +193,3 @@
#ifdef __cplusplus
} // extern "C"
#endif
-
-#endif //SWAPPYVK_H
diff --git a/include/swappy/swappy_common.h b/include/swappy/swappy_common.h
new file mode 100644
index 0000000..61b9658
--- /dev/null
+++ b/include/swappy/swappy_common.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Common part between swappyGL.h and swappyVk.h
+
+#pragma once
+
+// swap interval constant helpers
+#define SWAPPY_SWAP_60FPS (16666667L)
+#define SWAPPY_SWAP_30FPS (33333333L)
+#define SWAPPY_SWAP_20FPS (50000000L)
\ No newline at end of file
diff --git a/include/swappyVk/OWNERS b/include/swappyVk/OWNERS
deleted file mode 100644
index d79d861..0000000
--- a/include/swappyVk/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include ../../src/swappy/OWNERS
diff --git a/samples/bouncyball/app/src/main/cpp/Orbit.cpp b/samples/bouncyball/app/src/main/cpp/Orbit.cpp
index d9a710d..1c97d8e 100644
--- a/samples/bouncyball/app/src/main/cpp/Orbit.cpp
+++ b/samples/bouncyball/app/src/main/cpp/Orbit.cpp
@@ -26,8 +26,8 @@
#include "Log.h"
#include "Settings.h"
-#include "swappy/swappy.h"
-#include "swappy/swappy_extra.h"
+#include "swappy/swappyGL.h"
+#include "swappy/swappyGL_extra.h"
#include "Renderer.h"
@@ -51,7 +51,7 @@
}
void swapIntervalChangedCallback(void *) {
- uint64_t swap_ns = Swappy_getSwapIntervalNS();
+ uint64_t swap_ns = SwappyGL_getSwapIntervalNS();
ALOGI("Swappy changed swap interval to %.2fms", swap_ns / 1e6f);
}
@@ -60,7 +60,7 @@
// Get the Renderer instance to create it
Renderer::getInstance();
- Swappy_init(env, activity);
+ SwappyGL_init(env, activity);
SwappyTracer tracers;
tracers.preWait = nullptr;
@@ -71,7 +71,7 @@
tracers.userData = nullptr;
tracers.swapIntervalChanged = swapIntervalChangedCallback;
- Swappy_injectTracer(&tracers);
+ SwappyGL_injectTracer(&tracers);
}
JNIEXPORT void JNICALL
@@ -109,7 +109,7 @@
JNIEXPORT void JNICALL
Java_com_prefabulated_bouncyball_OrbitActivity_nSetAutoSwapInterval(JNIEnv *env, jobject /* this */,
jboolean enabled) {
- Swappy_setAutoSwapInterval(enabled);
+ SwappyGL_setAutoSwapInterval(enabled);
}
JNIEXPORT float JNICALL
@@ -130,16 +130,16 @@
jint bin) {
static bool enabled = false;
if (!enabled) {
- Swappy_enableStats(true);
+ SwappyGL_enableStats(true);
enabled = true;
}
// stats are read one by one, query once per stat
- static Swappy_Stats stats;
+ static SwappyStats stats;
static int stat_idx = -1;
if (stat_idx != stat) {
- Swappy_getStats(&stats);
+ SwappyGL_getStats(&stats);
stat_idx = stat;
}
diff --git a/samples/bouncyball/app/src/main/cpp/Renderer.cpp b/samples/bouncyball/app/src/main/cpp/Renderer.cpp
index c0c4c1e..19e0db2 100644
--- a/samples/bouncyball/app/src/main/cpp/Renderer.cpp
+++ b/samples/bouncyball/app/src/main/cpp/Renderer.cpp
@@ -26,8 +26,8 @@
#include "Log.h"
-#include "swappy/swappy.h"
-#include "swappy/swappy_extra.h"
+#include "swappy/swappyGL.h"
+#include "swappy/swappyGL_extra.h"
#include "Circle.h"
using namespace std::chrono_literals;
@@ -214,7 +214,7 @@
return;
}
- Swappy_recordFrameStart(threadState->display, threadState->surface);
+ SwappyGL_recordFrameStart(threadState->display, threadState->surface);
calculateFps();
@@ -245,7 +245,7 @@
Circle::draw(aspectRatio, circles, mWorkload);
- Swappy_swap(threadState->display, threadState->surface);
+ SwappyGL_swap(threadState->display, threadState->surface);
// If we're still started, request another frame
requestDraw();
diff --git a/samples/bouncyball/app/src/main/cpp/Settings.cpp b/samples/bouncyball/app/src/main/cpp/Settings.cpp
index 525187d..76823a1 100644
--- a/samples/bouncyball/app/src/main/cpp/Settings.cpp
+++ b/samples/bouncyball/app/src/main/cpp/Settings.cpp
@@ -20,7 +20,7 @@
#include <memory>
-#include "swappy/swappy.h"
+#include "swappy/swappyGL.h"
#include "Log.h"
namespace samples {
@@ -37,11 +37,11 @@
void Settings::setPreference(std::string key, std::string value) {
if (key == "refresh_period") {
- Swappy_setRefreshPeriod(std::stoll(value));
+ SwappyGL_setRefreshPeriod(std::stoll(value));
} else if (key == "swap_interval") {
- Swappy_setSwapIntervalNS(std::stoi(value) * 1e6);
+ SwappyGL_setSwapIntervalNS(std::stoi(value) * 1e6);
} else if (key == "use_affinity") {
- Swappy_setUseAffinity(value == "true");
+ SwappyGL_setUseAffinity(value == "true");
} else if (key == "hot_pocket") {
std::lock_guard<std::mutex> lock(mMutex);
mHotPocket = (value == "true");
@@ -55,15 +55,15 @@
}
std::chrono::nanoseconds Settings::getRefreshPeriod() const {
- return std::chrono::nanoseconds(Swappy_getRefreshPeriodNanos());
+ return std::chrono::nanoseconds(SwappyGL_getRefreshPeriodNanos());
}
int32_t Settings::getSwapIntervalNS() const {
- return Swappy_getSwapIntervalNS();
+ return SwappyGL_getSwapIntervalNS();
}
bool Settings::getUseAffinity() const {
- return Swappy_getUseAffinity();
+ return SwappyGL_getUseAffinity();
}
bool Settings::getHotPocket() const {
diff --git a/src/swappy/CMakeLists.txt b/src/swappy/CMakeLists.txt
index 802bf0f..7ab7134 100644
--- a/src/swappy/CMakeLists.txt
+++ b/src/swappy/CMakeLists.txt
@@ -38,9 +38,10 @@
${SOURCE_LOCATION_COMMON}/Thread.cpp
${SOURCE_LOCATION_COMMON}/SwappyCommon.cpp
${SOURCE_LOCATION_OPENGL}/EGL.cpp
- ${SOURCE_LOCATION_OPENGL}/Swappy_c.cpp
- ${SOURCE_LOCATION_OPENGL}/Swappy.cpp
+ ${SOURCE_LOCATION_OPENGL}/swappyGL_c.cpp
+ ${SOURCE_LOCATION_OPENGL}/SwappyGL.cpp
${ANDROID_NDK}/sources/third_party/vulkan/src/common/vulkan_wrapper.cpp
+ ${SOURCE_LOCATION_VULKAN}/swappyVk_c.cpp
${SOURCE_LOCATION_VULKAN}/SwappyVk.cpp
${SOURCE_LOCATION_VULKAN}/SwappyVkBase.cpp
${SOURCE_LOCATION_VULKAN}/SwappyVkFallback.cpp
@@ -56,7 +57,7 @@
SHARED
- ${SOURCE_LOCATION_OPENGL}/Swappy_c.cpp)
+ ${SOURCE_LOCATION_OPENGL}/swappyGL_c.cpp)
# Looks like I need to specify at least one file to build,
# the result .so size suggests it's including the rest of the
# source files from the library
diff --git a/src/swappy/common/FrameStatistics.cpp b/src/swappy/common/FrameStatistics.cpp
index cb16841..c3ea474 100644
--- a/src/swappy/common/FrameStatistics.cpp
+++ b/src/swappy/common/FrameStatistics.cpp
@@ -153,7 +153,7 @@
previousLogTime = std::chrono::steady_clock::now();
}
-Swappy_Stats FrameStatistics::getStats() {
+SwappyStats FrameStatistics::getStats() {
std::lock_guard<std::mutex> lock(mMutex);
return mStats;
}
diff --git a/src/swappy/common/FrameStatistics.h b/src/swappy/common/FrameStatistics.h
index fa8711b..7c5e996 100644
--- a/src/swappy/common/FrameStatistics.h
+++ b/src/swappy/common/FrameStatistics.h
@@ -23,7 +23,7 @@
#include <map>
#include <vector>
-#include <swappy/swappy_extra.h>
+#include <swappy/swappyGL_extra.h>
using TimePoint = std::chrono::steady_clock::time_point;
using namespace std::chrono_literals;
@@ -40,7 +40,7 @@
void capture(EGLDisplay dpy, EGLSurface surface);
- Swappy_Stats getStats();
+ SwappyStats getStats();
private:
static constexpr int MAX_FRAME_LAG = 10;
@@ -67,7 +67,7 @@
EGLnsecsANDROID mPrevFrameTime = 0;
std::mutex mMutex;
- Swappy_Stats mStats GUARDED_BY(mMutex)= {};
+ SwappyStats mStats GUARDED_BY(mMutex)= {};
};
} //namespace swappy
diff --git a/src/swappy/common/SwappyCommon.h b/src/swappy/common/SwappyCommon.h
index 56e258f..5d2448f 100644
--- a/src/swappy/common/SwappyCommon.h
+++ b/src/swappy/common/SwappyCommon.h
@@ -24,8 +24,8 @@
#include <list>
#include <atomic>
-#include "swappy/swappy.h"
-#include "swappy/swappy_extra.h"
+#include "swappy/swappyGL.h"
+#include "swappy/swappyGL_extra.h"
#include "Thread.h"
#include "ChoreographerFilter.h"
#include "ChoreographerThread.h"
diff --git a/src/swappy/opengl/Swappy.cpp b/src/swappy/opengl/SwappyGL.cpp
similarity index 76%
rename from src/swappy/opengl/Swappy.cpp
rename to src/swappy/opengl/SwappyGL.cpp
index 04fc432..9a565cb 100644
--- a/src/swappy/opengl/Swappy.cpp
+++ b/src/swappy/opengl/SwappyGL.cpp
@@ -14,30 +14,30 @@
* limitations under the License.
*/
-#include "Swappy.h"
+#include "SwappyGL.h"
#include <cmath>
#include <thread>
#include <cstdlib>
#include <cinttypes>
+#include "Log.h"
+#include "Trace.h"
+
#include "Thread.h"
#include "SystemProperties.h"
#define LOG_TAG "Swappy"
-#include "Log.h"
-#include "Trace.h"
-
namespace swappy {
using std::chrono::milliseconds;
using std::chrono::nanoseconds;
-std::mutex Swappy::sInstanceMutex;
-std::unique_ptr<Swappy> Swappy::sInstance;
+std::mutex SwappyGL::sInstanceMutex;
+std::unique_ptr<SwappyGL> SwappyGL::sInstance;
-void Swappy::init(JNIEnv *env, jobject jactivity) {
+void SwappyGL::init(JNIEnv *env, jobject jactivity) {
jclass activityClass = env->FindClass("android/app/NativeActivity");
jclass windowManagerClass = env->FindClass("android/view/WindowManager");
jclass displayClass = env->FindClass("android/view/Display");
@@ -93,26 +93,30 @@
using std::chrono::nanoseconds;
JavaVM *vm;
env->GetJavaVM(&vm);
- Swappy::init(
+ SwappyGL::init(
vm,
nanoseconds(vsyncPeriodNanos),
nanoseconds(appVsyncOffsetNanos),
nanoseconds(sfVsyncOffsetNanos));
}
-void Swappy::init(JavaVM *vm, nanoseconds refreshPeriod, nanoseconds appOffset, nanoseconds sfOffset) {
+void SwappyGL::init(JavaVM *vm,
+ nanoseconds refreshPeriod,
+ nanoseconds appOffset,
+ nanoseconds sfOffset) {
std::lock_guard<std::mutex> lock(sInstanceMutex);
if (sInstance) {
- ALOGE("Attempted to initialize Swappy twice");
+ ALOGE("Attempted to initialize SwappyGL twice");
return;
}
- sInstance = std::make_unique<Swappy>(vm, refreshPeriod, appOffset, sfOffset, ConstructorTag{});
+ sInstance =
+ std::make_unique<SwappyGL>(vm, refreshPeriod, appOffset, sfOffset, ConstructorTag{});
}
-void Swappy::onChoreographer(int64_t frameTimeNanos) {
+void SwappyGL::onChoreographer(int64_t frameTimeNanos) {
TRACE_CALL();
- Swappy *swappy = getInstance();
+ SwappyGL *swappy = getInstance();
if (!swappy) {
ALOGE("Failed to get Swappy instance in swap");
return;
@@ -121,12 +125,12 @@
swappy->mCommonBase.onChoreographer(frameTimeNanos);
}
-bool Swappy::swap(EGLDisplay display, EGLSurface surface) {
+bool SwappyGL::swap(EGLDisplay display, EGLSurface surface) {
TRACE_CALL();
- Swappy *swappy = getInstance();
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in swap");
+ ALOGE("Failed to get SwappyGL instance in swap");
return EGL_FALSE;
}
@@ -139,7 +143,7 @@
-bool Swappy::lastFrameIsComplete(EGLDisplay display) {
+bool SwappyGL::lastFrameIsComplete(EGLDisplay display) {
if (!getEgl()->lastFrameIsComplete(display)) {
gamesdk::ScopedTrace trace("lastFrameIncomplete");
ALOGV("lastFrameIncomplete");
@@ -148,7 +152,7 @@
return true;
}
-bool Swappy::swapInternal(EGLDisplay display, EGLSurface surface) {
+bool SwappyGL::swapInternal(EGLDisplay display, EGLSurface surface) {
const SwappyCommon::SwapHandlers handlers = {
.lastFrameIsComplete = [&]() { return lastFrameIsComplete(display); },
.getPrevFrameGpuTime = [&]() { return getEgl()->getFencePendingTime(); },
@@ -172,46 +176,46 @@
return swapBuffersResult;
}
-void Swappy::addTracer(const SwappyTracer *tracer) {
- Swappy *swappy = getInstance();
+void SwappyGL::addTracer(const SwappyTracer *tracer) {
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in addTracer");
+ ALOGE("Failed to get SwappyGL instance in addTracer");
return;
}
swappy->mCommonBase.addTracerCallbacks(*tracer);
}
-uint64_t Swappy::getSwapIntervalNS() {
- Swappy *swappy = getInstance();
+uint64_t SwappyGL::getSwapIntervalNS() {
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in getSwapIntervalNS");
+ ALOGE("Failed to get SwappyGL instance in getSwapIntervalNS");
return -1;
}
return swappy->mCommonBase.getSwapIntervalNS();
};
-void Swappy::setAutoSwapInterval(bool enabled) {
- Swappy *swappy = getInstance();
+void SwappyGL::setAutoSwapInterval(bool enabled) {
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in setAutoSwapInterval");
+ ALOGE("Failed to get SwappyGL instance in setAutoSwapInterval");
return;
}
swappy->mCommonBase.setAutoSwapInterval(enabled);
}
-void Swappy::setAutoPipelineMode(bool enabled) {
- Swappy *swappy = getInstance();
+void SwappyGL::setAutoPipelineMode(bool enabled) {
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in setAutoPipelineMode");
+ ALOGE("Failed to get SwappyGL instance in setAutoPipelineMode");
return;
}
swappy->mCommonBase.setAutoPipelineMode(enabled);
}
-void Swappy::enableStats(bool enabled) {
- Swappy *swappy = getInstance();
+void SwappyGL::enableStats(bool enabled) {
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in enableStats");
+ ALOGE("Failed to get SwappyGL instance in enableStats");
return;
}
@@ -234,9 +238,9 @@
}
}
-void Swappy::recordFrameStart(EGLDisplay display, EGLSurface surface) {
+void SwappyGL::recordFrameStart(EGLDisplay display, EGLSurface surface) {
TRACE_CALL();
- Swappy *swappy = getInstance();
+ SwappyGL *swappy = getInstance();
if (!swappy) {
ALOGE("Failed to get Swappy instance in recordFrameStart");
return;
@@ -246,10 +250,10 @@
swappy->mFrameStatistics->capture(display, surface);
}
-void Swappy::getStats(Swappy_Stats *stats) {
- Swappy *swappy = getInstance();
+void SwappyGL::getStats(SwappyStats *stats) {
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in getStats");
+ ALOGE("Failed to get SwappyGL instance in getStats");
return;
}
@@ -257,26 +261,26 @@
*stats = swappy->mFrameStatistics->getStats();
}
-Swappy *Swappy::getInstance() {
+SwappyGL *SwappyGL::getInstance() {
std::lock_guard<std::mutex> lock(sInstanceMutex);
return sInstance.get();
}
-bool Swappy::isEnabled() {
- Swappy *swappy = getInstance();
+bool SwappyGL::isEnabled() {
+ SwappyGL *swappy = getInstance();
if (!swappy) {
- ALOGE("Failed to get Swappy instance in getStats");
+ ALOGE("Failed to get SwappyGL instance in getStats");
return false;
}
return swappy->enabled();
}
-void Swappy::destroyInstance() {
+void SwappyGL::destroyInstance() {
std::lock_guard<std::mutex> lock(sInstanceMutex);
sInstance.reset();
}
-EGL *Swappy::getEgl() {
+EGL *SwappyGL::getEgl() {
static thread_local EGL *egl = nullptr;
if (!egl) {
std::lock_guard<std::mutex> lock(mEglMutex);
@@ -285,7 +289,7 @@
return egl;
}
-Swappy::Swappy(JavaVM *vm,
+SwappyGL::SwappyGL(JavaVM *vm,
nanoseconds refreshPeriod,
nanoseconds appOffset,
nanoseconds sfOffset,
@@ -313,11 +317,11 @@
(long long)sfOffset.count());
}
-void Swappy::resetSyncFence(EGLDisplay display) {
+void SwappyGL::resetSyncFence(EGLDisplay display) {
getEgl()->resetSyncFence(display);
}
-bool Swappy::setPresentationTime(EGLDisplay display, EGLSurface surface) {
+bool SwappyGL::setPresentationTime(EGLDisplay display, EGLSurface surface) {
TRACE_CALL();
// if we are too close to the vsync, there is no need to set presentation time
diff --git a/src/swappy/opengl/Swappy.h b/src/swappy/opengl/SwappyGL.h
similarity index 86%
rename from src/swappy/opengl/Swappy.h
rename to src/swappy/opengl/SwappyGL.h
index b7d9863..6e00922 100644
--- a/src/swappy/opengl/Swappy.h
+++ b/src/swappy/opengl/SwappyGL.h
@@ -20,8 +20,8 @@
#include <chrono>
#include <mutex>
-#include "swappy/swappy.h"
-#include "swappy/swappy_extra.h"
+#include "swappy/swappyGL.h"
+#include "swappy/swappyGL_extra.h"
#include "SwappyCommon.h"
#include "EGL.h"
@@ -34,17 +34,17 @@
using namespace std::chrono_literals;
-class Swappy {
+class SwappyGL {
private:
// Allows construction with std::unique_ptr from a static method, but disallows construction
// outside of the class since no one else can construct a ConstructorTag
struct ConstructorTag {};
public:
- Swappy(JavaVM *vm,
- std::chrono::nanoseconds refreshPeriod,
- std::chrono::nanoseconds appOffset,
- std::chrono::nanoseconds sfOffset,
- ConstructorTag);
+ SwappyGL(JavaVM *vm,
+ std::chrono::nanoseconds refreshPeriod,
+ std::chrono::nanoseconds appOffset,
+ std::chrono::nanoseconds sfOffset,
+ ConstructorTag);
static void init(JNIEnv *env, jobject jactivity);
@@ -63,7 +63,7 @@
static void enableStats(bool enabled);
static void recordFrameStart(EGLDisplay display, EGLSurface surface);
- static void getStats(Swappy_Stats *stats);
+ static void getStats(SwappyStats *stats);
static bool isEnabled();
static void destroyInstance();
@@ -73,7 +73,7 @@
std::chrono::nanoseconds appOffset,
std::chrono::nanoseconds sfOffset);
- static Swappy *getInstance();
+ static SwappyGL *getInstance();
bool enabled() const { return !mDisableSwappy; }
@@ -93,7 +93,7 @@
bool mDisableSwappy = false;
static std::mutex sInstanceMutex;
- static std::unique_ptr<Swappy> sInstance;
+ static std::unique_ptr<SwappyGL> sInstance;
std::mutex mEglMutex;
std::shared_ptr<EGL> mEgl;
diff --git a/src/swappy/opengl/Swappy_c.cpp b/src/swappy/opengl/Swappy_c.cpp
deleted file mode 100644
index dfb6a7a..0000000
--- a/src/swappy/opengl/Swappy_c.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "swappy/swappy.h"
-
-#include "Swappy.h"
-
-#include "Settings.h"
-
-#include <chrono>
-
-using namespace swappy;
-
-extern "C" {
-
-void Swappy_init(JNIEnv *env, jobject jactivity) {
- Swappy::init(env, jactivity);
-}
-
-void Swappy_destroy() {
- Swappy::destroyInstance();
-}
-
-void Swappy_onChoreographer(int64_t frameTimeNanos) {
- Swappy::onChoreographer(frameTimeNanos);
-}
-
-bool Swappy_swap(EGLDisplay display, EGLSurface surface) {
- return Swappy::swap(display, surface);
-}
-
-void Swappy_setRefreshPeriod(uint64_t period_ns) {
- Settings::getInstance()->setRefreshPeriod(std::chrono::nanoseconds(period_ns));
-}
-
-void Swappy_setUseAffinity(bool tf) {
- Settings::getInstance()->setUseAffinity(tf);
-}
-
-void Swappy_setSwapIntervalNS(uint64_t swap_ns) {
- Settings::getInstance()->setSwapIntervalNS(swap_ns);
-}
-
-uint64_t Swappy_getRefreshPeriodNanos() {
- return Settings::getInstance()->getRefreshPeriod().count();
-}
-
-bool Swappy_getUseAffinity() {
- return Settings::getInstance()->getUseAffinity();
-}
-
-uint64_t Swappy_getSwapIntervalNS() {
- return Swappy::getSwapIntervalNS();
-}
-
-void Swappy_injectTracer(const SwappyTracer *t) {
- Swappy::addTracer(t);
-}
-
-void Swappy_setAutoSwapInterval(bool enabled) {
- Swappy::setAutoSwapInterval(enabled);
-}
-
-void Swappy_setAutoPipelineMode(bool enabled) {
- Swappy::setAutoPipelineMode(enabled);
-}
-
-void Swappy_enableStats(bool enabled) {
- Swappy::enableStats(enabled);
-}
-
-void Swappy_recordFrameStart(EGLDisplay display, EGLSurface surface) {
- Swappy::recordFrameStart(display, surface);
-}
-
-void Swappy_getStats(Swappy_Stats *stats) {
- Swappy::getStats(stats);
-}
-
-bool Swappy_isEnabled() {
- return Swappy::isEnabled();
-}
-
-} // extern "C" {
diff --git a/src/swappy/opengl/swappyGL_c.cpp b/src/swappy/opengl/swappyGL_c.cpp
new file mode 100644
index 0000000..b025d69
--- /dev/null
+++ b/src/swappy/opengl/swappyGL_c.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// API entry points
+
+#include "swappy/swappyGL.h"
+
+#include "SwappyGL.h"
+
+#include "Settings.h"
+
+#include <chrono>
+
+using namespace swappy;
+
+extern "C" {
+
+void SwappyGL_init(JNIEnv *env, jobject jactivity) {
+ SwappyGL::init(env, jactivity);
+}
+
+void SwappyGL_destroy() {
+ SwappyGL::destroyInstance();
+}
+
+void SwappyGL_onChoreographer(int64_t frameTimeNanos) {
+ SwappyGL::onChoreographer(frameTimeNanos);
+}
+
+bool SwappyGL_swap(EGLDisplay display, EGLSurface surface) {
+ return SwappyGL::swap(display, surface);
+}
+
+void SwappyGL_setRefreshPeriod(uint64_t period_ns) {
+ Settings::getInstance()->setRefreshPeriod(std::chrono::nanoseconds(period_ns));
+}
+
+void SwappyGL_setUseAffinity(bool tf) {
+ Settings::getInstance()->setUseAffinity(tf);
+}
+
+void SwappyGL_setSwapIntervalNS(uint64_t swap_ns) {
+ Settings::getInstance()->setSwapIntervalNS(swap_ns);
+}
+
+uint64_t SwappyGL_getRefreshPeriodNanos() {
+ return Settings::getInstance()->getRefreshPeriod().count();
+}
+
+bool SwappyGL_getUseAffinity() {
+ return Settings::getInstance()->getUseAffinity();
+}
+
+uint64_t SwappyGL_getSwapIntervalNS() {
+ return SwappyGL::getSwapIntervalNS();
+}
+
+void SwappyGL_injectTracer(const SwappyTracer *t) {
+ SwappyGL::addTracer(t);
+}
+
+void SwappyGL_setAutoSwapInterval(bool enabled) {
+ SwappyGL::setAutoSwapInterval(enabled);
+}
+
+void SwappyGL_setAutoPipelineMode(bool enabled) {
+ SwappyGL::setAutoPipelineMode(enabled);
+}
+
+void SwappyGL_enableStats(bool enabled) {
+ SwappyGL::enableStats(enabled);
+}
+
+void SwappyGL_recordFrameStart(EGLDisplay display, EGLSurface surface) {
+ SwappyGL::recordFrameStart(display, surface);
+}
+
+void SwappyGL_getStats(SwappyStats *stats) {
+ SwappyGL::getStats(stats);
+}
+
+bool SwappyGL_isEnabled() {
+ return SwappyGL::isEnabled();
+}
+
+} // extern "C" {
diff --git a/src/swappy/vulkan/SwappyVk.cpp b/src/swappy/vulkan/SwappyVk.cpp
index cbe34a2..cbee274 100644
--- a/src/swappy/vulkan/SwappyVk.cpp
+++ b/src/swappy/vulkan/SwappyVk.cpp
@@ -14,84 +14,10 @@
* limitations under the License.
*/
-#include "SwappyVkBase.h"
-#include "SwappyVkFallback.h"
-#include "SwappyVkGoogleDisplayTiming.h"
+#include "SwappyVk.h"
namespace swappy {
-// Note: The API functions is at the botton of the file. Those functions call methods of the
-// singleton SwappyVk class. Those methods call virtual methods of the abstract SwappyVkBase
-// class, which is actually implemented by one of the derived/concrete classes:
-//
-// - SwappyVkGoogleDisplayTiming
-// - SwappyVkFallback
-
-/***************************************************************************************************
- *
- * Singleton class that provides the high-level implementation of the Swappy entrypoints.
- *
- ***************************************************************************************************/
-/**
- * Singleton class that provides the high-level implementation of the Swappy entrypoints.
- *
- * This class determines which low-level implementation to use for each physical
- * device, and then calls that class's do-method for the entrypoint.
- */
-class SwappyVk
-{
-public:
- static SwappyVk& getInstance() {
- static SwappyVk instance;
- return instance;
- }
-
- ~SwappyVk() {
- if(mLibVulkan)
- dlclose(mLibVulkan);
- }
-
- void swappyVkDetermineDeviceExtensions(VkPhysicalDevice physicalDevice,
- uint32_t availableExtensionCount,
- VkExtensionProperties* pAvailableExtensions,
- uint32_t* pRequiredExtensionCount,
- char** pRequiredExtensions);
- void SetQueueFamilyIndex(VkDevice device,
- VkQueue queue,
- uint32_t queueFamilyIndex);
- bool GetRefreshCycleDuration(VkPhysicalDevice physicalDevice,
- VkDevice device,
- VkSwapchainKHR swapchain,
- uint64_t* pRefreshDuration);
- void SetSwapIntervalNS(VkDevice device,
- VkSwapchainKHR swapchain,
- uint64_t swap_ns);
- VkResult QueuePresent(VkQueue queue,
- const VkPresentInfoKHR* pPresentInfo);
- void DestroySwapchain(VkDevice device,
- VkSwapchainKHR swapchain);
-
-private:
- std::map<VkPhysicalDevice, bool> doesPhysicalDeviceHaveGoogleDisplayTiming;
- std::map<VkDevice, std::shared_ptr<SwappyVkBase>> perDeviceImplementation;
- std::map<VkSwapchainKHR, std::shared_ptr<SwappyVkBase>> perSwapchainImplementation;
-
- struct QueueFamilyIndex {
- VkDevice device;
- uint32_t queueFamilyIndex;
- };
- std::map<VkQueue, QueueFamilyIndex> perQueueFamilyIndex;
-
- void *mLibVulkan = nullptr;
-
-private:
- SwappyVk() {} // Need to implement this constructor
-
- // Forbid copies.
- SwappyVk(SwappyVk const&) = delete;
- void operator=(SwappyVk const&) = delete;
-};
-
/**
* Generic/Singleton implementation of swappyVkDetermineDeviceExtensions.
*/
@@ -243,77 +169,4 @@
perSwapchainImplementation[swapchain] = nullptr;
}
-} // namespace swappy
-
-/***************************************************************************************************
- *
- * API ENTRYPOINTS
- *
- ***************************************************************************************************/
-
-extern "C" {
-
-void SwappyVk_determineDeviceExtensions(
- VkPhysicalDevice physicalDevice,
- uint32_t availableExtensionCount,
- VkExtensionProperties* pAvailableExtensions,
- uint32_t* pRequiredExtensionCount,
- char** pRequiredExtensions)
-{
- TRACE_CALL();
- swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
- swappy.swappyVkDetermineDeviceExtensions(physicalDevice,
- availableExtensionCount, pAvailableExtensions,
- pRequiredExtensionCount, pRequiredExtensions);
-}
-
-void SwappyVk_setQueueFamilyIndex(
- VkDevice device,
- VkQueue queue,
- uint32_t queueFamilyIndex)
-{
- TRACE_CALL();
- swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
- swappy.SetQueueFamilyIndex(device, queue, queueFamilyIndex);
-}
-
-bool SwappyVk_initAndGetRefreshCycleDuration(
- VkPhysicalDevice physicalDevice,
- VkDevice device,
- VkSwapchainKHR swapchain,
- uint64_t* pRefreshDuration)
-{
- TRACE_CALL();
- swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
- return swappy.GetRefreshCycleDuration(physicalDevice, device, swapchain, pRefreshDuration);
-}
-
-void SwappyVk_setSwapIntervalNS(
- VkDevice device,
- VkSwapchainKHR swapchain,
- uint64_t swap_ns)
-{
- TRACE_CALL();
- swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
- swappy.SetSwapIntervalNS(device, swapchain, swap_ns);
-}
-
-VkResult SwappyVk_queuePresent(
- VkQueue queue,
- const VkPresentInfoKHR* pPresentInfo)
-{
- TRACE_CALL();
- swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
- return swappy.QueuePresent(queue, pPresentInfo);
-}
-
-void SwappyVk_destroySwapchain(
- VkDevice device,
- VkSwapchainKHR swapchain)
-{
- TRACE_CALL();
- swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
- swappy.DestroySwapchain(device, swapchain);
-}
-
-} // extern "C"
+} // namespace swappy
\ No newline at end of file
diff --git a/src/swappy/vulkan/SwappyVk.h b/src/swappy/vulkan/SwappyVk.h
new file mode 100644
index 0000000..216f271
--- /dev/null
+++ b/src/swappy/vulkan/SwappyVk.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "SwappyVkBase.h"
+#include "SwappyVkFallback.h"
+#include "SwappyVkGoogleDisplayTiming.h"
+
+namespace swappy {
+
+// The API functions call methods of the singleton SwappyVk class.
+// Those methods call virtual methods of the abstract SwappyVkBase class,
+// which is actually implemented by one of the derived/concrete classes:
+//
+// - SwappyVkGoogleDisplayTiming
+// - SwappyVkFallback
+
+/***************************************************************************************************
+ *
+ * Singleton class that provides the high-level implementation of the Swappy entrypoints.
+ *
+ ***************************************************************************************************/
+/**
+ * Singleton class that provides the high-level implementation of the Swappy entrypoints.
+ *
+ * This class determines which low-level implementation to use for each physical
+ * device, and then calls that class's do-method for the entrypoint.
+ */
+class SwappyVk
+{
+public:
+ static SwappyVk& getInstance() {
+ static SwappyVk instance;
+ return instance;
+ }
+
+ ~SwappyVk() {
+ if(mLibVulkan)
+ dlclose(mLibVulkan);
+ }
+
+ void swappyVkDetermineDeviceExtensions(VkPhysicalDevice physicalDevice,
+ uint32_t availableExtensionCount,
+ VkExtensionProperties* pAvailableExtensions,
+ uint32_t* pRequiredExtensionCount,
+ char** pRequiredExtensions);
+ void SetQueueFamilyIndex(VkDevice device,
+ VkQueue queue,
+ uint32_t queueFamilyIndex);
+ bool GetRefreshCycleDuration(VkPhysicalDevice physicalDevice,
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint64_t* pRefreshDuration);
+ void SetSwapIntervalNS(VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint64_t swap_ns);
+ VkResult QueuePresent(VkQueue queue,
+ const VkPresentInfoKHR* pPresentInfo);
+ void DestroySwapchain(VkDevice device,
+ VkSwapchainKHR swapchain);
+
+private:
+ std::map<VkPhysicalDevice, bool> doesPhysicalDeviceHaveGoogleDisplayTiming;
+ std::map<VkDevice, std::shared_ptr<SwappyVkBase>> perDeviceImplementation;
+ std::map<VkSwapchainKHR, std::shared_ptr<SwappyVkBase>> perSwapchainImplementation;
+
+ struct QueueFamilyIndex {
+ VkDevice device;
+ uint32_t queueFamilyIndex;
+ };
+ std::map<VkQueue, QueueFamilyIndex> perQueueFamilyIndex;
+
+ void *mLibVulkan = nullptr;
+
+private:
+ SwappyVk() {} // Need to implement this constructor
+
+ // Forbid copies.
+ SwappyVk(SwappyVk const&) = delete;
+ void operator=(SwappyVk const&) = delete;
+};
+
+} // namespace swappy
\ No newline at end of file
diff --git a/src/swappy/vulkan/SwappyVkBase.h b/src/swappy/vulkan/SwappyVkBase.h
index 02aa66f..07f33aa 100644
--- a/src/swappy/vulkan/SwappyVkBase.h
+++ b/src/swappy/vulkan/SwappyVkBase.h
@@ -40,7 +40,7 @@
#pragma once
#define SWAPPYVK_USE_WRAPPER
-#include <swappyVk/SwappyVk.h>
+#include <swappy/swappyVk.h>
#include <unistd.h>
#include <pthread.h>
diff --git a/src/swappy/vulkan/swappyVk_c.cpp b/src/swappy/vulkan/swappyVk_c.cpp
new file mode 100644
index 0000000..91593f0
--- /dev/null
+++ b/src/swappy/vulkan/swappyVk_c.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// API entry points
+
+#include "swappy/swappyVk.h"
+
+#include "SwappyVk.h"
+
+using namespace swappy;
+
+extern "C" {
+
+void SwappyVk_determineDeviceExtensions(
+ VkPhysicalDevice physicalDevice,
+ uint32_t availableExtensionCount,
+ VkExtensionProperties* pAvailableExtensions,
+ uint32_t* pRequiredExtensionCount,
+ char** pRequiredExtensions)
+{
+ TRACE_CALL();
+ swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
+ swappy.swappyVkDetermineDeviceExtensions(physicalDevice,
+ availableExtensionCount, pAvailableExtensions,
+ pRequiredExtensionCount, pRequiredExtensions);
+}
+
+void SwappyVk_setQueueFamilyIndex(
+ VkDevice device,
+ VkQueue queue,
+ uint32_t queueFamilyIndex)
+{
+ TRACE_CALL();
+ swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
+ swappy.SetQueueFamilyIndex(device, queue, queueFamilyIndex);
+}
+
+bool SwappyVk_initAndGetRefreshCycleDuration(
+ VkPhysicalDevice physicalDevice,
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint64_t* pRefreshDuration)
+{
+ TRACE_CALL();
+ swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
+ return swappy.GetRefreshCycleDuration(physicalDevice, device, swapchain, pRefreshDuration);
+}
+
+void SwappyVk_setSwapIntervalNS(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint64_t swap_ns)
+{
+ TRACE_CALL();
+ swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
+ swappy.SetSwapIntervalNS(device, swapchain, swap_ns);
+}
+
+VkResult SwappyVk_queuePresent(
+ VkQueue queue,
+ const VkPresentInfoKHR* pPresentInfo)
+{
+ TRACE_CALL();
+ swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
+ return swappy.QueuePresent(queue, pPresentInfo);
+}
+
+void SwappyVk_destroySwapchain(
+ VkDevice device,
+ VkSwapchainKHR swapchain)
+{
+ TRACE_CALL();
+ swappy::SwappyVk& swappy = swappy::SwappyVk::getInstance();
+ swappy.DestroySwapchain(device, swapchain);
+}
+
+} // extern "C"
\ No newline at end of file
diff --git a/src/tuningfork/tuningfork_extra.cpp b/src/tuningfork/tuningfork_extra.cpp
index ea577c1..eb632bb 100644
--- a/src/tuningfork/tuningfork_extra.cpp
+++ b/src/tuningfork/tuningfork_extra.cpp
@@ -17,7 +17,7 @@
#define LOG_TAG "TuningFork"
#include "Log.h"
-#include "swappy/swappy_extra.h"
+#include "swappy/swappyGL_extra.h"
#include <android/asset_manager_jni.h>
#include <jni.h>
diff --git a/third_party/cube/app/src/main/cpp/cube.c b/third_party/cube/app/src/main/cpp/cube.c
index 24abf24..d9f2537 100644
--- a/third_party/cube/app/src/main/cpp/cube.c
+++ b/third_party/cube/app/src/main/cpp/cube.c
@@ -59,7 +59,7 @@
#include "linmath.h"
#include "object_type_string_helper.h"
-#include <swappyVk/SwappyVk.h>
+#include <swappy/swappyVk.h>
#include "gettime.h"
#include "inttypes.h"