- BindRestore _bind(this, type);
- glBufferSubData(type, off, sz, d);
+ if(ARB_direct_state_access)
+ glNamedBufferSubData(id, off, sz, d);
+ else
+ {
+ BindRestore _bind(this, type);
+ glBufferSubData(type, off, sz, d);
+ }
+}
+
+void Buffer::require_size(unsigned req_sz) const
+{
+ if(size<req_sz)
+ throw buffer_too_small(format("buffer has %d bytes; %d required", size, req_sz));