Home

GLMAPINVALIDATEBUFFERBIT

GL_MAP_INVALIDATE... refers to a family of OpenGL buffer mapping flags used with the glMapBufferRange function. They specify how the mapped memory may be treated by the driver and can enable optimizations for streaming or overwrite-heavy workloads. These flags are part of the ARB_map_buffer_range extension and are supported in modern OpenGL and OpenGL ES contexts.

GL_MAP_INVALIDATE_RANGE_BIT indicates that the contents of the specified mapped range are not required to be preserved.

GL_MAP_INVALIDATE_BUFFER_BIT indicates that the entire buffer can be invalidated. This signals the driver that no existing

Both invalidation flags are meaningful only when mapping with write access, typically in combination with GL_MAP_WRITE_BIT.

GL_MAP_UNSYNCHRONIZED_BIT is a related flag that disables certain synchronization guarantees, allowing potentially lower latency at the

In practice, these flags help optimize buffer updates by reducing synchronization and data traffic when the

When
used
with
glMapBufferRange,
the
driver
may
discard
the
previous
contents
of
that
range,
avoiding
the
need
to
synchronize
with
existing
data.
This
can
reduce
stalls
when
the
application
intends
to
overwrite
only
a
portion
of
a
buffer.
contents
need
to
be
preserved,
allowing
more
aggressive
optimization
and
potentially
eliminating
unnecessary
reads.
It
is
particularly
useful
when
the
whole
buffer
will
be
rewritten.
They
may
be
ignored
on
implementations
that
do
not
support
the
corresponding
extension
or
feature
set.
They
are
not
intended
for
use
with
read-only
mappings.
cost
of
requiring
the
application
to
ensure
there
are
no
concurrent
writes
or
reads
by
the
GL.
It
is
commonly
used
alongside
the
invalidation
flags
in
advanced
streaming
scenarios.
previous
contents
are
known
to
be
unnecessary.
Availability
depends
on
API
version
and
platform
support;
consult
the
specific
OpenGL
or
OpenGL
ES
specification
for
exact
requirements
and
behavior.
Examples
of
usage
include
glMapBufferRange(GL_ARRAY_BUFFER,
0,
size,
GL_MAP_WRITE_BIT
|
GL_MAP_INVALIDATE_RANGE_BIT)
and
glMapBufferRange(GL_ARRAY_BUFFER,
0,
size,
GL_MAP_WRITE_BIT
|
GL_MAP_INVALIDATE_BUFFER_BIT).