]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/programdata.cpp
Remove the notion of default binding point from Buffer
[libs/gl.git] / source / render / programdata.cpp
index f3c6108c767284a9e158ee88df7fdd9a5986873d..b21c395cf04c27f1084492294dbd2635993af5df 100644 (file)
@@ -565,7 +565,14 @@ void ProgramData::update_block_uniform_indices(SharedBlock &block, const Program
                if(info.bind_point>=0)
                {
                        if(!buffer)
-                               buffer = new Buffer(UNIFORM_BUFFER);
+                       {
+                               buffer = new Buffer();
+
+#ifdef DEBUG
+                               if(!debug_name.empty())
+                                       buffer->set_debug_name(debug_name);
+#endif
+                       }
 
                        BufferBackedUniformBlock *bb_block = new BufferBackedUniformBlock(info.data_size);
                        block.block = bb_block;
@@ -650,11 +657,6 @@ void ProgramData::apply() const
 
                prog_begin->masks.dirty = 0;
 
-               /* If any blocks stored in the buffer were updated, bind the buffer here
-               to avoid state thrashing. */
-               if(buffered_blocks_updated && !ARB_direct_state_access)
-                       buffer->bind();
-
                if(last_buffer_block!=old_last_block)
                {
                        unsigned required_size = last_buffer_block->get_required_buffer_size();
@@ -663,8 +665,13 @@ void ProgramData::apply() const
                                if(buffer->get_size()>0)
                                {
                                        delete buffer;
-                                       buffer = new Buffer(UNIFORM_BUFFER);
+                                       buffer = new Buffer();
                                        last_buffer_block->change_buffer(buffer);
+
+#ifdef DEBUG
+                                       if(!debug_name.empty())
+                                               buffer->set_debug_name(debug_name);
+#endif
                                }
 
                                buffer->storage(required_size);
@@ -677,6 +684,17 @@ void ProgramData::apply() const
                        i->block->apply(i->bind_point);
 }
 
+void ProgramData::set_debug_name(const string &name)
+{
+#ifdef DEBUG
+       debug_name = name;
+       if(buffer)
+               buffer->set_debug_name(name);
+#else
+       (void)name;
+#endif
+}
+
 
 ProgramData::TaggedUniform::TaggedUniform():
        value(0)