More optimizations to GL state machine when HAVE_SHARED_CONTEXT
is defined