diff --git a/Seele.natvis b/Seele.natvis
index f2ef801..53362e3 100644
--- a/Seele.natvis
+++ b/Seele.natvis
@@ -39,7 +39,7 @@
- value
-
+
{{ size={_size} }
- _size
@@ -47,27 +47,12 @@
_size
root
- left
- right
- pair
+ leftChild
+ rightChild
+ data
-
- [{pair}]
-
- - pair
- - leftChild
- - rightChild
-
-
-
- empty
- [{nodeContainer._data[node].pair}]
-
- nodeContainer._data[node].pair
-
-
empty
RefPtr {*object}
diff --git a/src/AssetViewer/main.cpp b/src/AssetViewer/main.cpp
index 4b5a1e8..5063e56 100644
--- a/src/AssetViewer/main.cpp
+++ b/src/AssetViewer/main.cpp
@@ -8,7 +8,7 @@
using namespace Seele;
-AssetRegistry * instance = new AssetRegistry();
+AssetRegistry * _instance = new AssetRegistry();
int main(int, char**)
{
diff --git a/src/Engine/Asset/AssetRegistry.cpp b/src/Engine/Asset/AssetRegistry.cpp
index 9a90e02..687260f 100644
--- a/src/Engine/Asset/AssetRegistry.cpp
+++ b/src/Engine/Asset/AssetRegistry.cpp
@@ -14,7 +14,7 @@
using namespace Seele;
-AssetRegistry* instance = new AssetRegistry();
+AssetRegistry* _instance = new AssetRegistry();
AssetRegistry::~AssetRegistry()
{
@@ -103,7 +103,7 @@ std::ifstream AssetRegistry::createReadStream(const std::filesystem::path& relat
AssetRegistry &AssetRegistry::get()
{
- return *instance;
+ return *_instance;
}
AssetRegistry::AssetRegistry()
@@ -113,7 +113,7 @@ AssetRegistry::AssetRegistry()
AssetRegistry* AssetRegistry::getInstance()
{
- return instance;
+ return _instance;
}
void AssetRegistry::loadRegistry()
@@ -409,7 +409,7 @@ AssetRegistry::AssetFolder::AssetFolder(std::string_view folderPath)
AssetRegistry::AssetFolder::~AssetFolder()
{
- for (const auto& [_, child] : children)
+ for (auto [_, child] : children)
{
delete child;
}
diff --git a/src/Engine/Containers/Tree.h b/src/Engine/Containers/Tree.h
index 2a760c0..0abace7 100644
--- a/src/Engine/Containers/Tree.h
+++ b/src/Engine/Containers/Tree.h
@@ -39,7 +39,7 @@ public:
: node(i.node), traversal(i.traversal)
{
}
- constexpr IteratorBase(IteratorBase&& i)
+ constexpr IteratorBase(IteratorBase&& i) noexcept
: node(std::move(i.node)), traversal(std::move(i.traversal))
{
}
@@ -52,7 +52,7 @@ public:
}
return *this;
}
- constexpr IteratorBase& operator=(IteratorBase&& other)
+ constexpr IteratorBase& operator=(IteratorBase&& other) noexcept
{
if (this != &other)
{
@@ -150,7 +150,8 @@ public:
using const_reverse_iterator = std::reverse_iterator;
constexpr Tree() noexcept
- : root(nullptr)
+ : alloc(NodeAlloc())
+ , root(nullptr)
, beginIt(nullptr)
, endIt(nullptr)
, iteratorsDirty(true)
@@ -197,6 +198,7 @@ public:
, _size(std::move(other._size))
, comp(std::move(other.comp))
{
+ other._size = 0;
}
constexpr ~Tree() noexcept
{
@@ -219,15 +221,19 @@ public:
}
return *this;
}
- constexpr Tree& operator=(Tree&& other)
+ constexpr Tree& operator=(Tree&& other) noexcept
{
if (this != &other)
{
clear();
- alloc = std::move(other.alloc);
+ if constexpr (std::allocator_traits::propagate_on_container_move_assignment::value)
+ {
+ alloc = std::move(other.alloc);
+ }
root = std::move(other.root);
_size = std::move(other._size);
comp = std::move(other.comp);
+ other._size = 0;
markIteratorsDirty();
}
return *this;
@@ -396,6 +402,7 @@ private:
template
Pair _insert(Node* r, NodeDataType&& data)
{
+ markIteratorsDirty();
if (r == nullptr)
{
root = alloc.allocate(1);
@@ -429,6 +436,7 @@ private:
template
Node* _remove(Node* r, KeyType&& key)
{
+ markIteratorsDirty();
Node* temp;
if (r == nullptr)
return nullptr;
@@ -458,6 +466,7 @@ private:
template
Node* _splay(Node* r, KeyType&& key)
{
+ markIteratorsDirty();
if (r == nullptr || equal(r->data, key))
{
return r;
diff --git a/src/Engine/Graphics/VertexData.h b/src/Engine/Graphics/VertexData.h
index ecaff88..ee2555b 100644
--- a/src/Engine/Graphics/VertexData.h
+++ b/src/Engine/Graphics/VertexData.h
@@ -32,6 +32,7 @@ public:
};
struct MeshData
{
+ AABB boundingBox;
uint32 numMeshlets = 0;
uint32 meshletOffset = 0;
uint32 firstIndex = 0;
diff --git a/src/Engine/Graphics/Vulkan/Buffer.cpp b/src/Engine/Graphics/Vulkan/Buffer.cpp
index bbb0cdb..6744549 100644
--- a/src/Engine/Graphics/Vulkan/Buffer.cpp
+++ b/src/Engine/Graphics/Vulkan/Buffer.cpp
@@ -13,7 +13,7 @@ struct PendingBuffer
bool writeOnly;
};
-static std::map pendingBuffers;
+static Map pendingBuffers;
Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage, Gfx::QueueType& queueType, bool dynamic)
: graphics(graphics)
@@ -239,7 +239,7 @@ void Buffer::unmap()
auto found = pendingBuffers.find(this);
if (found != pendingBuffers.end())
{
- PendingBuffer& pending = found->second;
+ PendingBuffer& pending = found->value;
pending.stagingBuffer->flush();
if (pending.writeOnly)
{
diff --git a/src/Engine/ThreadPool.cpp b/src/Engine/ThreadPool.cpp
index 6ff691d..cf52c31 100644
--- a/src/Engine/ThreadPool.cpp
+++ b/src/Engine/ThreadPool.cpp
@@ -38,7 +38,7 @@ void ThreadPool::runAndWait(List> functions)
void ThreadPool::work()
{
- while (true)
+ while (running)
{
std::unique_lock l(taskLock);
while(currentTask.functions.empty())
diff --git a/tests/Engine/Containers/Map.cpp b/tests/Engine/Containers/Map.cpp
index 1a8fdd9..92371b4 100644
--- a/tests/Engine/Containers/Map.cpp
+++ b/tests/Engine/Containers/Map.cpp
@@ -31,7 +31,7 @@ TEST(CachedMap, for_each)
map[6] = 4;
map[4] = 7;
int count = 0;
- for(auto it : map)
+ for(auto [key, val] : map)
{
count++;
}
@@ -113,3 +113,26 @@ TEST(CachedMap, copy)
}
}
+TEST(CachedMap, move)
+{
+ Map map;
+ map[54] = 14;
+ map[5123] = 51;
+ map[262] = 14;
+ map[9620] = 91283;
+ map[141] = 415;
+ Map map2 = std::move(map);
+ ASSERT_EQ(map2[54], 14);
+ ASSERT_EQ(map2[5123], 51);
+ ASSERT_EQ(map2[262], 14);
+ ASSERT_EQ(map2[9620], 91283);
+ ASSERT_EQ(map2[141], 415);
+ Map map3;
+ map3 = std::move(map2);
+ ASSERT_EQ(map3[54], 14);
+ ASSERT_EQ(map3[5123], 51);
+ ASSERT_EQ(map3[262], 14);
+ ASSERT_EQ(map3[9620], 91283);
+ ASSERT_EQ(map3[141], 415);
+}
+