Prevent the allocation of 0 size buffers

This commit is contained in:
Brad Davis 2016-08-07 11:25:14 -07:00
parent 42dcae72cb
commit 9ed1a5980a

View file

@ -21,7 +21,7 @@ class GL45Buffer : public gl::GLBuffer {
public:
GL45Buffer(const std::weak_ptr<gl::GLBackend>& backend, const Buffer& buffer, GLBuffer* original) : Parent(backend, buffer, allocate()) {
glNamedBufferStorage(_buffer, _size, nullptr, GL_DYNAMIC_STORAGE_BIT);
glNamedBufferStorage(_buffer, _size == 0 ? 256 : _size, nullptr, GL_DYNAMIC_STORAGE_BIT);
if (original && original->_size) {
glCopyNamedBufferSubData(original->_buffer, _buffer, 0, 0, std::min(original->_size, _size));
}