]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/pipelinestate.cpp
Use a scratch binding to modify textures and buffers
[libs/gl.git] / source / core / pipelinestate.cpp
index f855eed61e012c35d86775c32e5a8f1c6ce51a16..318522d6563b547eebcf6b823ed3e5ddbb9c0305 100644 (file)
@@ -162,6 +162,9 @@ void PipelineState::set_blend(const Blend *b)
 
 void PipelineState::apply() const
 {
+       if(!last_applied)
+               Texture::unbind_scratch();
+
        apply(this==last_applied ? changes : ~0U);
 }
 
@@ -281,11 +284,10 @@ void PipelineState::apply(unsigned mask) const
                                        {
                                                const BufferBackedUniformBlock *block = static_cast<const BufferBackedUniformBlock *>(i->block);
                                                glBindBufferRange(GL_UNIFORM_BUFFER, i->binding, block->get_buffer()->get_id(), block->get_offset(), block->get_data_size());
+                                               bound_uniform_blocks[i->binding] = 1;
                                        }
                                        else
                                                static_cast<const DefaultUniformBlock *>(i->block)->apply();
-
-                                       bound_uniform_blocks[i->binding] = 1;
                                }
 
                                i->changed = false;