12#ifndef GAMP_GLMAPPEDBUFFER_HPP_
13#define GAMP_GLMAPPEDBUFFER_HPP_
24 using namespace gamp::render::gl;
91 GLbitfield m_mutableUsage;
92 GLbitfield m_immutableFlags;
101 m_mappedBuffer =
nullptr;
109 m_mappedBuffer =
nullptr;
112 m_mappedBuffer = buffer;
116 GLuint
name() const noexcept {
return m_name; }
152 const void*
data() const noexcept {
return m_mappedBuffer; }
154 void*
data() noexcept {
return m_mappedBuffer; }
156 std::string
toString(
bool skipMappedBuffer=
false)
const {
159 s0 =
jau::format_string(
"GLMappedBuffer[name %u, size %zu, mutable usage 0x%X", m_name, m_size, m_mutableUsage);
161 s0 =
jau::format_string(
"GLMappedBuffer[name %u, size %zu, immutable flags 0x%X", m_name, m_size, m_immutableFlags);
163 if(skipMappedBuffer) {
164 return s0.append(
"]");
166 return s0.append(
", mapped ").append(
jau::toHexString(m_mappedBuffer)).append(
"]");
void reset(glmemsize_t size, GLbitfield mutableUsage, GLbitfield immutableFlags) noexcept
void setMappedBuffer(void *buffer) noexcept
GLMappedBuffer(GLuint name, glmemsize_t size, GLbitfield mutableUsage, GLbitfield immutableFlags) noexcept
const void * data() const noexcept
Returns the mapped ByteBuffer, or null if not mapped.
GLbitfield immutableFlags() const noexcept
Returns the immutable storage flags, invalid if storage is mutable.
std::string toString(bool skipMappedBuffer=false) const
GLuint name() const noexcept
Return the buffer name.
bool isMutableStorage() const noexcept
Returns true if buffer's storage is mutable, i.e.
glmemsize_t size() const noexcept
Return the buffer's storage size.
GLbitfield mutableUsage() const noexcept
Returns the mutable storage usage or 0 if storage is not mutable.
GLsizeiptr glmemsize_t
Compatible with ssize_t.
std::unique_ptr< GLMappedBuffer > GLMappedBufferPtr
constexpr std::string format_string(const std::string_view format, const Args &...args)
Safely returns a (non-truncated) string according to snprintf() formatting rules using an initially s...
std::string toHexString(const void *data, const nsize_t length, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix) noexcept
Produce a hexadecimal string representation of the given lsb-first byte values.