GL(ES): Spurious device errors
Sometimes the GLES backend produces strange device errors. I tracked down the issue to _cairo_gl_shader_set_samplers(). The problem here is that the currently bound program is being preserved by querying GL_CURRENT_PROGRAM, changing it (and doing stuff) and then setting the retrieved value. This may produce a gl-error if the last reference to the previously bound program was being bound in the context. This can easily be reproduced by code like
GLint p = someShader(); glUseProgram(p); glDeleteProgram(p); ... GLint q; glGetIntegerv(GL_CURRENT_PROGRAM, &q); glUseProgram(0); glUseProgram(q); <-- BAM! q is gone!