X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fbuffer.cpp;h=4a36937e7b745d1dd32f8c1e9ce19df0766037d7;hp=15a37397bcb18bdf094b5e5a5cef1a7d31b38c31;hb=7ef75a4c4dbfc437e466381dd67c23357e607b82;hpb=6080120777fdf7b6e1184288eff9d205ca7ebf5f diff --git a/source/core/buffer.cpp b/source/core/buffer.cpp index 15a37397..4a36937e 100644 --- a/source/core/buffer.cpp +++ b/source/core/buffer.cpp @@ -46,5 +46,23 @@ void Buffer::require_size(size_t req_sz) const throw buffer_too_small(format("buffer has %d bytes; %d required", size, req_sz)); } +void *Buffer::map() +{ + if(!can_map() || mapped) + throw invalid_operation("Buffer::map"); + void *result = BufferBackend::map(); + mapped = true; + return result; +} + +bool Buffer::unmap() +{ + if(!can_map() || !mapped) + throw invalid_operation("Buffer::map"); + bool result = BufferBackend::unmap(); + mapped = false; + return result; +} + } // namespace GL } // namespace Msp