Initialize shared context when creating a buffer