X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=util.h;h=c5dafed6b7160f8b080ea6536608e1fd7735ee54;hp=627c62934d7ce857ef4bb2263e35c6d1e30d4ec9;hb=ca8568e3e0f614320732c5c8e98ecd48cf5b9bcb;hpb=d398770154ecc4bc95282dc45656789dd5686309 diff --git a/util.h b/util.h index 627c629..c5dafed 100644 --- a/util.h +++ b/util.h @@ -34,6 +34,9 @@ void print_3x3_matrix(const Eigen::Matrix3d &m); // Output a GLSL 3x3 matrix declaration. std::string output_glsl_mat3(const std::string &name, const Eigen::Matrix3d &m); +// Calculate a / b, rounding up. Does not handle overflow correctly. +unsigned div_round_up(unsigned a, unsigned b); + // Calculate where to sample, and with what weight, if one wants to use // the GPU's bilinear hardware to sample w1 * x[0] + w2 * x[1]. // @@ -50,6 +53,9 @@ GLuint fill_vertex_attribute(GLuint glsl_program_num, const std::string &attribu // Clean up after fill_vertex_attribute(). void cleanup_vertex_attribute(GLuint glsl_program_num, const std::string &attribute_name, GLuint vbo); +// If v is not already a power of two, return the first higher power of two. +unsigned next_power_of_two(unsigned v); + } // namespace movit #ifdef NDEBUG