Besides the answers given so far, and although it has nothing directly to do with GLES, I's like to paste this bit from issue 2 of the ARB_buffer_storage
extension (introduces along with desktop GL 4.4):
2) The new flags don't directly map to the parameter for
glBufferData and one cannot be expressed in terms of the other. Does
that matter?
Most applications get usage
wrong and they're only hints anyway. The
flags are hard and fast rules that must be followed. They serve a
different purpose. The idea here is to allow the implementation to not
have to second guess the application and to perform less tracking, and
for the application to have more control. We define BufferData in
terms of BufferStorage with the most liberal allowed flags
(essentially, anything goes), but still pass the hint to the
implementation to allow it to continue to second guess the
application.
The problem with these flags has always been that every implementation might have different ideas on how to optimize the different paths suggested by the usage hint, and each application seem to have different expectations of how these optimization works.
Nvidias desktop GL driver will in a debug profile print some of the decisions it made for the buffer objects, especially if they are stored in client RAM or directly on the GPU. When playing around with this I got the following:
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) has been mapped in HOST memory.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) stored in VIDEO memory has been updated.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) has been mapped in HOST memory.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) stored in SYSTEM HEAP memory has been updated.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use SYSTEM HEAP memory as the source for buffer object operations.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use SYSTEM HEAP memory as the source for buffer object operations.
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) has been mapped WRITE_ONLY in SYSTEM HEAP memory (fast).
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) has been mapped WRITE_ONLY in SYSTEM HEAP memory (fast).
Buffer detailed info: Buffer object 5 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STATIC_DRAW) has been mapped WRITE_ONLY in SYSTEM HEAP memory (fast).
What I did here was using a PBO to stream texture updates to the GPU, with one update per frame via mapping the buffer. The natural choice here would be using GL_STREAM_DRAW
, but I specified GL_STATIC_DRAW
. What the driver did was giving me some VRAM backed buffer initially, and doing I/O mapping for the first two updates I did. But then, it changed its mind and uses a client-backed buffer - giving me exactly the result I would have gotten if I had asked for GL_STREAM_DRAW
in the first place. What we see here is an example for the second guessing
the quoted text above was about.
All of this is highly implementation specific. And that is also part of the reason the aforementioned GL extension was created - which will give the programmer much more control over such things. However, this extension is, as far as I know, not available in the realm of OpenGL ES.