Skip to content

Commit

Permalink
Merge master into dev
Browse files Browse the repository at this point in the history
commit 69b6b9e
Author: Joe Morton <jmorton06@live.co.uk>
Date:   Tue May 19 10:42:27 2020 +0100

    Windows build fix

    spdlog update removed a nominmax define

commit 72f3546
Author: Joe Morton <jmorton06@live.co.uk>
Date:   Mon May 18 22:47:38 2020 +0100

    Test update

commit cb5d80c
Author: Joe Morton <jmorton06@live.co.uk>
Date:   Mon May 18 22:09:52 2020 +0100

    DebugRender refactor

commit 7c516ee
Author: Joe Morton <jmorton06@live.co.uk>
Date:   Mon May 18 22:09:35 2020 +0100

    Environment class

    Use ecs for skybox

commit 675dcd1
Author: Joe Morton <jmorton06@live.co.uk>
Date:   Mon May 18 22:08:26 2020 +0100

    Resize Fixes

    Resize gbuffer not delete and create

commit a1a0648
Author: Joe Morton <jmorton06@live.co.uk>
Date:   Mon May 18 22:03:14 2020 +0100

    Updated spdlog to 1.6.0

commit 3a7852d
Author: Joe Morton <jmorton06@live.co.uk>
Date:   Thu May 14 23:38:16 2020 +0100

    Squashed commit of the following:

    commit fd76746
    Author: Joe Morton <jmorton06@live.co.uk>
    Date:   Thu May 14 23:37:17 2020 +0100

        Refactor + bug fixes

    commit 149db98
    Author: Joe Morton <jmorton06@live.co.uk>
    Date:   Mon May 11 22:45:41 2020 +0100

        Lua progress + glfw update

    commit 7e7c2a4
    Author: Joe Morton <jmorton06@live.co.uk>
    Date:   Sun May 10 10:42:13 2020 +0100

        Windows build fix

    commit cf2ce42
    Author: Joe Morton <jmorton06@live.co.uk>
    Date:   Sat May 9 22:42:22 2020 +0100

        Lua progress + Camera controllers

        Updated imFileBrowser

    commit 153a481
    Author: Joe Morton <jmorton06@live.co.uk>
    Date:   Tue May 5 21:59:55 2020 +0100

        Editor / Debug renderer improvements

    commit 4555cc9
    Author: Joe Morton <jmorton06@live.co.uk>
    Date:   Thu Apr 30 18:40:16 2020 +0100

        Debug Renderer

        + Refactor

commit 9b7f75c
Merge: 65ddb1a 31d630f
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Sun Apr 26 15:31:32 2020 +0100

    Lua Progress

commit 65ddb1a
Merge: 28053bc db980d0
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Sat Apr 4 21:02:59 2020 +0100

    Merge pull request #56 from jmorton06/dev

    Fix Xcode project warnings

commit 28053bc
Merge: 1bd59b8 6b2a672
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Thu Mar 26 22:27:45 2020 +0000

    Merge pull request #55 from jmorton06/dev

    iOS progress and refactor

commit 1bd59b8
Merge: beab295 4364007
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Thu Mar 12 09:08:55 2020 +0000

    iOS Progress

commit beab295
Merge: 3a19fc5 d3bd0e0
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Tue Feb 11 11:29:52 2020 +0000

    iOS Progress

    Todo : input / window size

commit 3a19fc5
Merge: cb85afe 17fd269
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Wed Jan 22 21:44:13 2020 +0000

    Merge pull request #50 from jmorton06/dev

    Readme update

commit cb85afe
Merge: 4a1e291 5b4bebe
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Mon Jan 20 18:48:34 2020 +0000

    Merge pull request #49 from jmorton06/dev

    Update readme

commit 4a1e291
Merge: 0859d92 493898c
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Fri Jan 17 08:56:48 2020 +0000

    iOS progress

    merge from dev

commit 0859d92
Merge: 22a1690 67b00c2
Author: jmorton06 <jmorton06@live.co.uk>
Date:   Thu Dec 5 18:45:54 2019 +0000

    Merge pull request #43 from jmorton06/dev

    Improved 3D grid
  • Loading branch information
