gles2rice: Integrate some upstream code into OGLGraphicsContext.cpp