diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-07 11:50:47 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-07 11:50:47 +0000 |
| commit | adb0096046d357a6463ae2ce66c182546c8de9c2 (patch) | |
| tree | 0e06a281efc2da637ebc19dca38f160e86516d9f /gfx/gl/glBuffer.h | |
| parent | Update stencils and billboards less often (diff) | |
| parent | Replace glContainer with glAllocator (diff) | |
| download | ilt-adb0096046d357a6463ae2ce66c182546c8de9c2.tar.bz2 ilt-adb0096046d357a6463ae2ce66c182546c8de9c2.tar.xz ilt-adb0096046d357a6463ae2ce66c182546c8de9c2.zip | |
Merge branch 'glalloc'
Diffstat (limited to 'gfx/gl/glBuffer.h')
| -rw-r--r-- | gfx/gl/glBuffer.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gfx/gl/glBuffer.h b/gfx/gl/glBuffer.h new file mode 100644 index 0000000..f43c223 --- /dev/null +++ b/gfx/gl/glBuffer.h @@ -0,0 +1,27 @@ +#pragma once + +#include "glArrays.h" + +namespace Impl { + // NOLINTNEXTLINE(readability-identifier-naming) + struct glBuffer : Detail::glNamed { + void + storage(const std::ranges::contiguous_range auto & data, GLenum flags) + { + glNamedBufferStorage( + name, static_cast<GLsizeiptr>(data.size() * sizeof(decltype(*data.data()))), data.data(), flags); + } + + void + data(const std::ranges::contiguous_range auto & data, GLenum flags) + { + glNamedBufferData( + name, static_cast<GLsizeiptr>(data.size() * sizeof(decltype(*data.data()))), data.data(), flags); + } + }; +} + +// NOLINTBEGIN(readability-identifier-naming) +template<size_t N> using glBuffers = glManagedArray<Impl::glBuffer, N, &glCreateBuffers, &glDeleteBuffers>; +using glBuffer = glManagedSingle<Impl::glBuffer, &glCreateBuffers, &glDeleteBuffers>; +// NOLINTEND(readability-identifier-naming) |
