Fixing mesh rendering

This commit is contained in:
Dynamitos
2023-12-24 21:49:49 +01:00
parent 95dcfda1cd
commit 1ae8d68838
8 changed files with 51 additions and 33 deletions
+4 -19
View File
@@ -39,7 +39,7 @@
<Item Name="[value]">value</Item>
</Expand>
</Type>
<Type Name="Seele::Map&lt;*&gt;">
<Type Name="Seele::Tree&lt;*&gt;">
<DisplayString>{{ size={_size} }</DisplayString>
<Expand>
<Item Name="[size]">_size</Item>
@@ -47,27 +47,12 @@
<TreeItems>
<Size>_size</Size>
<HeadPointer>root</HeadPointer>
<LeftPointer>left</LeftPointer>
<RightPointer>right</RightPointer>
<ValueNode Condition="!((bool)_Isnil)">pair</ValueNode>
<LeftPointer>leftChild</LeftPointer>
<RightPointer>rightChild</RightPointer>
<ValueNode>data</ValueNode>
</TreeItems>
</Expand>
</Type>
<Type Name="Seele::Map&lt;*&gt;::Node">
<DisplayString>[{pair}]</DisplayString>
<Expand>
<Item Name="[pair]">pair</Item>
<Item Name="[left]">leftChild</Item>
<Item Name="[right]">rightChild</Item>
</Expand>
</Type>
<Type Name="Seele::Map&lt;*&gt;::IteratorBase&lt;*&gt;">
<DisplayString Condition="nodeContainer.arraySize==0">empty</DisplayString>
<DisplayString>[{nodeContainer._data[node].pair}]</DisplayString>
<Expand>
<ExpandedItem>nodeContainer._data[node].pair</ExpandedItem>
</Expand>
</Type>
<Type Name="Seele::RefPtr&lt;*&gt;">
<DisplayString Condition="object == nullptr">empty</DisplayString>
<DisplayString>RefPtr {*object}</DisplayString>
+1 -1
View File
@@ -8,7 +8,7 @@
using namespace Seele;
AssetRegistry * instance = new AssetRegistry();
AssetRegistry * _instance = new AssetRegistry();
int main(int, char**)
{
+4 -4
View File
@@ -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;
}
+14 -5
View File
@@ -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<const_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<allocator_type>::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<class NodeDataType>
Pair<Node*, bool> _insert(Node* r, NodeDataType&& data)
{
markIteratorsDirty();
if (r == nullptr)
{
root = alloc.allocate(1);
@@ -429,6 +436,7 @@ private:
template<class KeyType>
Node* _remove(Node* r, KeyType&& key)
{
markIteratorsDirty();
Node* temp;
if (r == nullptr)
return nullptr;
@@ -458,6 +466,7 @@ private:
template<class KeyType>
Node* _splay(Node* r, KeyType&& key)
{
markIteratorsDirty();
if (r == nullptr || equal(r->data, key))
{
return r;
+1
View File
@@ -32,6 +32,7 @@ public:
};
struct MeshData
{
AABB boundingBox;
uint32 numMeshlets = 0;
uint32 meshletOffset = 0;
uint32 firstIndex = 0;
+2 -2
View File
@@ -13,7 +13,7 @@ struct PendingBuffer
bool writeOnly;
};
static std::map<Vulkan::Buffer*, PendingBuffer> pendingBuffers;
static Map<Vulkan::Buffer*, PendingBuffer> 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)
{
+1 -1
View File
@@ -38,7 +38,7 @@ void ThreadPool::runAndWait(List<std::function<void()>> functions)
void ThreadPool::work()
{
while (true)
while (running)
{
std::unique_lock l(taskLock);
while(currentTask.functions.empty())
+24 -1
View File
@@ -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<int, int> map;
map[54] = 14;
map[5123] = 51;
map[262] = 14;
map[9620] = 91283;
map[141] = 415;
Map<int, int> 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<int, int> 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);
}