summaryrefslogtreecommitdiff
path: root/gfx/gl/instanceVertices.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-03-07 11:42:46 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-03-07 11:42:46 +0000
commitc89a633f59d0e393695c10f28c4ba8635eadffba (patch)
tree0e06a281efc2da637ebc19dca38f160e86516d9f /gfx/gl/instanceVertices.h
parentRemove VertexArrayObject and supporting non-DSA gl_traits helpers (diff)
downloadilt-c89a633f59d0e393695c10f28c4ba8635eadffba.tar.bz2
ilt-c89a633f59d0e393695c10f28c4ba8635eadffba.tar.xz
ilt-c89a633f59d0e393695c10f28c4ba8635eadffba.zip
Replace glContainer with glAllocator
glContainer is no longer required, as we can use std::vector with a custom allocator which uses OpenGL buffers for storage. Minor irritation is that the mapped buffers aren't guaranteed to be flushed in the tests, so sometimes we're missing bits in a test render.
Diffstat (limited to 'gfx/gl/instanceVertices.h')
-rw-r--r--gfx/gl/instanceVertices.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/gfx/gl/instanceVertices.h b/gfx/gl/instanceVertices.h
index ecadf8f..f24eaa3 100644
--- a/gfx/gl/instanceVertices.h
+++ b/gfx/gl/instanceVertices.h
@@ -1,13 +1,13 @@
#pragma once
-#include "glContainer.h"
+#include "glAllocator.h"
#include <cassert>
#include <functional>
#include <special_members.h>
#include <utility>
-template<typename T> class InstanceVertices : protected glContainer<T> {
- using base = glContainer<T>;
+template<typename T> class InstanceVertices : protected glVector<T> {
+ using base = glVector<T>;
public:
class [[nodiscard]] InstanceProxy {
@@ -120,16 +120,31 @@ public:
return InstanceProxy {this, index.size() - 1};
}
- using base::bufferName;
- using base::reserve;
-
- [[nodiscard]] auto
- size() const
+ [[nodiscard]] GLuint
+ bufferName() const
{
- base::unmap();
- return base::size();
+ return base::get_allocator().getNameFor(static_cast<const base &>(*this));
}
+ using base::at;
+ using base::begin;
+ using base::cbegin;
+ using base::cend;
+ using base::crbegin;
+ using base::crend;
+ using base::end;
+ using base::rbegin;
+ using base::rend;
+ using base::size;
+ using base::operator[];
+ using base::back;
+ using base::capacity;
+ using base::data;
+ using base::empty;
+ using base::front;
+ using base::reserve;
+ using base::shrink_to_fit;
+
template<typename Pred>
base::size_type
partition(Pred pred)
@@ -195,8 +210,8 @@ protected:
}
template<typename Pred>
- glContainer<T>::iterator
- partition(glContainer<T>::iterator first, glContainer<T>::iterator last, Pred pred)
+ base::iterator
+ partition(base::iterator first, base::iterator last, Pred pred)
{
while (first < last) {
first = std::find_if_not(first, last, pred);