File: glMapBufferRange.xml

package info (click to toggle)
khronos-opengl-man4 1.0~svn27841-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 24,888 kB
  • ctags: 377
  • sloc: xml: 188,408; makefile: 1,153; python: 736; sh: 49; php: 7; sed: 2
file content (135 lines) | stat: -rw-r--r-- 16,237 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glMapBufferRange - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /></head><body><div class="refentry"><a id="glMapBufferRange"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glMapBufferRange — map a section of a buffer object's data store</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void *<strong class="fsfunc">glMapBufferRange</strong>(</code></td><td>GLenum <var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLintptr <var class="pdparam">offset</var>, </td></tr><tr><td> </td><td>GLsizeiptr <var class="pdparam">length</var>, </td></tr><tr><td> </td><td>GLbitfield <var class="pdparam">access</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p>
                    Specifies a binding to which the target buffer is bound.
                </p></dd><dt><span class="term"><em class="parameter"><code>offset</code></em></span></dt><dd><p>
                    Specifies a the starting offset within the buffer of the range to be mapped.
                </p></dd><dt><span class="term"><em class="parameter"><code>length</code></em></span></dt><dd><p>
                    Specifies a length of the range to be mapped.
                </p></dd><dt><span class="term"><em class="parameter"><code>access</code></em></span></dt><dd><p>
                    Specifies a combination of access flags indicating the desired access to the range.
                </p></dd></dl></div></div><div class="refsect1"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glMapBufferRange</code> maps all or part of the data store of a buffer object into the client's address
            space. <em class="parameter"><code>target</code></em> specifies the target to which the buffer is bound and must be one of <code class="constant">GL_ARRAY_BUFFER</code>,
            <code class="constant">GL_ATOMIC_COUNTER_BUFFER</code>,
            <code class="constant">GL_COPY_READ_BUFFER</code>, <code class="constant">GL_COPY_WRITE_BUFFER</code>, <code class="constant">GL_DRAW_INDIRECT_BUFFER</code>,
            <code class="constant">GL_DISPATCH_INDIRECT_BUFFER</code>, <code class="constant">GL_ELEMENT_ARRAY_BUFFER</code>,
            <code class="constant">GL_PIXEL_PACK_BUFFER</code>, <code class="constant">GL_PIXEL_UNPACK_BUFFER</code>, <code class="constant">GL_QUERY_BUFFER</code>, <code class="constant">GL_TEXTURE_BUFFER</code>,
            <code class="constant">GL_TRANSFORM_FEEDBACK_BUFFER</code>, <code class="constant">GL_UNIFORM_BUFFER</code> or <code class="constant">GL_SHADER_STORAGE_BUFFER</code>. <em class="parameter"><code>offset</code></em> and
            <em class="parameter"><code>length</code></em> indicate the range of data in the buffer object htat is to be mapped, in terms of basic machine units.
            <em class="parameter"><code>access</code></em> is a bitfield containing flags which describe the requested mapping. These flags are described below.
        </p><p>
            If no error occurs, a pointer to the beginning of the mapped range is returned once all pending operations on that buffer have
            completed, and may be used to modify and/or query the corresponding range of the buffer, according to the following flag bits set
            in <em class="parameter"><code>access</code></em>:
            </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                        <code class="constant">GL_MAP_READ_BIT</code> indicates that the returned pointer may be used to read
                        buffer object data. No GL error is generated if the pointer is used to query
                        a mapping which excludes this flag, but the result is undefined and system
                        errors (possibly including program termination) may occur.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_WRITE_BIT</code> indicates that the returned pointer may be used to modify
                        buffer object data. No GL error is generated if the pointer is used to modify
                        a mapping which excludes this flag, but the result is undefined and system
                        errors (possibly including program termination) may occur.
                    </p></li></ul></div><p>
        </p><p>
            Furthermore, the following <span class="emphasis"><em>optional</em></span> flag bits in <em class="parameter"><code>access</code></em> may be used to modify the mapping:
            </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                        <code class="constant">GL_MAP_INVALIDATE_RANGE_BIT</code> indicates that the previous contents of the
                        specified range may be discarded. Data within this range are undefined with
                        the exception of subsequently written data. No GL error is generated if sub-
                        sequent GL operations access unwritten data, but the result is undefined and
                        system errors (possibly including program termination) may occur. This flag
                        may not be used in combination with <code class="constant">GL_MAP_READ_BIT</code>.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_INVALIDATE_BUFFER_BIT</code> indicates that the previous contents of the
                        entire buffer may be discarded. Data within the entire buffer are undefined
                        with the exception of subsequently written data. No GL error is generated if
                        subsequent GL operations access unwritten data, but the result is undefined
                        and system errors (possibly including program termination) may occur. This
                        flag may not be used in combination with <code class="constant">GL_MAP_READ_BIT</code>.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_FLUSH_EXPLICIT_BIT</code> indicates that one or more discrete subranges
                        of the mapping may be modified.  When this flag is set, modifications to
                        each subrange must be explicitly flushed by calling <a class="citerefentry" href="glFlushMappedBufferRange.xml"><span class="citerefentry"><span class="refentrytitle">glFlushMappedBufferRange</span></span></a>.
                        No GL error is set if a subrange of the mapping is modified and
                        not flushed, but data within the corresponding subrange of the buffer are undefined.
                        This flag may only be used in conjunction with <code class="constant">GL_MAP_WRITE_BIT</code>.
                        When this option is selected, flushing is strictly limited to regions that are
                        explicitly indicated with calls to <a class="citerefentry" href="glFlushMappedBufferRange.xml"><span class="citerefentry"><span class="refentrytitle">glFlushMappedBufferRange</span></span></a>
                        prior to unmap; if this option is not selected <a class="citerefentry" href="glUnmapBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glUnmapBuffer</span></span></a>
                        will automatically flush the entire mapped range when called.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_UNSYNCHRONIZED_BIT</code> indicates that the GL should not attempt to
                        synchronize pending operations on the buffer prior to returning from <code class="function">glMapBufferRange</code>.
                        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.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_PERSISTENT_BIT</code> indicates that the mapping is to be made in a persistent
                        fassion and that the client intends to hold and use the returned pointer during subsequent GL operation. It is not
                        an error to call drawing commands (render) while buffers are mapped using this flag. It is an error to
                        specify this flag if the buffer's data store was not allocated through a call to the <a class="citerefentry" href="glBufferStorage.xml"><span class="citerefentry"><span class="refentrytitle">glBufferStorage</span></span></a>
                        command in which the <code class="constant">GL_MAP_PERSISTENT_BIT</code> was also set.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_COHERENT_BIT</code> indicates that a persistent mapping is also to be coherent.
                        Coherent maps guarantee that the effect of writes to a buffer's data store by either the client or server will
                        eventually become visible to the other without further intervention from the application. In the absence
                        of this bit, persistent mappings are not coherent and modified ranges of the buffer store must be explicitly
                        communicated to the GL, either by unmapping the buffer, or through a call to
                        <a class="citerefentry" href="glFlushMappedBufferRange.xml"><span class="citerefentry"><span class="refentrytitle">glFlushMappedBufferRange</span></span></a> or <a class="citerefentry" href="glMemoryBarrier.xml"><span class="citerefentry"><span class="refentrytitle">glMemoryBarrier</span></span></a>.
                    </p></li></ul></div><p>
        </p><p>
            If an error occurs, <code class="function">glMapBufferRange</code> returns a <code class="code">NULL</code> pointer.
            If no error occurs, the returned pointer will reflect an alignment of at least <code class="constant">GL_MIN_MAP_BUFFER_ALIGNMENT</code>
            basic machine units. The value of <code class="constant">GL_MIN_MAP_BUFFER_ALIGNMENT</code> can be retrieved by calling
            <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with <em class="parameter"><code>pname</code></em> set to
            <code class="constant">GL_MIN_MAP_BUFFER_ALIGNMENT</code> and must be a power of two that is at least 64. Subtracting <em class="parameter"><code>offset</code></em>
            from this returned pointed will always produce a multiple of <code class="constant">GL_MIN_MAP_BUFFER_ALINMENT</code>.
        </p></div><div class="refsect1"><a id="notes"></a><h2>Notes</h2><p>
            Alignment of the returned pointer is guaranteed only if the version
            of the GL version is 4.2 or greater. Also, the <code class="constant">GL_ATOMIC_COUNTER_BUFFER</code>
            target is accepted only if the GL version is 4.2 or greater.
        </p><p>
            The <code class="constant">GL_DISPATCH_INDIRECT_BUFFER</code> and <code class="constant">GL_SHADER_STORAGE_BUFFER</code> targets are accepted only if the
            GL version is 4.3 or greater.
        </p><p>
            The <code class="constant">GL_QUERY_BUFFER</code> target is available only if the GL version is 4.4 or greater.
        </p><p>
            The <code class="constant">GL_MAP_PERSISTENT_BIT</code> and <code class="constant">GL_MAP_COHERENT_BIT</code> flags are available
            only if the GL version is 4.4 or greater.
        </p></div><div class="refsect1"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if either of <em class="parameter"><code>offset</code></em> or <em class="parameter"><code>length</code></em> is negative,
            or if <em class="parameter"><code>offset</code></em> + <em class="parameter"><code>length</code></em> is greater than the value of <code class="constant">GL_BUFFER_SIZE</code>.
        </p><p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>access</code></em> has any bits set other than those defined above.
        </p><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated for any of the following conditions:
            </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                        The buffer is already in a mapped state.
                    </p></li><li class="listitem"><p>
                        Neither <code class="constant">GL_MAP_READ_BIT</code> or <code class="constant">GL_MAP_WRITE_BIT</code> is set.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_READ_BIT</code> is set and any of <code class="constant">GL_MAP_INVALIDATE_RANGE_BIT</code>,
                        <code class="constant">GL_MAP_INVALIDATE_BUFFER_BIT</code>, or <code class="constant">GL_MAP_UNSYNCHRONIZED_BIT</code> is set.
                    </p></li><li class="listitem"><p>
                        <code class="constant">GL_MAP_FLUSH_EXPLICIT_BIT</code> is set and <code class="constant">GL_MAP_WRITE_BIT</code> is not set.
                    </p></li><li class="listitem"><p>
                        Any of <code class="constant">GL_MAP_READ_BIT</code>, <code class="constant">GL_MAP_WRITE_BIT</code>, <code class="constant">GL_MAP_PERSISTENT_BIT</code>,
                        or <code class="constant">GL_MAP_COHERENT_BIT</code> are included in <em class="parameter"><code>access</code></em>, but the same bit
                        is not included in the buffer's storage flags.
                    </p></li></ul></div><p>
        </p><p>
            <code class="constant">GL_OUT_OF_MEMORY</code> is generated if <code class="function">glMapBufferRange</code> fails because memory for the
            mapping could not be obtained.
        </p></div><div class="refsect1"><a id="seealso"></a><h2>See Also</h2><p>
            <a class="citerefentry" href="glMapBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glMapBuffer</span></span></a>,
            <a class="citerefentry" href="glFlushMappedBufferRange.xml"><span class="citerefentry"><span class="refentrytitle">glFlushMappedBufferRange</span></span></a>,
            <a class="citerefentry" href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>,
            <a class="citerefentry" href="glBufferStorage.xml"><span class="citerefentry"><span class="refentrytitle">glBufferStorage</span></span></a>
        </p></div><div class="refsect1"><a id="Copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 2010-2013 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.
            <a class="ulink" href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
        </p></div></div></body></html>