Portal:OpenGL Concepts/Memory Model

From OpenGL.org
Jump to: navigation, search

The OpenGL Memory Model governs when state set by one OpenGL command becomes visible to other commands. Normally, the memory model is perfectly sequential and synchronous: state set by one command is immediately visible to any subsequent command, but not any prior ones. However, there are certain cases where the model breaks down or otherwise requires explicit synchronization.

Rendering to the same image as one is sampling from is one such case. A second case is when dealing with multiple contexts that have objects shared between them. State set from one context may not be immediately visible in another; special considerations need to be taken.

The big one has to do with arbitrary image reads/writes in GL 4.2+. The use of this feature (as well as some related ones) completely throws out any implicit GL memory model, thus forcing all synchronization for these operations on the user.