glMapBuffer, glMapNamedBuffer — 全てのバッファーオブジェクトのデータストアをクライアントのアドレス空間へマップします
void *glMapBuffer(
|
GLenum target, |
GLenum access) ; |
void *glMapNamedBuffer(
|
GLuint buffer, |
GLenum access) ; |
target
Buffer Binding Target | Purpose |
---|---|
GL_ARRAY_BUFFER
|
Vertex attributes |
GL_ATOMIC_COUNTER_BUFFER
|
Atomic counter storage |
GL_COPY_READ_BUFFER
|
Buffer copy source |
GL_COPY_WRITE_BUFFER
|
Buffer copy destination |
GL_DISPATCH_INDIRECT_BUFFER
|
Indirect compute dispatch commands |
GL_DRAW_INDIRECT_BUFFER
|
Indirect command arguments |
GL_ELEMENT_ARRAY_BUFFER
|
Vertex array indices |
GL_PIXEL_PACK_BUFFER
|
Pixel read target |
GL_PIXEL_UNPACK_BUFFER
|
Texture data source |
GL_QUERY_BUFFER
|
Query result buffer |
GL_SHADER_STORAGE_BUFFER
|
Read-write storage for shaders |
GL_TEXTURE_BUFFER
|
Texture data buffer |
GL_TRANSFORM_FEEDBACK_BUFFER
|
Transform feedback buffer |
GL_UNIFORM_BUFFER
|
Uniform block storage |
buffer
glMapNamedBuffer
に於いて、バッファーオブジェクトのハンドルを指定します。
access
glMapBuffer
及び
glMapNamedBuffer
のアクセスポリシーを指定し、
バッファオブジェクトのマップされたデータストアからの読み取り、
書き込み、または読み取りと書き込みの両方が可能かどうかを示します。
シンボリック定数は、
GL_READ_ONLY
または
GL_WRITE_ONLY
、
GL_READ_WRITE
である必要があります。
glMapBuffer
と glMapNamedBuffer
は、
指定されたバッファーオブジェクトのデータストア全体をクライアントのアドレス空間にマップします。
次に、access
で指定されたポリシーに応じて、
返されたポインターを基準としてデータを直接読み取りおよび/または書き込むことができます。
マップされた範囲の先頭へのポインタは、
そのバッファオブジェクトに対するすべての保留中の操作が完了すると返され、
access
の値に応じてデータストアの対応する範囲を変更および/またはクエリするために使用できます。
GL_READ_ONLY
は、
返されたポインターを使用してバッファーオブジェクトデータを読み取れることを示します。
GL_WRITE_ONLY
は、
返されたポインターを使用してバッファーオブジェクトデータを変更できることを示します。
GL_READ_WRITE
は、
返されたポインターを使用して、バッファーオブジェクトデータを読み取ったり変更したりできることを示します。
If an error is generated, a NULL
pointer is
returned.
If no error occurs, the returned pointer will reflect an
allocation aligned to the value of
GL_MIN_MAP_BUFFER_ALIGNMENT
basic machine
units.
The returned pointer values may not be passed as parameter values to GL commands. For example, they may not be used to specify array pointers, or to specify or query pixel or texture image data; such actions produce undefined results, although implementations may not check for such behavior for performance reasons.
No GL error is generated if the returned pointer is accessed in
a way inconsistent with access
(e.g. used
to read from a mapping made with access
GL_WRITE_ONLY
or write to a mapping made
with access
GL_READ_ONLY
), but the result is undefined
and system errors (possibly including program termination) may
occur.
Mappings to the data stores of buffer objects may have
nonstandard performance characteristics. For example, such
mappings may be marked as uncacheable regions of memory, and in
such cases reading from them may be very slow. To ensure optimal
performance, the client should use the mapping in a fashion
consistent with the values of
GL_BUFFER_USAGE
for the buffer object and
of access
. Using a mapping in a fashion
inconsistent with these values is liable to be multiple orders
of magnitude slower than using normal memory.
Alignment of the returned pointer is guaranteed only if the
version of the GL version is 4.2 or greater. Also, the
GL_ATOMIC_COUNTER_BUFFER
target is accepted
only if the GL version is 4.2 or greater.
The GL_DISPATCH_INDIRECT_BUFFER
and
GL_SHADER_STORAGE_BUFFER
targets are
available only if the GL version is 4.3 or greater.
The GL_QUERY_BUFFER
target is available
only if the GL version is 4.4 or greater.
GL_INVALID_ENUM
is generated by
glMapBuffer
if
target
is not one of the buffer binding
targets listed above.
GL_INVALID_OPERATION
is generated by
glMapBuffer
if zero is bound to
target
.
GL_INVALID_OPERATION
is generated by
glMapNamedBuffer
if
buffer
is not the name of an existing
buffer object.
GL_INVALID_ENUM
is generated if
access
is not
GL_READ_ONLY
,
GL_WRITE_ONLY
, or
GL_READ_WRITE
.
GL_OUT_OF_MEMORY
is generated if the GL is
unable to map the buffer object's data store. This may occur for
a variety of system-specific reasons, such as the absence of
sufficient remaining virtual memory.
GL_INVALID_OPERATION
is generated if the
buffer object is in a mapped state.
glGetBufferPointerv
with argument GL_BUFFER_MAP_POINTER
glGetBufferParameter
with argument GL_BUFFER_MAPPED
,
GL_BUFFER_ACCESS
, or
GL_BUFFER_USAGE
glGet
with pname
GL_MIN_MAP_BUFFER_ALIGNMENT
. The value must
be a power of two that is at least 64.
OpenGL Version | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5 |
glMapBuffer
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glMapNamedBuffer
|
- | - | - | - | - | - | - | - | - | - | - | ✔ |
glBindBuffer, glBindBufferBase, glBindBufferRange, glBufferData, glBufferSubData, glDeleteBuffers, glMapBufferRange, glUnmapBuffer
Copyright © 2005 Addison-Wesley. Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.