X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fbuffer.h;h=2366ec5ce0dd3269ee13db7d80bd53eade0fd565;hb=f2bb1caa233930e1148613e9d5daa2c29b0fe271;hp=0e1836888dfbdd083ce47fe4c9af5dbfe6bfa3a5;hpb=24b24e2203c776aacd9744bb947f5cf47b03d328;p=libs%2Fgl.git diff --git a/source/core/buffer.h b/source/core/buffer.h index 0e183688..2366ec5c 100644 --- a/source/core/buffer.h +++ b/source/core/buffer.h @@ -3,7 +3,7 @@ #include #include -#include +#include "buffer_backend.h" namespace Msp { namespace GL { @@ -15,29 +15,19 @@ public: virtual ~buffer_too_small() throw() { } }; -class BufferRange; - /** A buffer for storing data in GL memory. Putting vertex and index data in buffers can improve rendering performance. The VertexArray, Mesh and UniformBlock classes contain built-in support for buffers. */ -class Buffer +class Buffer: public BufferBackend { - friend class PipelineState; - friend class Texture2D; - friend class VertexSetup; + friend BufferBackend; private: - unsigned id; - unsigned size; - - static Buffer *scratch_binding; + unsigned size = 0; public: - Buffer(); - ~Buffer(); - /** Defines the storage size of the buffer. Must be called before data can be uploaded. Storage cannot be changed once set. */ void storage(unsigned); @@ -55,15 +45,10 @@ public: void require_size(unsigned) const; - void *map(); - bool unmap(); + using BufferBackend::map; + using BufferBackend::unmap; - void set_debug_name(const std::string &); - -private: - void bind_scratch(); -public: - static void unbind_scratch(); + using BufferBackend::set_debug_name; }; } // namespace GL