[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebGL2 and no mapBuffer/mapBufferRange



glMapBuffer with the unsynchronized bit cannot set the the read flag:

GL_INVALID_OPERATION is generated for any of the following conditions:
-  GL_MAP_READ_BIT is set and any of GL_MAP_INVALIDATE_RANGE_BIT, GL_MAP_INVALIDATE_BUFFER_BIT, or GL_MAP_UNSYNCHRONIZED_BIT is set.

It also states that:

GL_MAP_UNSYNCHRONIZED_BIT indicates that the GL should not attempt to synchronize pending operations on the buffer prior to returning from glMapBufferRange. No GL error is generated if pending operations which source or modify the buffer overlap the mapped region, but the result of such previous and any subsequent operations is undefined.

In a nutshell this means for instance if you do:
  1. first mapBuffer[Range] for read or write without unsynchronized bit
  2. do a second mapBufferRange overlapping a previous still active mapping in step #1 and set the unsynchronized bit, that the result of step #1 is undefined.
Since it is undefined, this indicates that this usage scheme is not very useful, and so I find it entirely permissible to restrict overlap for that case and generate an invalid operation.