]> git.tdb.fi Git - libs/gl.git/blobdiff - source/bufferable.cpp
Use ARB_direct_state_access to avoid some bind calls
[libs/gl.git] / source / bufferable.cpp
index e6b52ddfa53f622f1bdcbffe692dc337db92cb48..3178e0adefa38f72e2d8aa22ecbae6769c50cdc7 100644 (file)
@@ -1,4 +1,6 @@
 #include <stdexcept>
+#include <msp/core/raii.h>
+#include <msp/gl/extensions/arb_direct_state_access.h>
 #include "bindable.h"
 #include "buffer.h"
 #include "bufferable.h"
@@ -107,7 +109,8 @@ bool Bufferable::resize_buffer() const
 
 void Bufferable::update_buffer() const
 {
-       BindRestore bind(buffer, buffer->get_type());
+       Conditional<BindRestore> _bind(!ARB_direct_state_access, buffer, buffer->get_type());
+
        if(resize_buffer())
        {
                /* Resizing the buffer invalidates its contents.  Non-dirty data may