jmorton06 committed May 19, 2020
1 parent fd76746 commit 6f47511
Show file tree
Hide file tree
Showing 144 changed files with 14,328 additions and 9,594 deletions.
59 changes: 35 additions & 24 deletions Dependencies/imgui/examples/imgui_impl_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,30 +211,41 @@ void CreateDescriptorSets(ImDrawData* draw_data)

if (pcmd->TextureId)
{
if (!g_DescriptorSets[pcmd->TextureId])
{
VkWriteDescriptorSet descriptorWrites[1] = {};

VkDescriptorSet set;
VkDescriptorSetAllocateInfo alloc_info = {};
alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
alloc_info.descriptorPool = g_DescriptorPool;
alloc_info.descriptorSetCount = 1;
alloc_info.pSetLayouts = &g_DescriptorSetLayout;
vkAllocateDescriptorSets(g_Device, &alloc_info, &set);

descriptorWrites[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
descriptorWrites[0].dstSet = set;
descriptorWrites[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
descriptorWrites[0].pImageInfo = (VkDescriptorImageInfo*)pcmd->TextureId;
descriptorWrites[0].descriptorCount = 1;

vkUpdateDescriptorSets(g_Device, 1, descriptorWrites, 0, nullptr);

g_DescriptorSets[pcmd->TextureId] = set;
}
}

if (!g_DescriptorSets[pcmd->TextureId])
{
VkWriteDescriptorSet descriptorWrites[1] = {};

VkDescriptorSet set;
VkDescriptorSetAllocateInfo alloc_info = {};
alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
alloc_info.descriptorPool = g_DescriptorPool;
alloc_info.descriptorSetCount = 1;
alloc_info.pSetLayouts = &g_DescriptorSetLayout;
vkAllocateDescriptorSets(g_Device, &alloc_info, &set);

descriptorWrites[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
descriptorWrites[0].dstSet = set;
descriptorWrites[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
descriptorWrites[0].pImageInfo = (VkDescriptorImageInfo *) pcmd->TextureId;
descriptorWrites[0].descriptorCount = 1;

vkUpdateDescriptorSets(g_Device, 1, descriptorWrites, 0, nullptr);

g_DescriptorSets[pcmd->TextureId] = set;
}
else
{
VkWriteDescriptorSet descriptorWrites[1] = {};
auto set = g_DescriptorSets[pcmd->TextureId];
descriptorWrites[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
descriptorWrites[0].dstSet = set;
descriptorWrites[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
descriptorWrites[0].pImageInfo = (VkDescriptorImageInfo *) pcmd->TextureId;
descriptorWrites[0].descriptorCount = 1;

vkUpdateDescriptorSets(g_Device, 1, descriptorWrites, 0, nullptr);
}
}
}
}
}
Expand Down
28 changes: 17 additions & 11 deletions Lumos/external/spdlog/async.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@

//
// Copyright(c) 2018 Gabi Melman.
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//

#pragma once

//
// Async logging using global thread pool
// All loggers created here share same global thread pool.
// Each log message is pushed to a queue along withe a shared pointer to the
// Each log message is pushed to a queue along with a shared pointer to the
// logger.
// If a logger deleted while having pending messages in the queue, it's actual
// destruction will defer
// until all its messages are processed by the thread pool.
// This is because each message in the queue holds a shared_ptr to the
// originating logger.

#include "spdlog/async_logger.h"
#include "spdlog/details/registry.h"
#include "spdlog/details/thread_pool.h"
#include <spdlog/async_logger.h>
#include <spdlog/details/registry.h>
#include <spdlog/details/thread_pool.h>

#include <memory>
#include <mutex>
#include <functional>

namespace spdlog {

Expand All @@ -42,7 +40,9 @@ struct async_factory_impl
auto &registry_inst = details::registry::instance();

// create global thread pool if not already exists..
std::lock_guard<std::recursive_mutex> tp_lock(registry_inst.tp_mutex());

auto &mutex = registry_inst.tp_mutex();
std::lock_guard<std::recursive_mutex> tp_lock(mutex);
auto tp = registry_inst.get_tp();
if (tp == nullptr)
{
Expand Down Expand Up @@ -73,12 +73,18 @@ inline std::shared_ptr<spdlog::logger> create_async_nb(std::string logger_name,
}

// set global thread pool.
inline void init_thread_pool(size_t q_size, size_t thread_count)
inline void init_thread_pool(size_t q_size, size_t thread_count, std::function<void()> on_thread_start)
{
auto tp = std::make_shared<details::thread_pool>(q_size, thread_count);
auto tp = std::make_shared<details::thread_pool>(q_size, thread_count, on_thread_start);
details::registry::instance().set_tp(std::move(tp));
}

// set global thread pool.
inline void init_thread_pool(size_t q_size, size_t thread_count)
{
init_thread_pool(q_size, thread_count, [] {});
}

// get the global thread pool.
inline std::shared_ptr<spdlog::details::thread_pool> thread_pool()
{
Expand Down
92 changes: 92 additions & 0 deletions Lumos/external/spdlog/async_logger-inl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once

#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/async_logger.h>
#endif

#include <spdlog/sinks/sink.h>
#include <spdlog/details/thread_pool.h>

#include <memory>
#include <string>

SPDLOG_INLINE spdlog::async_logger::async_logger(
std::string logger_name, sinks_init_list sinks_list, std::weak_ptr<details::thread_pool> tp, async_overflow_policy overflow_policy)
: async_logger(std::move(logger_name), sinks_list.begin(), sinks_list.end(), std::move(tp), overflow_policy)
{}

SPDLOG_INLINE spdlog::async_logger::async_logger(
std::string logger_name, sink_ptr single_sink, std::weak_ptr<details::thread_pool> tp, async_overflow_policy overflow_policy)
: async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy)
{}

// send the log message to the thread pool
SPDLOG_INLINE void spdlog::async_logger::sink_it_(const details::log_msg &msg)
{
if (auto pool_ptr = thread_pool_.lock())
{
pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
}
else
{
throw_spdlog_ex("async log: thread pool doesn't exist anymore");
}
}

// send flush request to the thread pool
SPDLOG_INLINE void spdlog::async_logger::flush_()
{
if (auto pool_ptr = thread_pool_.lock())
{
pool_ptr->post_flush(shared_from_this(), overflow_policy_);
}
else
{
throw_spdlog_ex("async flush: thread pool doesn't exist anymore");
}
}

//
// backend functions - called from the thread pool to do the actual job
//
SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg)
{
for (auto &sink : sinks_)
{
if (sink->should_log(msg.level))
{
SPDLOG_TRY
{
sink->log(msg);
}
SPDLOG_LOGGER_CATCH()
}
}

if (should_flush_(msg))
{
backend_flush_();
}
}

SPDLOG_INLINE void spdlog::async_logger::backend_flush_()
{
for (auto &sink : sinks_)
{
SPDLOG_TRY
{
sink->flush();
}
SPDLOG_LOGGER_CATCH()
}
}

SPDLOG_INLINE std::shared_ptr<spdlog::logger> spdlog::async_logger::clone(std::string new_name)
{
auto cloned = std::make_shared<spdlog::async_logger>(*this);
cloned->name_ = std::move(new_name);
return cloned;
}
35 changes: 15 additions & 20 deletions Lumos/external/spdlog/async_logger.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
//
// Copyright(c) 2015 Gabi Melman.
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//

#pragma once

// Very fast asynchronous logger (millions of logs per second on an average
// desktop)
// Uses pre allocated lockfree queue for maximum throughput even under large
// number of threads.
// Fast asynchronous logger.
// Uses pre allocated queue.
// Creates a single back thread to pop messages from the queue and log them.
//
// Upon each log write the logger:
// 1. Checks if its log level is enough to log the message
// 2. Push a new copy of the message to a queue (or block the caller until
// space is available in the queue)
// 3. will throw spdlog_ex upon log exceptions
// Upon destruction, logs all remaining messages in the queue before
// destructing..

#include "spdlog/common.h"
#include "spdlog/logger.h"

#include <chrono>
#include <memory>
#include <string>
#include <spdlog/logger.h>

namespace spdlog {

Expand All @@ -40,14 +30,18 @@ namespace details {
class thread_pool;
}

class async_logger final : public std::enable_shared_from_this<async_logger>, public logger
class SPDLOG_API async_logger final : public std::enable_shared_from_this<async_logger>, public logger
{
friend class details::thread_pool;

public:
template<typename It>
async_logger(std::string logger_name, It begin, It end, std::weak_ptr<details::thread_pool> tp,
async_overflow_policy overflow_policy = async_overflow_policy::block);
async_overflow_policy overflow_policy = async_overflow_policy::block)
: logger(std::move(logger_name), begin, end)
, thread_pool_(std::move(tp))
, overflow_policy_(overflow_policy)
{}

async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr<details::thread_pool> tp,
async_overflow_policy overflow_policy = async_overflow_policy::block);
Expand All @@ -58,10 +52,9 @@ class async_logger final : public std::enable_shared_from_this<async_logger>, pu
std::shared_ptr<logger> clone(std::string new_name) override;

protected:
void sink_it_(details::log_msg &msg) override;
void sink_it_(const details::log_msg &msg) override;
void flush_() override;

void backend_log_(const details::log_msg &incoming_log_msg);
void backend_sink_it_(const details::log_msg &incoming_log_msg);
void backend_flush_();

private:
Expand All @@ -70,4 +63,6 @@ class async_logger final : public std::enable_shared_from_this<async_logger>, pu
};
} // namespace spdlog

#include "details/async_logger_impl.h"
#ifdef SPDLOG_HEADER_ONLY
#include "async_logger-inl.h"
#endif
45 changes: 45 additions & 0 deletions Lumos/external/spdlog/cfg/argv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once
#include <spdlog/cfg/helpers.h>
#include <spdlog/details/registry.h>

//
// Init log levels using each argv entry that starts with "SPDLOG_LEVEL="
//
// set all loggers to debug level:
// example.exe "SPDLOG_LEVEL=debug"

// set logger1 to trace level
// example.exe "SPDLOG_LEVEL=logger1=trace"

// turn off all logging except for logger1 and logger2:
// example.exe "SPDLOG_LEVEL=off,logger1=debug,logger2=info"

namespace spdlog {
namespace cfg {

// search for SPDLOG_LEVEL= in the args and use it to init the levels
void load_argv_levels(int argc, const char **argv)
{
const std::string spdlog_level_prefix = "SPDLOG_LEVEL=";
for (int i = 1; i < argc; i++)
{
std::string arg = argv[i];
if (arg.find(spdlog_level_prefix) == 0)
{
auto levels_string = arg.substr(spdlog_level_prefix.size());
auto levels = helpers::extract_levels(levels_string);
details::registry::instance().update_levels(std::move(levels));
}
}
}

void load_argv_levels(int argc, char **argv)
{
load_argv_levels(argc, const_cast<const char **>(argv));
}

} // namespace cfg
} // namespace spdlog
36 changes: 36 additions & 0 deletions Lumos/external/spdlog/cfg/env.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once
#include <spdlog/cfg/helpers.h>
#include <spdlog/details/registry.h>
#include <spdlog/details/os.h>

//
// Init levels and patterns from env variables SPDLOG_LEVEL
// Inspired from Rust's "env_logger" crate (https://crates.io/crates/env_logger).
// Note - fallback to "info" level on unrecognized levels
//
// Examples:
//
// set global level to debug:
// export SPDLOG_LEVEL=debug
//
// turn off all logging except for logger1:
// export SPDLOG_LEVEL="off,logger1=debug"
//

// turn off all logging except for logger1 and logger2:
// export SPDLOG_LEVEL="off,logger1=debug,logger2=info"

namespace spdlog {
namespace cfg {
void load_env_levels()
{
auto env_val = details::os::getenv("SPDLOG_LEVEL");
auto levels = helpers::extract_levels(env_val);
details::registry::instance().update_levels(std::move(levels));
}

} // namespace cfg
} // namespace spdlog
Loading

0 comments on commit 6f47511

Please sign in to comment.