- /** Unbinds the buffer from its default slot. */
- void unbind() const { unbind_from(type); }
-
- static const Buffer *current(BufferType);
- static void unbind_from(BufferType);
-private:
- static const Buffer *&binding(BufferType);
- static bool set_current(BufferType, const Buffer *);
-
-public:
- void set_debug_name(const std::string &);
-};
-
-
-/**
-A proxy for a subset of a buffer. Can be bound for use with uniform blocks.
-*/
-class BufferRange
-{
-private:
- Buffer &buffer;
- unsigned offset;
- unsigned size;
-
- static std::vector<const BufferRange *> bound_uniform;
-
-public:
- BufferRange(Buffer &, unsigned, unsigned);
- ~BufferRange();
-
- void data(const void *);
-
- void bind_to(BufferType, unsigned);
-
- static const BufferRange *current(BufferType t, unsigned i) { return binding(t, i); }
- static void unbind_from(BufferType, unsigned);
-private:
- static const BufferRange *&binding(BufferType, unsigned);
- static bool set_current(BufferType, unsigned, const BufferRange *);
-
-public:
- static unsigned get_n_uniform_buffer_bindings();
- static unsigned get_uniform_buffer_alignment();