]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programdata.cpp
Move buffer resizing out of Bufferable
[libs/gl.git] / source / programdata.cpp
index 912bc3c88a54c25a8c52199e8552a0d0a2b5eecc..68a6715d419c847c173ba56ab5cc0dac6c329878 100644 (file)
@@ -559,6 +559,7 @@ void ProgramData::apply() const
 
                const Program::UniformBlockMap &prog_blocks = prog->get_uniform_blocks();
 
+               UniformBlock *old_last_block = last_block;
                if(pu.dirty==ALL_ONES)
                {
                        /* The set of uniforms has changed since this program was last used.
@@ -600,6 +601,13 @@ void ProgramData::apply() const
                to avoid state thrashing. */
                if(buffered_blocks_updated && !ARB_direct_state_access)
                        buffer->bind();
+
+               if(last_block!=old_last_block)
+               {
+                       unsigned required_size = last_block->get_required_buffer_size();
+                       if(last_block->get_required_buffer_size()>buffer->get_size())
+                               buffer->data(required_size, 0);
+               }
        }
 
        for(vector<ProgramBlock>::iterator i=pu.blocks.begin(); i!=pu.blocks.end(); ++i)