return count;
}
+unsigned BufferRange::get_uniform_buffer_alignment()
+{
+ static unsigned align = get_i(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT);
+ return align;
+}
+
} // namespace GL
} // namespace Msp
public:
static unsigned get_n_uniform_buffer_bindings();
+ static unsigned get_uniform_buffer_alignment();
};
} // namespace GL
if(prev_in_buffer)
offset = prev_in_buffer->buffer_offset+prev_in_buffer->get_data_size();
+ unsigned align = get_alignment();
+ offset += align-1;
+ offset -= offset%align;
if(offset!=buffer_offset)
{
buffer_offset = offset;
protected:
virtual unsigned get_data_size() const = 0;
+ virtual unsigned get_alignment() const { return 1; }
void update_buffer_offset();
virtual void offset_changed() { }
delete buf_range;
}
+unsigned UniformBlock::get_alignment() const
+{
+ return BufferRange::get_uniform_buffer_alignment();
+}
+
void UniformBlock::offset_changed()
{
delete buf_range;
private:
virtual unsigned get_data_size() const { return size; }
+ virtual unsigned get_alignment() const;
virtual void offset_changed();
virtual void upload_data() const;