#include #include #include #include #include namespace mbgl { namespace gl { UniformLocation uniformLocation(ProgramID id, const char* name) { return MBGL_CHECK_ERROR(glGetUniformLocation(id, name)); } template <> void bindUniform(UniformLocation location, const float& t) { MBGL_CHECK_ERROR(glUniform1f(location, t)); } template <> void bindUniform(UniformLocation location, const int32_t& t) { MBGL_CHECK_ERROR(glUniform1i(location, t)); } template <> void bindUniform>(UniformLocation location, const std::array& t) { MBGL_CHECK_ERROR(glUniform2fv(location, 1, t.data())); } template <> void bindUniform>(UniformLocation location, const std::array& t) { MBGL_CHECK_ERROR(glUniform3fv(location, 1, t.data())); } template <> void bindUniform>(UniformLocation location, const std::array& t) { MBGL_CHECK_ERROR(glUniform4fv(location, 1, t.data())); } template <> void bindUniform>(UniformLocation location, const std::array& t) { MBGL_CHECK_ERROR(glUniformMatrix2fv(location, 1, GL_FALSE, util::convert(t).data())); } template <> void bindUniform>(UniformLocation location, const std::array& t) { MBGL_CHECK_ERROR(glUniformMatrix3fv(location, 1, GL_FALSE, util::convert(t).data())); } template <> void bindUniform>(UniformLocation location, const std::array& t) { MBGL_CHECK_ERROR(glUniformMatrix4fv(location, 1, GL_FALSE, util::convert(t).data())); } template <> void bindUniform(UniformLocation location, const bool& t) { return bindUniform(location, int32_t(t)); } template <> void bindUniform(UniformLocation location, const uint8_t& t) { bindUniform(location, int32_t(t)); } template <> void bindUniform(UniformLocation location, const Color& t) { bindUniform(location, std::array {{ t.r, t.g, t.b, t.a }}); } template <> void bindUniform(UniformLocation location, const Size& t) { bindUniform(location, util::convert(std::array {{ t.width, t.height }})); } template <> void bindUniform>(UniformLocation location, const std::array& t) { bindUniform(location, util::convert(t)); } // Add more as needed. } // namespace gl } // namespace mbgl