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::to_hexstring(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
std::string to_hexstring(value_type const &v, const bool skipLeading0x=false) noexcept
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given pointer.
std::string format_string(const char *format,...)
Returns a string according to printf() formatting rules and variable number of arguments following th...