mirror of https://github.com/auygun/kaliber.git
Compare commits
No commits in common. "068656ddc2ea80b117d2e6a273783e991b28db90" and "557eb517cbc48552d2e2c1f7d8902fa9836e9378" have entirely different histories.
068656ddc2
...
557eb517cb
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="22"
|
||||
android:versionName="1.0.4">
|
||||
android:versionCode="19"
|
||||
android:versionName="1.0.3">
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
|
|
|
@ -35,7 +35,7 @@ TaskRunner* TaskRunner::GetThreadLocalTaskRunner() {
|
|||
void TaskRunner::PostTask(const Location& from, Closure task) {
|
||||
DCHECK(task) << LOCATION(from);
|
||||
|
||||
task_count_.fetch_add(1, std::memory_order_relaxed);
|
||||
task_count_.fetch_add(1, std::memory_order_release);
|
||||
std::lock_guard<std::mutex> scoped_lock(lock_);
|
||||
queue_.emplace_back(from, std::move(task));
|
||||
}
|
||||
|
@ -71,11 +71,6 @@ void TaskRunner::MultiConsumerRun() {
|
|||
|
||||
task_cb();
|
||||
task_count_.fetch_sub(1, std::memory_order_release);
|
||||
|
||||
if (cancel_tasks_.load(std::memory_order_relaxed)) {
|
||||
CancelTasksInternal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,28 +93,12 @@ void TaskRunner::SingleConsumerRun() {
|
|||
|
||||
task_cb();
|
||||
task_count_.fetch_sub(1, std::memory_order_release);
|
||||
|
||||
if (cancel_tasks_.load(std::memory_order_relaxed)) {
|
||||
CancelTasksInternal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskRunner::CancelTasks() {
|
||||
cancel_tasks_.store(true, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void TaskRunner::WaitForCompletion() {
|
||||
while (task_count_.load(std::memory_order_acquire) > 0)
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
void TaskRunner::CancelTasksInternal() {
|
||||
cancel_tasks_.store(false, std::memory_order_relaxed);
|
||||
task_count_.store(0, std::memory_order_relaxed);
|
||||
std::lock_guard<std::mutex> scoped_lock(lock_);
|
||||
queue_.clear();
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
|
|
@ -60,9 +60,9 @@ class TaskRunner {
|
|||
}
|
||||
|
||||
void MultiConsumerRun();
|
||||
|
||||
void SingleConsumerRun();
|
||||
|
||||
void CancelTasks();
|
||||
void WaitForCompletion();
|
||||
|
||||
static void CreateThreadLocalTaskRunner();
|
||||
|
@ -74,12 +74,9 @@ class TaskRunner {
|
|||
std::deque<Task> queue_;
|
||||
mutable std::mutex lock_;
|
||||
std::atomic<size_t> task_count_{0};
|
||||
std::atomic<bool> cancel_tasks_{false};
|
||||
|
||||
static thread_local std::unique_ptr<TaskRunner> thread_local_task_runner;
|
||||
|
||||
void CancelTasksInternal();
|
||||
|
||||
TaskRunner(TaskRunner const&) = delete;
|
||||
TaskRunner& operator=(TaskRunner const&) = delete;
|
||||
};
|
||||
|
|
|
@ -130,11 +130,11 @@ void Demo::Update(float delta_time) {
|
|||
|
||||
if (do_benchmark_) {
|
||||
benchmark_time_ += delta_time;
|
||||
if (benchmark_time_ > 3) {
|
||||
if (benchmark_time_ > 1) {
|
||||
avarage_fps_ += Engine::Get().fps();
|
||||
++num_benchmark_samples_;
|
||||
}
|
||||
if (benchmark_time_ > 5) {
|
||||
if (benchmark_time_ > 6) {
|
||||
avarage_fps_ /= num_benchmark_samples_;
|
||||
do_benchmark_ = false;
|
||||
BenchmarkResult(avarage_fps_);
|
||||
|
@ -166,22 +166,14 @@ void Demo::Update(float delta_time) {
|
|||
UpdateGameState(delta_time);
|
||||
}
|
||||
|
||||
void Demo::ContextLost() {
|
||||
if (do_benchmark_) {
|
||||
benchmark_time_ = 0;
|
||||
num_benchmark_samples_ = 0;
|
||||
avarage_fps_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Demo::LostFocus() {}
|
||||
|
||||
void Demo::GainedFocus(bool from_interstitial_ad) {
|
||||
DLOG << __func__ << " from_interstitial_ad: " << from_interstitial_ad;
|
||||
if (!from_interstitial_ad) {
|
||||
// if (saved_data_.root().get(kLaunchCount, Json::Value(0)).asInt() >
|
||||
// kLaunchCountBeforeAd)
|
||||
// Engine::Get().ShowInterstitialAd();
|
||||
if (saved_data_.root().get(kLaunchCount, Json::Value(0)).asInt() >
|
||||
kLaunchCountBeforeAd)
|
||||
Engine::Get().ShowInterstitialAd();
|
||||
if (state_ == kGame)
|
||||
EnterMenuState();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class Demo final : public eng::Game {
|
|||
|
||||
void Update(float delta_time) final;
|
||||
|
||||
void ContextLost() final;
|
||||
void ContextLost() final {}
|
||||
|
||||
void LostFocus() final;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ using namespace eng;
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr char kVersionStr[] = "Version 1.0.4";
|
||||
constexpr char kVersionStr[] = "Version 1.0.3";
|
||||
|
||||
constexpr char kMenuOption[Menu::kOption_Max][10] = {"continue", "start",
|
||||
"credits", "exit"};
|
||||
|
@ -201,7 +201,6 @@ bool Menu::Initialize() {
|
|||
: RendererType::kOpenGL);
|
||||
renderer_type_.SetEnabled(
|
||||
(Engine::Get().GetRendererType() == RendererType::kVulkan));
|
||||
Engine::Get().ConsumeInputEvents();
|
||||
},
|
||||
true, Engine::Get().GetRendererType() == RendererType::kVulkan,
|
||||
kColorFadeOut, {Vector4f{1, 1, 1, 1}, Vector4f{1, 1, 1, 1}});
|
||||
|
|
|
@ -396,10 +396,6 @@ std::unique_ptr<InputEvent> Engine::GetNextInputEvent() {
|
|||
return event;
|
||||
}
|
||||
|
||||
void Engine::ConsumeInputEvents() {
|
||||
input_queue_.clear();
|
||||
}
|
||||
|
||||
void Engine::StartRecording(const Json::Value& payload) {
|
||||
if (!replaying_ && !recording_) {
|
||||
recording_ = true;
|
||||
|
|
|
@ -84,7 +84,6 @@ class Engine : public PlatformObserver {
|
|||
void RemoveCustomShader(const std::string& asset_name);
|
||||
|
||||
std::unique_ptr<InputEvent> GetNextInputEvent();
|
||||
void ConsumeInputEvents();
|
||||
|
||||
void StartRecording(const Json::Value& payload);
|
||||
void EndRecording(const std::string file_name);
|
||||
|
|
|
@ -987,13 +987,13 @@ void RendererVulkan::Shutdown() {
|
|||
return;
|
||||
|
||||
LOG << "Shutting down renderer.";
|
||||
DestroyAllResources();
|
||||
context_lost_ = true;
|
||||
|
||||
quit_.store(true, std::memory_order_relaxed);
|
||||
semaphore_.release();
|
||||
setup_thread_.join();
|
||||
|
||||
DestroyAllResources();
|
||||
context_lost_ = true;
|
||||
|
||||
vkDeviceWaitIdle(device_);
|
||||
|
||||
for (size_t i = 0; i < frames_.size(); ++i) {
|
||||
|
|
Loading…
Reference in New Issue