- unsigned max_clip_planes = DeviceInfo::get_global().limits.max_clip_planes;
- for(unsigned i=0; i<max_clip_planes; ++i)
- {
- if((self->enabled_clip_planes>>i)&1)
- glEnable(GL_CLIP_PLANE0+i);
- else
- glDisable(GL_CLIP_PLANE0+i);
- }
+ for(const PipelineState::BoundUniformBlock &u: self.uniform_blocks)
+ if(u.changed || changes==~0U)
+ {
+ if(u.used)
+ {
+ if(u.binding>=0)
+ {
+ glBindBufferRange(GL_UNIFORM_BUFFER, u.binding, u.buffer->id, u.block->get_offset(), u.block->get_data_size());
+ dev_state.bound_uniform_blocks[u.binding] = 1;
+ }
+ else if(u.binding==ReflectData::DEFAULT_BLOCK && self.shprog)
+ {
+ const char *data = static_cast<const char *>(u.block->get_data_pointer());
+ for(const Program::UniformCall &call: self.shprog->uniform_calls)
+ call.func(call.location, call.size, data+call.location*16);
+ }
+ }
+
+ u.changed = false;
+ }