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> <Item Name="[value]">value</Item>
</Expand> </Expand>
</Type> </Type>
<Type Name="Seele::Map&lt;*&gt;"> <Type Name="Seele::Tree&lt;*&gt;">
<DisplayString>{{ size={_size} }</DisplayString> <DisplayString>{{ size={_size} }</DisplayString>
<Expand> <Expand>
<Item Name="[size]">_size</Item> <Item Name="[size]">_size</Item>
@@ -47,27 +47,12 @@
<TreeItems> <TreeItems>
<Size>_size</Size> <Size>_size</Size>
<HeadPointer>root</HeadPointer> <HeadPointer>root</HeadPointer>
<LeftPointer>left</LeftPointer> <LeftPointer>leftChild</LeftPointer>
<RightPointer>right</RightPointer> <RightPointer>rightChild</RightPointer>
<ValueNode Condition="!((bool)_Isnil)">pair</ValueNode> <ValueNode>data</ValueNode>
</TreeItems> </TreeItems>
</Expand> </Expand>
</Type> </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;"> <Type Name="Seele::RefPtr&lt;*&gt;">
<DisplayString Condition="object == nullptr">empty</DisplayString> <DisplayString Condition="object == nullptr">empty</DisplayString>
<DisplayString>RefPtr {*object}</DisplayString> <DisplayString>RefPtr {*object}</DisplayString>
+1 -1
View File
@@ -8,7 +8,7 @@
using namespace Seele; using namespace Seele;
AssetRegistry * instance = new AssetRegistry(); AssetRegistry * _instance = new AssetRegistry();
int main(int, char**) int main(int, char**)
{ {
+4 -4
View File
@@ -14,7 +14,7 @@
using namespace Seele; using namespace Seele;
AssetRegistry* instance = new AssetRegistry(); AssetRegistry* _instance = new AssetRegistry();
AssetRegistry::~AssetRegistry() AssetRegistry::~AssetRegistry()
{ {
@@ -103,7 +103,7 @@ std::ifstream AssetRegistry::createReadStream(const std::filesystem::path& relat
AssetRegistry &AssetRegistry::get() AssetRegistry &AssetRegistry::get()
{ {
return *instance; return *_instance;
} }
AssetRegistry::AssetRegistry() AssetRegistry::AssetRegistry()
@@ -113,7 +113,7 @@ AssetRegistry::AssetRegistry()
AssetRegistry* AssetRegistry::getInstance() AssetRegistry* AssetRegistry::getInstance()
{ {
return instance; return _instance;
} }
void AssetRegistry::loadRegistry() void AssetRegistry::loadRegistry()
@@ -409,7 +409,7 @@ AssetRegistry::AssetFolder::AssetFolder(std::string_view folderPath)
AssetRegistry::AssetFolder::~AssetFolder() AssetRegistry::AssetFolder::~AssetFolder()
{ {
for (const auto& [_, child] : children) for (auto [_, child] : children)
{ {
delete child; delete child;
} }
+13 -4
View File
@@ -39,7 +39,7 @@ public:
: node(i.node), traversal(i.traversal) : 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)) : node(std::move(i.node)), traversal(std::move(i.traversal))
{ {
} }
@@ -52,7 +52,7 @@ public:
} }
return *this; return *this;
} }
constexpr IteratorBase& operator=(IteratorBase&& other) constexpr IteratorBase& operator=(IteratorBase&& other) noexcept
{ {
if (this != &other) if (this != &other)
{ {
@@ -150,7 +150,8 @@ public:
using const_reverse_iterator = std::reverse_iterator<const_iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>;
constexpr Tree() noexcept constexpr Tree() noexcept
: root(nullptr) : alloc(NodeAlloc())
, root(nullptr)
, beginIt(nullptr) , beginIt(nullptr)
, endIt(nullptr) , endIt(nullptr)
, iteratorsDirty(true) , iteratorsDirty(true)
@@ -197,6 +198,7 @@ public:
, _size(std::move(other._size)) , _size(std::move(other._size))
, comp(std::move(other.comp)) , comp(std::move(other.comp))
{ {
other._size = 0;
} }
constexpr ~Tree() noexcept constexpr ~Tree() noexcept
{ {
@@ -219,15 +221,19 @@ public:
} }
return *this; return *this;
} }
constexpr Tree& operator=(Tree&& other) constexpr Tree& operator=(Tree&& other) noexcept
{ {
if (this != &other) if (this != &other)
{ {
clear(); clear();
if constexpr (std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value)
{
alloc = std::move(other.alloc); alloc = std::move(other.alloc);
}
root = std::move(other.root); root = std::move(other.root);
_size = std::move(other._size); _size = std::move(other._size);
comp = std::move(other.comp); comp = std::move(other.comp);
other._size = 0;
markIteratorsDirty(); markIteratorsDirty();
} }
return *this; return *this;
@@ -396,6 +402,7 @@ private:
template<class NodeDataType> template<class NodeDataType>
Pair<Node*, bool> _insert(Node* r, NodeDataType&& data) Pair<Node*, bool> _insert(Node* r, NodeDataType&& data)
{ {
markIteratorsDirty();
if (r == nullptr) if (r == nullptr)
{ {
root = alloc.allocate(1); root = alloc.allocate(1);
@@ -429,6 +436,7 @@ private:
template<class KeyType> template<class KeyType>
Node* _remove(Node* r, KeyType&& key) Node* _remove(Node* r, KeyType&& key)
{ {
markIteratorsDirty();
Node* temp; Node* temp;
if (r == nullptr) if (r == nullptr)
return nullptr; return nullptr;
@@ -458,6 +466,7 @@ private:
template<class KeyType> template<class KeyType>
Node* _splay(Node* r, KeyType&& key) Node* _splay(Node* r, KeyType&& key)
{ {
markIteratorsDirty();
if (r == nullptr || equal(r->data, key)) if (r == nullptr || equal(r->data, key))
{ {
return r; return r;
+1
View File
@@ -32,6 +32,7 @@ public:
}; };
struct MeshData struct MeshData
{ {
AABB boundingBox;
uint32 numMeshlets = 0; uint32 numMeshlets = 0;
uint32 meshletOffset = 0; uint32 meshletOffset = 0;
uint32 firstIndex = 0; uint32 firstIndex = 0;
+2 -2
View File
@@ -13,7 +13,7 @@ struct PendingBuffer
bool writeOnly; 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) Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage, Gfx::QueueType& queueType, bool dynamic)
: graphics(graphics) : graphics(graphics)
@@ -239,7 +239,7 @@ void Buffer::unmap()
auto found = pendingBuffers.find(this); auto found = pendingBuffers.find(this);
if (found != pendingBuffers.end()) if (found != pendingBuffers.end())
{ {
PendingBuffer& pending = found->second; PendingBuffer& pending = found->value;
pending.stagingBuffer->flush(); pending.stagingBuffer->flush();
if (pending.writeOnly) if (pending.writeOnly)
{ {
+1 -1
View File
@@ -38,7 +38,7 @@ void ThreadPool::runAndWait(List<std::function<void()>> functions)
void ThreadPool::work() void ThreadPool::work()
{ {
while (true) while (running)
{ {
std::unique_lock l(taskLock); std::unique_lock l(taskLock);
while(currentTask.functions.empty()) while(currentTask.functions.empty())
+24 -1
View File
@@ -31,7 +31,7 @@ TEST(CachedMap, for_each)
map[6] = 4; map[6] = 4;
map[4] = 7; map[4] = 7;
int count = 0; int count = 0;
for(auto it : map) for(auto [key, val] : map)
{ {
count++; 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);
}